From e9b75a288b12aab498be27bb7f683c523dcff57c Mon Sep 17 00:00:00 2001 From: Britt Park Date: Mon, 23 Apr 2007 19:44:31 +0000 Subject: [PATCH] Added ACLs to Attributes. Can't do much with them yet, but the column is in place. Fixed failing AttrQueryTest. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5528 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/attributes/AttrQueryTest.java | 6 ++--- .../alfresco/repo/attributes/Attribute.java | 14 +++++++++++ .../repo/attributes/AttributeImpl.java | 23 +++++++++++++++++++ .../repo/attributes/AttributeValue.java | 20 ++++++++++++++++ .../attributes/hibernate/Attributes.hbm.xml | 2 ++ 5 files changed, 62 insertions(+), 3 deletions(-) diff --git a/source/java/org/alfresco/repo/attributes/AttrQueryTest.java b/source/java/org/alfresco/repo/attributes/AttrQueryTest.java index 01290a9c76..3c26ecbdda 100644 --- a/source/java/org/alfresco/repo/attributes/AttrQueryTest.java +++ b/source/java/org/alfresco/repo/attributes/AttrQueryTest.java @@ -67,8 +67,8 @@ public class AttrQueryTest extends TestCase System.out.println(fHelper.getParameters()); assertEquals("((me.key > :name0 and me.key < :name1) or (not me.key like :name2))", predicate); - assertEquals("cat", fHelper.getParameters().get(":name0")); - assertEquals("hat", fHelper.getParameters().get(":name1")); - assertEquals("fur%", fHelper.getParameters().get(":name2")); + assertEquals("cat", fHelper.getParameters().get("name0")); + assertEquals("hat", fHelper.getParameters().get("name1")); + assertEquals("fur%", fHelper.getParameters().get("name2")); } } diff --git a/source/java/org/alfresco/repo/attributes/Attribute.java b/source/java/org/alfresco/repo/attributes/Attribute.java index 74c601a462..77a67f5f47 100644 --- a/source/java/org/alfresco/repo/attributes/Attribute.java +++ b/source/java/org/alfresco/repo/attributes/Attribute.java @@ -30,6 +30,8 @@ import java.util.Collection; import java.util.Map; import java.util.Set; +import org.alfresco.repo.domain.DbAccessControlList; + /** * Interface for polymorphic attributes. * @author britt @@ -50,6 +52,18 @@ public interface Attribute extends Serializable MAP }; + /** + * Set the ACL on this Attribute. + * @param acl The ACL. + */ + public void setAcl(DbAccessControlList acl); + + /** + * Get the (possibly null ACL) on this Attribute. + * @return The ACL or null. + */ + public DbAccessControlList getAcl(); + /** * Get the value type for this node. * @return diff --git a/source/java/org/alfresco/repo/attributes/AttributeImpl.java b/source/java/org/alfresco/repo/attributes/AttributeImpl.java index ec3dd63d8f..8eb4a631ea 100644 --- a/source/java/org/alfresco/repo/attributes/AttributeImpl.java +++ b/source/java/org/alfresco/repo/attributes/AttributeImpl.java @@ -30,6 +30,8 @@ import java.util.Collection; import java.util.Set; import java.util.Map.Entry; +import org.alfresco.repo.domain.DbAccessControlList; + /** * The base class of the implementation of Values. * @author britt @@ -46,6 +48,11 @@ public abstract class AttributeImpl implements Attribute */ private long fVersion; + /** + * ACL for this Attribute. + */ + private DbAccessControlList fACL; + /** * Base constructor. */ @@ -314,4 +321,20 @@ public abstract class AttributeImpl implements Attribute { return (int)fID; } + + /* (non-Javadoc) + * @see org.alfresco.repo.attributes.Attribute#getAcl() + */ + public DbAccessControlList getAcl() + { + return fACL; + } + + /* (non-Javadoc) + * @see org.alfresco.repo.attributes.Attribute#setAcl(org.alfresco.repo.domain.DbAccessControlList) + */ + public void setAcl(DbAccessControlList acl) + { + fACL = acl; + } } diff --git a/source/java/org/alfresco/repo/attributes/AttributeValue.java b/source/java/org/alfresco/repo/attributes/AttributeValue.java index c7540e23de..1cada24e15 100644 --- a/source/java/org/alfresco/repo/attributes/AttributeValue.java +++ b/source/java/org/alfresco/repo/attributes/AttributeValue.java @@ -30,6 +30,8 @@ import java.util.Collection; import java.util.Set; import java.util.Map.Entry; +import org.alfresco.repo.domain.DbAccessControlList; + /** * Value based non-persistent implementation of Attribute. * @author britt @@ -251,4 +253,22 @@ public abstract class AttributeValue implements Attribute { throw new AttributeMethodNotImplemented("Not a map."); } + + // I'm not sure if ACLs are serializable. So for now the following two + // methods are noops. + /* (non-Javadoc) + * @see org.alfresco.repo.attributes.Attribute#getAcl() + */ + public DbAccessControlList getAcl() + { + return null; + } + + /* (non-Javadoc) + * @see org.alfresco.repo.attributes.Attribute#setAcl(org.alfresco.repo.domain.DbAccessControlList) + */ + public void setAcl(DbAccessControlList acl) + { + // Do Nothing. + } } diff --git a/source/java/org/alfresco/repo/attributes/hibernate/Attributes.hbm.xml b/source/java/org/alfresco/repo/attributes/hibernate/Attributes.hbm.xml index 8f113d3b2b..185d4168ec 100644 --- a/source/java/org/alfresco/repo/attributes/hibernate/Attributes.hbm.xml +++ b/source/java/org/alfresco/repo/attributes/hibernate/Attributes.hbm.xml @@ -14,6 +14,8 @@ +