]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-718 Added support for marking displayName computed or not, so can override...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Fri, 12 Feb 2010 22:20:47 +0000 (22:20 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Fri, 12 Feb 2010 22:20:47 +0000 (22:20 +0000)
services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/schemas/organizations_common.xsd
services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java
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/resources/organization_common.xsd
services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java

index 3b72e2d25ca7c379ee6560445a33e6e4d4ab9a7c..ab4cf14ca50b5505f774288176bb3c0d78bbf99a 100644 (file)
@@ -25,7 +25,7 @@
                <xs:element name="inAuthority" type="xs:string" />
                <xs:element name="refName" type="xs:string"/>
                <xs:element name="displayName" type="xs:string"/>
-<!--           <xs:element name="displayNameComputed" type="xs:boolean"/> -->
+               <xs:element name="displayNameComputed" type="xs:boolean"/>
                <xs:element name="shortName" type="xs:string"/>
                <xs:element name="longName" type="xs:string"/>
                <xs:element name="nameAdditions" type="xs:string"/>
index 585b671a4fb6d8fe57dd94cf5d339b8a7b15ddb3..d08f14886acee96253c1d6940ea41a7e97cff16a 100644 (file)
@@ -40,12 +40,61 @@ public class OrgAuthorityClientUtils {
         return multipart;\r
     }\r
 \r
+    public static String createItemInAuthority(String vcsid, \r
+               String orgAuthorityRefName, Map<String, String> orgInfo,\r
+               OrgAuthorityClient client) {\r
+       // Expected status code: 201 Created\r
+       int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();\r
+       // Type of service request being tested\r
+       ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;\r
+       String displayName = orgInfo.get(OrganizationJAXBSchema.DISPLAY_NAME);\r
+       String displayNameComputedStr = orgInfo.get(OrganizationJAXBSchema.DISPLAY_NAME_COMPUTED);\r
+       boolean displayNameComputed = (displayNameComputedStr==null) || displayNameComputedStr.equalsIgnoreCase("true");\r
+       if( displayName == null ) {\r
+               if(!displayNameComputed) {\r
+                       throw new RuntimeException(\r
+                       "CreateItem: Must supply a displayName if displayNameComputed is set to false.");\r
+               }\r
+               displayName = prepareDefaultDisplayName(\r
+                               orgInfo.get(OrganizationJAXBSchema.SHORT_NAME ),                        \r
+                               orgInfo.get(OrganizationJAXBSchema.FOUNDING_PLACE ));\r
+       }\r
+       String refName = createOrganizationRefName( orgAuthorityRefName, displayName, true);\r
+\r
+       if(logger.isDebugEnabled()){\r
+               logger.debug("Import: Create Item: \""+displayName\r
+                               +"\" in orgAuthorityulary: \"" + orgAuthorityRefName +"\"");\r
+       }\r
+       MultipartOutput multipart =\r
+               createOrganizationInstance( vcsid, refName, orgInfo, client.getItemCommonPartName() );\r
+       ClientResponse<Response> res = client.createItem(vcsid, multipart);\r
+\r
+       int statusCode = res.getStatus();\r
+\r
+       if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
+               throw new RuntimeException("Could not create Item: \""+displayName\r
+                               +"\" in orgAuthority: \"" + orgAuthorityRefName\r
+                               +"\" "+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
+       }\r
+       if(statusCode != EXPECTED_STATUS_CODE) {\r
+               throw new RuntimeException("Unexpected Status when creating Item: \""+displayName\r
+                               +"\" in orgAuthority: \"" + orgAuthorityRefName +"\", Status:"+ statusCode);\r
+       }\r
+\r
+       return extractId(res);\r
+    }\r
+\r
     public static MultipartOutput createOrganizationInstance(String inAuthority, \r
                String orgRefName, Map<String, String> orgInfo, String headerLabel){\r
         OrganizationsCommon organization = new OrganizationsCommon();\r
         organization.setInAuthority(inAuthority);\r
                organization.setRefName(orgRefName);\r
                String value = null;\r
+       value = orgInfo.get(OrganizationJAXBSchema.DISPLAY_NAME_COMPUTED);\r
+       boolean displayNameComputed = (value==null) || value.equalsIgnoreCase("true"); \r
+               organization.setDisplayNameComputed(displayNameComputed);\r
+        if((value = (String)orgInfo.get(OrganizationJAXBSchema.DISPLAY_NAME))!=null)\r
+               organization.setDisplayName(value);\r
         if((value = (String)orgInfo.get(OrganizationJAXBSchema.SHORT_NAME))!=null)\r
                organization.setShortName(value);\r
         if((value = (String)orgInfo.get(OrganizationJAXBSchema.LONG_NAME))!=null)\r
@@ -123,4 +172,33 @@ public class OrgAuthorityClientUtils {
        return refName;\r
     }\r
 \r
+    /**\r
+     * Produces a default displayName from the basic name and foundingPlace fields.\r
+     * @see OrgAuthorityDocumentModelHandler.prepareDefaultDisplayName() which\r
+     * duplicates this logic, until we define a service-general utils package\r
+     * that is neither client nor service specific.\r
+     * @param shortName\r
+     * @param foundingPlace\r
+     * @return\r
+     * @throws Exception\r
+     */\r
+    public static String prepareDefaultDisplayName(\r
+               String shortName, String foundingPlace ) {\r
+       StringBuilder newStr = new StringBuilder();\r
+               final String sep = " ";\r
+               boolean firstAdded = false;\r
+               if(null != shortName ) {\r
+                       newStr.append(shortName);\r
+                       firstAdded = true;\r
+               }\r
+       // Now we add the place\r
+               if(null != foundingPlace ) {\r
+                       if(firstAdded) {\r
+                               newStr.append(sep);\r
+                       }\r
+                       newStr.append(foundingPlace);\r
+               }\r
+               return newStr.toString();\r
+    }\r
+    \r
 }\r
index 51ce7db4aae2520a05cfb79f3c26239327c9884e..bd0c7fb9c60969cb04625edb211820be5fa2df1b 100644 (file)
@@ -63,6 +63,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
     private OrgAuthorityClient client = new OrgAuthorityClient();
     final String SERVICE_PATH_COMPONENT = "orgauthorities";
     final String ITEM_SERVICE_PATH_COMPONENT = "items";
+    private final String TEST_ORG_SHORTNAME = "Test Org";
+    private final String TEST_ORG_FOUNDING_PLACE = "Anytown, USA";
     private String knownResourceId = null;
     private String lastOrgAuthId = null;
     private String knownResourceRefName = null;
@@ -133,13 +135,13 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
     public void createItem(String testName) {
         setupCreate(testName);
 
-        knownItemResourceId = createItemInAuthority(lastOrgAuthId);
+        knownItemResourceId = createItemInAuthority(lastOrgAuthId, knownResourceRefName);
         if(logger.isDebugEnabled()){
             logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId);
         }
     }
 
