From 0831e3f5bd21c2506338c9be9306bf79e1963fb2 Mon Sep 17 00:00:00 2001 From: Patrick Schmitz Date: Fri, 12 Feb 2010 22:20:47 +0000 Subject: [PATCH] CSPACE-718 Added support for marking displayName computed or not, so can override to set a displayName, and revert to the computed form. --- .../schemas/organizations_common.xsd | 2 +- .../client/OrgAuthorityClientUtils.java | 78 ++++++++++ .../client/test/OrgAuthorityServiceTest.java | 141 +++++++++++++++--- .../importer/OrgAuthorityBaseImport.java | 38 +---- .../services/OrganizationJAXBSchema.java | 1 + .../main/resources/organization_common.xsd | 2 +- .../OrganizationDocumentModelHandler.java | 114 +++++++------- 7 files changed, 256 insertions(+), 120 deletions(-) diff --git a/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/schemas/organizations_common.xsd b/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/schemas/organizations_common.xsd index 3b72e2d25..ab4cf14ca 100644 --- a/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/schemas/organizations_common.xsd +++ b/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/schemas/organizations_common.xsd @@ -25,7 +25,7 @@ - + diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java index 585b671a4..d08f14886 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java @@ -40,12 +40,61 @@ public class OrgAuthorityClientUtils { return multipart; } + public static String createItemInAuthority(String vcsid, + String orgAuthorityRefName, Map orgInfo, + OrgAuthorityClient client) { + // 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 displayName = orgInfo.get(OrganizationJAXBSchema.DISPLAY_NAME); + String displayNameComputedStr = orgInfo.get(OrganizationJAXBSchema.DISPLAY_NAME_COMPUTED); + boolean displayNameComputed = (displayNameComputedStr==null) || displayNameComputedStr.equalsIgnoreCase("true"); + if( displayName == null ) { + if(!displayNameComputed) { + throw new RuntimeException( + "CreateItem: Must supply a displayName if displayNameComputed is set to false."); + } + displayName = prepareDefaultDisplayName( + orgInfo.get(OrganizationJAXBSchema.SHORT_NAME ), + orgInfo.get(OrganizationJAXBSchema.FOUNDING_PLACE )); + } + String refName = createOrganizationRefName( orgAuthorityRefName, displayName, true); + + if(logger.isDebugEnabled()){ + logger.debug("Import: Create Item: \""+displayName + +"\" in orgAuthorityulary: \"" + orgAuthorityRefName +"\""); + } + MultipartOutput multipart = + createOrganizationInstance( vcsid, refName, orgInfo, client.getItemCommonPartName() ); + ClientResponse res = client.createItem(vcsid, multipart); + + int statusCode = res.getStatus(); + + if(!REQUEST_TYPE.isValidStatusCode(statusCode)) { + throw new RuntimeException("Could not create Item: \""+displayName + +"\" in orgAuthority: \"" + orgAuthorityRefName + +"\" "+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + } + if(statusCode != EXPECTED_STATUS_CODE) { + throw new RuntimeException("Unexpected Status when creating Item: \""+displayName + +"\" in orgAuthority: \"" + orgAuthorityRefName +"\", Status:"+ statusCode); + } + + return extractId(res); + } + public static MultipartOutput createOrganizationInstance(String inAuthority, String orgRefName, Map orgInfo, String headerLabel){ OrganizationsCommon organization = new OrganizationsCommon(); organization.setInAuthority(inAuthority); organization.setRefName(orgRefName); String value = null; + value = orgInfo.get(OrganizationJAXBSchema.DISPLAY_NAME_COMPUTED); + boolean displayNameComputed = (value==null) || value.equalsIgnoreCase("true"); + organization.setDisplayNameComputed(displayNameComputed); + if((value = (String)orgInfo.get(OrganizationJAXBSchema.DISPLAY_NAME))!=null) + organization.setDisplayName(value); if((value = (String)orgInfo.get(OrganizationJAXBSchema.SHORT_NAME))!=null) organization.setShortName(value); if((value = (String)orgInfo.get(OrganizationJAXBSchema.LONG_NAME))!=null) @@ -123,4 +172,33 @@ public class OrgAuthorityClientUtils { return refName; } + /** + * Produces a default displayName from the basic name and foundingPlace fields. + * @see OrgAuthorityDocumentModelHandler.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 + */ + public static String prepareDefaultDisplayName( + String shortName, String foundingPlace ) { + 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(); + } + } diff --git a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java index 51ce7db4a..bd0c7fb9c 100644 --- a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java +++ b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java @@ -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 testOrgMap = new HashMap(); - 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 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 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. diff --git a/services/organization/import/src/main/java/org/collectionspace/services/organization/importer/OrgAuthorityBaseImport.java b/services/organization/import/src/main/java/org/collectionspace/services/organization/importer/OrgAuthorityBaseImport.java index 17abbaefd..57c77a428 100644 --- a/services/organization/import/src/main/java/org/collectionspace/services/organization/importer/OrgAuthorityBaseImport.java +++ b/services/organization/import/src/main/java/org/collectionspace/services/organization/importer/OrgAuthorityBaseImport.java @@ -96,45 +96,11 @@ public class OrgAuthorityBaseImport { +newOrgAuthorityId ); } for(Map orgInfo : orgInfos){ - createItemInAuthority(newOrgAuthorityId, - baseOrgAuthRefName, orgInfo ); + OrgAuthorityClientUtils.createItemInAuthority( + newOrgAuthorityId, baseOrgAuthRefName, orgInfo, client); } } - private String createItemInAuthority(String vcsid, - String orgAuthorityRefName, Map 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 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 // --------------------------------------------------------------- diff --git a/services/organization/jaxb/src/main/java/org/collectionspace/services/OrganizationJAXBSchema.java b/services/organization/jaxb/src/main/java/org/collectionspace/services/OrganizationJAXBSchema.java index 72fd1bc33..edea07553 100644 --- a/services/organization/jaxb/src/main/java/org/collectionspace/services/OrganizationJAXBSchema.java +++ b/services/organization/jaxb/src/main/java/org/collectionspace/services/OrganizationJAXBSchema.java @@ -12,6 +12,7 @@ public interface OrganizationJAXBSchema { final static String CSID = "csid"; final static String IN_AUTHORITY = "inAuthority"; final static String DISPLAY_NAME = "displayName"; + final static String DISPLAY_NAME_COMPUTED = "displayNameComputed"; final static String SHORT_NAME = "shortName"; final static String REF_NAME = "refName"; final static String LONG_NAME = "longName"; diff --git a/services/organization/jaxb/src/main/resources/organization_common.xsd b/services/organization/jaxb/src/main/resources/organization_common.xsd index d06746162..ca80816c5 100644 --- a/services/organization/jaxb/src/main/resources/organization_common.xsd +++ b/services/organization/jaxb/src/main/resources/organization_common.xsd @@ -20,7 +20,7 @@ - + diff --git a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java index 469b32440..328c818b5 100644 --- a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java +++ b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java @@ -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 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 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 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 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); -- 2.47.3