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