]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5130: More fixes for special handling of VocabularyItemDocumentModelHandler
authorRichard Millet <remillet@berkeley.edu>
Fri, 4 May 2012 20:31:31 +0000 (13:31 -0700)
committerRichard Millet <remillet@berkeley.edu>
Fri, 4 May 2012 20:31:31 +0000 (13:31 -0700)
services/authority/service/pom.xml
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CommonList.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java
services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java
services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/nuxeo/VocabularyItemDocumentModelHandler.java

index 83a83342beab6f2b0ab536a6dc81009c1024c257..dc218ccdfff975c0548b57a5e28aa82a70a2673f 100644 (file)
             <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
             <version>${project.version}</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.vocabulary.jaxb</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>\r
index 8ba40877c9a3348ba4f137947dd0dceb4a0a029d..c480dd53bc66ce02b857714ab3dc1f95055a6ce5 100644 (file)
@@ -59,6 +59,7 @@ import org.collectionspace.services.relation.RelationsCommon;
 import org.collectionspace.services.relation.RelationsCommonList;
 import org.collectionspace.services.relation.RelationsDocListItem;
 import org.collectionspace.services.relation.RelationshipType;
+import org.collectionspace.services.vocabulary.VocabularyItemJAXBSchema;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.model.PropertyException;
@@ -186,7 +187,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         for (int i = 0; i < nFields; i++) {
             ListResultField field = list.get(i);
             String elName = field.getElement();
-            if (AuthorityItemJAXBSchema.TERM_DISPLAY_NAME.equals(elName) || AuthorityItemJAXBSchema.DISPLAY_NAME.equals(elName)) {
+            if (AuthorityItemJAXBSchema.TERM_DISPLAY_NAME.equals(elName) || VocabularyItemJAXBSchema.DISPLAY_NAME.equals(elName)) {
                 hasDisplayName = true;
             } else if (AuthorityItemJAXBSchema.SHORT_IDENTIFIER.equals(elName)) {
                 hasShortId = true;
@@ -199,7 +200,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         ListResultField field;
         if (!hasDisplayName) {
                field = getListResultsDisplayNameField();
-            list.add(field);
+            list.add(field);  //Note: We're updating the "global" service and tenant bindings instance here -the list instance here is a reference to the tenant bindings instance in the singleton ServiceMain.
         }
         if (!hasShortId) {
             field = new ListResultField();
@@ -310,6 +311,9 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         return updatedRefName;
     }
     
+    /*
+     * Note: The Vocabulary document handler overrides this method.
+     */
     protected String getRefPropName() {
        return ServiceBindingUtils.AUTH_REF_PROP;
     }
index 7abf3e7ffe0e3c43b23b535a0f36301650cfcefd..1dbca727683364799772fc5efa2f4c88f74798b1 100644 (file)
             </types:item>
             -->
                         <!-- Fields containing term list / controlled vocabulary references -->
-            <types:item xmlns:types="http://collectionspace.org/services/config/types">
-                            <types:key>termRef</types:key>
-              <types:value>salutation</types:value>
-            </types:item>
-            <types:item xmlns:types="http://collectionspace.org/services/config/types">
-                            <types:key>termRef</types:key>
-              <types:value>title</types:value>
-            </types:item>
-            <types:item xmlns:types="http://collectionspace.org/services/config/types">
-                            <types:key>termRef</types:key>
-              <types:value>gender</types:value>
-            </types:item>
-            <types:item xmlns:types="http://collectionspace.org/services/config/types">
-                            <types:key>termRef</types:key>
-                            <types:value>termStatus</types:value>
-            </types:item>
+                               <types:item xmlns:types="http://collectionspace.org/services/config/types">
+                                       <types:key>termRef</types:key>
+                                       <types:value>personTermGroupList/[0]/salutation</types:value>
+                               </types:item>
+                               <types:item xmlns:types="http://collectionspace.org/services/config/types">
+                                       <types:key>termRef</types:key>
+                                       <types:value>personTermGroupList/[0]/title</types:value>
+                               </types:item>
+                               <types:item xmlns:types="http://collectionspace.org/services/config/types">
+                                       <types:key>termRef</types:key>
+                                       <types:value>gender</types:value>
+                               </types:item>
+                               <types:item xmlns:types="http://collectionspace.org/services/config/types">
+                                       <types:key>termRef</types:key>
+                                       <types:value>personTermGroupList/[0]/termStatus</types:value>
+                               </types:item>
           </service:properties>
         </service:part>
         <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
index 2b2e8f100fbf2a6ce59e46df3180628772d6947a..e13c0f33df3391d2028aa195256359190e5031a6 100644 (file)
@@ -107,20 +107,20 @@ public class CommonList extends AbstractCommonList {
         */\r
        public void setFieldsReturned(String[] fieldKeys) {\r
                this.fieldKeys = fieldKeys;\r
-               String fieldsImploded = implode(fieldKeys, "|");\r
+               String fieldsImploded = implode(fieldKeys, "|");  \r
                setFieldsReturned(fieldsImploded);\r
        }\r
 \r
        // TODO This should be in common, but then we have mutual dependencies. Sigh.\r
        private String implode(String strings[], String sep) {\r
                String implodedString;\r
-               if (strings.length==0) {\r
+               if (strings.length == 0) {\r
                        implodedString = "";\r
                } else {\r
                        StringBuffer sb = new StringBuffer();\r
                        sb.append(strings[0]);\r
-                       for (int i=1;i<strings.length;i++) {\r
-                               if(strings[i]!=null&& !strings[i].trim().isEmpty()) {\r
+                       for (int i = 1; i < strings.length; i++) {\r
+                               if (strings[i] != null && !strings[i].trim().isEmpty()) {\r
                                        sb.append(sep);\r
                                        sb.append(strings[i]);\r
                                }\r
index e37cad8d839b28bf90ccf7024a1c31ffc13cdd6f..34f7646aa59bdd0ab171651a5db4ce6a526df586 100644 (file)
@@ -183,15 +183,15 @@ public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T
        CommonList commonList = new CommonList();\r
         extractPagingInfo(commonList, wrapDoc);\r
         List<ListResultField> resultsFields = getListItemsArray();\r
-        int nFields = resultsFields.size()+NUM_STANDARD_LIST_RESULT_FIELDS;\r
+        int nFields = resultsFields.size() + NUM_STANDARD_LIST_RESULT_FIELDS;\r
         String fields[] = new String[nFields];\r
         fields[0] = STANDARD_LIST_CSID_FIELD;\r
         fields[1] = STANDARD_LIST_URI_FIELD;\r
         fields[2] = STANDARD_LIST_UPDATED_AT_FIELD;\r
         fields[3] = STANDARD_LIST_WORKFLOW_FIELD;\r
-        for(int i=NUM_STANDARD_LIST_RESULT_FIELDS;i<nFields;i++) {\r
-               ListResultField field = resultsFields.get(i-NUM_STANDARD_LIST_RESULT_FIELDS); \r
-               fields[i]=field.getElement();\r
+        for(int i = NUM_STANDARD_LIST_RESULT_FIELDS; i < nFields; i++) {\r
+               ListResultField field = resultsFields.get(i - NUM_STANDARD_LIST_RESULT_FIELDS); \r
+               fields[i] = field.getElement();\r
         }\r
         commonList.setFieldsReturned(fields);\r
         Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();\r
index f471deff3a20d70c5fbf79e035ecc69091e777fa..0837b9c7cf9d3ce5af38bfc7f9fb2b08fa38ed91 100644 (file)
@@ -25,9 +25,9 @@ package org.collectionspace.services.vocabulary;
 
 import org.collectionspace.services.client.VocabularyClient;
 import org.collectionspace.services.common.context.ServiceBindingUtils;
-import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
+//import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.common.vocabulary.AuthorityResource;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+//import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.vocabulary.nuxeo.VocabularyItemDocumentModelHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 13605c9b1220718e23f073130e5d54564231b21a..36901561978033514b9c7bffcc391a7a6d98c022 100644 (file)
@@ -94,8 +94,8 @@ public class VocabularyItemDocumentModelHandler
        protected ListResultField getListResultsDisplayNameField() {
                ListResultField result = new ListResultField();
 
-               result.setElement(AuthorityItemJAXBSchema.DISPLAY_NAME);
-               result.setXpath(AuthorityItemJAXBSchema.DISPLAY_NAME);
+               result.setElement(VocabularyItemJAXBSchema.DISPLAY_NAME);
+               result.setXpath(VocabularyItemJAXBSchema.DISPLAY_NAME);
 
                return result;
        }
@@ -103,8 +103,8 @@ public class VocabularyItemDocumentModelHandler
     protected ListResultField getListResultsTermStatusField() {
                ListResultField result = new ListResultField();
 
-               result.setElement(VocabularyItemJAXBSchema.DISPLAY_NAME);
-               result.setXpath(VocabularyItemJAXBSchema.TERM_STATUS);
+               result.setElement(AuthorityItemJAXBSchema.TERM_STATUS);
+               result.setXpath(AuthorityItemJAXBSchema.TERM_STATUS);
 
                return result;
     }