]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
13db2d40b26be99114d003c79a93634f76ba24f0
[tmp/jakarta-migration.git] /
1 /**
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:
5  *
6  * http://www.collectionspace.org
7  * http://wiki.collectionspace.org
8  *
9  * Copyright © 2009 Regents of the University of California
10  *
11  * Licensed under the Educational Community License (ECL), Version 2.0.
12  * You may not use this file except in compliance with this License.
13  *
14  * You may obtain a copy of the ECL 2.0 License at
15  * https://source.collectionspace.org/collection-space/LICENSE.txt
16  *
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.
22  */
23 package org.collectionspace.services.client.test;
24
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.List;
28 import java.util.Map;
29
30 import javax.ws.rs.core.MediaType;
31 import javax.ws.rs.core.Response;
32
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;
53
54 import org.jboss.resteasy.client.ClientResponse;
55
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;
62
63 import org.slf4j.Logger;
64 import org.slf4j.LoggerFactory;
65
66 /**
67  * CollectionObjectAuthRefsTest, carries out tests against a
68  * deployed and running CollectionObject Service.
69  *
70  * $LastChangedRevision: 1327 $
71  * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
72  */
73 public class CollectionObjectAuthRefsTest extends BaseServiceTest {
74
75    /** The logger. */
76     private final String CLASS_NAME = CollectionObjectAuthRefsTest.class.getName();
77     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
78
79     // Instance variables specific to this test.
80     /** The service path component. */
81     final String SERVICE_PATH_COMPONENT = "collectionobjects";
82     
83     /** The person authority name. */
84     final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
85
86     /** The organization authority name. */
87     final String ORG_AUTHORITY_NAME = "TestOrgAuth";
88     
89     /** The known resource id. */
90     private String knownResourceId = null;
91     
92     /** The collection object ids created. */
93     private List<String> collectionObjectIdsCreated = new ArrayList<String>();
94     
95     /** The person ids created. */
96     private List<String> personIdsCreated = new ArrayList<String>();
97     
98     /** The person authority csid and refName. */
99     private String personAuthCSID = null; 
100     private String personAuthRefName = null;
101     
102     /** The organization ids created. */
103     private List<String> orgIdsCreated = new ArrayList<String>();
104
105     /** The org authority csid and refName. */
106     private String orgAuthCSID = null;
107     private String orgAuthRefName = null;
108     
109     private String contentOrganizationRefName = null;
110     private String contentPersonRefName = null;
111     private String contentInscriberRefName = null;
112     private String descriptionInscriberRefName = null;
113     private String assocEventOrganizationRefName = null;
114     private String assocEventPersonRefName = null;
115     private String assocOrganizationRefName = null;
116     private String assocPersonRefName = null;
117     private String ownerRefName = null;
118     private String fieldCollectionSourceRefName = null;
119     private String fieldCollectorRefName = null;
120
121     /** The number of authority references expected. */
122     private final int NUM_AUTH_REFS_EXPECTED = 11;
123
124     /* (non-Javadoc)
125      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
126      */
127     @Override
128     protected CollectionSpaceClient getClientInstance() {
129         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
130     }
131     
132     /* (non-Javadoc)
133      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
134      */
135     @Override
136         protected AbstractCommonList getAbstractCommonList(
137                         ClientResponse<AbstractCommonList> response) {
138         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
139     }
140
141     // ---------------------------------------------------------------
142     // CRUD tests : CREATE tests
143     // ---------------------------------------------------------------
144     // Success outcomes
145     /**
146      * Creates the with auth refs.
147      *
148      * @param testName the test name
149      * @throws Exception the exception
150      */
151     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
152     public void createWithAuthRefs(String testName) throws Exception {
153
154         if (logger.isDebugEnabled()) {
155             logger.debug(testBanner(testName, CLASS_NAME));
156         }
157         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
158         
159         // Create all the person refs and entities
160         createPersonRefs();
161
162         // Create all the organization refs and entities
163         createOrganizationRefs();
164
165         // Create an object record payload, containing
166         // authority reference values in a number of its fields
167         String identifier = createIdentifier();
168         MultipartOutput multipart =
169             createCollectionObjectInstance(
170                 "Obj Title",
171                 "ObjNum" + "-" + identifier,
172                 contentOrganizationRefName,
173                 contentPersonRefName,
174                 contentInscriberRefName,
175                 descriptionInscriberRefName,
176                 assocEventOrganizationRefName,
177                 assocEventPersonRefName,
178                 assocOrganizationRefName,
179                 assocPersonRefName,
180                 ownerRefName,
181                 fieldCollectionSourceRefName,
182                 fieldCollectorRefName
183             );
184
185         // Submit the request to the service and store the response.
186         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
187         ClientResponse<Response> res = collectionObjectClient.create(multipart);
188
189         int statusCode = res.getStatus();
190
191         // Check the status code of the response: does it match
192         // the expected response(s)?
193         //
194         // Specifically:
195         // Does it fall within the set of valid status codes?
196         // Does it exactly match the expected status code?
197         if(logger.isDebugEnabled()){
198             logger.debug(testName + ": status = " + statusCode);
199         }
200         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
201                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
202         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
203
204         // Store the ID returned from the first resource created
205         // for additional tests below.
206         if (knownResourceId == null){
207             knownResourceId = extractId(res);
208             if (logger.isDebugEnabled()) {
209                 logger.debug(testName + ": knownResourceId=" + knownResourceId);
210             }
211         }
212         
213         // Store the IDs from every resource created by tests,
214         // so they can be deleted after tests have been run.
215         collectionObjectIdsCreated.add(extractId(res));
216     }
217
218     /**
219      * Creates a Person Authority.
220      *
221      * @param displayName the display name of the authority
222      * @param shortIdentifier the short identifier for the authority
223      */
224     private void createPersonAuthority(String displayName, String shortIdentifier) {
225         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
226         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
227         MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
228                         displayName, shortIdentifier, personAuthClient.getCommonPartName());
229         ClientResponse<Response> res = personAuthClient.create(multipart);
230         int statusCode = res.getStatus();
231
232         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
233                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
234         Assert.assertEquals(statusCode, STATUS_CREATED);
235         personAuthCSID = extractId(res);
236         personAuthRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
237     }
238
239     /**
240      * Creates a person item.
241      *
242      * @param firstName the person's first name
243      * @param surName the person's surname
244      * @param shortIdentifier the short identifier for the item
245      * @return the CSID of the newly-created person record
246      */
247     protected String createPerson(String firstName, String surName, String shortIdentifier ) {
248         Map<String, String> personInfo = new HashMap<String,String>();
249         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
250         personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
251         personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
252         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
253         MultipartOutput multipart =
254                 PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
255                                 personAuthRefName, personInfo, personAuthClient.getItemCommonPartName());
256         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
257         int statusCode = res.getStatus();
258
259         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
260                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
261         Assert.assertEquals(statusCode, STATUS_CREATED);
262         return extractId(res);
263     }
264
265     /**
266      * Creates multiple Person items within a Person Authority,
267      * and stores the refNames referring to each.
268      */
269     protected void createPersonRefs(){
270
271         createPersonAuthority(PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME);
272
273         String csid = "";
274         
275         csid = createPerson("Connie", "ContactPerson", "connieContactPerson");
276         contentPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
277         personIdsCreated.add(csid);
278         
279         csid = createPerson("Ingrid", "ContentInscriber", "ingridContentInscriber");
280         contentInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
281         personIdsCreated.add(csid);
282
283         csid = createPerson("Dessie", "DescriptionInscriber", "dessieDescriptionInscriber");
284         descriptionInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
285         personIdsCreated.add(csid);
286
287         csid = createPerson("Asok", "AssociatedEventPerson", "asokAssociatedEventPerson");
288         assocEventPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
289         personIdsCreated.add(csid);
290         
291         csid = createPerson("Andrew", "AssociatedPerson", "andrewAssociatedPerson");
292         assocPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
293         personIdsCreated.add(csid);
294
295         csid = createPerson("Owen", "Owner", "owenOwner");
296         ownerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
297         personIdsCreated.add(csid);
298
299         csid = createPerson("Sally", "Field-CollectionSource", "sallyFieldCollectionSource");
300         fieldCollectionSourceRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
301         personIdsCreated.add(csid);
302
303         csid = createPerson("Fred", "Lector", "fredLector");
304         fieldCollectorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
305         personIdsCreated.add(csid);
306     }
307     
308     /**
309      * Creates an organization authority.
310      *
311      * @param displayName the display name of the authority
312      * @param shortIdentifier the short identifier for the authority
313      */
314     private void createOrgAuthority(String displayName, String shortIdentifier) {
315         testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
316         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
317         MultipartOutput multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
318                         displayName, shortIdentifier, orgAuthClient.getCommonPartName());
319         ClientResponse<Response> res = orgAuthClient.create(multipart);
320         int statusCode = res.getStatus();
321
322         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
323                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
324         Assert.assertEquals(statusCode, STATUS_CREATED);
325         orgAuthCSID = extractId(res);
326         orgAuthRefName = OrgAuthorityClientUtils.getAuthorityRefName(orgAuthCSID, null);
327     }
328
329     /**
330      * Creates an organization item.
331      *
332      * @param shortName the organization's short name
333      * @param foundingPlace the organization's founding place
334      * @param shortIdentifier the short identifier for the item
335      * @return the CSID of the newly-created organization record
336      */
337     protected String createOrganization(String shortName, String foundingPlace, String shortIdentifier ) {
338         Map<String, String> orgInfo = new HashMap<String,String>();
339         orgInfo.put(OrganizationJAXBSchema.SHORT_NAME, shortName);
340         orgInfo.put(OrganizationJAXBSchema.FOUNDING_PLACE, foundingPlace);
341         orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
342         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
343         MultipartOutput multipart =
344                 OrgAuthorityClientUtils.createOrganizationInstance(orgAuthCSID,
345                                 orgAuthRefName, orgInfo, orgAuthClient.getItemCommonPartName());
346         ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);
347         int statusCode = res.getStatus();
348
349         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
350                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
351         Assert.assertEquals(statusCode, STATUS_CREATED);
352         return extractId(res);
353     }
354     
355    /**
356      * Creates multiple Organization items within an Organization Authority,
357      * and stores the refNames referring to each.
358      */
359     private void createOrganizationRefs() {
360
361         createOrgAuthority(ORG_AUTHORITY_NAME, ORG_AUTHORITY_NAME);
362
363         String csid = "";
364
365         csid = createOrganization("Content Org", "Content Org Town", "contentOrg");
366         contentOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
367         orgIdsCreated.add(csid);
368
369         csid = createOrganization("Associated Event Org", "Associated Event Org City", "associatedEventOrg");
370         assocEventOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
371         orgIdsCreated.add(csid);
372
373         csid = createOrganization("Associated Org", "Associated Org City", "associatedOrg");
374         assocOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null);
375         orgIdsCreated.add(csid);
376     }
377
378
379     // Success outcomes
380     /**
381      * Read and check auth refs.
382      *
383      * @param testName the test name
384      * @throws Exception the exception
385      */
386     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
387         dependsOnMethods = {"createWithAuthRefs"})
388     public void readAndCheckAuthRefs(String testName) throws Exception {
389
390         if (logger.isDebugEnabled()) {
391             logger.debug(testBanner(testName, CLASS_NAME));
392         }
393         // Perform setup.
394         testSetup(STATUS_OK, ServiceRequestType.READ);
395
396         // Submit the request to the service and store the response.
397         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
398         ClientResponse<MultipartInput> res = collectionObjectClient.read(knownResourceId);
399         int statusCode = res.getStatus();
400
401         // Check the status code of the response: does it match
402         // the expected response(s)?
403         if(logger.isDebugEnabled()){
404             logger.debug(testName + ".read: status = " + statusCode);
405         }
406         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
407                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
408         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
409
410         MultipartInput input = (MultipartInput) res.getEntity();
411         CollectionobjectsCommon collectionObject = (CollectionobjectsCommon) extractPart(input,
412                         collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class);
413         Assert.assertNotNull(collectionObject);
414
415         // Check a sample of one or more person authority ref fields
416         Assert.assertEquals(collectionObject.getInscriptionContentInscriber(), contentInscriberRefName);
417         Assert.assertEquals(collectionObject.getAssocPersons().getAssocPerson().get(0), assocPersonRefName);
418         Assert.assertEquals(collectionObject.getOwners().getOwner().get(0), ownerRefName);
419         Assert.assertEquals(collectionObject.getFieldCollectionSources().getFieldCollectionSource().get(0), fieldCollectionSourceRefName);
420
421         // Check a sample of one or more organization authority ref fields
422         Assert.assertEquals(collectionObject.getContentOrganizations().getContentOrganization().get(0), contentOrganizationRefName);
423         Assert.assertEquals(collectionObject.getAssocEventOrganizations().getAssocEventOrganization().get(0), assocEventOrganizationRefName);
424
425         // Get all of the auth refs and check that the expected number is returned
426         ClientResponse<AuthorityRefList> res2 = collectionObjectClient.getAuthorityRefs(knownResourceId);
427         statusCode = res2.getStatus();
428
429         if(logger.isDebugEnabled()){
430             logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
431         }
432         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
433                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
434         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
435         AuthorityRefList list = res2.getEntity();
436         
437         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
438         int numAuthRefsFound = items.size();
439         if(logger.isDebugEnabled()){
440             logger.debug("Expected " + NUM_AUTH_REFS_EXPECTED +
441                 " authority references, found " + numAuthRefsFound);
442         }
443         Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
444             "Did not find all expected authority references! " +
445             "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
446
447         // Optionally output additional data about list members for debugging.
448         boolean iterateThroughList = true;
449         if(iterateThroughList && logger.isDebugEnabled()){;
450             int i = 0;
451             for(AuthorityRefList.AuthorityRefItem item : items){
452                 logger.debug(testName + ": list-item[" + i + "] Field:" +
453                                 item.getSourceField() + " =" +
454                         " item display name = " + item.getAuthDisplayName() +
455                         " auth display name = " + item.getItemDisplayName());
456                 logger.debug(testName + ": list-item[" + i + "] refName=" +
457                         item.getRefName());
458                 logger.debug(testName + ": list-item[" + i + "] URI=" +
459                         item.getUri());
460                 i++;
461             }
462         }
463     }
464
465
466     // ---------------------------------------------------------------
467     // Cleanup of resources created during testing
468     // ---------------------------------------------------------------
469
470     /**
471      * Deletes all resources created by tests, after all tests have been run.
472      *
473      * This cleanup method will always be run, even if one or more tests fail.
474      * For this reason, it attempts to remove all resources created
475      * at any point during testing, even if some of those resources
476      * may be expected to be deleted by certain tests.
477      */
478     @AfterClass(alwaysRun=true)
479     public void cleanUp() {
480         String noTest = System.getProperty("noTestCleanup");
481         if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
482             if (logger.isDebugEnabled()) {
483                 logger.debug("Skipping Cleanup phase ...");
484             }
485             return;
486         }
487         if (logger.isDebugEnabled()) {
488             logger.debug("Cleaning up temporary resources created for testing ...");
489         }
490         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
491         for (String resourceId : collectionObjectIdsCreated) {
492             // Note: Any non-success responses are ignored and not reported.
493             collectionObjectClient.delete(resourceId).releaseConnection();
494         }
495         // Note: Any non-success response is ignored and not reported.
496         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
497         // Delete persons before PersonAuth
498         for (String resourceId : personIdsCreated) {
499             // Note: Any non-success responses are ignored and not reported.
500             personAuthClient.deleteItem(personAuthCSID, resourceId).releaseConnection();
501         }
502         personAuthClient.delete(personAuthCSID).releaseConnection();
503         // Note: Any non-success response is ignored and not reported.
504         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
505         // Delete organizations before OrgAuth
506         for (String resourceId : orgIdsCreated) {
507             // Note: Any non-success responses are ignored and not reported.
508             orgAuthClient.deleteItem(orgAuthCSID, resourceId).releaseConnection();
509         }
510         orgAuthClient.delete(orgAuthCSID).releaseConnection();
511     }
512
513     // ---------------------------------------------------------------
514     // Utility methods used by tests above
515     // ---------------------------------------------------------------
516     /* (non-Javadoc)
517      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
518      */
519     @Override
520     public String getServicePathComponent() {
521         return SERVICE_PATH_COMPONENT;
522     }
523
524    /**
525     * Creates the collection object instance.
526     *
527     * @param title the title
528     * @param objNum the obj num
529     * @param contentOrganization the content organization
530     * @param contentPeople the content people
531     * @param contentPerson the content person
532     * @param inscriber the inscriber
533     * @return the multipart output
534     */
535    private MultipartOutput createCollectionObjectInstance(
536                 String title,
537                 String objNum,
538                 String contentOrganization,
539                 String contentPerson,
540                 String contentInscriber,
541                 String descriptionInscriber,
542                 String assocEventOrganization,
543                 String assocEventPerson,
544                 String assocOrganization,
545                 String assocPerson,
546                 String owner,
547                 String fieldCollectionSource,
548                 String fieldCollector ) {
549         CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
550         collectionObject.setTitle(title);
551         collectionObject.setObjectNumber(objNum);
552         collectionObject.setInscriptionContentInscriber(contentInscriber);
553         collectionObject.setInscriptionDescriptionInscriber(descriptionInscriber);
554
555         ContentOrganizationList contentOrganizationList = new ContentOrganizationList();
556         List<String> contentOrganizations = contentOrganizationList.getContentOrganization();
557         contentOrganizations.add(contentOrganization);
558         collectionObject.setContentOrganizations(contentOrganizationList);
559
560         ContentPersonList contentPersonList = new ContentPersonList();
561         List<String> contentPersons = contentPersonList.getContentPerson();
562         contentPersons.add(contentPerson);
563         collectionObject.setContentPersons(contentPersonList);
564
565         AssocEventOrganizationList assocEventOrganizationList = new AssocEventOrganizationList();
566         List<String> assocEventOrganizations = assocEventOrganizationList.getAssocEventOrganization();
567         assocEventOrganizations.add(assocEventOrganization);
568         collectionObject.setAssocEventOrganizations(assocEventOrganizationList);
569
570         AssocEventPersonList assocEventPersonList = new AssocEventPersonList();
571         List<String> assocEventPersons = assocEventPersonList.getAssocEventPerson();
572         assocEventPersons.add(assocEventPerson);
573         collectionObject.setAssocEventPersons(assocEventPersonList);
574
575         AssocOrganizationList assocOrganizationList = new AssocOrganizationList();
576         List<String> assocOrganizations = assocOrganizationList.getAssocOrganization();
577         assocOrganizations.add(assocOrganization);
578         collectionObject.setAssocOrganizations(assocOrganizationList);
579
580         AssocPersonList assocPersonList = new AssocPersonList();
581         List<String> assocPersons = assocPersonList.getAssocPerson();
582         assocPersons.add(assocPerson);
583         collectionObject.setAssocPersons(assocPersonList);
584         
585         OwnerList ownerList = new OwnerList();
586         List<String> owners = ownerList.getOwner();
587         owners.add(owner);
588         collectionObject.setOwners(ownerList);
589         
590         FieldCollectionSourceList fieldCollectionSourceList = new FieldCollectionSourceList();
591         List<String> fieldCollectionSources = fieldCollectionSourceList.getFieldCollectionSource();
592         fieldCollectionSources.add(fieldCollectionSource);
593         collectionObject.setFieldCollectionSources(fieldCollectionSourceList);
594         
595         FieldCollectorList FieldCollectorList = new FieldCollectorList();
596         List<String> fieldCollectors = FieldCollectorList.getFieldCollector();
597         fieldCollectors.add(fieldCollector);
598         collectionObject.setFieldCollectors(FieldCollectorList);
599
600         MultipartOutput multipart = new MultipartOutput();
601         OutputPart commonPart =
602             multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
603         commonPart.getHeaders().add("label", new CollectionObjectClient().getCommonPartName());
604
605         if(logger.isDebugEnabled()){
606             logger.debug("to be created, collectionObject common");
607             logger.debug(objectAsXmlString(collectionObject, CollectionobjectsCommon.class));
608         }
609
610         return multipart;
611     }
612
613 }