]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
498546f6a6499bbe1f83ef902dbde4034c056c41
[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 University of California at Berkeley
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
16  *  https://source.collectionspace.org/collection-space/LICENSE.txt
17
18  *  Unless required by applicable law or agreed to in writing, software
19  *  distributed under the License is distributed on an "AS IS" BASIS,
20  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  *  See the License for the specific language governing permissions and
22  *  limitations under the License.
23  */
24
25 package org.collectionspace.services.client;
26
27 import javax.ws.rs.core.MediaType;
28 import org.collectionspace.services.client.PayloadOutputPart;
29 import org.collectionspace.services.client.PoxPayloadOut;
30 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
31 import org.collectionspace.services.collectionobject.domain.naturalhistory.CollectionobjectsNaturalhistory;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
34
35 /**
36  *
37  * @author 
38  */
39 public class CollectionObjectFactory {
40     static private final Logger logger = LoggerFactory.getLogger(CollectionObjectFactory.class);
41
42     final static String SERVICE_PATH_COMPONENT = "collectionobjects";
43
44     /**
45      * create account instance
46      * @param screenName
47      * @param userName
48      * @param passwd
49      * @param email
50      * @param useScreenName
51      * @param addTenant
52      * @param invalidTenant
53      * @param useUser
54      * @param usePassword
55      * @return
56      */
57
58     /**
59      * Creates the collection object instance.
60      *
61      * @param commonPartName the common part name
62      * @param collectionObject the collection object
63      * @param nhPartName 
64      * @param nhPartname natural history part name
65      * @param conh the conh
66      * @return the multipart output
67      */
68     public static PoxPayloadOut createCollectionObjectInstance(String commonPartName,
69             CollectionobjectsCommon collectionObjectCommon,
70             String nhPartName, CollectionobjectsNaturalhistory conh) {
71
72         PoxPayloadOut multipart = new PoxPayloadOut(getServicePathComponent());
73         PayloadOutputPart commonPart =
74                 multipart.addPart(collectionObjectCommon, MediaType.APPLICATION_XML_TYPE);
75         commonPart.setLabel(commonPartName);
76
77         if (conh != null) {
78             PayloadOutputPart nhPart = multipart.addPart(conh, MediaType.APPLICATION_XML_TYPE);
79             nhPart.setLabel(nhPartName);
80         }
81         return multipart;
82     }
83
84     public static String getServicePathComponent() {
85         return SERVICE_PATH_COMPONENT;
86     }
87
88 }