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 // FIXME: As of 2012-01-04, the two assocEvent... fields
130 // and the ownerRefName field have been commented out in
131 // the list of authRef fields in CollectionObject, in tenant bindings,
132 // because those fields fall within to-be-created repeatable groups,
134 // As a result, the number of authority references expected to be found
135 // is currently 4, rather than 7. - Aron
136 public String toString(){
137 String result = "CollectionObjectauthRefsTest: "
138 + "\r\npersonAuthCSID: "+personAuthCSID
139 + "\r\npersonAuthRefName: "+personAuthRefName
140 + "\r\norgAuthCSID: "+orgAuthCSID
141 + "\r\norgAuthRefName: "+orgAuthRefName
143 + "\r\n contentOrganizationRefName: "+contentOrganizationRefName
144 + "\r\n contentPersonRefName: "+contentPersonRefName
145 + "\r\n assocEventOrganizationRefName: "+assocEventOrganizationRefName
146 + "\r\n assocEventPersonRefName: "+assocEventPersonRefName
147 + "\r\n ownerRefName: "+ownerRefName
148 + "\r\n fieldCollectionSourceRefName: "+fieldCollectionSourceRefName
149 + "\r\n fieldCollectorRefName: "+fieldCollectorRefName;
150 StringBuffer buff = new StringBuffer();
155 /** The number of authority references expected. */
156 private final int NUM_AUTH_REFS_EXPECTED = 4;
159 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
162 protected AbstractCommonList getAbstractCommonList(
163 ClientResponse<AbstractCommonList> response) {
164 throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
167 // ---------------------------------------------------------------
168 // CRUD tests : CREATE tests
169 // ---------------------------------------------------------------
172 * Creates the with auth refs.
174 * @param testName the test name
175 * @throws Exception the exception
177 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
178 public void createWithAuthRefs(String testName) throws Exception {
180 if (logger.isDebugEnabled()) {
181 logger.debug(testBanner(testName, CLASS_NAME));
183 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
185 // Create all the person refs and entities
188 // Create all the organization refs and entities
189 createOrganizationRefs();
191 // Create an object record payload, containing
192 // authority reference values in a number of its fields
193 String identifier = createIdentifier();
194 PoxPayloadOut multipart =
195 createCollectionObjectInstance(
197 "ObjNum" + "-" + identifier,
198 contentOrganizationRefName,
199 contentPersonRefName,
200 assocEventOrganizationRefName,
201 assocEventPersonRefName,
203 fieldCollectionSourceRefName,
204 fieldCollectorRefName
207 // Submit the request to the service and store the response.
208 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
209 ClientResponse<Response> res = collectionObjectClient.create(multipart);
211 int statusCode = res.getStatus();
213 // Check the status code of the response: does it match
214 // the expected response(s)?
217 // Does it fall within the set of valid status codes?
218 // Does it exactly match the expected status code?
219 if(logger.isDebugEnabled()){
220 logger.debug(testName + ": status = " + statusCode);
222 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
223 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
224 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
226 // Store the ID returned from the first resource created
227 // for additional tests below.
228 if (knownResourceId == null){
229 knownResourceId = extractId(res);
230 if (logger.isDebugEnabled()) {
231 logger.debug(testName + ": knownResourceId=" + knownResourceId);
235 // Store the IDs from every resource created by tests,
236 // so they can be deleted after tests have been run.
237 collectionObjectIdsCreated.add(extractId(res));
241 * Creates a Person Authority.
243 * @param displayName the display name of the authority
244 * @param shortIdentifier the short identifier for the authority
246 private void createPersonAuthority(String displayName, String shortIdentifier) {
247 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
248 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
249 PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
250 displayName, shortIdentifier, personAuthClient.getCommonPartName());
251 ClientResponse<Response> res = personAuthClient.create(multipart);
252 int statusCode = res.getStatus();
254 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
255 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
256 Assert.assertEquals(statusCode, STATUS_CREATED);
257 personAuthCSID = extractId(res);
258 personAuthRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
262 * Creates a person item.
264 * @param firstName the person's first name
265 * @param surName the person's surname
266 * @param shortIdentifier the short identifier for the item
267 * @return the CSID of the newly-created person record
269 protected String createPerson(String firstName, String surName, String shortIdentifier ) {
270 Map<String, String> personInfo = new HashMap<String,String>();
271 personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
272 personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
273 personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
274 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
275 PoxPayloadOut multipart =
276 PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
277 personAuthRefName, personInfo, personAuthClient.getItemCommonPartName());
278 ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
279 int statusCode = res.getStatus();
281 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
282 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
283 Assert.assertEquals(statusCode, STATUS_CREATED);
284 return extractId(res);
288 * Creates multiple Person items within a Person Authority,
289 * and stores the refNames referring to each.
291 protected void createPersonRefs(){
293 createPersonAuthority(PERSON_AUTHORITY_NAME_DISPLAY, PERSON_AUTHORITY_NAME);
297 csid = createPerson("Connie", "ContactPerson", "connieContactPerson");
298 contentPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
299 personIdsCreated.add(csid);
301 // csid = createPerson("Ingrid", "ContentInscriber", "ingridContentInscriber");
302 // contentInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
303 // personIdsCreated.add(csid);
305 // csid = createPerson("Pacifico", "ProductionPerson", "pacificoProductionPerson");
306 // objectProductionPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
307 // personIdsCreated.add(csid);
309 // csid = createPerson("Dessie", "DescriptionInscriber", "dessieDescriptionInscriber");
310 // descriptionInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
311 // personIdsCreated.add(csid);
313 csid = createPerson("Asok", "AssociatedEventPerson", "asokAssociatedEventPerson");
314 assocEventPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
315 personIdsCreated.add(csid);
317 // csid = createPerson("Andrew", "AssociatedPerson", "andrewAssociatedPerson");
318 // assocPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
319 // personIdsCreated.add(csid);
321 csid = createPerson("Owen", "Owner", "owenOwner");
322 ownerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
323 personIdsCreated.add(csid);
325 csid = createPerson("Sally", "Field-CollectionSource", "sallyFieldCollectionSource");
326 fieldCollectionSourceRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
327 personIdsCreated.add(csid);
329 csid = createPerson("Fred", "Lector", "fredLector");
330 fieldCollectorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
331 personIdsCreated.add(csid);
335 * Creates an organization authority.
337 * @param displayName the display name of the authority
338 * @param shortIdentifier the short identifier for the authority
340 private void createOrgAuthority(String displayName, String shortIdentifier) {
341 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
342 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
343 PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
344 displayName, shortIdentifier, orgAuthClient.getCommonPartName());
345 ClientResponse<Response> res = orgAuthClient.create(multipart);
346 int statusCode = res.getStatus();
348 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
349 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
350 Assert.assertEquals(statusCode, STATUS_CREATED);
351 orgAuthCSID = extractId(res);
352 orgAuthRefName = OrgAuthorityClientUtils.getAuthorityRefName(orgAuthCSID, null);
356 * Creates an organization item.
358 * @param shortName the organization's short name
359 * @param foundingPlace the organization's founding place
360 * @param shortIdentifier the short identifier for the item
361 * @return the CSID of the newly-created organization record
363 protected String createOrganization(String shortName, String foundingPlace, String shortIdentifier ) {
364 Map<String, String> orgInfo = new HashMap<String,String>();
365 orgInfo.put(OrganizationJAXBSchema.SHORT_NAME, shortName);
366 orgInfo.put(OrganizationJAXBSchema.FOUNDING_PLACE, foundingPlace);
367 orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
368 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
369 PoxPayloadOut multipart =
370 OrgAuthorityClientUtils.createOrganizationInstance(
371 orgAuthRefName, orgInfo, orgAuthClient.getItemCommonPartName());
372 ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);
373 int statusCode = res.getStatus();
375 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
376 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
377 Assert.assertEquals(statusCode, STATUS_CREATED);
378 return extractId(res);
382 * Creates multiple Organization items within an Organization Authority,
383 * and stores the refNames referring to each.
385 private void createOrganizationRefs() {
387 createOrgAuthority(ORG_AUTHORITY_NAME, ORG_AUTHORITY_NAME);
391 csid = createOrganization("Content Org", "Content Org Town", "contentOrg");
392 contentOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
393 orgIdsCreated.add(csid);
395 // csid = createOrganization("Production Org", "Production Org Town", "productionOrg");
396 // objectProductionOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
397 // orgIdsCreated.add(csid);
399 csid = createOrganization("Associated Event Org", "Associated Event Org City", "associatedEventOrg");
400 assocEventOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
401 orgIdsCreated.add(csid);
403 // csid = createOrganization("Associated Org", "Associated Org City", "associatedOrg");
404 // assocOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
405 // orgIdsCreated.add(csid);
411 * Read and check auth refs.
413 * @param testName the test name
414 * @throws Exception the exception
416 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
417 dependsOnMethods = {"createWithAuthRefs"})
418 public void readAndCheckAuthRefs(String testName) throws Exception {
420 if (logger.isDebugEnabled()) {
421 logger.debug(testBanner(testName, CLASS_NAME));
424 testSetup(STATUS_OK, ServiceRequestType.READ);
426 // Submit the request to the service and store the response.
427 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
428 ClientResponse<String> res = collectionObjectClient.read(knownResourceId);
429 assertStatusCode(res, testName);
431 PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
432 CollectionobjectsCommon collectionObject = (CollectionobjectsCommon) extractPart(input,
433 collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class);
434 Assert.assertNotNull(collectionObject);
436 // Get all of the auth refs and check that the expected number is returned
437 ClientResponse<AuthorityRefList> res2 = collectionObjectClient.getAuthorityRefs(knownResourceId);
438 assertStatusCode(res2, testName);
440 AuthorityRefList list = res2.getEntity();
442 List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
443 int numAuthRefsFound = items.size();
444 if(logger.isDebugEnabled()){
445 logger.debug("Expected " + NUM_AUTH_REFS_EXPECTED +
446 " authority references, found " + numAuthRefsFound);
448 Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
449 "Did not find all expected authority references! " +
450 "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
452 // Check a sample of one or more person authority ref fields
453 // Assert.assertEquals(collectionObject.getAssocPersons().getAssocPerson().get(0), assocPersonRefName);
454 Assert.assertEquals(collectionObject.getOwners().getOwner().get(0), ownerRefName);
455 Assert.assertEquals(collectionObject.getFieldCollectionSources().getFieldCollectionSource().get(0), fieldCollectionSourceRefName);
457 // Check a sample of one or more organization authority ref fields
458 Assert.assertEquals(collectionObject.getContentOrganizations().getContentOrganization().get(0), contentOrganizationRefName);
459 Assert.assertEquals(collectionObject.getAssocEventOrganizations().getAssocEventOrganization().get(0), assocEventOrganizationRefName);
461 // Optionally output additional data about list members for debugging.
462 logger.info(this.toString());
463 boolean iterateThroughList = true;
464 if(iterateThroughList && logger.isDebugEnabled()){;
466 for(AuthorityRefList.AuthorityRefItem item : items){
467 logger.debug(testName + ": list-item[" + i + "] Field:" +
468 item.getSourceField() + " =" +
469 " item display name = " + item.getAuthDisplayName() +
470 " auth display name = " + item.getItemDisplayName());
471 logger.debug(testName + ": list-item[" + i + "] refName=" +
473 logger.debug(testName + ": list-item[" + i + "] URI=" +
481 // ---------------------------------------------------------------
482 // Cleanup of resources created during testing
483 // ---------------------------------------------------------------
486 * Deletes all resources created by tests, after all tests have been run.
488 * This cleanup method will always be run, even if one or more tests fail.
489 * For this reason, it attempts to remove all resources created
490 * at any point during testing, even if some of those resources
491 * may be expected to be deleted by certain tests.
493 @AfterClass(alwaysRun=true)
494 public void cleanUp() {
495 String noTest = System.getProperty("noTestCleanup");
496 if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
497 if (logger.isDebugEnabled()) {
498 logger.debug("Skipping Cleanup phase ...");
502 if (logger.isDebugEnabled()) {
503 logger.debug("Cleaning up temporary resources created for testing ...");
505 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
506 for (String resourceId : collectionObjectIdsCreated) {
507 // Note: Any non-success responses are ignored and not reported.
508 collectionObjectClient.delete(resourceId).releaseConnection();
510 // Note: Any non-success response is ignored and not reported.
511 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
512 // Delete persons before PersonAuth
513 for (String resourceId : personIdsCreated) {
514 // Note: Any non-success responses are ignored and not reported.
515 personAuthClient.deleteItem(personAuthCSID, resourceId).releaseConnection();
517 personAuthClient.delete(personAuthCSID).releaseConnection();
518 // Note: Any non-success response is ignored and not reported.
519 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
520 // Delete organizations before OrgAuth
521 for (String resourceId : orgIdsCreated) {
522 // Note: Any non-success responses are ignored and not reported.
523 orgAuthClient.deleteItem(orgAuthCSID, resourceId).releaseConnection();
525 orgAuthClient.delete(orgAuthCSID).releaseConnection();
528 // ---------------------------------------------------------------
529 // Utility methods used by tests above
530 // ---------------------------------------------------------------
532 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
535 public String getServicePathComponent() {
536 return SERVICE_PATH_COMPONENT;
540 * Creates the collection object instance.
542 * @param title the title
543 * @param objNum the obj num
544 * @param contentOrganization the content organization
545 * @param contentPeople the content people
546 * @param contentPerson the content person
547 * @param inscriber the inscriber
548 * @return the multipart output
550 private PoxPayloadOut createCollectionObjectInstance(
553 String contentOrganization,
554 String contentPerson,
555 String assocEventOrganization,
556 String assocEventPerson,
558 String fieldCollectionSource,
559 String fieldCollector ) {
560 CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
561 TitleGroupList titleGroupList = new TitleGroupList();
562 List<TitleGroup> titleGroups = titleGroupList.getTitleGroup();
563 TitleGroup titleGroup = new TitleGroup();
564 titleGroup.setTitle("a title");
565 titleGroups.add(titleGroup);
566 collectionObject.setTitleGroupList(titleGroupList);
567 collectionObject.setObjectNumber(objNum);
569 ContentOrganizationList contentOrganizationList = new ContentOrganizationList();
570 List<String> contentOrganizations = contentOrganizationList.getContentOrganization();
571 contentOrganizations.add(contentOrganization);
572 collectionObject.setContentOrganizations(contentOrganizationList);
574 ContentPersonList contentPersonList = new ContentPersonList();
575 List<String> contentPersons = contentPersonList.getContentPerson();
576 contentPersons.add(contentPerson);
577 collectionObject.setContentPersons(contentPersonList);
579 AssocEventOrganizationList assocEventOrganizationList = new AssocEventOrganizationList();
580 List<String> assocEventOrganizations = assocEventOrganizationList.getAssocEventOrganization();
581 assocEventOrganizations.add(assocEventOrganization);
582 collectionObject.setAssocEventOrganizations(assocEventOrganizationList);
584 AssocEventPersonList assocEventPersonList = new AssocEventPersonList();
585 List<String> assocEventPersons = assocEventPersonList.getAssocEventPerson();
586 assocEventPersons.add(assocEventPerson);
587 collectionObject.setAssocEventPersons(assocEventPersonList);
589 // AssocOrganizationList assocOrganizationList = new AssocOrganizationList();
590 // List<String> assocOrganizations = assocOrganizationList.getAssocOrganization();
591 // assocOrganizations.add(assocOrganization);
592 // collectionObject.setAssocOrganizations(assocOrganizationList);
594 // AssocPersonList assocPersonList = new AssocPersonList();
595 // List<String> assocPersons = assocPersonList.getAssocPerson();
596 // assocPersons.add(assocPerson);
597 // collectionObject.setAssocPersons(assocPersonList);
599 OwnerList ownerList = new OwnerList();
600 List<String> owners = ownerList.getOwner();
602 collectionObject.setOwners(ownerList);
604 FieldCollectionSourceList fieldCollectionSourceList = new FieldCollectionSourceList();
605 List<String> fieldCollectionSources = fieldCollectionSourceList.getFieldCollectionSource();
606 fieldCollectionSources.add(fieldCollectionSource);
607 collectionObject.setFieldCollectionSources(fieldCollectionSourceList);
609 FieldCollectorList FieldCollectorList = new FieldCollectorList();
610 List<String> fieldCollectors = FieldCollectorList.getFieldCollector();
611 fieldCollectors.add(fieldCollector);
612 collectionObject.setFieldCollectors(FieldCollectorList);
614 PoxPayloadOut multipart = new PoxPayloadOut(CollectionObjectClient.SERVICE_PAYLOAD_NAME);
615 PayloadOutputPart commonPart =
616 multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
617 commonPart.setLabel(new CollectionObjectClient().getCommonPartName());
619 if(logger.isDebugEnabled()){
620 logger.debug("to be created, collectionObject common");
621 logger.debug(objectAsXmlString(collectionObject, CollectionobjectsCommon.class));