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 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;
38 public class CollectionObjectFactory {
39 static private final Logger logger = LoggerFactory.getLogger(CollectionObjectFactory.class);
41 final static String SERVICE_PATH_COMPONENT = "collectionobjects";
44 * create account instance
49 * @param useScreenName
51 * @param invalidTenant
57 public static PoxPayloadOut createCollectionObjectInstance(String commonPartName,
58 CollectionobjectsCommon collectionObjectCommon) {
60 PoxPayloadOut multipart = new PoxPayloadOut(getServicePathComponent());
61 PayloadOutputPart commonPart =
62 multipart.addPart(commonPartName, collectionObjectCommon);
67 * Creates the collection object instance.
69 * @param commonPartName the common part name
70 * @param collectionObject the collection object
72 * @param nhPartname natural history part name
73 * @param conh the conh
74 * @return the multipart output
76 public static PoxPayloadOut createCollectionObjectInstance(String commonPartName,
77 CollectionobjectsCommon collectionObjectCommon,
78 String nhPartName, CollectionobjectsNaturalhistory conh) {
80 PoxPayloadOut multipart = new PoxPayloadOut(getServicePathComponent());
81 PayloadOutputPart commonPart =
82 multipart.addPart(commonPartName, collectionObjectCommon);
83 commonPart.setLabel(commonPartName);
86 PayloadOutputPart nhPart = multipart.addPart(nhPartName, conh);
87 nhPart.setLabel(nhPartName);
93 public static String getServicePathComponent() {
94 return SERVICE_PATH_COMPONENT;