]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/src/org/simantics/modeling/requests/SetSubscriptionEnabled.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / requests / SetSubscriptionEnabled.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.modeling.requests;
13
14 import java.util.Collection;
15
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;
20
21 /**
22  * @author Tuukka Lehtonen
23  */
24 public class SetSubscriptionEnabled {
25
26     Collection<Resource> subscriptions;
27     boolean              newValue;
28
29     public SetSubscriptionEnabled(Collection<Resource> subscriptions, boolean newValue) {
30         this.subscriptions = subscriptions;
31         this.newValue = newValue;
32     }
33
34     public void perform(WriteGraph graph) throws DatabaseException {
35         ModelingResources mod = ModelingResources.getInstance(graph);
36
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);
42         }
43     }
44
45 }