Moved key column from access_control_list onto node

This eliminates several select statements issued while walking up the parent hierarchy
The V1.2.1 - V1.3 script has been updated and tested, but if you want to keep an existing 1.3, then:
  SET FOREIGN_KEY_CHECKS = 0;
  ALTER TABLE node ADD `acl_id` bigint(20) default NULL;
  UPDATE node node SET node.acl_id = (SELECT acl.id FROM access_control_list acl WHERE acl.node_id = node.id);
  SET FOREIGN_KEY_CHECKS = 1;


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2911 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-05-17 15:36:20 +00:00
parent 516fc15cf4
commit da188b04c6

View File

@@ -87,10 +87,9 @@ public class HibernatePermissionTest extends BaseSpringTest
{ {
// create a new Node // create a new Node
DbAccessControlList accessControlList = new DbAccessControlListImpl(); DbAccessControlList accessControlList = new DbAccessControlListImpl();
accessControlList.setNode(node);
accessControlList.setInherits(true); accessControlList.setInherits(true);
Serializable id = getSession().save(accessControlList); Serializable id = getSession().save(accessControlList);
node.setAccessControlList(accessControlList);
// throw the reference away and get the a new one for the id // throw the reference away and get the a new one for the id
accessControlList = (DbAccessControlList) getSession().load(DbAccessControlListImpl.class, id); accessControlList = (DbAccessControlList) getSession().load(DbAccessControlListImpl.class, id);
@@ -166,9 +165,9 @@ public class HibernatePermissionTest extends BaseSpringTest
{ {
// create a new access control list for the node // create a new access control list for the node
DbAccessControlList accessControlList = new DbAccessControlListImpl(); DbAccessControlList accessControlList = new DbAccessControlListImpl();
accessControlList.setNode(node);
accessControlList.setInherits(true); accessControlList.setInherits(true);
Serializable nodeAclId = getSession().save(accessControlList); Serializable nodeAclId = getSession().save(accessControlList);
node.setAccessControlList(accessControlList);
DbAuthority recipient = new DbAuthorityImpl(); DbAuthority recipient = new DbAuthorityImpl();
recipient.setRecipient("Test"); recipient.setRecipient("Test");
@@ -196,6 +195,7 @@ public class HibernatePermissionTest extends BaseSpringTest
assertEquals(1, accessControlEntry.getAuthority().getExternalKeys().size()); assertEquals(1, accessControlEntry.getAuthority().getExternalKeys().size());
// Check that deletion of the list cascades // Check that deletion of the list cascades
node.setAccessControlList(null);
getSession().delete(accessControlList); getSession().delete(accessControlList);
try try
{ {