]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6937: Verified that new cs_sas lifecycle seems to be working on Person authority.
authorRichard Millet <remillet@yahoo.com>
Fri, 15 Apr 2016 04:59:51 +0000 (21:59 -0700)
committerRichard Millet <remillet@yahoo.com>
Fri, 15 Apr 2016 04:59:51 +0000 (21:59 -0700)
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java

index f8dcd8215d14abfe3e2ad7ae5e34f9ad05610b5d..c6bb8652ed8dfac6968883f63336fdebf8909c04 100644 (file)
@@ -754,16 +754,18 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
             if (existingContext != null && existingContext.getCurrentRepositorySession() != null) {
                ctx.setCurrentRepositorySession(existingContext.getCurrentRepositorySession()); // If a repo session is already open, we need to use it and not create a new one
             }
-
+            //
             // Create a service context and document handler for the target resource -not the workflow resource itself.
+            //
             ServiceContext<PoxPayloadIn, PoxPayloadOut> targetCtx = createServiceContext(getItemServiceName());
-            AuthorityItemDocumentModelHandler parentDocHandler = (AuthorityItemDocumentModelHandler) this.createDocumentHandler(targetCtx);
-            parentDocHandler.setShouldUpdateRevNumber(updateRevNumber);
-            ctx.setProperty(WorkflowClient.TARGET_DOCHANDLER, parentDocHandler); //added as a context param for the workflow document handler -it will call the parent's dochandler "prepareForWorkflowTranstion" method
-
-            // When looking for the document, we need to use the parent resource's workspace name -not the "workflow" workspace name
-            String parentWorkspaceName = targetCtx.getRepositoryWorkspaceName();
-            ctx.setRespositoryWorkspaceName(parentWorkspaceName); //find the document in the parent's workspace
+            AuthorityItemDocumentModelHandler targetDocHandler = (AuthorityItemDocumentModelHandler) this.createDocumentHandler(targetCtx);
+            targetDocHandler.setShouldUpdateRevNumber(updateRevNumber);
+            ctx.setProperty(WorkflowClient.TARGET_DOCHANDLER, targetDocHandler); //added as a context param for the workflow document handler -it will call the parent's dochandler "prepareForWorkflowTranstion" method
+            //
+            // When looking for the document, we need to use the parent/target resource's workspace name -not the "workflow" workspace name
+            //
+            String targetWorkspaceName = targetCtx.getRepositoryWorkspaceName();
+            ctx.setRespositoryWorkspaceName(targetWorkspaceName); //find the document in the parent's workspace
             
                // Get the type of transition we're being asked to make and store it as a context parameter -used by the workflow document handler
             TransitionDef transitionDef = getTransitionDef(targetCtx, transition);
index 5fdd5dcdc98a93158a9efe5ee29fa4f9bf734657..a6cf7781bfd331df5c0255a3d64b7d8c1a860ce7 100644 (file)
@@ -426,12 +426,27 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                ResourceMap resourceMap = ctx.getResourceMap();
                String resourceName = this.getAuthorityServicePath();
                AuthorityResource authorityResource = (AuthorityResource) resourceMap.get(resourceName);
-               authorityResource.updateItemWorkflowWithTransition(ctx, localParentCsid, localItemCsid, transition, AuthorityServiceUtils.DONT_UPDATE_REV)
+               //
+               // We need to move the local item to the SAS workflow state.  This might involve multiple transitions.
+               //
+               List<String> transitionList = getTransitionList(sasWorkflowState, localItemWorkflowState);
+               for (String transition:transitionList) {
+                       authorityResource.updateItemWorkflowWithTransition(ctx, localParentCsid, localItemCsid, transition, AuthorityServiceUtils.DONT_UPDATE_REV);
+               }
         }
         
         return result;
     }
     
+    /**
+     * We need to move the local item to the SAS workflow state.  This might involve multiple transitions.
+     */
+    private List<String> getTransitionList(String sasWorkflowState, String localItemWorkflowState) {
+       List<String> result = new ArrayList<String>();
+       // TO BE COMPLETELED
+       return result;
+    }
+    
     /* (non-Javadoc)
      * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper)
      */
@@ -534,7 +549,8 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
        //
        // Next, update the inAuthority (the parent's) rev number
        //
-       DocumentModel inAuthorityDocModel = NuxeoUtils.getDocFromCsid(getServiceContext(), getRepositorySession(), getInAuthority());
+       String inAuthority = (String)documentModel.getProperty(authorityItemCommonSchemaName, AuthorityItemJAXBSchema.IN_AUTHORITY);
+       DocumentModel inAuthorityDocModel = NuxeoUtils.getDocFromCsid(getServiceContext(), getRepositorySession(), inAuthority);
        Long parentRev = (Long)inAuthorityDocModel.getProperty(getParentCommonSchemaName(), AuthorityJAXBSchema.REV);
        if (parentRev == null) {
                parentRev = new Long(0);