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.
24 package org.collectionspace.services.movement.nuxeo;
26 import javax.ws.rs.core.MultivaluedMap;
28 import org.collectionspace.services.client.IQueryManager;
29 import org.collectionspace.services.movement.MovementResource;
30 import org.collectionspace.services.movement.MovementsCommon;
31 import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
36 * The Class MovementDocumentModelHandler.
38 * $LastChangedRevision$
41 public class MovementDocumentModelHandler
42 extends DocHandlerBase<MovementsCommon> {
44 final Logger logger = LoggerFactory.getLogger(MovementDocumentModelHandler.class);
47 * Creates the CMIS query from the service context. Each document handler is responsible for returning a valid CMIS query using the
48 * information in the current service context -which includes things like the query parameters, etc.
51 public String getCMISQuery() {
54 String subjectCsid = (String)getServiceContext().getQueryParams().get(IQueryManager.SEARCH_RELATED_TO_CSID_SUBJECT);
57 // For Debugging purposes only
59 String cmis_movement = System.getenv("CMIS_MOVEMENT");
61 if (cmis_movement != null && !cmis_movement.isEmpty()) {
62 result = cmis_movement;
64 result = "SELECT M.cmis:name, M.dc:title, R.dc:title, R.relations_common:subjectCsid "
65 + "FROM Movement M JOIN Relation R ON R.relations_common:objectCsid = M.cmis:name "
66 + "WHERE R.relations_common:subjectCsid = "
67 + "'" + subjectCsid + "'";
70 if (logger.isDebugEnabled() == true) {
71 logger.debug("The CMIS query for the Movement service is: " + result);