1 /*******************************************************************************
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.modeling.requests;
14 import java.util.Collection;
16 import org.simantics.db.Resource;
17 import org.simantics.db.WriteGraph;
18 import org.simantics.db.exception.DatabaseException;
19 import org.simantics.modeling.ModelingResources;
22 * @author Tuukka Lehtonen
24 public class SetSubscriptionEnabled {
26 Collection<Resource> subscriptions;
29 public SetSubscriptionEnabled(Collection<Resource> subscriptions, boolean newValue) {
30 this.subscriptions = subscriptions;
31 this.newValue = newValue;
34 public void perform(WriteGraph graph) throws DatabaseException {
35 ModelingResources mod = ModelingResources.getInstance(graph);
37 Boolean value = newValue;
38 //System.out.println("SetEnabled(" + value + "):");
39 for (Resource subscription : subscriptions) {
40 //System.out.println(" setting for " + NameUtils.getSafeLabel(graph, subscription));
41 graph.claimLiteral(subscription, mod.Subscription_Enabled, value);