Author: fmui
Date: Wed Aug  8 10:40:34 2012
New Revision: 1370737

URL: http://svn.apache.org/viewvc?rev=1370737&view=rev
Log:
CMIS-524: implemented setAcl()

Added:
    
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ExtendedAclService.java
   (with props)
Modified:
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.java
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
    
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
    
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/AclPropagation.java
    
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/AclService.java
    
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
 Wed Aug  8 10:40:34 2012
@@ -129,15 +129,27 @@ public interface CmisObject extends Obje
     Acl applyAcl(List<Ace> addAces, List<Ace> removeAces, AclPropagation 
aclPropagation);
 
     /**
-     * Adds ACEs to the objec tand refreshes this object afterwards.
+     * Adds ACEs to the object and refreshes this object afterwards.
+     * 
+     * @return the new ACL of this object
      */
     Acl addAcl(List<Ace> addAces, AclPropagation aclPropagation);
 
     /**
      * Removes ACEs to the object and refreshes this object afterwards.
+     * 
+     * @return the new ACL of this object
      */
     Acl removeAcl(List<Ace> removeAces, AclPropagation aclPropagation);
 
+    /**
+     * Removes the direct ACE of this object, sets the provided ACEs to the
+     * object and refreshes this object afterwards.
+     * 
+     * @return the new ACL of this object
+     */
+    Acl setAcl(List<Ace> aces);
+
     // extensions
 
     /**

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
 Wed Aug  8 10:40:34 2012
@@ -515,21 +515,79 @@ public interface Session extends Seriali
 
     /**
      * Fetches the ACL of an object from the repository.
+     * 
+     * @param objectId
+     *            the id the object
+     * @param onlyBasicPermissions
+     *            if <code>true</code> the repository should express the ACL
+     *            only with the basic permissions defined in the CMIS
+     *            specification; if <code>false</code> the repository can
+     *            express the ACL with basic and repository specific 
permissions
+     * 
+     * @return the ACL of the object
      */
     Acl getAcl(ObjectId objectId, boolean onlyBasicPermissions);
 
     /**
-     * Applies an ACL to an object.
+     * Applies ACL changes to an object and potentially dependent objects.
+     * 
+     * Only direct ACEs can be added and removed.
+     * 
+     * @param objectId
+     *            the id the object
+     * @param addAces
+     *            list of ACEs to be added or <code>null</code> if no ACEs
+     *            should be added
+     * @param removeAces
+     *            list of ACEs to be removed or <code>null</code> if no ACEs
+     *            should be removed
+     * @param aclPropagation
+     *            value that defines the propagation of the ACE changes;
+     *            <code>null</code> is equal to
+     *            {@link AclPropagation#REPOSITORYDETERMINED}
+     * 
+     * @return the new ACL of the object
      */
     Acl applyAcl(ObjectId objectId, List<Ace> addAces, List<Ace> removeAces, 
AclPropagation aclPropagation);
 
     /**
+     * Removes the direct ACEs of an object and sets the provided ACEs.
+     * 
+     * The changes are local to the given object and are not propagated to
+     * dependent objects.
+     * 
+     * @param objectId
+     *            the id the object
+     * @param aces
+     *            list of ACEs to be set
+     * 
+     * @return the new ACL of the object
+     */
+    Acl setAcl(ObjectId objectId, List<Ace> aces);
+
+    /**
      * Applies a set of policies to an object.
+     * 
+     * This operation is not atomic. If it fails some policies might already be
+     * applied.
+     * 
+     * @param objectId
+     *            the id the object
+     * @param policyIds
+     *            the ids of the policies to be applied
      */
     void applyPolicy(ObjectId objectId, ObjectId... policyIds);
 
     /**
      * Removes a set of policies from an object.
+     * 
+     * This operation is not atomic. If it fails some policies might already be
+     * removed.
+     * 
+     * @param objectId
+     *            the id the object
+     * @param policyIds
+     *            the ids of the policies to be removed
      */
     void removePolicy(ObjectId objectId, ObjectId... policyIds);
 }

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
 Wed Aug  8 10:40:34 2012
