You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fg...@apache.org on 2010/03/09 15:55:37 UTC
svn commit: r920905 - in
/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple:
SimpleConnection.java SimpleObjectEntry.java
Author: fguillaume
Date: Tue Mar 9 14:55:37 2010
New Revision: 920905
URL: http://svn.apache.org/viewvc?rev=920905&view=rev
Log:
Default allowable actions for in-memory implementation
Modified:
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java
Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java?rev=920905&r1=920904&r2=920905&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java Tue Mar 9 14:55:37 2010
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -43,7 +42,6 @@ import org.antlr.runtime.tree.CommonTree
import org.antlr.runtime.tree.CommonTreeNodeStream;
import org.apache.chemistry.ACE;
import org.apache.chemistry.ACLPropagation;
-import org.apache.chemistry.AllowableAction;
import org.apache.chemistry.BaseType;
import org.apache.chemistry.CMISObject;
import org.apache.chemistry.CMISRuntimeException;
@@ -481,10 +479,7 @@ public class SimpleConnection implements
}
public Set<QName> getAllowableActions(ObjectId object) {
- // TODO see SimpleObjectEntry.getAllowableActions
- Set<QName> set = new HashSet<QName>();
- set.add(AllowableAction.CAN_UPDATE_PROPERTIES);
- return set;
+ return getProperties(object, null).getAllowableActions();
}
public ObjectEntry getProperties(ObjectId object, Inclusion inclusion) {
Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java?rev=920905&r1=920904&r2=920905&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObjectEntry.java Tue Mar 9 14:55:37 2010
@@ -149,9 +149,49 @@ public class SimpleObjectEntry implement
}
public Set<QName> getAllowableActions() {
- // TODO see SimpleConnection.getAllowableActions
+ boolean canWrite = true;
+ boolean isFolder = getBaseType() == BaseType.FOLDER;
Set<QName> set = new HashSet<QName>();
- set.add(AllowableAction.CAN_UPDATE_PROPERTIES);
+ set.add(AllowableAction.CAN_GET_OBJECT_PARENTS);
+ set.add(AllowableAction.CAN_GET_PROPERTIES);
+ if (isFolder) {
+ set.add(AllowableAction.CAN_GET_DESCENDANTS);
+ set.add(AllowableAction.CAN_GET_FOLDER_PARENT);
+ set.add(AllowableAction.CAN_GET_FOLDER_TREE);
+ set.add(AllowableAction.CAN_GET_CHILDREN);
+ } else {
+ set.add(AllowableAction.CAN_GET_CONTENT_STREAM);
+ }
+ if (canWrite) {
+ if (isFolder) {
+ set.add(AllowableAction.CAN_CREATE_DOCUMENT);
+ set.add(AllowableAction.CAN_CREATE_FOLDER);
+ set.add(AllowableAction.CAN_CREATE_RELATIONSHIP);
+ set.add(AllowableAction.CAN_DELETE_TREE);
+ set.add(AllowableAction.CAN_ADD_OBJECT_TO_FOLDER);
+ set.add(AllowableAction.CAN_REMOVE_OBJECT_FROM_FOLDER);
+ } else {
+ set.add(AllowableAction.CAN_SET_CONTENT_STREAM);
+ set.add(AllowableAction.CAN_DELETE_CONTENT_STREAM);
+ }
+ set.add(AllowableAction.CAN_UPDATE_PROPERTIES);
+ set.add(AllowableAction.CAN_MOVE_OBJECT);
+ set.add(AllowableAction.CAN_DELETE_OBJECT);
+ }
+ if (Boolean.FALSE.booleanValue()) {
+ // TODO
+ set.add(AllowableAction.CAN_GET_RENDITIONS);
+ set.add(AllowableAction.CAN_CHECK_OUT);
+ set.add(AllowableAction.CAN_CANCEL_CHECK_OUT);
+ set.add(AllowableAction.CAN_CHECK_IN);
+ set.add(AllowableAction.CAN_GET_ALL_VERSIONS);
+ set.add(AllowableAction.CAN_GET_OBJECT_RELATIONSHIPS);
+ set.add(AllowableAction.CAN_APPLY_POLICY);
+ set.add(AllowableAction.CAN_REMOVE_POLICY);
+ set.add(AllowableAction.CAN_GET_APPLIED_POLICIES);
+ set.add(AllowableAction.CAN_GET_ACL);
+ set.add(AllowableAction.CAN_APPLY_ACL);
+ }
return set;
}