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/01/20 15:28:03 UTC
svn commit: r1061311 - in
/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src:
main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/
test/java/org/apache/chemistry/opencmis/client/bindings...
Author: fmui
Date: Thu Jan 20 14:28:02 2011
New Revision: 1061311
URL: http://svn.apache.org/viewvc?rev=1061311&view=rev
Log:
fixed CMIS-293: ACEs can get lost
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AclMergeTest.java
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java?rev=1061311&r1=1061310&r2=1061311&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java Thu Jan 20 14:28:02 2011
@@ -22,7 +22,6 @@ import static org.apache.chemistry.openc
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.Serializable;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
@@ -86,27 +85,27 @@ public class AbstractAtomPubService {
protected static final String NAME_RELATIVE_PATH_SEGMENT = "relativePathSegment";
protected static final String NAME_NUM_ITEMS = "numItems";
- private Session fSession;
+ private Session session;
/**
* Sets the current session.
*/
protected void setSession(Session session) {
- fSession = session;
+ this.session = session;
}
/**
* Gets the current session.
*/
protected Session getSession() {
- return fSession;
+ return session;
}
/**
* Returns the service document URL of this session.
*/
protected String getServiceDocURL() {
- Object url = fSession.get(SessionParameter.ATOMPUB_URL);
+ Object url = session.get(SessionParameter.ATOMPUB_URL);
if (url instanceof String) {
return (String) url;
}
@@ -474,7 +473,7 @@ public class AbstractAtomPubService {
*/
protected HttpUtils.Response read(UrlBuilder url) {
// make the call
- HttpUtils.Response resp = HttpUtils.invokeGET(url, fSession);
+ HttpUtils.Response resp = HttpUtils.invokeGET(url, session);
// check response code
if (resp.getResponseCode() != 200) {
@@ -490,7 +489,7 @@ public class AbstractAtomPubService {
*/
protected HttpUtils.Response post(UrlBuilder url, String contentType, HttpUtils.Output writer) {
// make the call
- HttpUtils.Response resp = HttpUtils.invokePOST(url, contentType, writer, fSession);
+ HttpUtils.Response resp = HttpUtils.invokePOST(url, contentType, writer, session);
// check response code
if (resp.getResponseCode() != 201) {
@@ -506,7 +505,7 @@ public class AbstractAtomPubService {
*/
protected HttpUtils.Response put(UrlBuilder url, String contentType, HttpUtils.Output writer) {
// make the call
- HttpUtils.Response resp = HttpUtils.invokePUT(url, contentType, writer, fSession);
+ HttpUtils.Response resp = HttpUtils.invokePUT(url, contentType, writer, session);
// check response code
if ((resp.getResponseCode() < 200) || (resp.getResponseCode() > 299)) {
@@ -522,7 +521,7 @@ public class AbstractAtomPubService {
*/
protected void delete(UrlBuilder url) {
// make the call
- HttpUtils.Response resp = HttpUtils.invokeDELETE(url, fSession);
+ HttpUtils.Response resp = HttpUtils.invokeDELETE(url, session);
// check response code
if (resp.getResponseCode() != 204) {
@@ -547,7 +546,7 @@ public class AbstractAtomPubService {
Map<String, Set<String>> originals = convertAclToMap(originalAces);
Map<String, Set<String>> adds = convertAclToMap(addAces);
Map<String, Set<String>> removes = convertAclToMap(removeAces);
- List<Ace> newACEs = new ArrayList<Ace>();
+ List<Ace> newAces = new ArrayList<Ace>();
// iterate through the original ACEs
for (Map.Entry<String, Set<String>> ace : originals.entrySet()) {
@@ -566,7 +565,7 @@ public class AbstractAtomPubService {
// create new ACE
if (!ace.getValue().isEmpty()) {
- newACEs.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
+ newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
new ArrayList<String>(ace.getValue())));
}
}
@@ -575,12 +574,12 @@ public class AbstractAtomPubService {
// list
for (Map.Entry<String, Set<String>> ace : adds.entrySet()) {
if (!originals.containsKey(ace.getKey()) && !ace.getValue().isEmpty()) {
- newACEs.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
+ newAces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(ace.getKey()),
new ArrayList<String>(ace.getValue())));
}
}
- return new AccessControlListImpl(newACEs);
+ return new AccessControlListImpl(newAces);
}
/**
@@ -606,12 +605,15 @@ public class AbstractAtomPubService {
continue;
}
- Set<String> permissions = new HashSet<String>();
+ Set<String> permissions = result.get(ace.getPrincipal().getId());
+ if (permissions == null) {
+ permissions = new HashSet<String>();
+ result.put(ace.getPrincipal().getId(), permissions);
+ }
+
if (ace.getPermissions() != null) {
permissions.addAll(ace.getPermissions());
}
-
- result.put(ace.getPrincipal().getId(), permissions);
}
return result;
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AclMergeTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AclMergeTest.java?rev=1061311&r1=1061310&r2=1061311&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AclMergeTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AclMergeTest.java Thu Jan 20 14:28:02 2011
@@ -35,9 +35,6 @@ import org.apache.chemistry.opencmis.com
/**
* Test for the ACL merging that is necessary in the AtomPub binding
* implementation.
- *
- * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
- *
*/
public class AclMergeTest extends TestCase {