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.CollectionobjectsCommon;
45 import org.collectionspace.services.collectionobject.ContentOrganizationList;
46 import org.collectionspace.services.collectionobject.ContentPersonList;
47 import org.collectionspace.services.collectionobject.OwnerList;
48 import org.collectionspace.services.collectionobject.FieldCollectionSourceList;
49 import org.collectionspace.services.collectionobject.FieldCollectorList;
50 import org.collectionspace.services.collectionobject.TitleGroup;
51 import org.collectionspace.services.collectionobject.TitleGroupList;
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";
85 final String PERSON_AUTHORITY_NAME_DISPLAY = "TestPersonAuth_DisplayName";
87 /** The organization authority name. */
88 final String ORG_AUTHORITY_NAME = "TestOrgAuth";
90 /** The known resource id. */
91 private String knownResourceId = null;
93 /** The collection object ids created. */
94 private List<String> collectionObjectIdsCreated = new ArrayList<String>();
96 /** The person ids created. */
97 private List<String> personIdsCreated = new ArrayList<String>();
99 /** The person authority csid and refName. */
100 private String personAuthCSID = null;
101 private String personAuthRefName = null;
103 /** The organization ids created. */
104 private List<String> orgIdsCreated = new ArrayList<String>();
106 /** The org authority csid and refName. */
107 private String orgAuthCSID = null;
108 private String orgAuthRefName = null;
110 private String contentOrganizationRefName = null;
111 private String contentPersonRefName = null;
112 private String assocEventOrganizationRefName = null;
113 private String assocEventPersonRefName = null;
114 private String ownerRefName = null;
115 private String fieldCollectionSourceRefName = null;
116 private String fieldCollectorRefName = null;
118 public String toString(){
119 String result = "CollectionObjectauthRefsTest: "
120 + "\r\npersonAuthCSID: "+personAuthCSID
121 + "\r\npersonAuthRefName: "+personAuthRefName
122 + "\r\norgAuthCSID: "+orgAuthCSID
123 + "\r\norgAuthRefName: "+orgAuthRefName
125 + "\r\n contentOrganizationRefName: "+contentOrganizationRefName
126 + "\r\n contentPersonRefName: "+contentPersonRefName
127 + "\r\n assocEventOrganizationRefName: "+assocEventOrganizationRefName
128 + "\r\n assocEventPersonRefName: "+assocEventPersonRefName
129 + "\r\n ownerRefName: "+ownerRefName
130 + "\r\n fieldCollectionSourceRefName: "+fieldCollectionSourceRefName
131 + "\r\n fieldCollectorRefName: "+fieldCollectorRefName;
132 StringBuffer buff = new StringBuffer();
137 /** The number of authority references expected. */
138 private final int NUM_AUTH_REFS_EXPECTED = 7;
141 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
144 protected CollectionSpaceClient getClientInstance() {
145 throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
149 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
152 protected AbstractCommonList getAbstractCommonList(
153 ClientResponse<AbstractCommonList> response) {
154 throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
157 // ---------------------------------------------------------------
158 // CRUD tests : CREATE tests
159 // ---------------------------------------------------------------
162 * Creates the with auth refs.
164 * @param testName the test name
165 * @throws Exception the exception
167 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
168 public void createWithAuthRefs(String testName) throws Exception {
170 if (logger.isDebugEnabled()) {
171 logger.debug(testBanner(testName, CLASS_NAME));
173 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
175 // Create all the person refs and entities
178 // Create all the organization refs and entities
179 createOrganizationRefs();
181 // Create an object record payload, containing
182 // authority reference values in a number of its fields
183 String identifier = createIdentifier();
184 MultipartOutput multipart =
185 createCollectionObjectInstance(
187 "ObjNum" + "-" + identifier,
188 contentOrganizationRefName,
189 contentPersonRefName,
190 assocEventOrganizationRefName,
191 assocEventPersonRefName,
193 fieldCollectionSourceRefName,
194 fieldCollectorRefName
197 // Submit the request to the service and store the response.
198 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
199 ClientResponse<Response> res = collectionObjectClient.create(multipart);
201 int statusCode = res.getStatus();
203 // Check the status code of the response: does it match
204 // the expected response(s)?
207 // Does it fall within the set of valid status codes?
208 // Does it exactly match the expected status code?
209 if(logger.isDebugEnabled()){
210 logger.debug(testName + ": status = " + statusCode);
212 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
213 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
214 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
216 // Store the ID returned from the first resource created
217 // for additional tests below.
218 if (knownResourceId == null){
219 knownResourceId = extractId(res);
220 if (logger.isDebugEnabled()) {
221 logger.debug(testName + ": knownResourceId=" + knownResourceId);
225 // Store the IDs from every resource created by tests,
226 // so they can be deleted after tests have been run.
227 collectionObjectIdsCreated.add(extractId(res));
231 * Creates a Person Authority.
233 * @param displayName the display name of the authority
234 * @param shortIdentifier the short identifier for the authority
236 private void createPersonAuthority(String displayName, String shortIdentifier) {
237 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
238 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
239 MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
240 displayName, shortIdentifier, personAuthClient.getCommonPartName());
241 ClientResponse<Response> res = personAuthClient.create(multipart);
242 int statusCode = res.getStatus();
244 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
245 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
246 Assert.assertEquals(statusCode, STATUS_CREATED);
247 personAuthCSID = extractId(res);
248 personAuthRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
252 * Creates a person item.
254 * @param firstName the person's first name
255 * @param surName the person's surname
256 * @param shortIdentifier the short identifier for the item
257 * @return the CSID of the newly-created person record
259 protected String createPerson(String firstName, String surName, String shortIdentifier ) {
260 Map<String, String> personInfo = new HashMap<String,String>();
261 personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
262 personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
263 personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
264 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
265 MultipartOutput multipart =
266 PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
267 personAuthRefName, personInfo, personAuthClient.getItemCommonPartName());
268 ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
269 int statusCode = res.getStatus();
271 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
272 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
273 Assert.assertEquals(statusCode, STATUS_CREATED);
274 return extractId(res);
278 * Creates multiple Person items within a Person Authority,
279 * and stores the refNames referring to each.
281 protected void createPersonRefs(){
283 createPersonAuthority(PERSON_AUTHORITY_NAME_DISPLAY, PERSON_AUTHORITY_NAME);
287 csid = createPerson("Connie", "ContactPerson", "connieContactPerson");
288 contentPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
289 personIdsCreated.add(csid);
291 // csid = createPerson("Ingrid", "ContentInscriber", "ingridContentInscriber");
292 // contentInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
293 // personIdsCreated.add(csid);
295 // csid = createPerson("Pacifico", "ProductionPerson", "pacificoProductionPerson");
296 // objectProductionPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
297 // personIdsCreated.add(csid);
299 // csid = createPerson("Dessie", "DescriptionInscriber", "dessieDescriptionInscriber");
300 // descriptionInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
301 // personIdsCreated.add(csid);
303 csid = createPerson("Asok", "AssociatedEventPerson", "asokAssociatedEventPerson");
304 assocEventPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
305 personIdsCreated.add(csid);
307 // csid = createPerson("Andrew", "AssociatedPerson", "andrewAssociatedPerson");
308 // assocPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
309 // personIdsCreated.add(csid);
311 csid = createPerson("Owen", "Owner", "owenOwner");
312 ownerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
313 personIdsCreated.add(csid);
315 csid = createPerson("Sally", "Field-CollectionSource", "sallyFieldCollectionSource");
316 fieldCollectionSourceRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
317 personIdsCreated.add(csid);
319 csid = createPerson("Fred", "Lector", "fredLector");
320 fieldCollectorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
321 personIdsCreated.add(csid);
325 * Creates an organization authority.
327 * @param displayName the display name of the authority
328 * @param shortIdentifier the short identifier for the authority
330 private void createOrgAuthority(String displayName, String shortIdentifier) {
331 testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
332 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
333 MultipartOutput multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
334 displayName, shortIdentifier, orgAuthClient.getCommonPartName());
335 ClientResponse<Response> res = orgAuthClient.create(multipart);
336 int statusCode = res.getStatus();
338 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
339 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
340 Assert.assertEquals(statusCode, STATUS_CREATED);
341 orgAuthCSID = extractId(res);
342 orgAuthRefName = OrgAuthorityClientUtils.getAuthorityRefName(orgAuthCSID, null);
346 * Creates an organization item.
348 * @param shortName the organization's short name
349 * @param foundingPlace the organization's founding place
350 * @param shortIdentifier the short identifier for the item
351 * @return the CSID of the newly-created organization record
353 protected String createOrganization(String shortName, String foundingPlace, String shortIdentifier ) {
354 Map<String, String> orgInfo = new HashMap<String,String>();
355 orgInfo.put(OrganizationJAXBSchema.SHORT_NAME, shortName);
356 orgInfo.put(OrganizationJAXBSchema.FOUNDING_PLACE, foundingPlace);
357 orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
358 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
359 MultipartOutput multipart =
360 OrgAuthorityClientUtils.createOrganizationInstance(
361 orgAuthRefName, orgInfo, orgAuthClient.getItemCommonPartName());
362 ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);
363 int statusCode = res.getStatus();
365 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
366 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
367 Assert.assertEquals(statusCode, STATUS_CREATED);
368 return extractId(res);
372 * Creates multiple Organization items within an Organization Authority,
373 * and stores the refNames referring to each.
375 private void createOrganizationRefs() {
377 createOrgAuthority(ORG_AUTHORITY_NAME, ORG_AUTHORITY_NAME);
381 csid = createOrganization("Content Org", "Content Org Town", "contentOrg");
382 contentOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
383 orgIdsCreated.add(csid);
385 // csid = createOrganization("Production Org", "Production Org Town", "productionOrg");
386 // objectProductionOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
387 // orgIdsCreated.add(csid);
389 csid = createOrganization("Associated Event Org", "Associated Event Org City", "associatedEventOrg");
390 assocEventOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
391 orgIdsCreated.add(csid);
393 // csid = createOrganization("Associated Org", "Associated Org City", "associatedOrg");
394 // assocOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
395 // orgIdsCreated.add(csid);
401 * Read and check auth refs.
403 * @param testName the test name
404 * @throws Exception the exception
406 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
407 dependsOnMethods = {"createWithAuthRefs"})
408 public void readAndCheckAuthRefs(String testName) throws Exception {
410 if (logger.isDebugEnabled()) {
411 logger.debug(testBanner(testName, CLASS_NAME));
414 testSetup(STATUS_OK, ServiceRequestType.READ);
416 // Submit the request to the service and store the response.
417 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
418 ClientResponse<MultipartInput> res = collectionObjectClient.read(knownResourceId);
419 int statusCode = res.getStatus();
421 // Check the status code of the response: does it match
422 // the expected response(s)?
423 if(logger.isDebugEnabled()){
424 logger.debug(testName + ".read: status = " + statusCode);
426 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
427 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
428 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
430 MultipartInput input = (MultipartInput) res.getEntity();
431 CollectionobjectsCommon collectionObject = (CollectionobjectsCommon) extractPart(input,
432 collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class);
433 Assert.assertNotNull(collectionObject);
435 // Get all of the auth refs and check that the expected number is returned
436 ClientResponse<AuthorityRefList> res2 = collectionObjectClient.getAuthorityRefs(knownResourceId);
437 statusCode = res2.getStatus();
439 if(logger.isDebugEnabled()){
440 logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
442 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
443 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
444 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
445 AuthorityRefList list = res2.getEntity();
447 List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
448 int numAuthRefsFound = items.size();
449 if(logger.isDebugEnabled()){
450 logger.debug("Expected " + NUM_AUTH_REFS_EXPECTED +
451 " authority references, found " + numAuthRefsFound);
453 Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
454 "Did not find all expected authority references! " +
455 "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
457 // Check a sample of one or more person authority ref fields
458 // Assert.assertEquals(collectionObject.getInscriptionContentInscriber(), contentInscriberRefName);
459 // Assert.assertEquals(collectionObject.getAssocPersons().getAssocPerson().get(0), assocPersonRefName);
460 Assert.assertEquals(collectionObject.getOwners().getOwner().get(0), ownerRefName);
461 Assert.assertEquals(collectionObject.getFieldCollectionSources().getFieldCollectionSource().get(0), fieldCollectionSourceRefName);
463 // Check a sample of one or more organization authority ref fields
464 Assert.assertEquals(collectionObject.getContentOrganizations().getContentOrganization().get(0), contentOrganizationRefName);
465 Assert.assertEquals(collectionObject.getAssocEventOrganizations().getAssocEventOrganization().get(0), assocEventOrganizationRefName);
467 // Optionally output additional data about list members for debugging.
468 logger.info(this.toString());
469 boolean iterateThroughList = true;
470 if(iterateThroughList && logger.isDebugEnabled()){;
472 for(AuthorityRefList.AuthorityRefItem item : items){
473 logger.debug(testName + ": list-item[" + i + "] Field:" +
474 item.getSourceField() + " =" +
475 " item display name = " + item.getAuthDisplayName() +
476 " auth display name = " + item.getItemDisplayName());
477 logger.debug(testName + ": list-item[" + i + "] refName=" +
479 logger.debug(testName + ": list-item[" + i + "] URI=" +
487 // ---------------------------------------------------------------
488 // Cleanup of resources created during testing
489 // ---------------------------------------------------------------
492 * Deletes all resources created by tests, after all tests have been run.
494 * This cleanup method will always be run, even if one or more tests fail.
495 * For this reason, it attempts to remove all resources created
496 * at any point during testing, even if some of those resources
497 * may be expected to be deleted by certain tests.
499 @AfterClass(alwaysRun=true)
500 public void cleanUp() {
501 String noTest = System.getProperty("noTestCleanup");
502 if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
503 if (logger.isDebugEnabled()) {
504 logger.debug("Skipping Cleanup phase ...");
508 if (logger.isDebugEnabled()) {
509 logger.debug("Cleaning up temporary resources created for testing ...");
511 CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
512 for (String resourceId : collectionObjectIdsCreated) {
513 // Note: Any non-success responses are ignored and not reported.
514 collectionObjectClient.delete(resourceId).releaseConnection();
516 // Note: Any non-success response is ignored and not reported.
517 PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
518 // Delete persons before PersonAuth
519 for (String resourceId : personIdsCreated) {
520 // Note: Any non-success responses are ignored and not reported.
521 personAuthClient.deleteItem(personAuthCSID, resourceId).releaseConnection();
523 personAuthClient.delete(personAuthCSID).releaseConnection();
524 // Note: Any non-success response is ignored and not reported.
525 OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
526 // Delete organizations before OrgAuth
527 for (String resourceId : orgIdsCreated) {
528 // Note: Any non-success responses are ignored and not reported.
529 orgAuthClient.deleteItem(orgAuthCSID, resourceId).releaseConnection();
531 orgAuthClient.delete(orgAuthCSID).releaseConnection();
534 // ---------------------------------------------------------------
535 // Utility methods used by tests above
536 // ---------------------------------------------------------------
538 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
541 public String getServicePathComponent() {
542 return SERVICE_PATH_COMPONENT;
546 * Creates the collection object instance.
548 * @param title the title
549 * @param objNum the obj num
550 * @param contentOrganization the content organization
551 * @param contentPeople the content people
552 * @param contentPerson the content person
553 * @param inscriber the inscriber
554 * @return the multipart output
556 private MultipartOutput createCollectionObjectInstance(
559 String contentOrganization,
560 String contentPerson,
561 String assocEventOrganization,
562 String assocEventPerson,
564 String fieldCollectionSource,
565 String fieldCollector ) {
566 CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
567 TitleGroupList titleGroupList = new TitleGroupList();
568 List<TitleGroup> titleGroups = titleGroupList.getTitleGroup();
569 TitleGroup titleGroup = new TitleGroup();
570 titleGroup.setTitle("a title");
571 titleGroups.add(titleGroup);
572 collectionObject.setTitleGroupList(titleGroupList);
573 collectionObject.setObjectNumber(objNum);
575 ContentOrganizationList contentOrganizationList = new ContentOrganizationList();
576 List<String> contentOrganizations = contentOrganizationList.getContentOrganization();
577 contentOrganizations.add(contentOrganization);
578 collectionObject.setContentOrganizations(contentOrganizationList);
580 ContentPersonList contentPersonList = new ContentPersonList();
581 List<String> contentPersons = contentPersonList.getContentPerson();
582 contentPersons.add(contentPerson);
583 collectionObject.setContentPersons(contentPersonList);
585 AssocEventOrganizationList assocEventOrganizationList = new AssocEventOrganizationList();
586 List<String> assocEventOrganizations = assocEventOrganizationList.getAssocEventOrganization();
587 assocEventOrganizations.add(assocEventOrganization);
588 collectionObject.setAssocEventOrganizations(assocEventOrganizationList);
590 AssocEventPersonList assocEventPersonList = new AssocEventPersonList();
591 List<String> assocEventPersons = assocEventPersonList.getAssocEventPerson();
592 assocEventPersons.add(assocEventPerson);
593 collectionObject.setAssocEventPersons(assocEventPersonList);
595 // AssocOrganizationList assocOrganizationList = new AssocOrganizationList();
596 // List<String> assocOrganizations = assocOrganizationList.getAssocOrganization();
597 // assocOrganizations.add(assocOrganization);
598 // collectionObject.setAssocOrganizations(assocOrganizationList);
600 // AssocPersonList assocPersonList = new AssocPersonList();
601 // List<String> assocPersons = assocPersonList.getAssocPerson();
602 // assocPersons.add(assocPerson);
603 // collectionObject.setAssocPersons(assocPersonList);
605 OwnerList ownerList = new OwnerList();
606 List<String> owners = ownerList.getOwner();
608 collectionObject.setOwners(ownerList);
610 FieldCollectionSourceList fieldCollectionSourceList = new FieldCollectionSourceList();
611 List<String> fieldCollectionSources = fieldCollectionSourceList.getFieldCollectionSource();
612 fieldCollectionSources.add(fieldCollectionSource);
613 collectionObject.setFieldCollectionSources(fieldCollectionSourceList);
615 FieldCollectorList FieldCollectorList = new FieldCollectorList();
616 List<String> fieldCollectors = FieldCollectorList.getFieldCollector();
617 fieldCollectors.add(fieldCollector);
618 collectionObject.setFieldCollectors(FieldCollectorList);
620 MultipartOutput multipart = new MultipartOutput();
621 OutputPart commonPart =
622 multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
623 commonPart.getHeaders().add("label", new CollectionObjectClient().getCommonPartName());
625 if(logger.isDebugEnabled()){
626 logger.debug("to be created, collectionObject common");
627 logger.debug(objectAsXmlString(collectionObject, CollectionobjectsCommon.class));