]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-2675 Add CSID to payload of Authority documents, since may be retrieved via...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Mon, 23 Aug 2010 20:56:21 +0000 (20:56 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Mon, 23 Aug 2010 20:56:21 +0000 (20:56 +0000)
services/common/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java
services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationAuthorityDocumentModelHandler.java
services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrgAuthorityDocumentModelHandler.java
services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonAuthorityDocumentModelHandler.java
services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyDocumentModelHandler.java

index a3df7b584684e61ca4c64f528a1a487c02671bb6..666631a6d447c5c39f371a19d95d817ec4e80eb2 100644 (file)
  */
 package org.collectionspace.services.common.vocabulary.nuxeo;
 
+import java.util.Map;
+
 import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.service.ObjectPartType;
 
 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.nuxeo.ecm.core.api.DocumentModel;
 
 /**
@@ -37,6 +41,8 @@ import org.nuxeo.ecm.core.api.DocumentModel;
 public abstract class AuthorityDocumentModelHandler<AuthCommon, AuthCommonList>
         extends RemoteDocumentModelHandlerImpl<AuthCommon, AuthCommonList> {
 
+       private String authorityCommonSchemaName;
+       
     /**
      * authority is used to stash JAXB object to use when handle is called
      * for Action.CREATE, Action.UPDATE or Action.GET
@@ -49,6 +55,10 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon, AuthCommonList>
     private AuthCommonList authorityList;
 
 
+    public AuthorityDocumentModelHandler(String authorityCommonSchemaName) {
+       this.authorityCommonSchemaName = authorityCommonSchemaName;
+    }
+
     /**
      * getCommonPart get associated authority
      * @return
@@ -101,5 +111,22 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon, AuthCommonList>
         throw new UnsupportedOperationException();
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl#extractPart(org.nuxeo.ecm.core.api.DocumentModel, java.lang.String, org.collectionspace.services.common.service.ObjectPartType)
+     */
+    @Override
+    protected Map<String, Object> extractPart(DocumentModel docModel, String schema, ObjectPartType partMeta)
+            throws Exception {
+       Map<String, Object> unQObjectProperties = super.extractPart(docModel, schema, partMeta);
+       
+       // Add the CSID to the common part
+       if (partMeta.getLabel().equalsIgnoreCase(authorityCommonSchemaName)) {
+               String csid = NuxeoUtils.extractId(docModel.getPathAsString());
+               unQObjectProperties.put("csid", csid);
+       }
+       
+       return unQObjectProperties;
+    }
+    
 }
 
index 9917dff163118b0dbb0331aef85184a281a15ca6..d228da68c3276cd37a6ebe2c86248fb60eb974d2 100644 (file)
@@ -51,6 +51,15 @@ import org.slf4j.LoggerFactory;
 public class LocationAuthorityDocumentModelHandler
         extends AuthorityDocumentModelHandler<LocationauthoritiesCommon, LocationauthoritiesCommonList> {
 
+    /**
+     * Common part schema label
+     */
+    private static final String COMMON_PART_LABEL = "locationauthorities_common";   
+    
+    public LocationAuthorityDocumentModelHandler() {
+       super(COMMON_PART_LABEL);
+    }
+       
     @Override
     public LocationauthoritiesCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
         LocationauthoritiesCommonList coList = extractPagingInfo(new LocationauthoritiesCommonList(),
index 97f6de58b21ae023b6b6898f0b9f431b195cc4dd..6c33ac988e1be5520146994168623487fcb40a5e 100644 (file)
@@ -48,8 +48,15 @@ import org.nuxeo.ecm.core.api.DocumentModelList;
 public class OrgAuthorityDocumentModelHandler
         extends AuthorityDocumentModelHandler<OrgauthoritiesCommon, OrgauthoritiesCommonList> {
 
-    //private final Logger logger = LoggerFactory.getLogger(OrgAuthorityDocumentModelHandler.class);
+    /**
+     * Common part schema label
+     */
+    private static final String COMMON_PART_LABEL = "orgauthorities_common";   
     
+    public OrgAuthorityDocumentModelHandler() {
+       super(COMMON_PART_LABEL);
+    }
+       
     /* (non-Javadoc)
      * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
      */
index 188cdbfc8fa23341aed79eef63676f7edcbe10e1..3e5bee78279124e71b30ca4e6bbe03fca050f5cc 100644 (file)
@@ -48,8 +48,15 @@ import org.slf4j.LoggerFactory;
 public class PersonAuthorityDocumentModelHandler
                extends AuthorityDocumentModelHandler<PersonauthoritiesCommon, PersonauthoritiesCommonList> {
 
-    private final Logger logger = LoggerFactory.getLogger(PersonAuthorityDocumentModelHandler.class);
-
+    /**
+     * Common part schema label
+     */
+    private static final String COMMON_PART_LABEL = "personauthorities_common";   
+    
+    public PersonAuthorityDocumentModelHandler() {
+       super(COMMON_PART_LABEL);
+    }
+       
     @Override
     public PersonauthoritiesCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
         PersonauthoritiesCommonList coList = extractPagingInfo(new PersonauthoritiesCommonList(),
index 1ee7ed3594f78e1bfba3a5c44d9577d3d25cc95f..81bc5b5b4c021c62d7c71ce67dcd518894eea29a 100644 (file)
@@ -48,9 +48,15 @@ import org.slf4j.LoggerFactory;
 public class VocabularyDocumentModelHandler
                extends AuthorityDocumentModelHandler<VocabulariesCommon, VocabulariesCommonList> {
 
-    /** The logger. */
-    private final Logger logger = LoggerFactory.getLogger(VocabularyDocumentModelHandler.class);
-
+    /**
+     * Common part schema label
+     */
+    private static final String COMMON_PART_LABEL = "vocabularies_common";   
+    
+    public VocabularyDocumentModelHandler() {
+       super(COMMON_PART_LABEL);
+    }
+       
     /* (non-Javadoc)
      * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
      */