From af957d5d6a40f7eb5f8d5ebe7f2e33c0920f66ff Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Mon, 9 Aug 2010 20:02:16 +0000 Subject: [PATCH] CSPACE-2601: Checking in Laramie's set of changes to ten files - nearly all in sdk, sample, and import modules, which are built under a separate Maven profile - to reflect changes to object records that made object name fields repeatable as a group. --- .../client/sample/Sample.java | 11 +++++---- .../importer/OrgAuthorityBaseImport.java | 19 ++++++++++----- .../organization/client/sample/Sample.java | 11 +++++---- .../importer/PersonAuthorityBaseImport.java | 15 ++++++++---- .../services/person/client/sample/Sample.java | 23 +++++++++++++------ .../services/query/QueryResource.java | 3 ++- .../services/sdk/sample/Sample.java | 11 ++++++--- .../importer/VocabularyBaseImport.java | 2 +- .../vocabulary/client/sample/Sample.java | 16 ++++++++----- 9 files changed, 74 insertions(+), 37 deletions(-) diff --git a/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java b/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java index 0eedbaa11..9611ee611 100644 --- a/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java +++ b/services/collectionobject/sample/sample/src/main/java/org/collectionspace/services/collectionobject/client/sample/Sample.java @@ -203,7 +203,9 @@ public class Sample { CollectionobjectsCommon collectionObject = new CollectionobjectsCommon(); collectionObject.setObjectNumber("some object number here"); - collectionObject.setObjectName("some object name here"); + collectionObject.getObjectNameList().getObjectNameGroup().get(0).setObjectName("some object name here"); + + ResponsibleDepartmentList deptList = new ResponsibleDepartmentList(); List depts = deptList.getResponsibleDepartment(); // @TODO Use properly formatted refNames for representative departments @@ -211,10 +213,9 @@ public class Sample { depts.add("urn:org.collectionspace.services.department:Registrar"); depts.add("urn:org.walkerart.department:Fine Art"); collectionObject.setAge(""); // Test using an empty String. -// collectionObject.setBriefDescription("Papier mache bird mask with horns, " + -// "painted red with black and yellow spots. " + -// "Puerto Rico. ca. 8" high, 6" wide, projects 10" (with horns)."); - + collectionObject.getBriefDescriptions().getBriefDescription().add("Papier mache bird mask with horns, " + + "painted red with black and yellow spots. " + + "Puerto Rico. ca. 8" high, 6" wide, projects 10" (with horns)."); MultipartOutput multipart = new MultipartOutput(); OutputPart commonPart = multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE); 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 75bd8ae11..eda8264dd 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 @@ -93,10 +93,17 @@ public class OrgAuthorityBaseImport { logger.debug("Import: Created orgAuthorityulary: \"" + orgAuthorityShortId +"\" ID:" +newOrgAuthorityId ); } - for(Map orgInfo : orgInfos){ - OrgAuthorityClientUtils.createItemInAuthority( - newOrgAuthorityId, baseOrgAuthRefName, orgInfo, client); - } + + + /* + *TODO: Laramie20100728 this code is out of date, and needs to use the new API. Commenting out for now. + * + *orgRepeatablesInfo is undefined; + *for(Map orgInfo : orgInfos){ + * OrgAuthorityClientUtils.createItemInAuthority(newOrgAuthorityId, baseOrgAuthRefName, orgInfo, orgRepeatablesInfo, client); + *} + */ + logger.error("MethodcreateOrgAuthority(String orgAuthorityDisplayName, String orgAuthorityShortId,List> orgInfos ) not implemented properly."); } // --------------------------------------------------------------- @@ -116,7 +123,7 @@ public class OrgAuthorityBaseImport { mmiOrgMap.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, "mmi"); mmiOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "MMI"); mmiOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Museum of the Moving Image"); - mmiOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Megan Forbes"); + //TODO: CONTACT_NAME is not in API any more. mmiOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Megan Forbes"); mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1984"); mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Astoria, NY"); Map pahmaOrgMap = new HashMap(); @@ -124,7 +131,7 @@ public class OrgAuthorityBaseImport { pahmaOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "PAHMA"); pahmaOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Phoebe A. Hearst Museum of Anthropology"); pahmaOrgMap.put(OrganizationJAXBSchema.NAME_ADDITIONS, "University of California, Berkeley"); - pahmaOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Michael Black"); + //TODO: CONTACT_NAME is not in API any more. pahmaOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Michael Black"); pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1901"); pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Berkeley, CA"); Map savoyOrgMap = new HashMap(); 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 91602d8c7..5331b522f 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 @@ -235,8 +235,11 @@ public class Sample { ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; // Submit the request to the service and store the response. - ClientResponse res = - client.readItemList(orgAuthId); + + //was: ClientResponse res = client.readItemList(orgAuthId); + //new API: readItemList(String inAuthority, String partialTerm, String keywords) + ClientResponse res = client.readItemList(orgAuthId, "", "");//TODO: .New call, most certainly wrong. Just trying to get this to compile. Laramie20100728 + OrganizationsCommonList list = res.getEntity(); int statusCode = res.getStatus(); @@ -442,14 +445,14 @@ public class Sample { Map mmiOrgMap = new HashMap(); mmiOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "MMI"); mmiOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Museum of the Moving Image"); - mmiOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Megan Forbes"); + //mmiOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Megan Forbes"); mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1984"); mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Astoria, NY"); Map pahmaOrgMap = new HashMap(); pahmaOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "PAHMA"); pahmaOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Phoebe A. Hearst Museum of Anthropology"); pahmaOrgMap.put(OrganizationJAXBSchema.NAME_ADDITIONS, "University of California, Berkeley"); - pahmaOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Michael Black"); + //pahmaOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Michael Black"); pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1901"); pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Berkeley, CA"); Map savoyOrgMap = new HashMap(); diff --git a/services/person/import/src/main/java/org/collectionspace/services/person/importer/PersonAuthorityBaseImport.java b/services/person/import/src/main/java/org/collectionspace/services/person/importer/PersonAuthorityBaseImport.java index f68810601..e7f628d3e 100644 --- a/services/person/import/src/main/java/org/collectionspace/services/person/importer/PersonAuthorityBaseImport.java +++ b/services/person/import/src/main/java/org/collectionspace/services/person/importer/PersonAuthorityBaseImport.java @@ -98,10 +98,17 @@ public class PersonAuthorityBaseImport { logger.debug("Import: Created personAuthorityulary: \"" + displayName +"\" ID:" +newPersonAuthorityId ); } - for(Map personMap : personMaps){ - PersonAuthorityClientUtils.createItemInAuthority( - newPersonAuthorityId, basePersonRefName, personMap, client); - } + + /* + *TODO: Laramie20100728 this code is out of date, and needs to use the new API. Commenting out for now. + * + *for(Map personMap : personMaps){ + * PersonAuthorityClientUtils.createItemInAuthority( + * newPersonAuthorityId, basePersonRefName, personMap, client); + *} + */ + logger.error("Method PersonAuthorityBaseImport.createPersonAuthority not implemented properly."); + } public static void main(String[] args) { diff --git a/services/person/sample/sample/src/main/java/org/collectionspace/services/person/client/sample/Sample.java b/services/person/sample/sample/src/main/java/org/collectionspace/services/person/client/sample/Sample.java index bd3be3c6a..b8a815368 100644 --- a/services/person/sample/sample/src/main/java/org/collectionspace/services/person/client/sample/Sample.java +++ b/services/person/sample/sample/src/main/java/org/collectionspace/services/person/client/sample/Sample.java @@ -80,8 +80,11 @@ public class Sample { ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE; logger.info("Import: Create personAuthority: \"" + personAuthorityName +"\""); - String basePersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, false); - String fullPersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, true); + + + String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix. + String basePersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, displaySuffix);//TODO: Laramie20100728 temp fix was personAuthorityName, false + String fullPersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, displaySuffix); //TODO: Laramie20100728 temp fix was personAuthorityName, true MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( personAuthorityName, fullPersonRefName, client.getCommonPartName() ); @@ -134,7 +137,10 @@ public class Sample { builtName.append("-"); if(deathDate!=null) builtName.append(deathDate); - String refName = PersonAuthorityClientUtils.createPersonRefName(personAuthorityRefName, builtName.toString(), true); + + String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix. + + String refName = PersonAuthorityClientUtils.createPersonRefName(personAuthorityRefName, builtName.toString(), displaySuffix); //TODO was ...,true); logger.info("Import: Create Item: \""+refName+"\" in personAuthority: \"" + personAuthorityRefName +"\""); if(logger.isDebugEnabled()){ @@ -238,8 +244,7 @@ public class Sample { ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; // Submit the request to the service and store the response. - ClientResponse res = - client.readItemList(personAuthId); + ClientResponse res = client.readItemList(personAuthId, "", ""); //TODO: Laramie201007289 added empty strings to satisfy api PersonsCommonList list = res.getEntity(); int statusCode = res.getStatus(); @@ -375,16 +380,20 @@ public class Sample { person.setBirthPlace(value); if((value = (String)personInfo.get(PersonJAXBSchema.DEATH_PLACE))!=null) person.setDeathPlace(value); + + /* TODO: Laramie20100728 removed missing member calls if((value = (String)personInfo.get(PersonJAXBSchema.GROUP))!=null) person.setGroup(value); if((value = (String)personInfo.get(PersonJAXBSchema.NATIONALITY))!=null) person.setNationality(value); - if((value = (String)personInfo.get(PersonJAXBSchema.GENDER))!=null) - person.setGender(value); if((value = (String)personInfo.get(PersonJAXBSchema.OCCUPATION))!=null) person.setOccupation(value); if((value = (String)personInfo.get(PersonJAXBSchema.SCHOOL_OR_STYLE))!=null) person.setSchoolOrStyle(value); + */ + + if((value = (String)personInfo.get(PersonJAXBSchema.GENDER))!=null) + person.setGender(value); if((value = (String)personInfo.get(PersonJAXBSchema.BIO_NOTE))!=null) person.setBioNote(value); if((value = (String)personInfo.get(PersonJAXBSchema.NAME_NOTE))!=null) diff --git a/services/query/service/src/main/java/org/collectionspace/services/query/QueryResource.java b/services/query/service/src/main/java/org/collectionspace/services/query/QueryResource.java index ad6b3d228..c6f6d6057 100644 --- a/services/query/service/src/main/java/org/collectionspace/services/query/QueryResource.java +++ b/services/query/service/src/main/java/org/collectionspace/services/query/QueryResource.java @@ -41,12 +41,13 @@ import javax.ws.rs.core.UriInfo; import org.collectionspace.services.common.query.QueryManager; //import org.collectionspace.services.common.NuxeoClientType; -import org.collectionspace.services.common.ServiceMain; +/*import org.collectionspace.services.common.ServiceMain; import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.document.DocumentHandler; import org.collectionspace.services.common.repository.RepositoryClient; import org.collectionspace.services.common.repository.RepositoryClientFactory; import org.jboss.resteasy.util.HttpResponseCodes; +*/ import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/services/sdk/sample/src/main/java/org/collectionspace/services/sdk/sample/Sample.java b/services/sdk/sample/src/main/java/org/collectionspace/services/sdk/sample/Sample.java index 414592d9c..7a29f137c 100644 --- a/services/sdk/sample/src/main/java/org/collectionspace/services/sdk/sample/Sample.java +++ b/services/sdk/sample/src/main/java/org/collectionspace/services/sdk/sample/Sample.java @@ -35,6 +35,8 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; +import org.collectionspace.services.collectionobject.ObjectNameGroup; +import org.collectionspace.services.collectionobject.ObjectNameList; import org.testng.Assert; import org.jboss.resteasy.client.ClientResponse; @@ -82,7 +84,10 @@ public class Sample { String result = null; CollectionobjectsCommon co = new CollectionobjectsCommon(); - co.setObjectName("Keiko CollectionobjectsCommon"); + ObjectNameList onl = co.getObjectNameList(); + ObjectNameGroup ong = new ObjectNameGroup(); + ong.setObjectName("Keiko CollectionobjectsCommon"); + onl.getObjectNameGroup().add(ong); MultipartOutput multipart = new MultipartOutput(); OutputPart commonPart = multipart.addPart(co, @@ -144,8 +149,8 @@ public class Sample { // Update the content of this resource. collectionObject.setObjectNumber("updated-" + collectionObject.getObjectNumber()); - collectionObject.setObjectName("updated-" - + collectionObject.getObjectName()); + String name = collectionObject.getObjectNameList().getObjectNameGroup().get(0).getObjectName(); + collectionObject.getObjectNameList().getObjectNameGroup().get(0).setObjectName("updated-"+ name); // Submit the request to the service and store the response. MultipartOutput output = new MultipartOutput(); diff --git a/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java b/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java index 3a41051d3..ec6089297 100644 --- a/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java +++ b/services/vocabulary/import/src/main/java/org/collectionspace/services/vocabulary/importer/VocabularyBaseImport.java @@ -28,7 +28,7 @@ import java.util.List; import javax.ws.rs.core.Response; -import org.collectionspace.services.VocabularyItemJAXBSchema; +import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; import org.collectionspace.services.client.VocabularyClient; import org.collectionspace.services.client.VocabularyClientUtils; import org.collectionspace.services.client.test.ServiceRequestType; diff --git a/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java b/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java index 9bfcad16a..f49bcf899 100644 --- a/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java +++ b/services/vocabulary/sample/sample/src/main/java/org/collectionspace/services/vocabulary/client/sample/Sample.java @@ -33,7 +33,9 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import org.apache.log4j.BasicConfigurator; -import org.collectionspace.services.VocabularyItemJAXBSchema; +//import org.collectionspace.services.VocabularyItemJAXBSchema; +import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema; + import org.collectionspace.services.client.VocabularyClient; import org.collectionspace.services.client.VocabularyClientUtils; import org.collectionspace.services.client.test.ServiceRequestType; @@ -80,8 +82,10 @@ public class Sample { if(logger.isDebugEnabled()){ logger.debug("Import: Create vocabulary: \"" + vocabName +"\""); } - String baseVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, false); - String fullVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, true); + + String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix. + String baseVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, displaySuffix); //TODO: Laramie20100728 temp fix was vocabName, false + String fullVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, displaySuffix); //TODO: Laramie20100728 temp fix was vocabName, true MultipartOutput multipart = VocabularyClientUtils.createEnumerationInstance( vocabName, fullVocabRefName, client.getCommonPartName()); ClientResponse res = client.create(multipart); @@ -106,7 +110,7 @@ public class Sample { } for(String itemName : enumValues){ HashMap itemInfo = new HashMap(); - itemInfo.put(VocabularyItemJAXBSchema.DISPLAY_NAME, itemName); + itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, itemName); VocabularyClientUtils.createItemInVocabulary(newVocabId, baseVocabRefName, itemInfo, client); } @@ -189,8 +193,8 @@ public class Sample { ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ; // Submit the request to the service and store the response. - ClientResponse res = - client.readItemList(vocabId); + // readItemList(String inAuthority, String partialTerm, String keywords) + ClientResponse res = client.readItemList(vocabId, "", ""); //TODO: figure out these params. I just put in empty string to make it recompile after refactoring. Laramie20100728 VocabularyitemsCommonList list = res.getEntity(); int statusCode = res.getStatus(); -- 2.47.3