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 2010/03/01 22:05:44 UTC

svn commit: r917719 - in /incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub: AbstractAtomPubService.java AclServiceImpl.java

Author: fmui
Date: Mon Mar  1 21:05:43 2010
New Revision: 917719

URL: http://svn.apache.org/viewvc?rev=917719&view=rev
Log:
CMIS-143: applyAcl expects an ACL, not an entry

Modified:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java?rev=917719&r1=917718&r2=917719&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java Mon Mar  1 21:05:43 2010
@@ -31,6 +31,7 @@
 import java.util.Set;
 
 import org.apache.opencmis.client.provider.spi.Session;
+import org.apache.opencmis.client.provider.spi.atompub.objects.Acl;
 import org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase;
 import org.apache.opencmis.client.provider.spi.atompub.objects.AtomElement;
 import org.apache.opencmis.client.provider.spi.atompub.objects.AtomEntry;
@@ -722,7 +723,7 @@
   /**
    * Updates the ACL of an object.
    */
-  protected AtomEntry updateAcl(String repositoryId, String objectId, AccessControlList acl,
+  protected Acl updateAcl(String repositoryId, String objectId, AccessControlList acl,
       AclPropagation aclPropagation) {
 
     // find the link
@@ -747,7 +748,7 @@
     });
 
     // parse new entry
-    return parse(resp.getStream(), AtomEntry.class);
+    return parse(resp.getStream(), Acl.class);
   }
 
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java?rev=917719&r1=917718&r2=917719&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java Mon Mar  1 21:05:43 2010
@@ -22,14 +22,11 @@
 
 import org.apache.opencmis.client.provider.spi.Session;
 import org.apache.opencmis.client.provider.spi.atompub.objects.Acl;
-import org.apache.opencmis.client.provider.spi.atompub.objects.AtomElement;
-import org.apache.opencmis.client.provider.spi.atompub.objects.AtomEntry;
 import org.apache.opencmis.commons.api.ExtensionsData;
 import org.apache.opencmis.commons.enums.AclPropagation;
 import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.opencmis.commons.impl.Constants;
 import org.apache.opencmis.commons.impl.UrlBuilder;
-import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
 import org.apache.opencmis.commons.provider.AccessControlList;
 import org.apache.opencmis.commons.provider.AclService;
 
@@ -51,9 +48,11 @@
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.provider.ACLService#applyACL(java.lang.String, java.lang.String,
-   * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.commons.enums.ACLPropagation, org.apache.opencmis.client.provider.ExtensionsData)
+   * @see org.apache.opencmis.client.provider.ACLService#applyACL(java.lang.String,
+   * java.lang.String, org.apache.opencmis.client.provider.AccessControlList,
+   * org.apache.opencmis.client.provider.AccessControlList,
+   * org.apache.opencmis.commons.enums.ACLPropagation,
+   * org.apache.opencmis.client.provider.ExtensionsData)
    */
   public AccessControlList applyAcl(String repositoryId, String objectId,
       AccessControlList addAces, AccessControlList removeAces, AclPropagation aclPropagation,
@@ -72,18 +71,8 @@
     AccessControlList newACL = mergeAcls(originalAces, addAces, removeAces);
 
     // update ACL
-    AtomEntry entry = updateAcl(repositoryId, objectId, newACL, aclPropagation);
-
-    // walk through the entry and find updated ACL
-    for (AtomElement element : entry.getElements()) {
-      if (element.getObject() instanceof CmisObjectType) {
-        // extract new ACL
-        CmisObjectType object = (CmisObjectType) element.getObject();
-        result = convert(object.getAcl(), object.isExactACL());
-
-        break;
-      }
-    }
+    Acl acl = updateAcl(repositoryId, objectId, newACL, aclPropagation);
+    result = convert(acl.getACL(), null);
 
     return result;
   }