]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1927 - Refactored how displayName computation is done in prep for handling...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Fri, 7 Oct 2011 17:02:06 +0000 (17:02 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Fri, 7 Oct 2011 17:02:06 +0000 (17:02 +0000)
services/authority/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationDocumentModelHandler.java
services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java
services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java
services/taxonomy/service/src/main/java/org/collectionspace/services/taxonomy/nuxeo/TaxonDocumentModelHandler.java

index 8696ea6f07699c520c3bb93eabe6bfa8a93efae2..a0fe1b802cb139a307665ce0ffceaf78a691ff04 100644 (file)
@@ -120,12 +120,32 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         // first fill all the parts of the document
         super.handleCreate(wrapDoc);
         handleInAuthority(wrapDoc.getWrappedObject());
+       handleComputedDisplayNames(wrapDoc.getWrappedObject());
         // CSPACE-3178:
         // Uncomment once debugged and App layer is read to integrate
         // Experimenting with these uncommented now ...
         handleDisplayNameAsShortIdentifier(wrapDoc.getWrappedObject(), authorityItemCommonSchemaName);
         updateRefnameForAuthorityItem(wrapDoc, authorityItemCommonSchemaName, getAuthorityRefNameBase());
     }
+    
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleUpdate(org.collectionspace.services.common.document.DocumentWrapper)
+     */
+    @Override
+    public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+       super.handleUpdate(wrapDoc);
+       handleComputedDisplayNames(wrapDoc.getWrappedObject());
+    }
+
+    /**
+     * Handle display name.
+     *
+     * @param docModel the doc model
+     * @throws Exception the exception
+     */
+    protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
+       // Do nothing by default.
+    }
 
     private void handleDisplayNameAsShortIdentifier(DocumentModel docModel, String schemaName) throws Exception {
         String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
index 2f0c0326874e0d81ebc79c08086f9f46612644d4..b761b6de93daf06ec072052b51ae7181400139e3 100644 (file)
@@ -57,32 +57,14 @@ public class LocationDocumentModelHandler
         return LocationAuthorityClient.SERVICE_PATH_COMPONENT;    //  CSPACE-3932
     }
        
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-       // first fill all the parts of the document
-       super.handleCreate(wrapDoc);            
-       handleDisplayNames(wrapDoc.getWrappedObject());
-    }
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleUpdate(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-       super.handleUpdate(wrapDoc);
-       handleDisplayNames(wrapDoc.getWrappedObject());
-    }
-
     /**
      * Handle display name.
      *
      * @param docModel the doc model
      * @throws Exception the exception
      */
-    private void handleDisplayNames(DocumentModel docModel) throws Exception {
+    @Override
+    protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
        String commonPartLabel = getServiceContext().getCommonPartLabel("locations");
        Boolean displayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
                        LocationJAXBSchema.DISPLAY_NAME_COMPUTED);
index e95ff1bc335c5704246848db524992bb3927bea8..f14fefddfca6b416d2f08cc6fca085cae0685e86 100644 (file)
@@ -57,25 +57,6 @@ public class OrganizationDocumentModelHandler
         return OrgAuthorityClient.SERVICE_PATH_COMPONENT;    //  CSPACE-3932
     }
        
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-       // first fill all the parts of the document
-       super.handleCreate(wrapDoc);            
-       handleDisplayNames(wrapDoc.getWrappedObject());
-    }
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleUpdate(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-       super.handleUpdate(wrapDoc);
-       handleDisplayNames(wrapDoc.getWrappedObject());
-    }
-
     /**
      * Check the logic around the computed displayName
      * 
@@ -83,7 +64,8 @@ public class OrganizationDocumentModelHandler
      * 
      * @throws Exception the exception
      */
-    private void handleDisplayNames(DocumentModel docModel) throws Exception {
+    @Override
+    protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
        String commonPartLabel = getServiceContext().getCommonPartLabel("organizations");
        Boolean displayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
                        OrganizationJAXBSchema.DISPLAY_NAME_COMPUTED);
index a3e076a4759d31bacb4fd1f6412d239885fbd9f2..491d7a697e3bfb5b1f7105c84041d97738c00f78 100644 (file)
@@ -64,32 +64,14 @@ public class PersonDocumentModelHandler
         return PersonAuthorityClient.SERVICE_PATH_COMPONENT;    // CSPACE-3932
     }
        
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-       // first fill all the parts of the document
-       super.handleCreate(wrapDoc);            
-       handleDisplayNames(wrapDoc.getWrappedObject());
-    }
-    
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleUpdate(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-       super.handleUpdate(wrapDoc);
-       handleDisplayNames(wrapDoc.getWrappedObject());
-    }
-
     /**
      * Handle display names.
      *
      * @param docModel the doc model
      * @throws Exception the exception
      */
-    private void handleDisplayNames(DocumentModel docModel) throws Exception {
+    @Override
+    protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
        String commonPartLabel = getServiceContext().getCommonPartLabel("persons");
        Boolean displayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
                        PersonJAXBSchema.DISPLAY_NAME_COMPUTED);
index 95b1688f429aa8450bdfae1209497a18230e3cbe..886b7ba32a39ec2603bfab5cf2638c0a5fe64b75 100644 (file)
@@ -51,32 +51,14 @@ public class TaxonDocumentModelHandler
         super(COMMON_PART_LABEL);
     }
 
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleCreate(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        // first fill all the parts of the document
-        super.handleCreate(wrapDoc);
-        handleDisplayNames(wrapDoc.getWrappedObject());
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleUpdate(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        super.handleUpdate(wrapDoc);
-        handleDisplayNames(wrapDoc.getWrappedObject());
-    }
-
     /**
      * Handle display name.
      *
      * @param docModel the doc model
      * @throws Exception the exception
      */
-    private void handleDisplayNames(DocumentModel docModel) throws Exception {
+    @Override
+    protected void handleComputedDisplayNames(DocumentModel docModel) throws Exception {
         String commonPartLabel = getServiceContext().getCommonPartLabel("taxon");
         Boolean displayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
                 TaxonJAXBSchema.DISPLAY_NAME_COMPUTED);