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.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;
39 public class CollectionObjectFactory {
40 static private final Logger logger = LoggerFactory.getLogger(CollectionObjectFactory.class);
42 final static String SERVICE_PATH_COMPONENT = "collectionobjects";
45 * create account instance
50 * @param useScreenName
52 * @param invalidTenant
59 * Creates the collection object instance.
61 * @param commonPartName the common part name
62 * @param collectionObject the collection object
64 * @param nhPartname natural history part name
65 * @param conh the conh
66 * @return the multipart output
68 public static PoxPayloadOut createCollectionObjectInstance(String commonPartName,
69 CollectionobjectsCommon collectionObjectCommon,
70 String nhPartName, CollectionobjectsNaturalhistory conh) {
72 PoxPayloadOut multipart = new PoxPayloadOut(getServicePathComponent());
73 PayloadOutputPart commonPart =
74 multipart.addPart(collectionObjectCommon, MediaType.APPLICATION_XML_TYPE);
75 commonPart.setLabel(commonPartName);
78 PayloadOutputPart nhPart = multipart.addPart(conh, MediaType.APPLICATION_XML_TYPE);
79 nhPart.setLabel(nhPartName);
84 public static String getServicePathComponent() {
85 return SERVICE_PATH_COMPONENT;