]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-149. Updated to add displayName in, computed from shortName (on get). Fixed...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Wed, 6 Jan 2010 23:51:58 +0000 (23:51 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Wed, 6 Jan 2010 23:51:58 +0000 (23:51 +0000)
services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/layouts-contrib.xml
services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/schemas/organizations_common.xsd
services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java
services/organization/import/src/main/java/org/collectionspace/services/organization/importer/OrgAuthorityBaseImport.java
services/organization/jaxb/src/main/java/org/collectionspace/services/OrganizationJAXBSchema.java
services/organization/jaxb/src/main/java/org/collectionspace/services/OrganizationListItemJAXBSchema.java
services/organization/jaxb/src/main/resources/organization_common.xsd
services/organization/sample/sample/src/main/java/org/collectionspace/services/organization/client/sample/Sample.java
services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java

index e0db2b20e1b6e296fb32d0744992998c70f8b547..ca5555761c9d76b28d8d01be883b2caac6579fd4 100644 (file)
@@ -17,7 +17,7 @@
 
       <widget name="displayName" type="text">
         <labels>
-          <label mode="any">Name</label>
+          <label mode="any">Display Name</label>
         </labels>
         <translated>true</translated>
         <fields>
@@ -64,6 +64,7 @@
         <template mode="any">/layouts/layout_default_template.xhtml</template>
       </templates>
       <rows>
+        <row><widget>displayName</widget></row>
         <row><widget>shortName</widget></row>
         <row><widget>refName</widget></row>
         <row><widget>inAuthority</widget></row>
         <row><widget>description</widget></row>
       </rows>
 
+      <widget name="displayName" type="text">
+        <labels>
+          <label mode="any">Display Name</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="orgauthorities_common">displayName</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
       <widget name="shortName" type="text">
         <labels>
-          <label mode="any">Name</label>
+          <label mode="any">ShortName</label>
         </labels>
         <translated>true</translated>
         <fields>
index 5e4bacb44339a3d4e49ade68bc8980dbe0db26c0..f66283d5d6abbef52034d6a9d25f207ffb99b4c5 100644 (file)
@@ -24,6 +24,7 @@
                <!--  inAuthority is the csid of the owning OrgAuthority -->
                <xs:element name="inAuthority" type="xs:string" />
                <xs:element name="refName" type="xs:string"/>
+               <xs:element name="displayName" type="xs:string"/>
                <xs:element name="shortName" type="xs:string"/>
                <xs:element name="longName" type="xs:string"/>
                <xs:element name="nameAdditions" type="xs:string"/>
index 6d6f5026c246e230c68bff005c81134f7428307f..930505300fe0c5bc42994bbc9f3df6e06375738f 100644 (file)
@@ -527,7 +527,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest {
                 logger.debug("  " + testName + ": list-item[" + i + "] csid=" +
                         item.getCsid());
                 logger.debug("  " + testName + ": list-item[" + i + "] shortName=" +
-                        item.getShortName());
+                        item.getDisplayName());
                 logger.debug("  " + testName + ": list-item[" + i + "] URI=" +
                         item.getUri());
                 i++;
index 6e513de5072fa4143499e2a33b96aa1e2c1b60e2..af7c7140936441f0e597924d05cfe47d021f34ee 100644 (file)
@@ -69,10 +69,10 @@ public class OrgAuthorityBaseImport {
        if(logger.isDebugEnabled()){
                logger.debug("Import: Create orgAuthority: \"" + orgAuthorityName +"\"");
        }
-       String baseOrgRefName = createOrgAuthRefName(orgAuthorityName);
-       String fullOrgRefName = baseOrgRefName+"'"+orgAuthorityName+"'";
+       String baseOrgAuthRefName = createOrgAuthRefName(orgAuthorityName);
+       String fullOrgAuthRefName = baseOrgAuthRefName+"'"+orgAuthorityName+"'";
        MultipartOutput multipart = createOrgAuthorityInstance(orgAuthorityName, 
-                       fullOrgRefName);
+                       fullOrgAuthRefName);
        ClientResponse<Response> res = client.create(multipart);
 
        int statusCode = res.getStatus();
@@ -94,7 +94,7 @@ public class OrgAuthorityBaseImport {
                                +newOrgAuthorityId );
        }
        for(List<String> orgStrings : orgInfo){
-               createItemInAuthority(newOrgAuthorityId, baseOrgRefName, orgStrings);
+               createItemInAuthority(newOrgAuthorityId, baseOrgAuthRefName, orgStrings);
        }
     }
     
