From: Patrick Schmitz Date: Wed, 6 Jan 2010 23:51:58 +0000 (+0000) Subject: CSPACE-149. Updated to add displayName in, computed from shortName (on get). Fixed... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=73f39f029da70fac07d65e75f4657345bd25b406;p=tmp%2Fjakarta-migration.git CSPACE-149. Updated to add displayName in, computed from shortName (on get). Fixed typos in refName generation in the Base Import. Tweaked some labels etc. in the nuxeo layout to make it easier to debug orgs. --- diff --git a/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/layouts-contrib.xml b/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/layouts-contrib.xml index e0db2b20e..ca5555761 100644 --- a/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/layouts-contrib.xml +++ b/services/organization/3rdparty/nuxeo-platform-cs-organization/src/main/resources/OSGI-INF/layouts-contrib.xml @@ -17,7 +17,7 @@ - + true @@ -64,6 +64,7 @@ + displayName shortName refName inAuthority @@ -77,9 +78,22 @@ description + + + + + true + + displayName + + + dataInputText + + + - + true 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 5e4bacb44..f66283d5d 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 @@ -24,6 +24,7 @@ + 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 6d6f5026c..930505300 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 @@ -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++; 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 6e513de50..af7c71409 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 @@ -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 res = client.create(multipart); int statusCode = res.getStatus(); @@ -94,7 +94,7 @@ public class OrgAuthorityBaseImport { +newOrgAuthorityId ); } for(List 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+")"; } 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 11ff58d10..bd38eca97 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 @@ -10,6 +10,7 @@ package org.collectionspace.services; public interface OrganizationJAXBSchema { final static String CSID = "csid"; final static String IN_AUTHORITY = "inAuthority"; + final static String DISPLAY_NAME = "displayName"; 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/java/org/collectionspace/services/OrganizationListItemJAXBSchema.java b/services/organization/jaxb/src/main/java/org/collectionspace/services/OrganizationListItemJAXBSchema.java index e661607a5..86653cf18 100644 --- a/services/organization/jaxb/src/main/java/org/collectionspace/services/OrganizationListItemJAXBSchema.java +++ b/services/organization/jaxb/src/main/java/org/collectionspace/services/OrganizationListItemJAXBSchema.java @@ -1,7 +1,7 @@ package org.collectionspace.services; public interface OrganizationListItemJAXBSchema { - final static String SHORT_NAME = "shortName"; + final static String DISPLAY_NAME = "displayName"; final static String REF_NAME = "refName"; final static String CSID = "csid"; final static String URI = "url"; diff --git a/services/organization/jaxb/src/main/resources/organization_common.xsd b/services/organization/jaxb/src/main/resources/organization_common.xsd index 9a3232672..b12ba3622 100644 --- a/services/organization/jaxb/src/main/resources/organization_common.xsd +++ b/services/organization/jaxb/src/main/resources/organization_common.xsd @@ -21,14 +21,15 @@ + - - - - - - + + + + + + @@ -41,7 +42,7 @@ - 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));