-    private String createItemInAuthority(String vcsid) {
+    private String createItemInAuthority(String vcsid, String orgAuthorityRefName) {
 
         final String testName = "createItemInAuthority";
         if(logger.isDebugEnabled()){
@@ -150,31 +152,18 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         String identifier = createIdentifier();
         String refName = OrgAuthorityClientUtils.createOrganizationRefName(knownResourceRefName, identifier, true);
         Map<String, String> testOrgMap = new HashMap<String,String>();
-        testOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "Test Org");
+        testOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, TEST_ORG_SHORTNAME);
         testOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "The real official test organization");
         testOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "joe@test.org");
         testOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "May 26, 1907");
-        testOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Anytown, USA");
+        testOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, TEST_ORG_FOUNDING_PLACE);
         testOrgMap.put(OrganizationJAXBSchema.FUNCTION, "For testing");
-        MultipartOutput multipart = 
-               OrgAuthorityClientUtils.createOrganizationInstance(vcsid, 
-               refName, testOrgMap, client.getItemCommonPartName() );
-        ClientResponse<Response> res = client.createItem(vcsid, multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
-
+        String newID = OrgAuthorityClientUtils.createItemInAuthority(
+                       vcsid, orgAuthorityRefName, testOrgMap, client);
         // Store the ID returned from the first item resource created
         // for additional tests below.
         if (knownItemResourceId == null){
-            knownItemResourceId = extractId(res);
+            knownItemResourceId = newID;
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": knownItemResourceId=" + knownItemResourceId);
             }