@@ -109,7 +109,7 @@ public class OrgAuthorityBaseImport {
                foundingDate, dissolutionDate, foundingPlace, function, description
                 */             
        String shortName = orgStrings.get(0);
-       String refName = createOrganizationRefName(orgAuthorityRefName, shortName);
+       String refName = createOrganizationRefName(orgAuthorityRefName, shortName)+"'"+shortName+"'";
 
        if(logger.isDebugEnabled()){
                logger.debug("Import: Create Item: \""+shortName
@@ -231,7 +231,7 @@ public class OrgAuthorityBaseImport {
     }
     
     protected String createOrgAuthRefName(String orgAuthorityName) {
-       return "urn:cspace:org.collectionspace.demo:personauthority:name("
+       return "urn:cspace:org.collectionspace.demo:orgauthority:name("
                        +orgAuthorityName+")";
     }
 
index 11ff58d10e404a8532982876d39d0d71d72d5450..bd38eca9713b4e118474527283101676a3ff9bff 100644 (file)
@@ -10,6 +10,7 @@ package org.collectionspace.services;
 public interface OrganizationJAXBSchema {\r
        final static String CSID = "csid";\r
        final static String IN_AUTHORITY = "inAuthority";\r
+       final static String DISPLAY_NAME = "displayName";\r
        final static String SHORT_NAME = "shortName";\r
        final static String REF_NAME = "refName";\r
        final static String LONG_NAME = "longName";\r
index e661607a5656799b1a8a71c2aa4e3edbdf31f1d5..86653cf18b81c35c325edd82b4a89ff588d3a5be 100644 (file)
@@ -1,7 +1,7 @@
 package org.collectionspace.services;\r
 \r
 public interface OrganizationListItemJAXBSchema {\r
-       final static String SHORT_NAME = "shortName";\r
+       final static String DISPLAY_NAME = "displayName";\r
        final static String REF_NAME = "refName";\r
        final static String CSID = "csid";\r
        final static String URI = "url";\r
index 9a3232672db54c161a1f150fde52cca383cb6247..b12ba36227c23ed51bb13ab16e0acfae0a9c6ba6 100644 (file)
                 <!--  Organization Information Group -->
                 <xs:element name="inAuthority" type="xs:string" />
                 <xs:element name="refName" type="xs:string"/>
+                <xs:element name="displayName" type="xs:string"/>
                 <xs:element name="shortName" type="xs:string"/>
                 <xs:element name="longName" type="xs:string"/>
-                                                               <xs:element name="nameAdditions" type="xs:string"/>
-                                                               <xs:element name="contactName" type="xs:string"/>
-                                                               <xs:element name="foundingDate" type="xs:string"/>
-                                                               <xs:element name="dissolutionDate" type="xs:string"/>
-                                                               <xs:element name="foundingPlace" type="xs:string"/>
-                                                               <xs:element name="function" type="xs:string"/>
+                               <xs:element name="nameAdditions" type="xs:string"/>
+                               <xs:element name="contactName" type="xs:string"/>
+                               <xs:element name="foundingDate" type="xs:string"/>
+                               <xs:element name="dissolutionDate" type="xs:string"/>
+                               <xs:element name="foundingPlace" type="xs:string"/>
+                               <xs:element name="function" type="xs:string"/>
                 <xs:element name="description" type="xs:string"/>
             </xs:sequence>
         </xs:complexType>
@@ -41,7 +42,7 @@
                 <xs:element name="organization_list_item" maxOccurs="unbounded">
                     <xs:complexType>
                         <xs:sequence>
-                            <xs:element name="shortName" type="xs:string"
+                            <xs:element name="displayName" type="xs:string"
                                 minOccurs="1" />
                             <!-- uri to retrieve organization details -->
                             <xs:element name="uri" type="xs:anyURI"
index 33a6c8b8dc5aeb783e6c0d46588e6f2c6d72c226..c64a25eac31c9e842e6b148eff34ab070e98005f 100644 (file)
@@ -374,7 +374,7 @@ public class Sample {
         OrganizationsCommonList.OrganizationListItem item) {\r
             StringBuffer sb = new StringBuffer();\r
             sb.append("csid=" + item.getCsid() + "\n");\r
-            sb.append("shortName=" + item.getShortName() + "\n");\r
+            sb.append("displayName=" + item.getDisplayName() + "\n");\r
             // sb.append("URI=" + item.getUri() + "\n");\r
         return sb.toString();\r
     }\r
@@ -520,8 +520,8 @@ public class Sample {
             // For each organization ...\r
             for (OrganizationsCommonList.OrganizationListItem\r
                 item : items.getOrganizationListItem()) {\r
-                // Get its short name.\r
-                logger.info(" " + item.getShortName());\r
+                // Get its display name.\r
+                logger.info(" " + item.getDisplayName());\r
             }\r
         }\r
 \r
index 41fbfa8d8640f60a6194554b8b73b0618d154ae1..44f7ea65c9a835d28116f32a76c28cc406abd695 100644 (file)
@@ -77,6 +77,23 @@ public class OrganizationDocumentModelHandler
         //no specific action needed
     }
 
+    /* Override handleGet so we can deal with defaulting the displayName
+     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#handleGet(org.collectionspace.services.common.document.DocumentWrapper)
+     */
+    @Override
+    public void handleGet(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+       DocumentModel docModel = wrapDoc.getWrappedObject();
+       String displayName = (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
+                       OrganizationJAXBSchema.DISPLAY_NAME);
+       if(displayName == null) {
+               displayName = (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
+                               OrganizationJAXBSchema.SHORT_NAME);
+               docModel.setProperty(getServiceContext().getCommonPartLabel("organizations"),
+                               OrganizationJAXBSchema.DISPLAY_NAME, displayName);
+       }
+       super.handleGet(wrapDoc);
+    }
+
     /**
      * getCommonPart get associated organization
      * @return
@@ -136,9 +153,13 @@ public class OrganizationDocumentModelHandler
                while(iter.hasNext()){
                    DocumentModel docModel = iter.next();
                    OrganizationListItem ilistItem = new OrganizationListItem();
-                   ilistItem.setShortName(
-                                                                       (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
-                                                                       OrganizationJAXBSchema.SHORT_NAME));
+                   // We look for a set display name, and fall back to teh short name if there is none
+                   String displayName = (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
+                                                                                               OrganizationJAXBSchema.DISPLAY_NAME);
+                   if(displayName == null)
+                           displayName = (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
+                                                       OrganizationJAXBSchema.SHORT_NAME);
+                   ilistItem.setDisplayName( displayName );
                    ilistItem.setRefName(
                                                                        (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
                                                                        OrganizationJAXBSchema.REF_NAME));