@@ -26,11 +26,12 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.spi.AclService;
+import org.apache.chemistry.opencmis.commons.spi.ExtendedAclService;
 
 /**
  * ACL Service AtomPub client.
  */
-public class AclServiceImpl extends AbstractAtomPubService implements 
AclService {
+public class AclServiceImpl extends AbstractAtomPubService implements 
AclService, ExtendedAclService {
 
     /**
      * Constructor.
@@ -64,4 +65,10 @@ public class AclServiceImpl extends Abst
         return getAclInternal(repositoryId, objectId, onlyBasicPermissions, 
extension);
     }
 
+    public Acl setAcl(String repositoryId, String objectId, Acl aces) {
+        AtomAcl acl = updateAcl(repositoryId, objectId, aces, 
AclPropagation.OBJECTONLY);
+        Acl result = convert(acl.getACL(), null);
+
+        return result;
+    }
 }

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
 Wed Aug  8 10:40:34 2012
@@ -19,22 +19,27 @@
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
 import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
 import org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils;
+import org.apache.chemistry.opencmis.commons.data.Ace;
 import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.JSONConverter;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
+import 
org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
 import org.apache.chemistry.opencmis.commons.spi.AclService;
+import org.apache.chemistry.opencmis.commons.spi.ExtendedAclService;
 
 /**
  * ACL Service Browser Binding client.
  */
-public class AclServiceImpl extends AbstractBrowserBindingService implements 
AclService {
+public class AclServiceImpl extends AbstractBrowserBindingService implements 
AclService, ExtendedAclService {
 
     /**
      * Constructor.
@@ -76,4 +81,20 @@ public class AclServiceImpl extends Abst
 
         return JSONConverter.convertAcl(json, null);
     }
+
+    public Acl setAcl(String repositoryId, String objectId, Acl aces) {
+        Acl currentAcl = getAcl(repositoryId, objectId, false, null);
+
+        List<Ace> removeAces = new ArrayList<Ace>();
+        if (currentAcl.getAces() != null) {
+            for (Ace ace : currentAcl.getAces()) {
+                if (ace.isDirect()) {
+                    removeAces.add(ace);
+                }
+            }
+        }
+
+        return applyAcl(repositoryId, objectId, aces, new 
AccessControlListImpl(removeAces), AclPropagation.OBJECTONLY,
+                null);
+    }
 }

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java
 Wed Aug  8 10:40:34 2012
@@ -20,15 +20,21 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.local;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
+import org.apache.chemistry.opencmis.commons.data.Ace;
 import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
+import 
org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
 import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
 import org.apache.chemistry.opencmis.commons.spi.AclService;
+import org.apache.chemistry.opencmis.commons.spi.ExtendedAclService;
 
-public class AclServiceImpl extends AbstractLocalService implements AclService 
{
+public class AclServiceImpl extends AbstractLocalService implements 
AclService, ExtendedAclService {
 
     /**
      * Constructor.
@@ -58,4 +64,26 @@ public class AclServiceImpl extends Abst
             service.close();
         }
     }
+
+    public Acl setAcl(String repositoryId, String objectId, Acl aces) {
+        CmisService service = getService(repositoryId);
+
+        try {
+            Acl currentAcl = service.getAcl(repositoryId, objectId, false, 
null);
+
+            List<Ace> removeAces = new ArrayList<Ace>();
+            if (currentAcl.getAces() != null) {
+                for (Ace ace : currentAcl.getAces()) {
+                    if (ace.isDirect()) {
+                        removeAces.add(ace);
+                    }
+                }
+            }
+
+            return service.applyAcl(repositoryId, objectId, aces, new 
AccessControlListImpl(removeAces),
+                    AclPropagation.OBJECTONLY, null);
+        } finally {
+            service.close();
+        }
+    }
 }

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.java
 Wed Aug  8 10:40:34 2012
@@ -20,20 +20,26 @@ package org.apache.chemistry.opencmis.cl
 
 import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
+import org.apache.chemistry.opencmis.commons.data.Ace;
 import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import 
org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumACLPropagation;
 import org.apache.chemistry.opencmis.commons.spi.AclService;
+import org.apache.chemistry.opencmis.commons.spi.ExtendedAclService;
 
 /**
  * ACL Service Web Services client.
  */
-public class AclServiceImpl extends AbstractWebServicesService implements 
AclService {
+public class AclServiceImpl extends AbstractWebServicesService implements 
AclService, ExtendedAclService {
 
     private final AbstractPortProvider portProvider;
 
@@ -74,4 +80,30 @@ public class AclServiceImpl extends Abst
             portProvider.endCall(port);
         }
     }
+
+    public Acl setAcl(String repositoryId, String objectId, Acl aces) {
+        ACLServicePort port = portProvider.getACLServicePort();
+
+        try {
+            Acl currentAcl = convert(port.getACL(repositoryId, objectId, 
false, null));
+
+            List<Ace> removeAces = new ArrayList<Ace>();
+            if (currentAcl.getAces() != null) {
+                for (Ace ace : currentAcl.getAces()) {
+                    if (ace.isDirect()) {
+                        removeAces.add(ace);
+                    }
+                }
+            }
+
+            return convert(port.applyACL(repositoryId, objectId, 
convert(aces), convert(new AccessControlListImpl(
+                    removeAces)), convert(EnumACLPropagation.class, 
AclPropagation.OBJECTONLY), null));
+        } catch (CmisException e) {
+            throw convertException(e);
+        } catch (Exception e) {
+            throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+        } finally {
+            portProvider.endCall(port);
+        }
+    }
 }

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
 Wed Aug  8 10:40:34 2012
@@ -465,6 +465,14 @@ public abstract class AbstractCmisObject
         return applyAcl(null, removeAces, aclPropagation);
     }
 
+    public Acl setAcl(List<Ace> aces) {
+        Acl result = getSession().setAcl(this, aces);
+
+        refresh();
+
+        return result;
+    }
+
     public Acl getAcl() {
         readLock();
         try {

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
 Wed Aug  8 10:40:34 2012
@@ -20,6 +20,7 @@ package org.apache.chemistry.opencmis.cl
 
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Locale;
@@ -66,10 +67,13 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
 import 
org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
+import 
org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.spi.AclService;
 import org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider;
 import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
 import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
+import org.apache.chemistry.opencmis.commons.spi.ExtendedAclService;
 import org.apache.chemistry.opencmis.commons.spi.Holder;
 import org.apache.chemistry.opencmis.commons.spi.NavigationService;
 import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
@@ -944,6 +948,26 @@ public class SessionImpl implements Sess
                 of.convertAces(removeAces), aclPropagation, null);
     }
 
+    public Acl setAcl(ObjectId objectId, List<Ace> aces) {
+        if ((objectId == null) || (objectId.getId() == null)) {
+            throw new IllegalArgumentException("Invalid object id!");
+        }
+        if (aces == null) {
+            aces = Collections.emptyList();
+        }
+
+        AclService aclService = getBinding().getAclService();
+        if (!(aclService instanceof ExtendedAclService)) {
+            throw new CmisNotSupportedException("setAcl() is not supported by 
the binding implementation.");
+        }
+
+        ObjectFactory of = getObjectFactory();
+
+        return ((ExtendedAclService) aclService).setAcl(getRepositoryId(), 
objectId.getId(), of.convertAces(aces));
+    }
+
+    // --- Policies ---
+
     public void applyPolicy(ObjectId objectId, ObjectId... policyIds) {
         if ((objectId == null) || (objectId.getId() == null)) {
             throw new IllegalArgumentException("Invalid object id!");

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
 Wed Aug  8 10:40:34 2012
@@ -63,12 +63,16 @@ public class CmisObjectMock implements C
         return null;
     }
 
+    public Acl setAcl(List<Ace> aces) {
+        return null;
+    }
+
     public void applyPolicy(ObjectId policyId) {
     }
 
     public void delete() {
     }
-    
+
     public void delete(boolean allVersions) {
     }
 

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/AclPropagation.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/AclPropagation.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/AclPropagation.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/AclPropagation.java
 Wed Aug  8 10:40:34 2012
@@ -20,9 +20,6 @@ package org.apache.chemistry.opencmis.co
 
 /**
  * ACL Propagation Enum.
- * 
- * @author <a href="mailto:[email protected]";>Florian M&uuml;ller</a>
- * 
  */
 public enum AclPropagation {
 

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/AclService.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/AclService.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/AclService.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/AclService.java
 Wed Aug  8 10:40:34 2012
@@ -44,6 +44,7 @@ public interface AclService {
      * @param onlyBasicPermissions
      *            <em>(optional)</em> an indicator if only basic permissions
      *            should be returned (default is <code>true</code>)
+     * @return the ACL of the object
      */
     Acl getAcl(String repositoryId, String objectId, Boolean 
onlyBasicPermissions, ExtensionsData extension);
 
@@ -61,6 +62,7 @@ public interface AclService {
      * @param aclPropagation
      *            <em>(optional)</em> specifies how ACEs should be handled
      *            (default is {@link AclPropagation#REPOSITORYDETERMINED})
+     * @return the ACL of the object
      */
     Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl 
removeAces, AclPropagation aclPropagation,
             ExtensionsData extension);

Added: 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ExtendedAclService.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ExtendedAclService.java?rev=1370737&view=auto
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ExtendedAclService.java
 (added)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ExtendedAclService.java
 Wed Aug  8 10:40:34 2012
@@ -0,0 +1,53 @@
+/*
+ * 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.commons.spi;
+
+import org.apache.chemistry.opencmis.commons.data.Acl;
+
+/**
+ * Extended ACL Service interface.
+ * 
+ * This interface has NO equivalent in the CMIS specification. It contains ACL
+ * convenience operations for clients and is built on top of the CMIS specified
+ * operations.
+ * 
+ * This interface need not to be implemented by CMIS servers.
+ */
+public interface ExtendedAclService {
+
+    /**
+     * Removes the direct ACEs of an object and sets the provided ACEs.
+     * 
+     * The changes are local to the given object and are not propagated to
+     * dependent objects.
+     * 
+     * The effect of this operation depends on the repository and the binding.
+     * It is recommended to process the returned ACL after the method has been
+     * called and check if result matches the expectation.
+     * 
+     * @param repositoryId
+     *            the identifier for the repository
+     * @param objectId
+     *            the identifier for the object
+     * @param aces
+     *            the ACEs
+     * @return the ACL of the object
+     */
+    Acl setAcl(String repositoryId, String objectId, Acl aces);
+}

Propchange: 
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ExtendedAclService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java?rev=1370737&r1=1370736&r2=1370737&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java
 Wed Aug  8 10:40:34 2012
@@ -22,6 +22,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.SKIPPED;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -90,17 +91,23 @@ public class ACLSmokeTest extends Abstra
                     }
                 }
 
-                // apply permission "cmis:read"
                 if (getAclCapability(session) == CapabilityAcl.MANAGE) {
                     String principal = 
getParameters().get(TestParameters.DEFAULT_ACL_PRINCIPAL);
                     if (principal == null) {
                         principal = TestParameters.DEFAULT_ACL_PRINCIPAL_VALUE;
                     }
 
+                    // apply permission "cmis:read"
                     List<Ace> aces = new ArrayList<Ace>();
                     aces.add(session.getObjectFactory().createAce(principal, 
Collections.singletonList("cmis:read")));
 
                     session.applyAcl(doc, aces, null, null);
+
+                    // set permission "cmis:read" and "cmis:write"
+                    aces = new ArrayList<Ace>();
+                    aces.add(session.getObjectFactory().createAce(principal, 
Arrays.asList("cmis:all")));
+
+                    session.setAcl(doc, aces);
                 }
 
                 deleteObject(doc);


Reply via email to