From: Patrick Schmitz Date: Tue, 5 Jan 2010 23:11:09 +0000 (+0000) Subject: CSPACE-149. Revised schema for organization to match the spec. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=c959de2c40fa01cce8ca6f8ff936ca5ec3669457;p=tmp%2Fjakarta-migration.git CSPACE-149. Revised schema for organization to match the spec. --- 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 a15057748..5e4bacb44 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,8 +24,14 @@ - + + + + + + + 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 8241900d2..830a642c1 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 @@ -148,8 +148,9 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { String identifier = createIdentifier(); String refName = createRefName(identifier); MultipartOutput multipart = createOrganizationInstance(vcsid, - identifier, refName, "Longer Name for "+identifier, - "This is a fake organization that was created by a test method."); + identifier, refName, "Longer Name for "+identifier, + null, "joe@org.org", "1910", null, "Anytown, USA", "testing", + "This is a fake organization that was created by a test method." ); ClientResponse res = client.createItem(vcsid, multipart); int statusCode = res.getStatus(); @@ -611,7 +612,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { Assert.assertNotNull(organization); // Update the contents of this resource. - organization.setDisplayName("updated-" + organization.getDisplayName()); + organization.setShortName("updated-" + organization.getShortName()); if(logger.isDebugEnabled()){ logger.debug("to be updated Organization"); logger.debug(objectAsXmlString(organization, @@ -641,8 +642,8 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { Assert.assertNotNull(updatedOrganization); // Verify that the updated resource received the correct data. - Assert.assertEquals(updatedOrganization.getDisplayName(), - organization.getDisplayName(), + Assert.assertEquals(updatedOrganization.getShortName(), + organization.getShortName(), "Data in updated Organization did not match submitted data."); } @@ -784,7 +785,7 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { // The only relevant ID may be the one used in update(), below. MultipartOutput multipart = createOrganizationInstance( knownResourceId, NON_EXISTENT_ID, createRefName(NON_EXISTENT_ID), - null, null); + null, null, null, null, null, null, null, null); ClientResponse res = client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart); int statusCode = res.getStatus(); @@ -1038,13 +1039,28 @@ public class OrgAuthorityServiceTest extends AbstractServiceTest { } private MultipartOutput createOrganizationInstance(String inAuthority, - String displayName, String refName, String longName, String description) { + String shortName, String refName, String longName, + String nameAdditions, String contactName, + String foundingDate, String dissolutionDate, String foundingPlace, + String function, String description ) { OrganizationsCommon organization = new OrganizationsCommon(); - organization.setDisplayName(displayName); + organization.setShortName(shortName); if(refName!=null) organization.setRefName(refName); if(longName!=null) organization.setLongName(longName); + if(nameAdditions!=null) + organization.setNameAdditions(nameAdditions); + if(contactName!=null) + organization.setContactName(contactName); + if(foundingDate!=null) + organization.setFoundingDate(foundingDate); + if(dissolutionDate!=null) + organization.setDissolutionDate(dissolutionDate); + if(foundingPlace!=null) + organization.setFoundingPlace(foundingPlace); + if(function!=null) + organization.setFunction(function); if(description!=null) organization.setDescription(description); MultipartOutput multipart = new MultipartOutput(); 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 c4d124c6d..e6b1832d4 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 @@ -104,7 +104,8 @@ public class OrgAuthorityBaseImport { if(logger.isDebugEnabled()){ logger.debug("Import: Create Item: \""+itemName+"\" in orgAuthorityulary: \"" + orgAuthorityName +"\""); } - MultipartOutput multipart = createOrganizationInstance(itemName, refName); + MultipartOutput multipart = createOrganizationInstance(itemName, refName, + null, null, null, null, null, null, null, null, null ); ClientResponse res = client.createItem(vcsid, multipart); int statusCode = res.getStatus(); @@ -144,13 +145,34 @@ public class OrgAuthorityBaseImport { return multipart; } - private MultipartOutput createOrganizationInstance( - String displayName, String refName) { - OrganizationsCommon organization = new OrganizationsCommon(); - organization.setDisplayName(displayName); - organization.setRefName(refName); + private MultipartOutput createOrganizationInstance(String inAuthority, + String shortName, String refName, String longName, + String nameAdditions, String contactName, + String foundingDate, String dissolutionDate, String foundingPlace, + String function, String description ) { + OrganizationsCommon organization = new OrganizationsCommon(); + organization.setShortName(shortName); + if(refName!=null) + organization.setRefName(refName); + if(longName!=null) + organization.setLongName(longName); + if(nameAdditions!=null) + organization.setNameAdditions(nameAdditions); + if(contactName!=null) + organization.setContactName(contactName); + if(foundingDate!=null) + organization.setFoundingDate(foundingDate); + if(dissolutionDate!=null) + organization.setDissolutionDate(dissolutionDate); + if(foundingPlace!=null) + organization.setFoundingPlace(foundingPlace); + if(function!=null) + organization.setFunction(function); + if(description!=null) + organization.setDescription(description); MultipartOutput multipart = new MultipartOutput(); - OutputPart commonPart = multipart.addPart(organization, MediaType.APPLICATION_XML_TYPE); + OutputPart commonPart = multipart.addPart(organization, + MediaType.APPLICATION_XML_TYPE); commonPart.getHeaders().add("label", client.getItemCommonPartName()); if(logger.isDebugEnabled()){ diff --git a/services/organization/jaxb/src/main/resources/organization_common.xsd b/services/organization/jaxb/src/main/resources/organization_common.xsd index 3104fbd37..23ef6fe98 100644 --- a/services/organization/jaxb/src/main/resources/organization_common.xsd +++ b/services/organization/jaxb/src/main/resources/organization_common.xsd @@ -18,10 +18,16 @@ - - + + + + + + + + diff --git a/services/organization/sample/sample/src/main/java/org/collectionspace/services/organization/client/sample/Sample.java b/services/organization/sample/sample/src/main/java/org/collectionspace/services/organization/client/sample/Sample.java index cc9d7bb24..736f7637d 100644 --- a/services/organization/sample/sample/src/main/java/org/collectionspace/services/organization/client/sample/Sample.java +++ b/services/organization/sample/sample/src/main/java/org/collectionspace/services/organization/client/sample/Sample.java @@ -316,7 +316,7 @@ public class Sample { private MultipartOutput createOrganizationInstance( String displayName, String refName) { OrganizationsCommon organization = new OrganizationsCommon(); - organization.setDisplayName(displayName); + organization.setShortName(displayName); organization.setRefName(refName); MultipartOutput multipart = new MultipartOutput(); OutputPart commonPart = multipart.addPart(organization, MediaType.APPLICATION_XML_TYPE);