]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/ActivateModel.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / request / ActivateModel.java
index 690267dc5f7f7ad7d69ecda8b5b716503f64c544..770659935180b4d38cb40b179512a145b326be82 100644 (file)
@@ -1,58 +1,58 @@
-package org.simantics.db.layer0.request;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.VirtualGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.request.WriteResultRequest;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.service.VirtualGraphSupport;\r
-import org.simantics.operation.Layer0X;\r
-\r
-public class ActivateModel extends WriteResultRequest<Boolean> {\r
-\r
-    final Resource project;\r
-    final Resource model;\r
-\r
-    public ActivateModel(Resource project, Resource model) {\r
-        \r
-        if(project == null) throw new IllegalArgumentException("project can not be null");\r
-        this.project = project;\r
-        this.model = model;\r
-        \r
-    }\r
-\r
-    public static Boolean perform(WriteGraph graph, Resource project, Resource model) throws DatabaseException {\r
-        Layer0X L0X = Layer0X.getInstance(graph);\r
-        if (model != null) {\r
-            if (!graph.hasStatement(model, L0X.IsActivatedBy, project)) {\r
-                graph.deny(project, L0X.Activates);\r
-                graph.claim(project, L0X.Activates, model);\r
-                return true;\r
-            }\r
-        } else {\r
-            if (graph.hasStatement(project, L0X.Activates)) {\r
-                graph.deny(project, L0X.Activates);\r
-                return true;\r
-            }\r
-        }\r
-        return false;\r
-    }\r
-\r
-    @Override\r
-    public Boolean perform(WriteGraph graph) throws DatabaseException {\r
-        VirtualGraphSupport support = graph.getService(VirtualGraphSupport.class);\r
-        VirtualGraph activations = support.getWorkspacePersistent("activations");\r
-        VirtualGraph vg = graph.getProvider();\r
-        if (vg == activations) {\r
-            return perform(graph, project, model);\r
-        } else {\r
-            return graph.syncRequest(new WriteResultRequest<Boolean>() {\r
-                @Override\r
-                public Boolean perform(WriteGraph graph) throws DatabaseException {\r
-                    return ActivateModel.perform(graph, project, model);\r
-                }\r
-            });\r
-        }\r
-    }\r
-\r
-}\r
+package org.simantics.db.layer0.request;
+
+import org.simantics.db.Resource;
+import org.simantics.db.VirtualGraph;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.common.request.WriteResultRequest;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.service.VirtualGraphSupport;
+import org.simantics.operation.Layer0X;
+
+public class ActivateModel extends WriteResultRequest<Boolean> {
+
+    final Resource project;
+    final Resource model;
+
+    public ActivateModel(Resource project, Resource model) {
+        
+        if(project == null) throw new IllegalArgumentException("project can not be null");
+        this.project = project;
+        this.model = model;
+        
+    }
+
+    public static Boolean perform(WriteGraph graph, Resource project, Resource model) throws DatabaseException {
+        Layer0X L0X = Layer0X.getInstance(graph);
+        if (model != null) {
+            if (!graph.hasStatement(model, L0X.IsActivatedBy, project)) {
+                graph.deny(project, L0X.Activates);
+                graph.claim(project, L0X.Activates, model);
+                return true;
+            }
+        } else {
+            if (graph.hasStatement(project, L0X.Activates)) {
+                graph.deny(project, L0X.Activates);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public Boolean perform(WriteGraph graph) throws DatabaseException {
+        VirtualGraphSupport support = graph.getService(VirtualGraphSupport.class);
+        VirtualGraph activations = support.getWorkspacePersistent("activations");
+        VirtualGraph vg = graph.getProvider();
+        if (vg == activations) {
+            return perform(graph, project, model);
+        } else {
+            return graph.syncRequest(new WriteResultRequest<Boolean>() {
+                @Override
+                public Boolean perform(WriteGraph graph) throws DatabaseException {
+                    return ActivateModel.perform(graph, project, model);
+                }
+            });
+        }
+    }
+
+}