From e3b9920d9c5a77c074c00e6d5026e40940587fa7 Mon Sep 17 00:00:00 2001 From: Ben Alex Date: Sun, 5 Dec 2004 05:30:06 +0000 Subject: [PATCH] Fix default query string to remove ambiguous columns. Thanks to Aaron Tang. --- .../acl/basic/jdbc/JdbcDaoImpl.java | 170 +++++++++--------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcDaoImpl.java b/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcDaoImpl.java index 44298a6eb2..6517c56bb3 100644 --- a/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcDaoImpl.java +++ b/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcDaoImpl.java @@ -60,7 +60,7 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements BasicAclDao { public static final String RECIPIENT_USED_FOR_INHERITENCE_MARKER = "___INHERITENCE_MARKER_ONLY___"; public static final String DEF_ACLS_BY_OBJECT_IDENTITY_QUERY = "SELECT RECIPIENT, MASK FROM acl_permission WHERE acl_object_identity = ?"; - public static final String DEF_OBJECT_PROPERTIES_QUERY = "SELECT ID, OBJECT_IDENTITY, ACL_CLASS, PARENT.OBJECT_IDENTITY as PARENT_OBJECT_IDENTITY FROM acl_object_identity LEFT OUTER JOIN acl_object_identity as PARENT ON acl_object_identity.parent_object=parent.id WHERE parent.id=acl_object_identity.parent_object and object_identity = ?"; + public static final String DEF_OBJECT_PROPERTIES_QUERY = "SELECT CHILD.ID, CHILD.OBJECT_IDENTITY, CHILD.ACL_CLASS, PARENT.OBJECT_IDENTITY as PARENT_OBJECT_IDENTITY FROM acl_object_identity as CHILD LEFT OUTER JOIN acl_object_identity as PARENT ON CHILD.parent_object=parent.id WHERE CHILD.object_identity = ?"; private static final Log logger = LogFactory.getLog(JdbcDaoImpl.class); //~ Instance fields ======================================================== @@ -258,6 +258,90 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements BasicAclDao { //~ Inner Classes ========================================================== + /** + * Used to hold details of a domain object instance's properties, or an + * individual ACL entry. + * + *

+ * Not all properties will be set. The actual properties set will depend on + * which MappingSqlQuery creates the object. + *

+ * + *

+ * Does not enforce nulls or empty Strings as + * this is performed by the MappingSqlQuery objects (or + * preferably the backend RDBMS via schema constraints). + *

+ */ + protected final class AclDetailsHolder { + private AclObjectIdentity aclObjectIdentity; + private AclObjectIdentity aclObjectParentIdentity; + private Class aclClass; + private Object recipient; + private int foreignKeyId; + private int mask; + + /** + * Record details of an individual ACL entry (usually from the + * ACL_PERMISSION table) + * + * @param recipient the recipient + * @param mask the integer to be masked + */ + public AclDetailsHolder(Object recipient, int mask) { + this.recipient = recipient; + this.mask = mask; + } + + /** + * Record details of a domain object instance's properties (usually + * from the ACL_OBJECT_IDENTITY table) + * + * @param foreignKeyId used by the + * AclsByObjectIdentityMapping to locate the + * individual ACL entries + * @param aclObjectIdentity the object identity of the domain object + * instance + * @param aclObjectParentIdentity the object identity of the domain + * object instance's parent + * @param aclClass the class of which a new instance which should be + * created for each individual ACL entry (or an inheritence + * "holder" class if there are no ACL entries) + */ + public AclDetailsHolder(int foreignKeyId, + AclObjectIdentity aclObjectIdentity, + AclObjectIdentity aclObjectParentIdentity, Class aclClass) { + this.foreignKeyId = foreignKeyId; + this.aclObjectIdentity = aclObjectIdentity; + this.aclObjectParentIdentity = aclObjectParentIdentity; + this.aclClass = aclClass; + } + + public Class getAclClass() { + return aclClass; + } + + public AclObjectIdentity getAclObjectIdentity() { + return aclObjectIdentity; + } + + public AclObjectIdentity getAclObjectParentIdentity() { + return aclObjectParentIdentity; + } + + public int getForeignKeyId() { + return foreignKeyId; + } + + public int getMask() { + return mask; + } + + public Object getRecipient() { + return recipient; + } + } + /** * Query object to look up individual ACL entries. * @@ -359,88 +443,4 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements BasicAclDao { return new NamedEntityObjectIdentity(classname, id); } } - - /** - * Used to hold details of a domain object instance's properties, or an - * individual ACL entry. - * - *

- * Not all properties will be set. The actual properties set will depend on - * which MappingSqlQuery creates the object. - *

- * - *

- * Does not enforce nulls or empty Strings as - * this is performed by the MappingSqlQuery objects (or - * preferably the backend RDBMS via schema constraints). - *

- */ - protected final class AclDetailsHolder { - private AclObjectIdentity aclObjectIdentity; - private AclObjectIdentity aclObjectParentIdentity; - private Class aclClass; - private Object recipient; - private int foreignKeyId; - private int mask; - - /** - * Record details of an individual ACL entry (usually from the - * ACL_PERMISSION table) - * - * @param recipient the recipient - * @param mask the integer to be masked - */ - public AclDetailsHolder(Object recipient, int mask) { - this.recipient = recipient; - this.mask = mask; - } - - /** - * Record details of a domain object instance's properties (usually - * from the ACL_OBJECT_IDENTITY table) - * - * @param foreignKeyId used by the - * AclsByObjectIdentityMapping to locate the - * individual ACL entries - * @param aclObjectIdentity the object identity of the domain object - * instance - * @param aclObjectParentIdentity the object identity of the domain - * object instance's parent - * @param aclClass the class of which a new instance which should be - * created for each individual ACL entry (or an inheritence - * "holder" class if there are no ACL entries) - */ - public AclDetailsHolder(int foreignKeyId, - AclObjectIdentity aclObjectIdentity, - AclObjectIdentity aclObjectParentIdentity, Class aclClass) { - this.foreignKeyId = foreignKeyId; - this.aclObjectIdentity = aclObjectIdentity; - this.aclObjectParentIdentity = aclObjectParentIdentity; - this.aclClass = aclClass; - } - - public Class getAclClass() { - return aclClass; - } - - public AclObjectIdentity getAclObjectIdentity() { - return aclObjectIdentity; - } - - public AclObjectIdentity getAclObjectParentIdentity() { - return aclObjectParentIdentity; - } - - public int getForeignKeyId() { - return foreignKeyId; - } - - public int getMask() { - return mask; - } - - public Object getRecipient() { - return recipient; - } - } }