]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
a5587eb3e71d18e7c92314b69bd07369f0a7d2ea
[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.collectionobject.CollectionobjectsCommon;
29 import org.collectionspace.services.collectionobject.domain.naturalhistory.CollectionobjectsNaturalhistory;
30 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
31 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
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     /**
43      * create account instance
44      * @param screenName
45      * @param userName
46      * @param passwd
47      * @param email
48      * @param useScreenName
49      * @param addTenant
50      * @param invalidTenant
51      * @param useUser
52      * @param usePassword
53      * @return
54      */
55
56     /**
57      * Creates the collection object instance.
58      *
59      * @param commonPartName the common part name
60      * @param collectionObject the collection object
61      * @param nhPartname natural history part name
62      * @param conh the conh
63      * @return the multipart output
64      */
65     public static MultipartOutput createCollectionObjectInstance(String commonPartName,
66             CollectionobjectsCommon collectionObject,
67             String nhPartName, CollectionobjectsNaturalhistory conh) {
68
69         MultipartOutput multipart = new MultipartOutput();
70         OutputPart commonPart = multipart.addPart(collectionObject,
71                 MediaType.APPLICATION_XML_TYPE);
72         commonPart.getHeaders().add("label", commonPartName);
73
74         if (conh != null) {
75             OutputPart nhPart = multipart.addPart(conh, MediaType.APPLICATION_XML_TYPE);
76             nhPart.getHeaders().add("label", nhPartName);
77         }
78         return multipart;
79
80     }
81
82
83 }