From b5caedf00e900c141600d8564bc5577d9e924b0c Mon Sep 17 00:00:00 2001 From: kondelin Date: Mon, 27 Aug 2012 13:53:59 +0000 Subject: [PATCH] fixes #3420 git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@25521 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../interop/mapping/SplittingWriteGraph.java | 47 ++++++++++++++++++- .../interop/mapping/WriteGraphProxy.java | 19 +++++++- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/SplittingWriteGraph.java b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/SplittingWriteGraph.java index 791ab0a..c3b0298 100644 --- a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/SplittingWriteGraph.java +++ b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/SplittingWriteGraph.java @@ -453,8 +453,51 @@ public class SplittingWriteGraph implements WriteGraph { throw new ServiceException(e); } } - - @Override + + @Override + public Resource newResource(final Resource clusterSet) throws ServiceException { + try { + return session.syncRequest(new WriteResultRequest() { + + @Override + public Resource perform(WriteGraph graph) throws DatabaseException { + return graph.newResource(clusterSet); + } + }); + } catch (DatabaseException e) { + throw new ServiceException(e); + } + } + + @Override + public void newClusterSet(final Resource clusterSet) throws ServiceException { + try { + session.syncRequest(new WriteRequest() { + @Override + public void perform(WriteGraph graph) throws DatabaseException { + graph.newClusterSet(clusterSet); + } + }); + } catch (DatabaseException e) { + throw new ServiceException(e); + } + } + + @Override + public Resource setClusterSet4NewResource(final Resource clusterSet) throws ServiceException { + try { + return session.syncRequest(new WriteResultRequest() { + + @Override + public Resource perform(WriteGraph graph) throws DatabaseException { + return graph.newResource(clusterSet); + } + }); + } catch (DatabaseException e) { + throw new ServiceException(e); + } + } + @Override public T adapt(final Resource resource, final Class clazz) throws AdaptionException, ValidationException, ServiceException { try { diff --git a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/WriteGraphProxy.java b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/WriteGraphProxy.java index 204d801..1fff2a2 100644 --- a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/WriteGraphProxy.java +++ b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/WriteGraphProxy.java @@ -291,8 +291,23 @@ public class WriteGraphProxy implements WriteGraph { public Resource newResource(long clusterId) throws ServiceException { return graph.newResource(clusterId); } - - @Override + + @Override + public Resource newResource(Resource clusterSet) throws ServiceException { + return graph.newResource(clusterSet); + } + + @Override + public void newClusterSet(Resource clusterSet) throws ServiceException { + graph.newClusterSet(clusterSet); + } + + + public Resource setClusterSet4NewResource(Resource clusterSet) throws ServiceException { + return graph.setClusterSet4NewResource(clusterSet); + } + + @Override public T adapt(Resource resource, Class clazz) throws AdaptionException, ValidationException, ServiceException { return graph.adapt(resource, clazz); -- 2.45.2