]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
2af0aa313b8603c8beb3c2de2a59ecbd62636706
[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 org.collectionspace.services.client.PayloadOutputPart;
28 import org.collectionspace.services.client.PoxPayloadOut;
29 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
30 import org.collectionspace.services.collectionobject.domain.naturalhistory.CollectionobjectsNaturalhistory;
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
33
34 /**
35  *
36  * @author 
37  */
38 public class CollectionObjectFactory {
39     static private final Logger logger = LoggerFactory.getLogger(CollectionObjectFactory.class);
40
41     final static String SERVICE_PATH_COMPONENT = "collectionobjects";
42
43     /**
44      * create account instance
45      * @param screenName
46      * @param userName
47      * @param passwd
48      * @param email
49      * @param useScreenName
50      * @param addTenant
51      * @param invalidTenant
52      * @param useUser
53      * @param usePassword
54      * @return
55      */
56
57     public static PoxPayloadOut createCollectionObjectInstance(String commonPartName,
58             CollectionobjectsCommon collectionObjectCommon) {
59
60         PoxPayloadOut multipart = new PoxPayloadOut(getServicePathComponent());
61         PayloadOutputPart commonPart =
62                 multipart.addPart(commonPartName, collectionObjectCommon);
63
64         return multipart;
65     }    
66     /**
67      * Creates the collection object instance.
68      *
69      * @param commonPartName the common part name
70      * @param collectionObject the collection object
71      * @param nhPartName 
72      * @param nhPartname natural history part name
73      * @param conh the conh
74      * @return the multipart output
75      */
76     public static PoxPayloadOut createCollectionObjectInstance(String commonPartName,
77             CollectionobjectsCommon collectionObjectCommon,
78             String nhPartName, CollectionobjectsNaturalhistory conh) {
79
80         PoxPayloadOut multipart = new PoxPayloadOut(getServicePathComponent());
81         PayloadOutputPart commonPart =
82                 multipart.addPart(commonPartName, collectionObjectCommon);
83         commonPart.setLabel(commonPartName);
84
85         if (conh != null) {
86             PayloadOutputPart nhPart = multipart.addPart(nhPartName, conh);
87             nhPart.setLabel(nhPartName);
88         }
89         
90         return multipart;
91     }
92
93     public static String getServicePathComponent() {
94         return SERVICE_PATH_COMPONENT;
95     }
96
97 }