2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright © 2009 Regents of the University of California
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
15 * https://source.collectionspace.org/collection-space/LICENSE.txt
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
23 package org.collectionspace.services.client.test;
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.List;
30 import javax.ws.rs.core.MediaType;
31 import javax.ws.rs.core.Response;
33 import org.collectionspace.services.OrganizationJAXBSchema;
34 import org.collectionspace.services.PersonJAXBSchema;
35 import org.collectionspace.services.client.CollectionObjectClient;
36 import org.collectionspace.services.client.CollectionSpaceClient;
37 import org.collectionspace.services.client.OrgAuthorityClient;
38 import org.collectionspace.services.client.OrgAuthorityClientUtils;
39 import org.collectionspace.services.client.PersonAuthorityClient;
40 import org.collectionspace.services.client.PersonAuthorityClientUtils;
41 import org.collectionspace.services.common.authorityref.AuthorityRefList;
42 import org.collectionspace.services.collectionobject.AssocEventOrganizationList;
43 import org.collectionspace.services.collectionobject.AssocEventPersonList;
44 import org.collectionspace.services.collectionobject.AssocOrganizationList;
45 import org.collectionspace.services.collectionobject.AssocPersonList;
46 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
47 import org.collectionspace.services.collectionobject.ContentOrganizationList;
48 import org.collectionspace.services.collectionobject.ContentPersonList;
49 import org.collectionspace.services.collectionobject.FieldCollectionSourceList;
50 import org.collectionspace.services.collectionobject.FieldCollectorList;
51 import org.collectionspace.services.collectionobject.OwnerList;
52 import org.collectionspace.services.jaxb.AbstractCommonList;
54 import org.jboss.resteasy.client.ClientResponse;
56 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
57 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
58 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
59 import org.testng.Assert;
60 import org.testng.annotations.AfterClass;
61 import org.testng.annotations.Test;
63 import org.slf4j.Logger;
64 import org.slf4j.LoggerFactory;
67 * CollectionObjectAuthRefsTest, carries out tests against a
68 * deployed and running CollectionObject Service.
70 * $LastChangedRevision: 1327 $
71 * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
73 public class CollectionObjectAuthRefsTest extends BaseServiceTest {
76 private final String CLASS_NAME = CollectionObjectAuthRefsTest.class.getName();
77 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
79 // Instance variables specific to this test.
80 /** The service path component. */
81 final String SERVICE_PATH_COMPONENT = "collectionobjects";
83 /** The person authority name. */
84 final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
86 /** The organization authority name. */
87 final String ORG_AUTHORITY_NAME = "TestOrgAuth";
89 /** The known resource id. */
90 private String knownResourceId = null;
92 /** The collection object ids created. */
93 private List<String> collectionObjectIdsCreated = new ArrayList<String>();
95 /** The person ids created. */
96 private List<String> personIdsCreated = new ArrayList<String>();
98 /** The person authority csid and refName. */
99 private String personAuthCSID = null;
100 private String personAuthRefName = null;
102 /** The organization ids created. */
103 private List<String> orgIdsCreated = new ArrayList<String>();
105 /** The org authority csid and refName. */
106 private String orgAuthCSID = null;
107 private String orgAuthRefName = null;
109 private String contentOrganizationRefName = null;
110 private String contentPersonRefName = null;
111 private String contentInscriberRefName = null;
112 private String descriptionInscriberRefName = null;
113 private String objectProductionPersonRefName = null;
114 private String objectProductionOrganizationRefName = null;
115 private String assocEventOrganizationRefName = null;
116 private String assocEventPersonRefName = null;
117 private String assocOrganizationRefName = null;
118 private String assocPersonRefName = null;
119 private String ownerRefName = null;
120 private String fieldCollectionSourceRefName = null;
121 private String fieldCollectorRefName = null;
123 /** The number of authority references expected. */
124 private final int NUM_AUTH_REFS_EXPECTED = 13;
127 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
130 protected CollectionSpaceClient getClientInstance() {
131 throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
135 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
138 protected AbstractCommonList getAbstractCommonList(
139 ClientResponse<AbstractCommonList> response) {
140 throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
143 // ---------------------------------------------------------------
144 // CRUD tests : CREATE tests
145 // ---------------------------------------------------------------
148 * Creates the with auth refs.
150 * @param testName the test name
151 * @throws Exception the exception
153 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
154 public void createWithAuthRefs(String testName) throws Exception {
156 if (logger.isDebugEnabled()) {
157 logger.debug(testBanner(testName, CLASS_NAME));
159 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
161 // Create all the person refs and entities
164 // Create all the organization refs and entities
165 createOrganizationRefs();
167 // Create an object record payload, containing
168 // authority reference values in a number of its fields
169 String identifier = createIdentifier();
170 MultipartOutput multipart =
171 createCollectionObjectInstance(
173 "ObjNum" + "-" + identifier,
174 contentOrganizationRefName,
175 contentPersonRefName,
176 contentInscriberRefName,
177 descriptionInscriberRefName,
178 objectProductionPersonRefName,
179 objectProductionOrganizationRefName,
180 assocEventOrganizationRefName,
181 assocEventPersonRefName,
182 assocOrganizationRefName,
185 fieldCollectionSourceRefName,
186 fieldCollectorRefName
189 // Submit the request to the service and store the response.
190 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
191 ClientResponse<Response> res = collectionObjectClient.create(multipart);
193 int statusCode = res.getStatus();
195 // Check the status code of the response: does it match
196 // the expected response(s)?
199 // Does it fall within the set of valid status codes?
200 // Does it exactly match the expected status code?
201 if(logger.isDebugEnabled()){
202 logger.debug(testName + ": status = " + statusCode);
204 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
205 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
206 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
208 // Store the ID returned from the first resource created
209 // for additional tests below.
210 if (knownResourceId == null){
211 knownResourceId = extractId(res);
212 if (logger.isDebugEnabled()) {
213 logger.debug(testName + ": knownResourceId=" + knownResourceId);
217 // Store the IDs from every resource created by tests,
218 // so they can be deleted after tests have been run.
219 collectionObjectIdsCreated.add(extractId(res));
223 * Creates a Person Authority.
225 * @param displayName the display name of the authority
226 * @param shortIdentifier the short identifier for the authority
228 private void createPersonAuthority(String displayName, String shortIdentifier) {
229 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
230 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
231 MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
232 displayName, shortIdentifier, personAuthClient.getCommonPartName());
233 ClientResponse<Response> res = personAuthClient.create(multipart);
234 int statusCode = res.getStatus();
236 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
237 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
238 Assert.assertEquals(statusCode, STATUS_CREATED);
239 personAuthCSID = extractId(res);
240 personAuthRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
244 * Creates a person item.
246 * @param firstName the person's first name
247 * @param surName the person's surname
248 * @param shortIdentifier the short identifier for the item
249 * @return the CSID of the newly-created person record
251 protected String createPerson(String firstName, String surName, String shortIdentifier ) {
252 Map<String, String> personInfo = new HashMap<String,String>();
253 personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
254 personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
255 personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
256 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
257 MultipartOutput multipart =
258 PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
259 personAuthRefName, personInfo, personAuthClient.getItemCommonPartName());
260 ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
261 int statusCode = res.getStatus();
263 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
264 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
265 Assert.assertEquals(statusCode, STATUS_CREATED);
266 return extractId(res);
270 * Creates multiple Person items within a Person Authority,
271 * and stores the refNames referring to each.
273 protected void createPersonRefs(){
275 createPersonAuthority(PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME);
279 csid = createPerson("Connie", "ContactPerson", "connieContactPerson");
280 contentPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
281 personIdsCreated.add(csid);
283 csid = createPerson("Ingrid", "ContentInscriber", "ingridContentInscriber");
284 contentInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
285 personIdsCreated.add(csid);
287 csid = createPerson("Pacifico", "ProductionPerson", "pacificoProductionPerson");
288 objectProductionPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
289 personIdsCreated.add(csid);
291 csid = createPerson("Dessie", "DescriptionInscriber", "dessieDescriptionInscriber");
292 descriptionInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
293 personIdsCreated.add(csid);
295 csid = createPerson("Asok", "AssociatedEventPerson", "asokAssociatedEventPerson");
296 assocEventPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
297 personIdsCreated.add(csid);
299 csid = createPerson("Andrew", "AssociatedPerson", "andrewAssociatedPerson");
300 assocPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
301 personIdsCreated.add(csid);
303 csid = createPerson("Owen", "Owner", "owenOwner");
304 ownerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
305 personIdsCreated.add(csid);
307 csid = createPerson("Sally", "Field-CollectionSource", "sallyFieldCollectionSource");
308 fieldCollectionSourceRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
309 personIdsCreated.add(csid);
311 csid = createPerson("Fred", "Lector", "fredLector");
312 fieldCollectorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
313 personIdsCreated.add(csid);
317 * Creates an organization authority.
319 * @param displayName the display name of the authority
320 * @param shortIdentifier the short identifier for the authority
322 private void createOrgAuthority(String displayName, String shortIdentifier) {
323 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
324 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
325 MultipartOutput multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
326 displayName, shortIdentifier, orgAuthClient.getCommonPartName());
327 ClientResponse<Response> res = orgAuthClient.create(multipart);
328 int statusCode = res.getStatus();
330 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
331 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
332 Assert.assertEquals(statusCode, STATUS_CREATED);
333 orgAuthCSID = extractId(res);
334 orgAuthRefName = OrgAuthorityClientUtils.getAuthorityRefName(orgAuthCSID, null);
338 * Creates an organization item.
340 * @param shortName the organization's short name
341 * @param foundingPlace the organization's founding place
342 * @param shortIdentifier the short identifier for the item
343 * @return the CSID of the newly-created organization record
345 protected String createOrganization(String shortName, String foundingPlace, String shortIdentifier ) {
346 Map<String, String> orgInfo = new HashMap<String,String>();
347 orgInfo.put(OrganizationJAXBSchema.SHORT_NAME, shortName);
348 orgInfo.put(OrganizationJAXBSchema.FOUNDING_PLACE, foundingPlace);
349 orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
350 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
351 MultipartOutput multipart =
352 OrgAuthorityClientUtils.createOrganizationInstance(
353 orgAuthRefName, orgInfo, orgAuthClient.getItemCommonPartName());
354 ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);
355 int statusCode = res.getStatus();
357 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
358 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
359 Assert.assertEquals(statusCode, STATUS_CREATED);
360 return extractId(res);
364 * Creates multiple Organization items within an Organization Authority,
365 * and stores the refNames referring to each.
367 private void createOrganizationRefs() {
369 createOrgAuthority(ORG_AUTHORITY_NAME, ORG_AUTHORITY_NAME);
373 csid = createOrganization("Content Org", "Content Org Town", "contentOrg");
374 contentOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
375 orgIdsCreated.add(csid);
377 csid = createOrganization("Production Org", "Production Org Town", "productionOrg");
378 objectProductionOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
379 orgIdsCreated.add(csid);
381 csid = createOrganization("Associated Event Org", "Associated Event Org City", "associatedEventOrg");
382 assocEventOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
383 orgIdsCreated.add(csid);
385 csid = createOrganization("Associated Org", "Associated Org City", "associatedOrg");
386 assocOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
387 orgIdsCreated.add(csid);
393 * Read and check auth refs.
395 * @param testName the test name
396 * @throws Exception the exception
398 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
399 dependsOnMethods = {"createWithAuthRefs"})
400 public void readAndCheckAuthRefs(String testName) throws Exception {
402 if (logger.isDebugEnabled()) {
403 logger.debug(testBanner(testName, CLASS_NAME));
406 testSetup(STATUS_OK, ServiceRequestType.READ);
408 // Submit the request to the service and store the response.
409 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
410 ClientResponse<MultipartInput> res = collectionObjectClient.read(knownResourceId);
411 int statusCode = res.getStatus();
413 // Check the status code of the response: does it match
414 // the expected response(s)?
415 if(logger.isDebugEnabled()){
416 logger.debug(testName + ".read: status = " + statusCode);
418 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
419 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
420 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
422 MultipartInput input = (MultipartInput) res.getEntity();
423 CollectionobjectsCommon collectionObject = (CollectionobjectsCommon) extractPart(input,
424 collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class);
425 Assert.assertNotNull(collectionObject);
427 // Get all of the auth refs and check that the expected number is returned
428 ClientResponse<AuthorityRefList> res2 = collectionObjectClient.getAuthorityRefs(knownResourceId);
429 statusCode = res2.getStatus();
431 if(logger.isDebugEnabled()){
432 logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
434 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
435 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
436 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
437 AuthorityRefList list = res2.getEntity();
439 List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
440 int numAuthRefsFound = items.size();
441 if(logger.isDebugEnabled()){
442 logger.debug("Expected " + NUM_AUTH_REFS_EXPECTED +
443 " authority references, found " + numAuthRefsFound);
445 Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
446 "Did not find all expected authority references! " +
447 "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
449 // Check a sample of one or more person authority ref fields
450 Assert.assertEquals(collectionObject.getInscriptionContentInscriber(), contentInscriberRefName);
451 Assert.assertEquals(collectionObject.getAssocPersons().getAssocPerson().get(0), assocPersonRefName);
452 Assert.assertEquals(collectionObject.getOwners().getOwner().get(0), ownerRefName);
453 Assert.assertEquals(collectionObject.getFieldCollectionSources().getFieldCollectionSource().get(0), fieldCollectionSourceRefName);
455 // Check a sample of one or more organization authority ref fields
456 Assert.assertEquals(collectionObject.getContentOrganizations().getContentOrganization().get(0), contentOrganizationRefName);
457 Assert.assertEquals(collectionObject.getAssocEventOrganizations().getAssocEventOrganization().get(0), assocEventOrganizationRefName);
459 // Optionally output additional data about list members for debugging.
460 boolean iterateThroughList = true;
461 if(iterateThroughList && logger.isDebugEnabled()){;
463 for(AuthorityRefList.AuthorityRefItem item : items){
464 logger.debug(testName + ": list-item[" + i + "] Field:" +
465 item.getSourceField() + " =" +
466 " item display name = " + item.getAuthDisplayName() +
467 " auth display name = " + item.getItemDisplayName());
468 logger.debug(testName + ": list-item[" + i + "] refName=" +
470 logger.debug(testName + ": list-item[" + i + "] URI=" +
478 // ---------------------------------------------------------------
479 // Cleanup of resources created during testing
480 // ---------------------------------------------------------------
483 * Deletes all resources created by tests, after all tests have been run.
485 * This cleanup method will always be run, even if one or more tests fail.
486 * For this reason, it attempts to remove all resources created
487 * at any point during testing, even if some of those resources
488 * may be expected to be deleted by certain tests.
490 @AfterClass(alwaysRun=true)
491 public void cleanUp() {
492 String noTest = System.getProperty("noTestCleanup");
493 if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
494 if (logger.isDebugEnabled()) {
495 logger.debug("Skipping Cleanup phase ...");
499 if (logger.isDebugEnabled()) {
500 logger.debug("Cleaning up temporary resources created for testing ...");
502 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
503 for (String resourceId : collectionObjectIdsCreated) {
504 // Note: Any non-success responses are ignored and not reported.
505 collectionObjectClient.delete(resourceId).releaseConnection();
507 // Note: Any non-success response is ignored and not reported.
508 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
509 // Delete persons before PersonAuth
510 for (String resourceId : personIdsCreated) {
511 // Note: Any non-success responses are ignored and not reported.
512 personAuthClient.deleteItem(personAuthCSID, resourceId).releaseConnection();
514 personAuthClient.delete(personAuthCSID).releaseConnection();
515 // Note: Any non-success response is ignored and not reported.
516 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
517 // Delete organizations before OrgAuth
518 for (String resourceId : orgIdsCreated) {
519 // Note: Any non-success responses are ignored and not reported.
520 orgAuthClient.deleteItem(orgAuthCSID, resourceId).releaseConnection();
522 orgAuthClient.delete(orgAuthCSID).releaseConnection();
525 // ---------------------------------------------------------------
526 // Utility methods used by tests above
527 // ---------------------------------------------------------------
529 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
532 public String getServicePathComponent() {
533 return SERVICE_PATH_COMPONENT;
537 * Creates the collection object instance.
539 * @param title the title
540 * @param objNum the obj num
541 * @param contentOrganization the content organization
542 * @param contentPeople the content people
543 * @param contentPerson the content person
544 * @param inscriber the inscriber
545 * @return the multipart output
547 private MultipartOutput createCollectionObjectInstance(
550 String contentOrganization,
551 String contentPerson,
552 String contentInscriber,
553 String descriptionInscriber,
554 String objectProductionPerson,
555 String objectProductionOrganization,
556 String assocEventOrganization,
557 String assocEventPerson,
558 String assocOrganization,
561 String fieldCollectionSource,
562 String fieldCollector ) {
563 CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
564 collectionObject.setTitle(title);
565 collectionObject.setObjectNumber(objNum);
566 collectionObject.setInscriptionContentInscriber(contentInscriber);
567 collectionObject.setInscriptionDescriptionInscriber(descriptionInscriber);
568 collectionObject.setObjectProductionPerson(objectProductionPerson);
569 collectionObject.setObjectProductionOrganization(objectProductionOrganization);
571 ContentOrganizationList contentOrganizationList = new ContentOrganizationList();
572 List<String> contentOrganizations = contentOrganizationList.getContentOrganization();
573 contentOrganizations.add(contentOrganization);
574 collectionObject.setContentOrganizations(contentOrganizationList);
576 ContentPersonList contentPersonList = new ContentPersonList();
577 List<String> contentPersons = contentPersonList.getContentPerson();
578 contentPersons.add(contentPerson);
579 collectionObject.setContentPersons(contentPersonList);
581 AssocEventOrganizationList assocEventOrganizationList = new AssocEventOrganizationList();
582 List<String> assocEventOrganizations = assocEventOrganizationList.getAssocEventOrganization();
583 assocEventOrganizations.add(assocEventOrganization);
584 collectionObject.setAssocEventOrganizations(assocEventOrganizationList);
586 AssocEventPersonList assocEventPersonList = new AssocEventPersonList();
587 List<String> assocEventPersons = assocEventPersonList.getAssocEventPerson();
588 assocEventPersons.add(assocEventPerson);
589 collectionObject.setAssocEventPersons(assocEventPersonList);
591 AssocOrganizationList assocOrganizationList = new AssocOrganizationList();
592 List<String> assocOrganizations = assocOrganizationList.getAssocOrganization();
593 assocOrganizations.add(assocOrganization);
594 collectionObject.setAssocOrganizations(assocOrganizationList);
596 AssocPersonList assocPersonList = new AssocPersonList();
597 List<String> assocPersons = assocPersonList.getAssocPerson();
598 assocPersons.add(assocPerson);
599 collectionObject.setAssocPersons(assocPersonList);
601 OwnerList ownerList = new OwnerList();
602 List<String> owners = ownerList.getOwner();
604 collectionObject.setOwners(ownerList);
606 FieldCollectionSourceList fieldCollectionSourceList = new FieldCollectionSourceList();
607 List<String> fieldCollectionSources = fieldCollectionSourceList.getFieldCollectionSource();
608 fieldCollectionSources.add(fieldCollectionSource);
609 collectionObject.setFieldCollectionSources(fieldCollectionSourceList);
611 FieldCollectorList FieldCollectorList = new FieldCollectorList();
612 List<String> fieldCollectors = FieldCollectorList.getFieldCollector();
613 fieldCollectors.add(fieldCollector);
614 collectionObject.setFieldCollectors(FieldCollectorList);
616 MultipartOutput multipart = new MultipartOutput();
617 OutputPart commonPart =
618 multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
619 commonPart.getHeaders().add("label", new CollectionObjectClient().getCommonPartName());
621 if(logger.isDebugEnabled()){
622 logger.debug("to be created, collectionObject common");
623 logger.debug(objectAsXmlString(collectionObject, CollectionobjectsCommon.class));