Use new find method with update
authorCherian Mathew <c.mathew@bgbm.org>
Mon, 20 Jul 2015 13:37:23 +0000 (15:37 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Mon, 20 Jul 2015 13:37:23 +0000 (15:37 +0200)
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/CreateNodeOperation.java
eu.etaxonomy.taxeditor.store/src/test/java/eu/etaxonomy/taxeditor/store/operations/RemotingTestUpdateOperation.java
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.test/pom.xml
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionAwareTest.java

index 2510d27e15e2a8115d96d7a573adaf5b979c8921..9bc131ea3743f996b57f55fe16dc9c2358e9797e 100644 (file)
@@ -143,7 +143,7 @@ public class CdmTransientEntityCacher implements ICdmCacher {
 
 
     private CdmBase load(CdmEntityIdentifier cei, boolean update) {
-        return load(CdmBase.deproxy(CdmApplicationState.getCommonService().find(cei.getCdmClass(), cei.getId()),cei.getCdmClass()), update);
+        return CdmApplicationState.getCommonService().findWithUpdate(cei.getCdmClass(), cei.getId());
     }
 
 
index 888c1ca3c8e97f132a047c61fd8e1a6ca8d39cde..0b7ca355d920d5e66afbbb4e57caba5715c974d4 100644 (file)
@@ -44,7 +44,9 @@ public class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerReques
                    logger.info("Remote invoking : " + currentRemoteInvocation.getMethodName() + "@" + config.getServiceUrl());
                        rir = super.doExecuteRequest(config, baos);
                        if(rir.getValue() != null && !rir.hasException()) {
-                if("merge".equals(currentRemoteInvocation.getMethodName()) || "save".equals(currentRemoteInvocation.getMethodName())) {
+                if("merge".equals(currentRemoteInvocation.getMethodName()) ||
+                        "save".equals(currentRemoteInvocation.getMethodName()) ||
+                        "findWithUpdate".equals(currentRemoteInvocation.getMethodName())) {
                     rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true));
                 } else if(rir.getValue() instanceof UpdateResult){
                     UpdateResult result = (UpdateResult)rir.getValue();
index fcf5b9171a2f5aff639ef5fb6743b17a1985dfd1..aa1a363f964e4966947112a26db956c8903fbe07 100644 (file)
@@ -9,7 +9,6 @@ import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 
-import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
@@ -39,7 +38,7 @@ public class CreateNodeOperation extends AbstractPostTaxonOperation {
                childNode = PolytomousKeyNode.NewInstance();
 
                parentNode.addChild(childNode);
-               childNode = CdmApplicationState.getCurrentAppConfig().getPolytomousKeyNodeService().merge(childNode);
+
                return postExecute(childNode);
        }
 
index 255849b4495ab9e497cf27446a474cd37780f4b1..727460c57e0f23ecea43fdc8b35eb9fe6e59c496 100644 (file)
@@ -70,6 +70,8 @@ public class RemotingTestUpdateOperation extends RemotingCdmUpdateOperation {
             return testService.returnResult(result);
         } else if(exception != null) {
             return testService.throwException(exception);
+        } else if(cei != null) {
+            return testService.addChild(cei);
         }
         return null;
     }
index 7f2bd7c9d31b4d3e120003ae970bc05c09c3c2ea..efb306994d3cc83dd9e54ac0545a87be9df2c0c7 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: eu.etaxonomy.taxeditor.test
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.test;singleton:=true
-Bundle-Version: 3.6.1.qualifier
+Bundle-Version: 3.8.0.qualifier
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: EDIT
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
index 3e230b1488413c8dabcca000c2cca2ea63eea787..86844afddc6ffc1de8757fea687bf35ac890db61 100644 (file)
@@ -4,7 +4,7 @@
   <parent>\r
     <groupId>eu.etaxonomy</groupId>\r
     <artifactId>taxeditor-parent</artifactId>\r
-    <version>3.6.1-SNAPSHOT</version>\r
+    <version>3.8.0-SNAPSHOT</version>\r
   </parent>\r
   <modelVersion>4.0.0</modelVersion>\r
   <artifactId>eu.etaxonomy.taxeditor.test</artifactId>\r
index 8f35f665944ba511664d1040b192717c719b555a..207ce093baf5ffed4700ffca82a08863181d19ae 100644 (file)
@@ -127,6 +127,8 @@ public class CdmEntitySessionAwareTest extends RemotingSessionAwareTest {
         // TO DO : Added tests for Annotations , Markers
     }
 
+
+
     @Test
     public void readPolytomousKeyDataFromNodes() {
         PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
@@ -161,6 +163,20 @@ public class CdmEntitySessionAwareTest extends RemotingSessionAwareTest {
         Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getChildAt(0).getTaxon().getTitleCache(), "Achillea arabica Kotschy sec. Cyprus");
     }
 
+    @Test
+    public void addGrandChildPolytomousKeyNode() {
+        PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        PolytomousKeyNode rootNode = pKey.getRoot();
+        PolytomousKeyNode childNode = PolytomousKeyNode.NewInstance();
+        rootNode.addChild(childNode);
+
+        polytomousKeyService.merge(pKey);
+
+        PolytomousKeyNode grandChildNode = PolytomousKeyNode.NewInstance();
+        childNode.addChild(grandChildNode);
+
+        polytomousKeyService.merge(pKey);
+    }
 
     @Test
     public void savePolytomousKeyNodeData() {