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<String> depts = deptList.getResponsibleDepartment();
// @TODO Use properly formatted refNames for representative departments
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);
logger.debug("Import: Created orgAuthorityulary: \"" + orgAuthorityShortId +"\" ID:"
+newOrgAuthorityId );
}
- for(Map<String,String> 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<String,String> orgInfo : orgInfos){
+ * OrgAuthorityClientUtils.createItemInAuthority(newOrgAuthorityId, baseOrgAuthRefName, orgInfo, orgRepeatablesInfo, client);
+ *}
+ */
+ logger.error("MethodcreateOrgAuthority(String orgAuthorityDisplayName, String orgAuthorityShortId,List<Map<String,String>> orgInfos ) not implemented properly.");
}
// ---------------------------------------------------------------
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<String, String> pahmaOrgMap = new HashMap<String,String>();
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<String, String> savoyOrgMap = new HashMap<String,String>();
ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ;\r
\r
// Submit the request to the service and store the response.\r
- ClientResponse<OrganizationsCommonList> res =\r
- client.readItemList(orgAuthId);\r
+\r
+ //was: ClientResponse<OrganizationsCommonList> res = client.readItemList(orgAuthId);\r
+ //new API: readItemList(String inAuthority, String partialTerm, String keywords)\r
+ ClientResponse<OrganizationsCommonList> res = client.readItemList(orgAuthId, "", "");//TODO: .New call, most certainly wrong. Just trying to get this to compile. Laramie20100728\r
+\r
OrganizationsCommonList list = res.getEntity();\r
\r
int statusCode = res.getStatus();\r
Map<String, String> mmiOrgMap = new HashMap<String,String>();\r
mmiOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "MMI");\r
mmiOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Museum of the Moving Image");\r
- mmiOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Megan Forbes");\r
+ //mmiOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Megan Forbes");\r
mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1984");\r
mmiOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Astoria, NY");\r
Map<String, String> pahmaOrgMap = new HashMap<String,String>();\r
pahmaOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, "PAHMA");\r
pahmaOrgMap.put(OrganizationJAXBSchema.LONG_NAME, "Phoebe A. Hearst Museum of Anthropology");\r
pahmaOrgMap.put(OrganizationJAXBSchema.NAME_ADDITIONS, "University of California, Berkeley");\r
- pahmaOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Michael Black");\r
+ //pahmaOrgMap.put(OrganizationJAXBSchema.CONTACT_NAME, "Michael Black");\r
pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_DATE, "1901");\r
pahmaOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, "Berkeley, CA");\r
Map<String, String> savoyOrgMap = new HashMap<String,String>();\r
logger.debug("Import: Created personAuthorityulary: \"" + displayName +"\" ID:"
+newPersonAuthorityId );
}
- for(Map<String,String> 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<String,String> personMap : personMaps){
+ * PersonAuthorityClientUtils.createItemInAuthority(
+ * newPersonAuthorityId, basePersonRefName, personMap, client);
+ *}
+ */
+ logger.error("Method PersonAuthorityBaseImport.createPersonAuthority not implemented properly.");
+
}
public static void main(String[] args) {
ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;\r
\r
logger.info("Import: Create personAuthority: \"" + personAuthorityName +"\"");\r
- String basePersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, false);\r
- String fullPersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, true);\r
+\r
+\r
+ String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix.\r
+ String basePersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, displaySuffix);//TODO: Laramie20100728 temp fix was personAuthorityName, false\r
+ String fullPersonRefName = PersonAuthorityClientUtils.createPersonAuthRefName(personAuthorityName, displaySuffix); //TODO: Laramie20100728 temp fix was personAuthorityName, true\r
MultipartOutput multipart = \r
PersonAuthorityClientUtils.createPersonAuthorityInstance(\r
personAuthorityName, fullPersonRefName, client.getCommonPartName() );\r
builtName.append("-");\r
if(deathDate!=null)\r
builtName.append(deathDate);\r
- String refName = PersonAuthorityClientUtils.createPersonRefName(personAuthorityRefName, builtName.toString(), true);\r
+\r
+ String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix.\r
+\r
+ String refName = PersonAuthorityClientUtils.createPersonRefName(personAuthorityRefName, builtName.toString(), displaySuffix); //TODO was ...,true);\r
logger.info("Import: Create Item: \""+refName+"\" in personAuthority: \"" + personAuthorityRefName +"\"");\r
\r
if(logger.isDebugEnabled()){\r
ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ;\r
\r
// Submit the request to the service and store the response.\r
- ClientResponse<PersonsCommonList> res =\r
- client.readItemList(personAuthId);\r
+ ClientResponse<PersonsCommonList> res = client.readItemList(personAuthId, "", ""); //TODO: Laramie201007289 added empty strings to satisfy api\r
PersonsCommonList list = res.getEntity();\r
\r
int statusCode = res.getStatus();\r
person.setBirthPlace(value);\r
if((value = (String)personInfo.get(PersonJAXBSchema.DEATH_PLACE))!=null)\r
person.setDeathPlace(value);\r
+\r
+ /* TODO: Laramie20100728 removed missing member calls\r
if((value = (String)personInfo.get(PersonJAXBSchema.GROUP))!=null)\r
person.setGroup(value);\r
if((value = (String)personInfo.get(PersonJAXBSchema.NATIONALITY))!=null)\r
person.setNationality(value);\r
- if((value = (String)personInfo.get(PersonJAXBSchema.GENDER))!=null)\r
- person.setGender(value);\r
if((value = (String)personInfo.get(PersonJAXBSchema.OCCUPATION))!=null)\r
person.setOccupation(value);\r
if((value = (String)personInfo.get(PersonJAXBSchema.SCHOOL_OR_STYLE))!=null)\r
person.setSchoolOrStyle(value);\r
+ */\r
+ \r
+ if((value = (String)personInfo.get(PersonJAXBSchema.GENDER))!=null)\r
+ person.setGender(value);\r
if((value = (String)personInfo.get(PersonJAXBSchema.BIO_NOTE))!=null)\r
person.setBioNote(value);\r
if((value = (String)personInfo.get(PersonJAXBSchema.NAME_NOTE))!=null)\r
\r
import org.collectionspace.services.common.query.QueryManager;\r
//import org.collectionspace.services.common.NuxeoClientType;\r
-import org.collectionspace.services.common.ServiceMain;\r
+/*import org.collectionspace.services.common.ServiceMain;\r
import org.collectionspace.services.common.document.DocumentNotFoundException;\r
import org.collectionspace.services.common.document.DocumentHandler;\r
import org.collectionspace.services.common.repository.RepositoryClient;\r
import org.collectionspace.services.common.repository.RepositoryClientFactory;\r
import org.jboss.resteasy.util.HttpResponseCodes;\r
+*/\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
import javax.ws.rs.core.MultivaluedMap;\r
import javax.ws.rs.core.Response;\r
\r
+import org.collectionspace.services.collectionobject.ObjectNameGroup;\r
+import org.collectionspace.services.collectionobject.ObjectNameList;\r
import org.testng.Assert;\r
\r
import org.jboss.resteasy.client.ClientResponse;\r
String result = null;\r
\r
CollectionobjectsCommon co = new CollectionobjectsCommon();\r
- co.setObjectName("Keiko CollectionobjectsCommon");\r
+ ObjectNameList onl = co.getObjectNameList();\r
+ ObjectNameGroup ong = new ObjectNameGroup();\r
+ ong.setObjectName("Keiko CollectionobjectsCommon");\r
+ onl.getObjectNameGroup().add(ong);\r
\r
MultipartOutput multipart = new MultipartOutput();\r
OutputPart commonPart = multipart.addPart(co,\r
// Update the content of this resource.\r
collectionObject.setObjectNumber("updated-"\r
+ collectionObject.getObjectNumber());\r
- collectionObject.setObjectName("updated-"\r
- + collectionObject.getObjectName());\r
+ String name = collectionObject.getObjectNameList().getObjectNameGroup().get(0).getObjectName();\r
+ collectionObject.getObjectNameList().getObjectNameGroup().get(0).setObjectName("updated-"+ name);\r
\r
// Submit the request to the service and store the response.\r
MultipartOutput output = new MultipartOutput();\r
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;
import javax.ws.rs.core.Response;\r
\r
import org.apache.log4j.BasicConfigurator;\r
-import org.collectionspace.services.VocabularyItemJAXBSchema;\r
+//import org.collectionspace.services.VocabularyItemJAXBSchema; \r
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;\r
+\r
import org.collectionspace.services.client.VocabularyClient;\r
import org.collectionspace.services.client.VocabularyClientUtils;\r
import org.collectionspace.services.client.test.ServiceRequestType;\r
if(logger.isDebugEnabled()){\r
logger.debug("Import: Create vocabulary: \"" + vocabName +"\"");\r
}\r
- String baseVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, false);\r
- String fullVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, true);\r
+\r
+ String displaySuffix = "displayName-" + System.currentTimeMillis(); //TODO: Laramie20100728 temp fix, made-up displaySuffix.\r
+ String baseVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, displaySuffix); //TODO: Laramie20100728 temp fix was vocabName, false\r
+ String fullVocabRefName = VocabularyClientUtils.createVocabularyRefName(vocabName, displaySuffix); //TODO: Laramie20100728 temp fix was vocabName, true\r
MultipartOutput multipart = VocabularyClientUtils.createEnumerationInstance(\r
vocabName, fullVocabRefName, client.getCommonPartName());\r
ClientResponse<Response> res = client.create(multipart);\r
}\r
for(String itemName : enumValues){\r
HashMap<String, String> itemInfo = new HashMap<String, String>();\r
- itemInfo.put(VocabularyItemJAXBSchema.DISPLAY_NAME, itemName);\r
+ itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, itemName);\r
VocabularyClientUtils.createItemInVocabulary(newVocabId, \r
baseVocabRefName, itemInfo, client);\r
}\r
ServiceRequestType REQUEST_TYPE = ServiceRequestType.READ;\r
\r
// Submit the request to the service and store the response.\r
- ClientResponse<VocabularyitemsCommonList> res =\r
- client.readItemList(vocabId);\r
+ // readItemList(String inAuthority, String partialTerm, String keywords)\r
+ ClientResponse<VocabularyitemsCommonList> res = client.readItemList(vocabId, "", ""); //TODO: figure out these params. I just put in empty string to make it recompile after refactoring. Laramie20100728\r
VocabularyitemsCommonList list = res.getEntity();\r
\r
int statusCode = res.getStatus();\r