|
@@ -1,4 +1,4 @@
|
|
|
-/* Copyright 2004, 2005 Acegi Technology Pty Limited
|
|
|
|
|
|
|
+/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
|
|
*
|
|
*
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
* you may not use this file except in compliance with the License.
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -103,110 +103,6 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|
|
|
|
|
|
|
//~ Methods ================================================================
|
|
//~ Methods ================================================================
|
|
|
|
|
|
|
|
- public void setAclObjectIdentityDelete(
|
|
|
|
|
- AclObjectIdentityDelete aclObjectIdentityDelete) {
|
|
|
|
|
- this.aclObjectIdentityDelete = aclObjectIdentityDelete;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public AclObjectIdentityDelete getAclObjectIdentityDelete() {
|
|
|
|
|
- return aclObjectIdentityDelete;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAclObjectIdentityDeleteStatement(
|
|
|
|
|
- String aclObjectIdentityDeleteStatement) {
|
|
|
|
|
- this.aclObjectIdentityDeleteStatement = aclObjectIdentityDeleteStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public String getAclObjectIdentityDeleteStatement() {
|
|
|
|
|
- return aclObjectIdentityDeleteStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAclObjectIdentityInsert(
|
|
|
|
|
- AclObjectIdentityInsert aclObjectIdentityInsert) {
|
|
|
|
|
- this.aclObjectIdentityInsert = aclObjectIdentityInsert;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public AclObjectIdentityInsert getAclObjectIdentityInsert() {
|
|
|
|
|
- return aclObjectIdentityInsert;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAclObjectIdentityInsertStatement(
|
|
|
|
|
- String aclObjectIdentityInsertStatement) {
|
|
|
|
|
- this.aclObjectIdentityInsertStatement = aclObjectIdentityInsertStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public String getAclObjectIdentityInsertStatement() {
|
|
|
|
|
- return aclObjectIdentityInsertStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAclPermissionDelete(AclPermissionDelete aclPermissionDelete) {
|
|
|
|
|
- this.aclPermissionDelete = aclPermissionDelete;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public AclPermissionDelete getAclPermissionDelete() {
|
|
|
|
|
- return aclPermissionDelete;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAclPermissionDeleteStatement(
|
|
|
|
|
- String aclPermissionDeleteStatement) {
|
|
|
|
|
- this.aclPermissionDeleteStatement = aclPermissionDeleteStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public String getAclPermissionDeleteStatement() {
|
|
|
|
|
- return aclPermissionDeleteStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAclPermissionInsert(AclPermissionInsert aclPermissionInsert) {
|
|
|
|
|
- this.aclPermissionInsert = aclPermissionInsert;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public AclPermissionInsert getAclPermissionInsert() {
|
|
|
|
|
- return aclPermissionInsert;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAclPermissionInsertStatement(
|
|
|
|
|
- String aclPermissionInsertStatement) {
|
|
|
|
|
- this.aclPermissionInsertStatement = aclPermissionInsertStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public String getAclPermissionInsertStatement() {
|
|
|
|
|
- return aclPermissionInsertStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAclPermissionUpdate(AclPermissionUpdate aclPermissionUpdate) {
|
|
|
|
|
- this.aclPermissionUpdate = aclPermissionUpdate;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public AclPermissionUpdate getAclPermissionUpdate() {
|
|
|
|
|
- return aclPermissionUpdate;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAclPermissionUpdateStatement(
|
|
|
|
|
- String aclPermissionUpdateStatement) {
|
|
|
|
|
- this.aclPermissionUpdateStatement = aclPermissionUpdateStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public String getAclPermissionUpdateStatement() {
|
|
|
|
|
- return aclPermissionUpdateStatement;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setLookupPermissionIdMapping(
|
|
|
|
|
- MappingSqlQuery lookupPermissionIdMapping) {
|
|
|
|
|
- this.lookupPermissionIdMapping = lookupPermissionIdMapping;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public MappingSqlQuery getLookupPermissionIdMapping() {
|
|
|
|
|
- return lookupPermissionIdMapping;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setLookupPermissionIdQuery(String lookupPermissionIdQuery) {
|
|
|
|
|
- this.lookupPermissionIdQuery = lookupPermissionIdQuery;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public String getLookupPermissionIdQuery() {
|
|
|
|
|
- return lookupPermissionIdQuery;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public void changeMask(AclObjectIdentity aclObjectIdentity,
|
|
public void changeMask(AclObjectIdentity aclObjectIdentity,
|
|
|
Object recipient, Integer newMask) throws DataAccessException {
|
|
Object recipient, Integer newMask) throws DataAccessException {
|
|
|
// Retrieve acl_object_identity record details
|
|
// Retrieve acl_object_identity record details
|
|
@@ -241,10 +137,14 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|
|
.getAclObjectIdentity());
|
|
.getAclObjectIdentity());
|
|
|
|
|
|
|
|
// Ensure there isn't an existing record for this recipient
|
|
// Ensure there isn't an existing record for this recipient
|
|
|
- if (lookupPermissionId(aclDetailsHolder.getForeignKeyId(),
|
|
|
|
|
- basicAclEntry.getRecipient()) != -1) {
|
|
|
|
|
- throw new DataIntegrityViolationException(
|
|
|
|
|
- "This recipient already exists for this aclObjectIdentity");
|
|
|
|
|
|
|
+ long permissionId = lookupPermissionId(aclDetailsHolder.getForeignKeyId(),
|
|
|
|
|
+ basicAclEntry.getRecipient());
|
|
|
|
|
+
|
|
|
|
|
+ if (permissionId != -1) {
|
|
|
|
|
+ throw new DataIntegrityViolationException("Recipient '"
|
|
|
|
|
+ + basicAclEntry.getRecipient()
|
|
|
|
|
+ + "' already exists for aclObjectIdentity ID "
|
|
|
|
|
+ + aclDetailsHolder.getForeignKeyId() + " (permission ID " + ")");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Create acl_permission
|
|
// Create acl_permission
|
|
@@ -253,6 +153,40 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|
|
new Integer(basicAclEntry.getMask()));
|
|
new Integer(basicAclEntry.getMask()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Convenience method that creates an acl_object_identity record if
|
|
|
|
|
+ * required.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param basicAclEntry containing the <code>AclObjectIdentity</code> to
|
|
|
|
|
+ * create
|
|
|
|
|
+ *
|
|
|
|
|
+ * @throws DataAccessException
|
|
|
|
|
+ */
|
|
|
|
|
+ private void createAclObjectIdentityIfRequired(BasicAclEntry basicAclEntry)
|
|
|
|
|
+ throws DataAccessException {
|
|
|
|
|
+ String aclObjectIdentityString = convertAclObjectIdentityToString(basicAclEntry
|
|
|
|
|
+ .getAclObjectIdentity());
|
|
|
|
|
+
|
|
|
|
|
+ // Lookup the object's main properties from the RDBMS (guaranteed no nulls)
|
|
|
|
|
+ List objects = objectProperties.execute(aclObjectIdentityString);
|
|
|
|
|
+
|
|
|
|
|
+ if (objects.size() == 0) {
|
|
|
|
|
+ if (basicAclEntry.getAclObjectParentIdentity() != null) {
|
|
|
|
|
+ AclDetailsHolder parentDetails = lookupAclDetailsHolder(basicAclEntry
|
|
|
|
|
+ .getAclObjectParentIdentity());
|
|
|
|
|
+
|
|
|
|
|
+ // Must create the acl_object_identity record
|
|
|
|
|
+ aclObjectIdentityInsert.insert(aclObjectIdentityString,
|
|
|
|
|
+ new Long(parentDetails.getForeignKeyId()),
|
|
|
|
|
+ basicAclEntry.getClass().getName());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // Must create the acl_object_identity record
|
|
|
|
|
+ aclObjectIdentityInsert.insert(aclObjectIdentityString, null,
|
|
|
|
|
+ basicAclEntry.getClass().getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public void delete(AclObjectIdentity aclObjectIdentity)
|
|
public void delete(AclObjectIdentity aclObjectIdentity)
|
|
|
throws DataAccessException {
|
|
throws DataAccessException {
|
|
|
// Retrieve acl_object_identity record details
|
|
// Retrieve acl_object_identity record details
|
|
@@ -283,6 +217,54 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|
|
recipient.toString());
|
|
recipient.toString());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public AclObjectIdentityDelete getAclObjectIdentityDelete() {
|
|
|
|
|
+ return aclObjectIdentityDelete;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getAclObjectIdentityDeleteStatement() {
|
|
|
|
|
+ return aclObjectIdentityDeleteStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public AclObjectIdentityInsert getAclObjectIdentityInsert() {
|
|
|
|
|
+ return aclObjectIdentityInsert;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getAclObjectIdentityInsertStatement() {
|
|
|
|
|
+ return aclObjectIdentityInsertStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public AclPermissionDelete getAclPermissionDelete() {
|
|
|
|
|
+ return aclPermissionDelete;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getAclPermissionDeleteStatement() {
|
|
|
|
|
+ return aclPermissionDeleteStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public AclPermissionInsert getAclPermissionInsert() {
|
|
|
|
|
+ return aclPermissionInsert;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getAclPermissionInsertStatement() {
|
|
|
|
|
+ return aclPermissionInsertStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public AclPermissionUpdate getAclPermissionUpdate() {
|
|
|
|
|
+ return aclPermissionUpdate;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getAclPermissionUpdateStatement() {
|
|
|
|
|
+ return aclPermissionUpdateStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public MappingSqlQuery getLookupPermissionIdMapping() {
|
|
|
|
|
+ return lookupPermissionIdMapping;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getLookupPermissionIdQuery() {
|
|
|
|
|
+ return lookupPermissionIdQuery;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
protected void initDao() throws ApplicationContextException {
|
|
protected void initDao() throws ApplicationContextException {
|
|
|
super.initDao();
|
|
super.initDao();
|
|
|
lookupPermissionIdMapping = new LookupPermissionIdMapping(getDataSource());
|
|
lookupPermissionIdMapping = new LookupPermissionIdMapping(getDataSource());
|
|
@@ -293,40 +275,6 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|
|
aclPermissionUpdate = new AclPermissionUpdate(getDataSource());
|
|
aclPermissionUpdate = new AclPermissionUpdate(getDataSource());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Convenience method that creates an acl_object_identity record if
|
|
|
|
|
- * required.
|
|
|
|
|
- *
|
|
|
|
|
- * @param basicAclEntry containing the <code>AclObjectIdentity</code> to
|
|
|
|
|
- * create
|
|
|
|
|
- *
|
|
|
|
|
- * @throws DataAccessException
|
|
|
|
|
- */
|
|
|
|
|
- private void createAclObjectIdentityIfRequired(BasicAclEntry basicAclEntry)
|
|
|
|
|
- throws DataAccessException {
|
|
|
|
|
- String aclObjectIdentityString = convertAclObjectIdentityToString(basicAclEntry
|
|
|
|
|
- .getAclObjectIdentity());
|
|
|
|
|
-
|
|
|
|
|
- // Lookup the object's main properties from the RDBMS (guaranteed no nulls)
|
|
|
|
|
- List objects = objectProperties.execute(aclObjectIdentityString);
|
|
|
|
|
-
|
|
|
|
|
- if (objects.size() == 0) {
|
|
|
|
|
- if (basicAclEntry.getAclObjectParentIdentity() != null) {
|
|
|
|
|
- AclDetailsHolder parentDetails = lookupAclDetailsHolder(basicAclEntry
|
|
|
|
|
- .getAclObjectParentIdentity());
|
|
|
|
|
-
|
|
|
|
|
- // Must create the acl_object_identity record
|
|
|
|
|
- aclObjectIdentityInsert.insert(aclObjectIdentityString,
|
|
|
|
|
- new Long(parentDetails.getForeignKeyId()),
|
|
|
|
|
- basicAclEntry.getClass().getName());
|
|
|
|
|
- } else {
|
|
|
|
|
- // Must create the acl_object_identity record
|
|
|
|
|
- aclObjectIdentityInsert.insert(aclObjectIdentityString, null,
|
|
|
|
|
- basicAclEntry.getClass().getName());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* Convenience method that obtains a given acl_object_identity record.
|
|
* Convenience method that obtains a given acl_object_identity record.
|
|
|
*
|
|
*
|
|
@@ -376,6 +324,62 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl
|
|
|
return ((Long) list.get(0)).longValue();
|
|
return ((Long) list.get(0)).longValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void setAclObjectIdentityDelete(
|
|
|
|
|
+ AclObjectIdentityDelete aclObjectIdentityDelete) {
|
|
|
|
|
+ this.aclObjectIdentityDelete = aclObjectIdentityDelete;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setAclObjectIdentityDeleteStatement(
|
|
|
|
|
+ String aclObjectIdentityDeleteStatement) {
|
|
|
|
|
+ this.aclObjectIdentityDeleteStatement = aclObjectIdentityDeleteStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setAclObjectIdentityInsert(
|
|
|
|
|
+ AclObjectIdentityInsert aclObjectIdentityInsert) {
|
|
|
|
|
+ this.aclObjectIdentityInsert = aclObjectIdentityInsert;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setAclObjectIdentityInsertStatement(
|
|
|
|
|
+ String aclObjectIdentityInsertStatement) {
|
|
|
|
|
+ this.aclObjectIdentityInsertStatement = aclObjectIdentityInsertStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setAclPermissionDelete(AclPermissionDelete aclPermissionDelete) {
|
|
|
|
|
+ this.aclPermissionDelete = aclPermissionDelete;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setAclPermissionDeleteStatement(
|
|
|
|
|
+ String aclPermissionDeleteStatement) {
|
|
|
|
|
+ this.aclPermissionDeleteStatement = aclPermissionDeleteStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setAclPermissionInsert(AclPermissionInsert aclPermissionInsert) {
|
|
|
|
|
+ this.aclPermissionInsert = aclPermissionInsert;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setAclPermissionInsertStatement(
|
|
|
|
|
+ String aclPermissionInsertStatement) {
|
|
|
|
|
+ this.aclPermissionInsertStatement = aclPermissionInsertStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setAclPermissionUpdate(AclPermissionUpdate aclPermissionUpdate) {
|
|
|
|
|
+ this.aclPermissionUpdate = aclPermissionUpdate;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setAclPermissionUpdateStatement(
|
|
|
|
|
+ String aclPermissionUpdateStatement) {
|
|
|
|
|
+ this.aclPermissionUpdateStatement = aclPermissionUpdateStatement;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setLookupPermissionIdMapping(
|
|
|
|
|
+ MappingSqlQuery lookupPermissionIdMapping) {
|
|
|
|
|
+ this.lookupPermissionIdMapping = lookupPermissionIdMapping;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setLookupPermissionIdQuery(String lookupPermissionIdQuery) {
|
|
|
|
|
+ this.lookupPermissionIdQuery = lookupPermissionIdQuery;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//~ Inner Classes ==========================================================
|
|
//~ Inner Classes ==========================================================
|
|
|
|
|
|
|
|
protected class AclObjectIdentityDelete extends SqlUpdate {
|
|
protected class AclObjectIdentityDelete extends SqlUpdate {
|