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/11 07:08:29 UTC
svn commit: r1200743 -
/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/
Author: fmui
Date: Fri Nov 11 06:08:28 2011
New Revision: 1200743
URL: http://svn.apache.org/viewvc?rev=1200743&view=rev
Log:
more browser binding code
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.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/BrowserBindingUtils.java?rev=1200743&r1=1200742&r2=1200743&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java Fri Nov 11 06:08:28 2011
@@ -93,6 +93,7 @@ public class BrowserBindingUtils {
public static final String SELECTOR_CHECKEDOUT = "checkedout";
public static final String SELECTOR_POLICIES = "policies";
public static final String SELECTOR_ACL = "acl";
+ public static final String SELECTOR_CONTENT_CHANGES = "contentChanges";
public static final String CMISACTION_CREATE_DOCUMENT = "createDocument";
public static final String CMISACTION_CREATE_DOCUMENT_FROM_SOURCE = "createDocumentFromSource";
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.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/CmisBrowserBindingServlet.java?rev=1200743&r1=1200742&r2=1200743&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java Fri Nov 11 06:08:28 2011
@@ -20,6 +20,7 @@ package org.apache.chemistry.opencmis.se
import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_OBJECT_ID;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_ADD_OBJECT_TO_FOLDER;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_APPLY_ACL;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_APPLY_POLICY;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_CANCEL_CHECK_OUT;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_CHECK_IN;
@@ -45,9 +46,11 @@ import static org.apache.chemistry.openc
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.JSON_MIME_TYPE;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.PARAM_SELECTOR;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.PARAM_SUPPRESS_RESPONSE_CODES;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_ACL;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_CHECKEDOUT;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_CHILDREN;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_CONTENT;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_CONTENT_CHANGES;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_DESCENDANTS;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_FOLDER_TREE;
import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.SELECTOR_LAST_RESULT;
@@ -154,6 +157,11 @@ public class CmisBrowserBindingServlet e
repositoryDispatcher.addResource(SELECTOR_TYPE_DEFINITION, METHOD_GET, RepositoryService.class,
"getTypeDefinition");
repositoryDispatcher.addResource(SELECTOR_QUERY, METHOD_GET, DiscoveryService.class, "query");
+ repositoryDispatcher.addResource(SELECTOR_CHECKEDOUT, METHOD_GET, NavigationService.class,
+ "getCheckedOutDocs");
+ repositoryDispatcher.addResource(SELECTOR_CONTENT_CHANGES, METHOD_GET, DiscoveryService.class,
+ "getContentChanges");
+
repositoryDispatcher.addResource(CMISACTION_QUERY, METHOD_POST, DiscoveryService.class, "query");
repositoryDispatcher.addResource(CMISACTION_CREATE_DOCUMENT, METHOD_POST, ObjectService.class,
"createDocument");
@@ -163,8 +171,6 @@ public class CmisBrowserBindingServlet e
.addResource(CMISACTION_CREATE_POLICY, METHOD_POST, ObjectService.class, "createPolicy");
repositoryDispatcher.addResource(CMISACTION_CREATE_RELATIONSHIP, METHOD_POST, ObjectService.class,
"createRelationship");
- repositoryDispatcher.addResource(SELECTOR_CHECKEDOUT, METHOD_GET, DiscoveryService.class,
- "getCheckedOutDocs");
rootDispatcher.addResource(SELECTOR_OBJECT, METHOD_GET, ObjectService.class, "getObject");
rootDispatcher.addResource(SELECTOR_PROPERTIES, METHOD_GET, ObjectService.class, "getProperties");
@@ -178,8 +184,9 @@ public class CmisBrowserBindingServlet e
rootDispatcher.addResource(SELECTOR_VERSIONS, METHOD_GET, VersioningService.class, "getAllVersions");
rootDispatcher.addResource(SELECTOR_RELATIONSHIPS, METHOD_GET, RelationshipService.class,
"getObjectRelationships");
- rootDispatcher.addResource(SELECTOR_CHECKEDOUT, METHOD_GET, DiscoveryService.class, "getCheckedOutDocs");
+ rootDispatcher.addResource(SELECTOR_CHECKEDOUT, METHOD_GET, NavigationService.class, "getCheckedOutDocs");
rootDispatcher.addResource(SELECTOR_POLICIES, METHOD_GET, PolicyService.class, "getAppliedPolicies");
+ rootDispatcher.addResource(SELECTOR_ACL, METHOD_GET, AclService.class, "getACL");
rootDispatcher.addResource(CMISACTION_CREATE_DOCUMENT, METHOD_POST, ObjectService.class, "createDocument");
rootDispatcher.addResource(CMISACTION_CREATE_DOCUMENT_FROM_SOURCE, METHOD_POST, ObjectService.class,
@@ -202,6 +209,7 @@ public class CmisBrowserBindingServlet e
rootDispatcher.addResource(CMISACTION_CHECK_IN, METHOD_POST, VersioningService.class, "checkIn");
rootDispatcher.addResource(CMISACTION_APPLY_POLICY, METHOD_POST, PolicyService.class, "applyPolicy");
rootDispatcher.addResource(CMISACTION_REMOVE_POLICY, METHOD_POST, PolicyService.class, "removePolicy");
+ rootDispatcher.addResource(CMISACTION_APPLY_ACL, METHOD_POST, AclService.class, "applyACL");
} catch (NoSuchMethodException e) {
LOG.error("Cannot initialize dispatcher!", e);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.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/DiscoveryService.java?rev=1200743&r1=1200742&r2=1200743&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.java Fri Nov 11 06:08:28 2011
@@ -18,14 +18,11 @@
*/
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_ACL;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_CHANGE_LOG_TOKEN;
import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_FILTER;
-import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_MAX_ITEMS;
-import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_ORDER_BY;
-import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_RELATIONSHIPS;
-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.server.impl.browser.BrowserBindingUtils.CONTEXT_OBJECT_ID;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_POLICY_IDS;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_PROPERTIES;
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;
@@ -42,6 +39,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.Constants;
import org.apache.chemistry.opencmis.commons.server.CallContext;
import org.apache.chemistry.opencmis.commons.server.CmisService;
+import org.apache.chemistry.opencmis.commons.spi.Holder;
import org.apache.chemistry.opencmis.server.impl.browser.json.JSONConverter;
import org.json.simple.JSONObject;
@@ -54,36 +52,8 @@ public class DiscoveryService {
}
/**
- * getCheckedOutDocs.
+ * query.
*/
- public static void getCheckedOutDocs(CallContext context, CmisService service, String repositoryId,
- HttpServletRequest request, HttpServletResponse response) throws Exception {
- // get parameters
- String folderId = (String) context.get(CONTEXT_OBJECT_ID);
- String filter = getStringParameter(request, PARAM_FILTER);
- String orderBy = getStringParameter(request, PARAM_ORDER_BY);
- Boolean includeAllowableActions = getBooleanParameter(request, PARAM_ALLOWABLE_ACTIONS);
- IncludeRelationships includeRelationships = getEnumParameter(request, PARAM_RELATIONSHIPS,
- IncludeRelationships.class);
- String renditionFilter = getStringParameter(request, PARAM_RENDITION_FILTER);
- BigInteger maxItems = getBigIntegerParameter(request, PARAM_MAX_ITEMS);
- BigInteger skipCount = getBigIntegerParameter(request, PARAM_SKIP_COUNT);
-
- // execute
- ObjectList checkedout = service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
- includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, null);
-
- if (checkedout == null) {
- throw new CmisRuntimeException("Checked out list is null!");
- }
-
- TypeCache typeCache = new TypeCache(repositoryId, service);
- JSONObject jsonCheckedOut = JSONConverter.convert(checkedout, typeCache);
-
- response.setStatus(HttpServletResponse.SC_OK);
- BrowserBindingUtils.writeJSON(jsonCheckedOut, request, response);
- }
-
public static void query(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
HttpServletResponse response) throws Exception {
// get parameters
@@ -92,7 +62,7 @@ public class DiscoveryService {
Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
IncludeRelationships includeRelationships = getEnumParameter(request, Constants.PARAM_RELATIONSHIPS,
IncludeRelationships.class);
- String renditionFilter = null;
+ String renditionFilter = getStringParameter(request, Constants.PARAM_RENDITION_FILTER);
BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
@@ -110,4 +80,32 @@ public class DiscoveryService {
response.setStatus(HttpServletResponse.SC_OK);
BrowserBindingUtils.writeJSON(jsonResults, request, response);
}
+
+ /**
+ * getContentChanges.
+ */
+ @SuppressWarnings("unchecked")
+ public static void getContentChanges(CallContext context, CmisService service, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // get parameters
+ String changeLogToken = getStringParameter(request, PARAM_CHANGE_LOG_TOKEN);
+ Boolean includeProperties = getBooleanParameter(request, PARAM_PROPERTIES);
+ String filter = getStringParameter(request, PARAM_FILTER);
+ Boolean includePolicyIds = getBooleanParameter(request, PARAM_POLICY_IDS);
+ Boolean includeAcl = getBooleanParameter(request, PARAM_ACL);
+ BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
+
+ Holder<String> changeLogTokenHolder = new Holder<String>(changeLogToken);
+ ObjectList changes = service.getContentChanges(repositoryId, changeLogTokenHolder, includeProperties, filter,
+ includePolicyIds, includeAcl, maxItems, null);
+
+ JSONObject jsonChanges = new JSONObject();
+ jsonChanges.put("changeLogToken", changeLogTokenHolder.getValue());
+
+ TypeCache typeCache = new TypeCache(repositoryId, service);
+ jsonChanges.put("objects", JSONConverter.convert(changes, typeCache));
+
+ response.setStatus(HttpServletResponse.SC_OK);
+ BrowserBindingUtils.writeJSON(jsonChanges, request, response);
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.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/NavigationService.java?rev=1200743&r1=1200742&r2=1200743&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java Fri Nov 11 06:08:28 2011
@@ -43,6 +43,7 @@ import javax.servlet.http.HttpServletRes
import org.apache.chemistry.opencmis.commons.data.ObjectData;
import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer;
import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
+import org.apache.chemistry.opencmis.commons.data.ObjectList;
import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
@@ -216,4 +217,35 @@ public final class NavigationService {
response.setStatus(HttpServletResponse.SC_OK);
BrowserBindingUtils.writeJSON(jsonParents, request, response);
}
+
+ /**
+ * getCheckedOutDocs.
+ */
+ public static void getCheckedOutDocs(CallContext context, CmisService service, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // get parameters
+ String folderId = (String) context.get(CONTEXT_OBJECT_ID);
+ String filter = getStringParameter(request, PARAM_FILTER);
+ String orderBy = getStringParameter(request, PARAM_ORDER_BY);
+ Boolean includeAllowableActions = getBooleanParameter(request, PARAM_ALLOWABLE_ACTIONS);
+ IncludeRelationships includeRelationships = getEnumParameter(request, PARAM_RELATIONSHIPS,
+ IncludeRelationships.class);
+ String renditionFilter = getStringParameter(request, PARAM_RENDITION_FILTER);
+ BigInteger maxItems = getBigIntegerParameter(request, PARAM_MAX_ITEMS);
+ BigInteger skipCount = getBigIntegerParameter(request, PARAM_SKIP_COUNT);
+
+ // execute
+ ObjectList checkedout = service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
+ includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, null);
+
+ if (checkedout == null) {
+ throw new CmisRuntimeException("Checked out list is null!");
+ }
+
+ TypeCache typeCache = new TypeCache(repositoryId, service);
+ JSONObject jsonCheckedOut = JSONConverter.convert(checkedout, typeCache);
+
+ response.setStatus(HttpServletResponse.SC_OK);
+ BrowserBindingUtils.writeJSON(jsonCheckedOut, request, response);
+ }
}