]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.interop.mapping/src/org/simantics/interop/mapping/SplittingWriteGraph.java
Fixed interop WriteGraph implementations after changes to ReadGraph.
[simantics/interop.git] / org.simantics.interop.mapping / src / org / simantics / interop / mapping / SplittingWriteGraph.java
index a91c8c0b72eff08f3ecf195887967c716a04c870..fb2cbb56ff3e7bb1dae6274e0c4b97288e0a49e8 100644 (file)
@@ -453,8 +453,51 @@ public class SplittingWriteGraph implements WriteGraph {
                        throw new ServiceException(e);\r
                }\r
        }\r
-       \r
-       @Override\r
+\r
+    @Override\r
+    public Resource newResource(final Resource clusterSet) throws ServiceException {\r
+        try {\r
+            return session.syncRequest(new WriteResultRequest<Resource>() {\r
+                \r
+                @Override\r
+                public Resource perform(WriteGraph graph) throws DatabaseException {\r
+                    return graph.newResource(clusterSet);\r
+                }\r
+            });\r
+        } catch (DatabaseException e) {\r
+            throw new ServiceException(e);\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public void newClusterSet(final Resource clusterSet) throws ServiceException {\r
+        try {\r
+            session.syncRequest(new WriteRequest() {\r
+                @Override\r
+                public void perform(WriteGraph graph) throws DatabaseException {\r
+                    graph.newClusterSet(clusterSet);\r
+                }\r
+            });\r
+        } catch (DatabaseException e) {\r
+            throw new ServiceException(e);\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public Resource setClusterSet4NewResource(final Resource clusterSet) throws ServiceException {\r
+        try {\r
+            return session.syncRequest(new WriteResultRequest<Resource>() {\r
+                \r
+                @Override\r
+                public Resource perform(WriteGraph graph) throws DatabaseException {\r
+                    return graph.newResource(clusterSet);\r
+                }\r
+            });\r
+        } catch (DatabaseException e) {\r
+            throw new ServiceException(e);\r
+        }\r
+    }\r
+    @Override\r
        public <T> T adapt(final Resource resource, final Class<T> clazz)\r
                        throws AdaptionException, ValidationException, ServiceException {\r
                try {\r
@@ -6183,4 +6226,74 @@ public class SplittingWriteGraph implements WriteGraph {
                return null;\r
        }\r
 \r
+       @Override\r
+       public boolean isImmutable(final Resource resource) throws DatabaseException {\r
+           try {\r
+               return session.syncRequest(new Read<Boolean>() {\r
+                   @Override\r
+                   public Boolean perform(ReadGraph graph) throws DatabaseException {\r
+                       return graph.isImmutable(resource);\r
+                   }\r
+               });\r
+           } catch (DatabaseException e) {\r
+               throw new ServiceException(e);\r
+           }\r
+       }\r
+\r
+    @Override\r
+    public <T> T getValue2(final Resource subject, final Object context) throws DatabaseException {\r
+        try {\r
+            return (T) session.syncRequest(new Read<T>() {\r
+                @Override\r
+                public T perform(ReadGraph graph) throws DatabaseException {\r
+                    return graph.getValue2(subject, context);\r
+                }\r
+            });\r
+        } catch (DatabaseException e) {\r
+            throw new ServiceException(e);\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public <T> T getPossibleValue2(final Resource subject, final Object context) throws DatabaseException {\r
+        try {\r
+            return (T) session.syncRequest(new Read<T>() {\r
+                @Override\r
+                public T perform(ReadGraph graph) throws DatabaseException {\r
+                    return graph.getPossibleValue2(subject, context);\r
+                }\r
+            });\r
+        } catch (DatabaseException e) {\r
+            throw new ServiceException(e);\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public <T> T getValue2(final Resource subject, final Object context, final Binding binding) throws DatabaseException {\r
+        try {\r
+            return (T) session.syncRequest(new Read<T>() {\r
+                @Override\r
+                public T perform(ReadGraph graph) throws DatabaseException {\r
+                    return graph.getValue2(subject, context, binding);\r
+                }\r
+            });\r
+        } catch (DatabaseException e) {\r
+            throw new ServiceException(e);\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public <T> T getPossibleValue2(final Resource subject, final Object context, final Binding binding) throws DatabaseException {\r
+        try {\r
+            return (T) session.syncRequest(new Read<T>() {\r
+                @Override\r
+                public T perform(ReadGraph graph) throws DatabaseException {\r
+                    return graph.getPossibleValue2(subject, context, binding);\r
+                }\r
+            });\r
+        } catch (DatabaseException e) {\r
+            throw new ServiceException(e);\r
+        }\r
+    }\r
+\r
 }\r