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