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:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
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.
25 package org.collectionspace.services.client;
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;
39 public class CollectionObjectFactory {
40 static private final Logger logger = LoggerFactory.getLogger(CollectionObjectFactory.class);
43 * create account instance
48 * @param useScreenName
50 * @param invalidTenant
57 * Creates the collection object instance.
59 * @param commonPartName the common part name
60 * @param collectionObject the collection object
62 * @param nhPartname natural history part name
63 * @param conh the conh
64 * @return the multipart output
66 public static MultipartOutput createCollectionObjectInstance(String commonPartName,
67 CollectionobjectsCommon collectionObject,
68 String nhPartName, CollectionobjectsNaturalhistory conh) {
70 MultipartOutput multipart = new MultipartOutput();
71 OutputPart commonPart = multipart.addPart(collectionObject,
72 MediaType.APPLICATION_XML_TYPE);
73 commonPart.getHeaders().add("label", commonPartName);
76 OutputPart nhPart = multipart.addPart(conh, MediaType.APPLICATION_XML_TYPE);
77 nhPart.getHeaders().add("label", nhPartName);