@@ -186,9 +175,9 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         //
         // Item resource IDs are unique, so these are used as keys;
         // the non-unique IDs of their parents are stored as associated values.
-        allResourceItemIdsCreated.put(extractId(res), vcsid);
+        allResourceItemIdsCreated.put(newID, vcsid);
 
-        return extractId(res);
+        return newID;
     }
 
     @Override
@@ -404,6 +393,112 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
         Assert.assertEquals(organization.getInAuthority(), knownResourceId);
     }
 
+    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+            dependsOnMethods = {"readItem", "updateItem"})
+    public void verifyItemDisplayName(String testName) throws Exception {
+
+        // Perform setup.
+        setupRead(testName);
+
+        // Submit the request to the service and store the response.
+        ClientResponse<MultipartInput> res = client.readItem(knownResourceId, knownItemResourceId);
+        int statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match
+        // the expected response(s)?
+        if(logger.isDebugEnabled()){
+            logger.debug(testName + ": status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+        // Check whether organization has expected displayName.
+        MultipartInput input = (MultipartInput) res.getEntity();
+        OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
+                client.getItemCommonPartName(), OrganizationsCommon.class);
+        Assert.assertNotNull(organization);
+        String displayName = organization.getDisplayName();
+        // Make sure displayName matches computed form
+        String expectedDisplayName = 
+               OrgAuthorityClientUtils.prepareDefaultDisplayName(
+                               TEST_ORG_SHORTNAME, TEST_ORG_FOUNDING_PLACE);
+        Assert.assertNotNull(displayName, expectedDisplayName);
+        
+        // Update the shortName and verify the computed name is updated.
+        organization.setDisplayNameComputed(true);
+        organization.setShortName("updated-" + TEST_ORG_SHORTNAME);
+        expectedDisplayName = 
+               OrgAuthorityClientUtils.prepareDefaultDisplayName(
+                               "updated-" + TEST_ORG_SHORTNAME, TEST_ORG_FOUNDING_PLACE);
+
+        // Submit the updated resource to the service and store the response.
+        MultipartOutput output = new MultipartOutput();
+        OutputPart commonPart = output.addPart(organization, MediaType.APPLICATION_XML_TYPE);
+        commonPart.getHeaders().add("label", client.getItemCommonPartName());
+        res = client.updateItem(knownResourceId, knownItemResourceId, output);
+        statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match the expected response(s)?
+        if(logger.isDebugEnabled()){
+            logger.debug("updateItem: status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+        // Retrieve the updated resource and verify that its contents exist.
+        input = (MultipartInput) res.getEntity();
+        OrganizationsCommon updatedOrganization =
+                (OrganizationsCommon) extractPart(input,
+                        client.getItemCommonPartName(), OrganizationsCommon.class);
+        Assert.assertNotNull(updatedOrganization);
+
+        // Verify that the updated resource received the correct data.
+        Assert.assertEquals(updatedOrganization.getShortName(),
+                organization.getShortName(),
+                "Updated ShortName in Organization did not match submitted data.");
+        // Verify that the updated resource computes the right displayName.
+        Assert.assertEquals(updatedOrganization.getDisplayName(),
+                       expectedDisplayName,
+                "Updated ShortName in Organization not reflected in computed DisplayName.");
+
+        // Now Update the displayName, not computed and verify the computed name is overriden.
+        organization.setDisplayNameComputed(false);
+        expectedDisplayName = "TestName";
+        organization.setDisplayName(expectedDisplayName);
+
+        // Submit the updated resource to the service and store the response.
+        output = new MultipartOutput();
+        commonPart = output.addPart(organization, MediaType.APPLICATION_XML_TYPE);
+        commonPart.getHeaders().add("label", client.getItemCommonPartName());
+        res = client.updateItem(knownResourceId, knownItemResourceId, output);
+        statusCode = res.getStatus();
+
+        // Check the status code of the response: does it match the expected response(s)?
+        if(logger.isDebugEnabled()){
+            logger.debug("updateItem: status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+        // Retrieve the updated resource and verify that its contents exist.
+        input = (MultipartInput) res.getEntity();
+        updatedOrganization =
+                (OrganizationsCommon) extractPart(input,
+                        client.getItemCommonPartName(), OrganizationsCommon.class);
+        Assert.assertNotNull(updatedOrganization);
+
+        // Verify that the updated resource received the correct data.
+        Assert.assertEquals(updatedOrganization.isDisplayNameComputed(), false,
+                "Updated displayNameComputed in Organization did not match submitted data.");
+        // Verify that the updated resource computes the right displayName.
+        Assert.assertEquals(updatedOrganization.getDisplayName(),
+                       expectedDisplayName,
+                "Updated DisplayName (not computed) in Organization not stored.");
+    }
+
     // Failure outcomes
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
@@ -861,7 +956,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTestImpl {
 
    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
         dependsOnMethods = {"createItem", "readItemList", "testItemSubmitRequest",
-            "updateItem"})
+            "updateItem", "verifyItemDisplayName"})
     public void deleteItem(String testName) throws Exception {
 
         // Perform setup.
index 17abbaefd0646221b1dcb2e4da98296786c27036..57c77a428ee1cfee2c40e8747f17aca7e78d34d9 100644 (file)
@@ -96,45 +96,11 @@ public class OrgAuthorityBaseImport {
                                +newOrgAuthorityId );
        }
        for(Map<String,String> orgInfo : orgInfos){
-               createItemInAuthority(newOrgAuthorityId, 
-                               baseOrgAuthRefName, orgInfo );
+            OrgAuthorityClientUtils.createItemInAuthority(
+                       newOrgAuthorityId, baseOrgAuthRefName, orgInfo, client);
        }
     }
     
-    private String createItemInAuthority(String vcsid, 
-               String orgAuthorityRefName, Map<String, String> orgInfo) {
-       // Expected status code: 201 Created
-       int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();
-       // Type of service request being tested
-       ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;
-       String shortName = orgInfo.get(OrganizationJAXBSchema.SHORT_NAME);
-       String refName = OrgAuthorityClientUtils.createOrganizationRefName(
-                                               orgAuthorityRefName, shortName, true);
-
-       if(logger.isDebugEnabled()){
-               logger.debug("Import: Create Item: \""+shortName
-                               +"\" in orgAuthorityulary: \"" + orgAuthorityRefName +"\"");
-       }
-       MultipartOutput multipart = 
-               OrgAuthorityClientUtils.createOrganizationInstance( vcsid, 
-                               refName, orgInfo, client.getItemCommonPartName() );
-       ClientResponse<Response> res = client.createItem(vcsid, multipart);
-
-       int statusCode = res.getStatus();
-
-       if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {
-               throw new RuntimeException("Could not create Item: \""+shortName
-                               +"\" in orgAuthority: \"" + orgAuthorityRefName
-                               +"\" "+ OrgAuthorityClientUtils.invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-       }
-       if(statusCode != EXPECTED_STATUS_CODE) {
-               throw new RuntimeException("Unexpected Status when creating Item: \""+shortName
-                               +"\" in orgAuthority: \"" + orgAuthorityRefName +"\", Status:"+ statusCode);
-       }
-
-       return OrgAuthorityClientUtils.extractId(res);
-    }
-
     // ---------------------------------------------------------------
     // Utility methods used by methods above
     // ---------------------------------------------------------------
index 72fd1bc33ec18db3f63f6563f11e75484d71c6f6..edea07553f52ebee59a3adb4e57c07db3041aec0 100644 (file)
@@ -12,6 +12,7 @@ public interface OrganizationJAXBSchema {
        final static String CSID = "csid";\r
        final static String IN_AUTHORITY = "inAuthority";\r
        final static String DISPLAY_NAME = "displayName";\r
+       final static String DISPLAY_NAME_COMPUTED = "displayNameComputed";\r
        final static String SHORT_NAME = "shortName";\r
        final static String REF_NAME = "refName";\r
        final static String LONG_NAME = "longName";\r
index d06746162f47b3ba64aba33a62ddbfcb16b1afbb..ca80816c54527f0038aa2d210b58a8f6cd9394f5 100644 (file)
@@ -20,7 +20,7 @@
                 <xs:element name="inAuthority" type="xs:string" />
                 <xs:element name="refName" type="xs:string"/>
                 <xs:element name="displayName" type="xs:string"/>
-<!--                           <xs:element name="displayNameComputed" type="xs:boolean"/> -->
+                                       <xs:element name="displayNameComputed" type="xs:boolean"/>
                 <xs:element name="shortName" type="xs:string"/>
                 <xs:element name="longName" type="xs:string"/>
                 <xs:element name="nameAdditions" type="xs:string"/>
index 469b32440eb49095bc2cf233fad3f0675fbca55e..328c818b5e8961dca410f4ac040fb49aecde3648 100644 (file)
@@ -27,6 +27,7 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.collectionspace.services.OrganizationJAXBSchema;
+import org.collectionspace.services.common.context.MultipartServiceContext;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
@@ -77,64 +78,68 @@ public class OrganizationDocumentModelHandler
     public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
        // first fill all the parts of the document
        super.handleCreate(wrapDoc);            
-       handleGetDisplayName(wrapDoc.getWrappedObject());
-    }
-       
-    private String prepareDefaultDisplayName(DocumentModel docModel) throws Exception {
-       String result = null;
-       
-       result = (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
-                               OrganizationJAXBSchema.SHORT_NAME);
-       
-       return result;
+       handleDisplayName(wrapDoc.getWrappedObject());
     }
     
-    /**
-     * Handle get display name.
-     * 
-     * @param docModel the doc model
-     * 
-     * @return the string
-     * 
-     * @throws Exception the exception
-     */
-    private String handleGetDisplayName(DocumentModel docModel) throws Exception {
-       return handleGetDisplayName(docModel, true);
+    @Override
+    public void handleUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+       super.handleUpdate(wrapDoc);
+       handleDisplayName(wrapDoc.getWrappedObject());
     }
-    
+
     /**
-     * Handle get display name.
-     * 
-     * @param wrapDoc the wrap doc
+     * Check the logic around the computed displayName
      * 
-     * @return the string
+     * @param docModel
      * 
      * @throws Exception the exception
      */
-    private String handleGetDisplayName(DocumentModel docModel, boolean updateDocModel) throws Exception {
-       String displayName = (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
-                       OrganizationJAXBSchema.DISPLAY_NAME);
-       if (displayName == null) {
-               displayName = prepareDefaultDisplayName(docModel);
-                       if (updateDocModel == true) {
-                               docModel.setProperty(getServiceContext().getCommonPartLabel(
-                                               "organizations"), OrganizationJAXBSchema.DISPLAY_NAME,
+    private void handleDisplayName(DocumentModel docModel) throws Exception {
+       String commonPartLabel = getServiceContext().getCommonPartLabel("organizations");
+       Boolean displayNameComputed = (Boolean) docModel.getProperty(commonPartLabel,
+                       OrganizationJAXBSchema.DISPLAY_NAME_COMPUTED);
+       if (displayNameComputed) {
+               String displayName = prepareDefaultDisplayName(
+                               (String) docModel.getProperty(commonPartLabel,OrganizationJAXBSchema.SHORT_NAME),
+                               (String) docModel.getProperty(commonPartLabel,OrganizationJAXBSchema.FOUNDING_PLACE));
+                       docModel.setProperty(commonPartLabel, OrganizationJAXBSchema.DISPLAY_NAME,
                                                displayName);
-                       }
+       } else if(null ==  
+                               docModel.getProperty(commonPartLabel,OrganizationJAXBSchema.DISPLAY_NAME)) { 
+            throw new IllegalArgumentException("Must provide "+OrganizationJAXBSchema.DISPLAY_NAME
+                       +" if " + OrganizationJAXBSchema.DISPLAY_NAME_COMPUTED+" is declared false."); 
        }
-       
-       return displayName;
     }
 
-    /* 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)
+    /**
+     * Produces a default displayName from the basic name and foundingPlace fields.
+     * @see OrgAuthorityClientUtils.prepareDefaultDisplayName() which
+     * duplicates this logic, until we define a service-general utils package
+     * that is neither client nor service specific.
+     * @param shortName
+     * @param foundingPlace
+     * @return
+     * @throws Exception
      */
-    @Override
-    public void handleGet(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-       handleGetDisplayName(wrapDoc.getWrappedObject());
-       super.handleGet(wrapDoc);
+    private static String prepareDefaultDisplayName(
+               String shortName, String foundingPlace ) throws Exception {
+       StringBuilder newStr = new StringBuilder();
+               final String sep = " ";
+               boolean firstAdded = false;
+               if(null != shortName ) {
+                       newStr.append(shortName);
+                       firstAdded = true;
+               }
+       // Now we add the place
+               if(null != foundingPlace ) {
+                       if(firstAdded) {
+                               newStr.append(sep);
+                       }
+                       newStr.append(foundingPlace);
+               }
+               return newStr.toString();
     }
-
+    
     /**
      * getCommonPart get associated organization
      * @return
@@ -191,24 +196,15 @@ public class OrganizationDocumentModelHandler
                //FIXME: iterating over a long list of documents is not a long term
                //strategy...need to change to more efficient iterating in future
                Iterator<DocumentModel> iter = docList.iterator();
+               String commonPartLabel = getServiceContext().getCommonPartLabel("organizations");
                while(iter.hasNext()){
                    DocumentModel docModel = iter.next();
                    OrganizationListItem ilistItem = new OrganizationListItem();
-                   // We look for a set display name, and fall back to the short name if there is none
-                   String displayName = handleGetDisplayName(docModel, false);
-                               ilistItem.setDisplayName(displayName);
-                               ilistItem.setRefName((String) docModel.getProperty(getServiceContext().getCommonPartLabel(
-                                               "organizations"), OrganizationJAXBSchema.REF_NAME));
-                                                       /*
-                                                        * These are not currently included in the listing - only in the details
-                   ilistItem.setLongName(
-                                                                       (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
-                                                                       OrganizationJAXBSchema.LONG_NAME));
-                   ilistItem.setDescription(
-                                                                       (String) docModel.getProperty(getServiceContext().getCommonPartLabel("organizations"),
-                                                                       OrganizationJAXBSchema.DESCRIPTION));
-                                                        */
-                                                       String id = NuxeoUtils.extractId(docModel.getPathAsString());
+                   ilistItem.setDisplayName((String)
+                               docModel.getProperty(commonPartLabel,OrganizationJAXBSchema.DISPLAY_NAME ));
+                               ilistItem.setRefName((String) 
+                                               docModel.getProperty(commonPartLabel, OrganizationJAXBSchema.REF_NAME));
+                               String id = NuxeoUtils.extractId(docModel.getPathAsString());
                    ilistItem.setUri("/orgauthorities/"+inAuthority+"/items/" + id);
                    ilistItem.setCsid(id);
                    list.add(ilistItem);