chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1199559 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser: CmisBrowserBindingServlet.java ObjectService.java
Date Wed, 09 Nov 2011 00:05:53 GMT
Author: fmui
Date: Wed Nov  9 00:05:52 2011
New Revision: 1199559

URL: http://svn.apache.org/viewvc?rev=1199559&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/CmisBrowserBindingServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java

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=1199559&r1=1199558&r2=1199559&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
Wed Nov  9 00:05:52 2011
@@ -24,6 +24,8 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_CHECK_OUT;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_CREATE_DOCUMENT;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_CREATE_FOLDER;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_CREATE_POLICY;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_CREATE_RELATIONSHIP;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_DELETE;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_DELETE_CONTENT;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CMISACTION_DELETE_TREE;
@@ -149,7 +151,11 @@ public class CmisBrowserBindingServlet e
             repositoryDispatcher.addResource(CMISACTION_QUERY, METHOD_POST, DiscoveryService.class,
"query");
             repositoryDispatcher.addResource(CMISACTION_CREATE_DOCUMENT, METHOD_POST, ObjectService.class,
                     "createDocument");
-            repositoryDispatcher.addResource(SELECTOR_CHECKEDOUT, METHOD_GET, RelationshipService.class,
+            repositoryDispatcher
+                    .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");
@@ -164,10 +170,11 @@ 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, RelationshipService.class,
"getCheckedOutDocs");
+            rootDispatcher.addResource(SELECTOR_CHECKEDOUT, METHOD_GET, DiscoveryService.class,
"getCheckedOutDocs");
 
             rootDispatcher.addResource(CMISACTION_CREATE_DOCUMENT, METHOD_POST, ObjectService.class,
"createDocument");
             rootDispatcher.addResource(CMISACTION_CREATE_FOLDER, METHOD_POST, ObjectService.class,
"createFolder");
+            rootDispatcher.addResource(CMISACTION_CREATE_POLICY, METHOD_POST, ObjectService.class,
"createPolicy");
             rootDispatcher.addResource(CMISACTION_SET_CONTENT, METHOD_POST, ObjectService.class,
"setContentStream");
             rootDispatcher.addResource(CMISACTION_DELETE_CONTENT, METHOD_POST, ObjectService.class,
                     "deleteContentStream");

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.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/ObjectService.java?rev=1199559&r1=1199558&r2=1199559&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
Wed Nov  9 00:05:52 2011
@@ -154,6 +154,67 @@ public final class ObjectService {
     }
 
     /**
+     * Create policy.
+     */
+    public static void createPolicy(CallContext context, CmisService service, String repositoryId,
+            HttpServletRequest request, HttpServletResponse response) throws Exception {
+        // get parameters
+        String folderId = (String) context.get(CONTEXT_OBJECT_ID);
+        String transaction = getStringParameter(request, PARAM_TRANSACTION);
+
+        // execute
+        ControlParser cp = new ControlParser(request);
+        TypeCache typeCache = new TypeCache(repositoryId, service);
+
+        String newObjectId = service.createPolicy(repositoryId, createProperties(cp, null,
typeCache), folderId,
+                createPolicies(cp), createAddAcl(cp), createRemoveAcl(cp), null);
+
+        ObjectData object = getSimpleObject(service, repositoryId, newObjectId);
+        if (object == null) {
+            throw new CmisRuntimeException("New policy is null!");
+        }
+
+        // return object
+        JSONObject jsonObject = JSONConverter.convert(object, typeCache);
+
+        response.setStatus(HttpServletResponse.SC_CREATED);
+        setCookie(request, response, repositoryId, transaction,
+                createCookieValue(HttpServletResponse.SC_CREATED, object.getId(), null, null));
+
+        writeJSON(jsonObject, request, response);
+    }
+
+    /**
+     * Create relationship.
+     */
+    public static void createRelationship(CallContext context, CmisService service, String
repositoryId,
+            HttpServletRequest request, HttpServletResponse response) throws Exception {
+        // get parameters
+        String transaction = getStringParameter(request, PARAM_TRANSACTION);
+
+        // execute
+        ControlParser cp = new ControlParser(request);
+        TypeCache typeCache = new TypeCache(repositoryId, service);
+
+        String newObjectId = service.createRelationship(repositoryId, createProperties(cp,
null, typeCache),
+                createPolicies(cp), createAddAcl(cp), createRemoveAcl(cp), null);
+
+        ObjectData object = getSimpleObject(service, repositoryId, newObjectId);
+        if (object == null) {
+            throw new CmisRuntimeException("New relationship is null!");
+        }
+
+        // return object
+        JSONObject jsonObject = JSONConverter.convert(object, typeCache);
+
+        response.setStatus(HttpServletResponse.SC_CREATED);
+        setCookie(request, response, repositoryId, transaction,
+                createCookieValue(HttpServletResponse.SC_CREATED, object.getId(), null, null));
+
+        writeJSON(jsonObject, request, response);
+    }
+
+    /**
      * updateProperties.
      */
     public static void updateProperties(CallContext context, CmisService service, String
repositoryId,



Mime
View raw message