You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2011/11/08 01:44:04 UTC
svn commit: r1199032 -
/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RelationshipService.java
Author: fmui
Date: Tue Nov 8 00:44:04 2011
New Revision: 1199032
URL: http://svn.apache.org/viewvc?rev=1199032&view=rev
Log:
added missing file
Added:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RelationshipService.java (with props)
Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RelationshipService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RelationshipService.java?rev=1199032&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RelationshipService.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RelationshipService.java Tue Nov 8 00:44:04 2011
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.server.impl.browser;
+
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_ALLOWABLE_ACTIONS;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_MAX_ITEMS;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_RELATIONSHIP_DIRECTION;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_RENDITION_FILTER;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_SKIP_COUNT;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_SUB_RELATIONSHIP_TYPES;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_TYPE_ID;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTEXT_OBJECT_ID;
+import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
+import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
+import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getEnumParameter;
+import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
+
+import java.math.BigInteger;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.chemistry.opencmis.commons.data.ObjectList;
+import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
+import org.apache.chemistry.opencmis.commons.server.CmisService;
+import org.apache.chemistry.opencmis.server.impl.browser.json.JSONConverter;
+import org.json.simple.JSONObject;
+
+public class RelationshipService {
+
+ /**
+ * getObjectRelationships.
+ */
+ public static void getObjectRelationships(CallContext context, CmisService service, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // get parameters
+ String objectId = (String) context.get(CONTEXT_OBJECT_ID);
+
+ Boolean includeSubRelationshipTypes = getBooleanParameter(request, PARAM_SUB_RELATIONSHIP_TYPES);
+ RelationshipDirection relationshipDirection = getEnumParameter(request, PARAM_RELATIONSHIP_DIRECTION,
+ RelationshipDirection.class);
+ String typeId = getStringParameter(request, PARAM_TYPE_ID);
+ String renditionFilter = getStringParameter(request, PARAM_RENDITION_FILTER);
+ Boolean includeAllowableActions = getBooleanParameter(request, PARAM_ALLOWABLE_ACTIONS);
+ BigInteger maxItems = getBigIntegerParameter(request, PARAM_MAX_ITEMS);
+ BigInteger skipCount = getBigIntegerParameter(request, PARAM_SKIP_COUNT);
+
+ // execute
+ ObjectList relationships = service.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes,
+ relationshipDirection, typeId, renditionFilter, includeAllowableActions, maxItems, skipCount, null);
+
+ if (relationships == null) {
+ throw new CmisRuntimeException("Relationships are null!");
+ }
+
+ JSONObject jsonChildren = JSONConverter.convert(relationships);
+
+ response.setStatus(HttpServletResponse.SC_OK);
+ BrowserBindingUtils.writeJSON(jsonChildren, request, response);
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RelationshipService.java
------------------------------------------------------------------------------
svn:eol-style = native