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.PayloadOutputPart;
40 import org.collectionspace.services.client.PersonAuthorityClient;
41 import org.collectionspace.services.client.PersonAuthorityClientUtils;
42 import org.collectionspace.services.client.PoxPayloadIn;
43 import org.collectionspace.services.client.PoxPayloadOut;
44 import org.collectionspace.services.common.authorityref.AuthorityRefList;
45 import org.collectionspace.services.collectionobject.AssocEventOrganizationList;
46 import org.collectionspace.services.collectionobject.AssocEventPersonList;
47 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
48 import org.collectionspace.services.collectionobject.ContentOrganizationList;
49 import org.collectionspace.services.collectionobject.ContentPersonList;
50 import org.collectionspace.services.collectionobject.OwnerList;
51 import org.collectionspace.services.collectionobject.FieldCollectionSourceList;
52 import org.collectionspace.services.collectionobject.FieldCollectorList;
53 import org.collectionspace.services.collectionobject.TitleGroup;
54 import org.collectionspace.services.collectionobject.TitleGroupList;
55 import org.collectionspace.services.jaxb.AbstractCommonList;
57 import org.jboss.resteasy.client.ClientResponse;
59 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
60 import org.testng.Assert;
61 import org.testng.annotations.AfterClass;
62 import org.testng.annotations.Test;
64 import org.slf4j.Logger;
65 import org.slf4j.LoggerFactory;
68 * CollectionObjectAuthRefsTest, carries out tests against a
69 * deployed and running CollectionObject Service.
71 * $LastChangedRevision: 1327 $
72 * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
74 public class CollectionObjectAuthRefsTest extends BaseServiceTest {
77 protected CollectionSpaceClient getClientInstance() {
78 throw new UnsupportedOperationException(); //FIXME: REM - See http://issues.collectionspace.org/browse/CSPACE-3498
82 protected String getServiceName() {
83 throw new UnsupportedOperationException(); //FIXME: REM - See http://issues.collectionspace.org/browse/CSPACE-3498
87 private final String CLASS_NAME = CollectionObjectAuthRefsTest.class.getName();
88 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
90 // Instance variables specific to this test.
91 /** The service path component. */
92 final String SERVICE_PATH_COMPONENT = "collectionobjects";
94 /** The person authority name. */
95 final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
96 final String PERSON_AUTHORITY_NAME_DISPLAY = "TestPersonAuth_DisplayName";
98 /** The organization authority name. */
99 final String ORG_AUTHORITY_NAME = "TestOrgAuth";
101 /** The known resource id. */
102 private String knownResourceId = null;
104 /** The collection object ids created. */
105 private List<String> collectionObjectIdsCreated = new ArrayList<String>();
107 /** The person ids created. */
108 private List<String> personIdsCreated = new ArrayList<String>();
110 /** The person authority csid and refName. */
111 private String personAuthCSID = null;
112 private String personAuthRefName = null;
114 /** The organization ids created. */
115 private List<String> orgIdsCreated = new ArrayList<String>();
117 /** The org authority csid and refName. */
118 private String orgAuthCSID = null;
119 private String orgAuthRefName = null;
121 private String contentOrganizationRefName = null;
122 private String contentPersonRefName = null;
123 private String assocEventOrganizationRefName = null;
124 private String assocEventPersonRefName = null;
125 private String ownerRefName = null;
126 private String fieldCollectionSourceRefName = null;
127 private String fieldCollectorRefName = null;
129 public String toString(){
130 String result = "CollectionObjectauthRefsTest: "
131 + "\r\npersonAuthCSID: "+personAuthCSID
132 + "\r\npersonAuthRefName: "+personAuthRefName
133 + "\r\norgAuthCSID: "+orgAuthCSID
134 + "\r\norgAuthRefName: "+orgAuthRefName
136 + "\r\n contentOrganizationRefName: "+contentOrganizationRefName
137 + "\r\n contentPersonRefName: "+contentPersonRefName
138 + "\r\n assocEventOrganizationRefName: "+assocEventOrganizationRefName
139 + "\r\n assocEventPersonRefName: "+assocEventPersonRefName
140 + "\r\n ownerRefName: "+ownerRefName
141 + "\r\n fieldCollectionSourceRefName: "+fieldCollectionSourceRefName
142 + "\r\n fieldCollectorRefName: "+fieldCollectorRefName;
143 StringBuffer buff = new StringBuffer();
148 /** The number of authority references expected. */
149 private final int NUM_AUTH_REFS_EXPECTED = 7;
152 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
155 protected AbstractCommonList getAbstractCommonList(
156 ClientResponse<AbstractCommonList> response) {
157 throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
160 // ---------------------------------------------------------------
161 // CRUD tests : CREATE tests
162 // ---------------------------------------------------------------
165 * Creates the with auth refs.
167 * @param testName the test name
168 * @throws Exception the exception
170 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
171 public void createWithAuthRefs(String testName) throws Exception {
173 if (logger.isDebugEnabled()) {
174 logger.debug(testBanner(testName, CLASS_NAME));
176 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
178 // Create all the person refs and entities
181 // Create all the organization refs and entities
182 createOrganizationRefs();
184 // Create an object record payload, containing
185 // authority reference values in a number of its fields
186 String identifier = createIdentifier();
187 PoxPayloadOut multipart =
188 createCollectionObjectInstance(
190 "ObjNum" + "-" + identifier,
191 contentOrganizationRefName,
192 contentPersonRefName,
193 assocEventOrganizationRefName,
194 assocEventPersonRefName,
196 fieldCollectionSourceRefName,
197 fieldCollectorRefName
200 // Submit the request to the service and store the response.
201 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
202 ClientResponse<Response> res = collectionObjectClient.create(multipart);
204 int statusCode = res.getStatus();
206 // Check the status code of the response: does it match
207 // the expected response(s)?
210 // Does it fall within the set of valid status codes?
211 // Does it exactly match the expected status code?
212 if(logger.isDebugEnabled()){
213 logger.debug(testName + ": status = " + statusCode);
215 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
216 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
217 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
219 // Store the ID returned from the first resource created
220 // for additional tests below.
221 if (knownResourceId == null){
222 knownResourceId = extractId(res);
223 if (logger.isDebugEnabled()) {
224 logger.debug(testName + ": knownResourceId=" + knownResourceId);
228 // Store the IDs from every resource created by tests,
229 // so they can be deleted after tests have been run.
230 collectionObjectIdsCreated.add(extractId(res));
234 * Creates a Person Authority.
236 * @param displayName the display name of the authority
237 * @param shortIdentifier the short identifier for the authority
239 private void createPersonAuthority(String displayName, String shortIdentifier) {
240 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
241 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
242 PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
243 displayName, shortIdentifier, personAuthClient.getCommonPartName());
244 ClientResponse<Response> res = personAuthClient.create(multipart);
245 int statusCode = res.getStatus();
247 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
248 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
249 Assert.assertEquals(statusCode, STATUS_CREATED);
250 personAuthCSID = extractId(res);
251 personAuthRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
255 * Creates a person item.
257 * @param firstName the person's first name
258 * @param surName the person's surname
259 * @param shortIdentifier the short identifier for the item
260 * @return the CSID of the newly-created person record
262 protected String createPerson(String firstName, String surName, String shortIdentifier ) {
263 Map<String, String> personInfo = new HashMap<String,String>();
264 personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
265 personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
266 personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
267 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
268 PoxPayloadOut multipart =
269 PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
270 personAuthRefName, personInfo, personAuthClient.getItemCommonPartName());
271 ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
272 int statusCode = res.getStatus();
274 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
275 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
276 Assert.assertEquals(statusCode, STATUS_CREATED);
277 return extractId(res);
281 * Creates multiple Person items within a Person Authority,
282 * and stores the refNames referring to each.
284 protected void createPersonRefs(){
286 createPersonAuthority(PERSON_AUTHORITY_NAME_DISPLAY, PERSON_AUTHORITY_NAME);
290 csid = createPerson("Connie", "ContactPerson", "connieContactPerson");
291 contentPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
292 personIdsCreated.add(csid);
294 // csid = createPerson("Ingrid", "ContentInscriber", "ingridContentInscriber");
295 // contentInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
296 // personIdsCreated.add(csid);
298 // csid = createPerson("Pacifico", "ProductionPerson", "pacificoProductionPerson");
299 // objectProductionPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
300 // personIdsCreated.add(csid);
302 // csid = createPerson("Dessie", "DescriptionInscriber", "dessieDescriptionInscriber");
303 // descriptionInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
304 // personIdsCreated.add(csid);
306 csid = createPerson("Asok", "AssociatedEventPerson", "asokAssociatedEventPerson");
307 assocEventPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
308 personIdsCreated.add(csid);
310 // csid = createPerson("Andrew", "AssociatedPerson", "andrewAssociatedPerson");
311 // assocPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
312 // personIdsCreated.add(csid);
314 csid = createPerson("Owen", "Owner", "owenOwner");
315 ownerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
316 personIdsCreated.add(csid);
318 csid = createPerson("Sally", "Field-CollectionSource", "sallyFieldCollectionSource");
319 fieldCollectionSourceRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
320 personIdsCreated.add(csid);
322 csid = createPerson("Fred", "Lector", "fredLector");
323 fieldCollectorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
324 personIdsCreated.add(csid);
328 * Creates an organization authority.
330 * @param displayName the display name of the authority
331 * @param shortIdentifier the short identifier for the authority
333 private void createOrgAuthority(String displayName, String shortIdentifier) {
334 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
335 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
336 PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
337 displayName, shortIdentifier, orgAuthClient.getCommonPartName());
338 ClientResponse<Response> res = orgAuthClient.create(multipart);
339 int statusCode = res.getStatus();
341 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
342 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
343 Assert.assertEquals(statusCode, STATUS_CREATED);
344 orgAuthCSID = extractId(res);
345 orgAuthRefName = OrgAuthorityClientUtils.getAuthorityRefName(orgAuthCSID, null);
349 * Creates an organization item.
351 * @param shortName the organization's short name
352 * @param foundingPlace the organization's founding place
353 * @param shortIdentifier the short identifier for the item
354 * @return the CSID of the newly-created organization record
356 protected String createOrganization(String shortName, String foundingPlace, String shortIdentifier ) {
357 Map<String, String> orgInfo = new HashMap<String,String>();
358 orgInfo.put(OrganizationJAXBSchema.SHORT_NAME, shortName);
359 orgInfo.put(OrganizationJAXBSchema.FOUNDING_PLACE, foundingPlace);
360 orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
361 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
362 PoxPayloadOut multipart =
363 OrgAuthorityClientUtils.createOrganizationInstance(
364 orgAuthRefName, orgInfo, orgAuthClient.getItemCommonPartName());
365 ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);
366 int statusCode = res.getStatus();
368 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
369 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
370 Assert.assertEquals(statusCode, STATUS_CREATED);
371 return extractId(res);
375 * Creates multiple Organization items within an Organization Authority,
376 * and stores the refNames referring to each.
378 private void createOrganizationRefs() {
380 createOrgAuthority(ORG_AUTHORITY_NAME, ORG_AUTHORITY_NAME);
384 csid = createOrganization("Content Org", "Content Org Town", "contentOrg");
385 contentOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
386 orgIdsCreated.add(csid);
388 // csid = createOrganization("Production Org", "Production Org Town", "productionOrg");
389 // objectProductionOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
390 // orgIdsCreated.add(csid);
392 csid = createOrganization("Associated Event Org", "Associated Event Org City", "associatedEventOrg");
393 assocEventOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
394 orgIdsCreated.add(csid);
396 // csid = createOrganization("Associated Org", "Associated Org City", "associatedOrg");
397 // assocOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
398 // orgIdsCreated.add(csid);
404 * Read and check auth refs.
406 * @param testName the test name
407 * @throws Exception the exception
409 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
410 dependsOnMethods = {"createWithAuthRefs"})
411 public void readAndCheckAuthRefs(String testName) throws Exception {
413 if (logger.isDebugEnabled()) {
414 logger.debug(testBanner(testName, CLASS_NAME));
417 testSetup(STATUS_OK, ServiceRequestType.READ);
419 // Submit the request to the service and store the response.
420 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
421 ClientResponse<String> res = collectionObjectClient.read(knownResourceId);
422 assertStatusCode(res, testName);
424 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
425 CollectionobjectsCommon collectionObject = (CollectionobjectsCommon) extractPart(input,
426 collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class);
427 Assert.assertNotNull(collectionObject);
429 // Get all of the auth refs and check that the expected number is returned
430 ClientResponse<AuthorityRefList> res2 = collectionObjectClient.getAuthorityRefs(knownResourceId);
431 assertStatusCode(res2, testName);
433 AuthorityRefList list = res2.getEntity();
435 List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
436 int numAuthRefsFound = items.size();
437 if(logger.isDebugEnabled()){
438 logger.debug("Expected " + NUM_AUTH_REFS_EXPECTED +
439 " authority references, found " + numAuthRefsFound);
441 Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
442 "Did not find all expected authority references! " +
443 "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
445 // Check a sample of one or more person authority ref fields
446 // Assert.assertEquals(collectionObject.getAssocPersons().getAssocPerson().get(0), assocPersonRefName);
447 Assert.assertEquals(collectionObject.getOwners().getOwner().get(0), ownerRefName);
448 Assert.assertEquals(collectionObject.getFieldCollectionSources().getFieldCollectionSource().get(0), fieldCollectionSourceRefName);
450 // Check a sample of one or more organization authority ref fields
451 Assert.assertEquals(collectionObject.getContentOrganizations().getContentOrganization().get(0), contentOrganizationRefName);
452 Assert.assertEquals(collectionObject.getAssocEventOrganizations().getAssocEventOrganization().get(0), assocEventOrganizationRefName);
454 // Optionally output additional data about list members for debugging.
455 logger.info(this.toString());
456 boolean iterateThroughList = true;
457 if(iterateThroughList && logger.isDebugEnabled()){;
459 for(AuthorityRefList.AuthorityRefItem item : items){
460 logger.debug(testName + ": list-item[" + i + "] Field:" +
461 item.getSourceField() + " =" +
462 " item display name = " + item.getAuthDisplayName() +
463 " auth display name = " + item.getItemDisplayName());
464 logger.debug(testName + ": list-item[" + i + "] refName=" +
466 logger.debug(testName + ": list-item[" + i + "] URI=" +
474 // ---------------------------------------------------------------
475 // Cleanup of resources created during testing
476 // ---------------------------------------------------------------
479 * Deletes all resources created by tests, after all tests have been run.
481 * This cleanup method will always be run, even if one or more tests fail.
482 * For this reason, it attempts to remove all resources created
483 * at any point during testing, even if some of those resources
484 * may be expected to be deleted by certain tests.
486 @AfterClass(alwaysRun=true)
487 public void cleanUp() {
488 String noTest = System.getProperty("noTestCleanup");
489 if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
490 if (logger.isDebugEnabled()) {
491 logger.debug("Skipping Cleanup phase ...");
495 if (logger.isDebugEnabled()) {
496 logger.debug("Cleaning up temporary resources created for testing ...");
498 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
499 for (String resourceId : collectionObjectIdsCreated) {
500 // Note: Any non-success responses are ignored and not reported.
501 collectionObjectClient.delete(resourceId).releaseConnection();
503 // Note: Any non-success response is ignored and not reported.
504 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
505 // Delete persons before PersonAuth
506 for (String resourceId : personIdsCreated) {
507 // Note: Any non-success responses are ignored and not reported.
508 personAuthClient.deleteItem(personAuthCSID, resourceId).releaseConnection();
510 personAuthClient.delete(personAuthCSID).releaseConnection();
511 // Note: Any non-success response is ignored and not reported.
512 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
513 // Delete organizations before OrgAuth
514 for (String resourceId : orgIdsCreated) {
515 // Note: Any non-success responses are ignored and not reported.
516 orgAuthClient.deleteItem(orgAuthCSID, resourceId).releaseConnection();
518 orgAuthClient.delete(orgAuthCSID).releaseConnection();
521 // ---------------------------------------------------------------
522 // Utility methods used by tests above
523 // ---------------------------------------------------------------
525 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
528 public String getServicePathComponent() {
529 return SERVICE_PATH_COMPONENT;
533 * Creates the collection object instance.
535 * @param title the title
536 * @param objNum the obj num
537 * @param contentOrganization the content organization
538 * @param contentPeople the content people
539 * @param contentPerson the content person
540 * @param inscriber the inscriber
541 * @return the multipart output
543 private PoxPayloadOut createCollectionObjectInstance(
546 String contentOrganization,
547 String contentPerson,
548 String assocEventOrganization,
549 String assocEventPerson,
551 String fieldCollectionSource,
552 String fieldCollector ) {
553 CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
554 TitleGroupList titleGroupList = new TitleGroupList();
555 List<TitleGroup> titleGroups = titleGroupList.getTitleGroup();
556 TitleGroup titleGroup = new TitleGroup();
557 titleGroup.setTitle("a title");
558 titleGroups.add(titleGroup);
559 collectionObject.setTitleGroupList(titleGroupList);
560 collectionObject.setObjectNumber(objNum);
562 ContentOrganizationList contentOrganizationList = new ContentOrganizationList();
563 List<String> contentOrganizations = contentOrganizationList.getContentOrganization();
564 contentOrganizations.add(contentOrganization);
565 collectionObject.setContentOrganizations(contentOrganizationList);
567 ContentPersonList contentPersonList = new ContentPersonList();
568 List<String> contentPersons = contentPersonList.getContentPerson();
569 contentPersons.add(contentPerson);
570 collectionObject.setContentPersons(contentPersonList);
572 AssocEventOrganizationList assocEventOrganizationList = new AssocEventOrganizationList();
573 List<String> assocEventOrganizations = assocEventOrganizationList.getAssocEventOrganization();
574 assocEventOrganizations.add(assocEventOrganization);
575 collectionObject.setAssocEventOrganizations(assocEventOrganizationList);
577 AssocEventPersonList assocEventPersonList = new AssocEventPersonList();
578 List<String> assocEventPersons = assocEventPersonList.getAssocEventPerson();
579 assocEventPersons.add(assocEventPerson);
580 collectionObject.setAssocEventPersons(assocEventPersonList);
582 // AssocOrganizationList assocOrganizationList = new AssocOrganizationList();
583 // List<String> assocOrganizations = assocOrganizationList.getAssocOrganization();
584 // assocOrganizations.add(assocOrganization);
585 // collectionObject.setAssocOrganizations(assocOrganizationList);
587 // AssocPersonList assocPersonList = new AssocPersonList();
588 // List<String> assocPersons = assocPersonList.getAssocPerson();
589 // assocPersons.add(assocPerson);
590 // collectionObject.setAssocPersons(assocPersonList);
592 OwnerList ownerList = new OwnerList();
593 List<String> owners = ownerList.getOwner();
595 collectionObject.setOwners(ownerList);
597 FieldCollectionSourceList fieldCollectionSourceList = new FieldCollectionSourceList();
598 List<String> fieldCollectionSources = fieldCollectionSourceList.getFieldCollectionSource();
599 fieldCollectionSources.add(fieldCollectionSource);
600 collectionObject.setFieldCollectionSources(fieldCollectionSourceList);
602 FieldCollectorList FieldCollectorList = new FieldCollectorList();
603 List<String> fieldCollectors = FieldCollectorList.getFieldCollector();
604 fieldCollectors.add(fieldCollector);
605 collectionObject.setFieldCollectors(FieldCollectorList);
607 PoxPayloadOut multipart = new PoxPayloadOut(CollectionObjectClient.SERVICE_PAYLOAD_NAME);
608 PayloadOutputPart commonPart =
609 multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
610 commonPart.setLabel(new CollectionObjectClient().getCommonPartName());
612 if(logger.isDebugEnabled()){
613 logger.debug("to be created, collectionObject common");
614 logger.debug(objectAsXmlString(collectionObject, CollectionobjectsCommon.class));