Use setNodeAclId() to set ACL IDs

- ALF-10699: Nodes not getting put into new transactions during various operations


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31109 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-10-11 03:56:34 +00:00
parent e2b4f2884d
commit 658c856a2d
5 changed files with 14 additions and 52 deletions

View File

@@ -1574,17 +1574,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
invalidateCachesByNodeId(primaryParentNodeId, null, nodesCache);
}
@Override
public void setNodeDefiningAclId(Long nodeId, long aclId)
{
NodeUpdateEntity nodeUpdateEntity = new NodeUpdateEntity();
nodeUpdateEntity.setId(nodeId);
nodeUpdateEntity.setAclId(aclId);
nodeUpdateEntity.setUpdateAclId(true);
updateNodePatchAcl(nodeUpdateEntity);
invalidateCachesByNodeId(null, nodeId, nodesCache);
}
public void deleteNode(Long nodeId)
{
Node node = getNodeNotNull(nodeId);
@@ -3058,11 +3047,11 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
/**
* Potentially cheaper than evaluating all of a node's paths to check for child association cycles
* <p/>
* TODO: When is it cheaper to go up and when is it cheaper to go down?
* Look at using direct queries to pass through layers both up and down.
*
* @param nodePair
* the node to check
* @param path
* a set containing the nodes in the path to the node
* @param nodePair the node to check
*/
public void cycleCheck(Pair<Long, NodeRef> nodePair)
{
@@ -3074,7 +3063,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
}
}
class CycleCallBack implements ChildAssocRefQueryCallback
private class CycleCallBack implements ChildAssocRefQueryCallback
{
final Set<ChildAssociationRef> path = new HashSet<ChildAssociationRef>(97);
CyclicChildRelationshipException toThrow;
@@ -3085,7 +3074,9 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
}
@Override
public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair, Pair<Long, NodeRef> parentNodePair,
public boolean handle(
Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair,
Pair<Long, NodeRef> childNodePair)
{
ChildAssociationRef childAssociationRef = childAssocPair.getSecond();
@@ -3845,7 +3836,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
protected abstract int updateStore(StoreEntity store);
protected abstract Long insertNode(NodeEntity node);
protected abstract int updateNode(NodeUpdateEntity nodeUpdate);
protected abstract int updateNodePatchAcl(NodeUpdateEntity nodeUpdate);
protected abstract void updatePrimaryChildrenSharedAclId(
Long txnId,
Long primaryParentNodeId,

View File

@@ -711,30 +711,16 @@ public interface NodeDAO extends NodeBulkLoader
public Long getMaxTxnCommitTime();
/**
*
* @param parentNodeId
* @param childNodeTypeQNames
* @param value
* @param resultsCallback
* Select children by property values
*/
public void getChildAssocsByPropertyValue(Long parentNodeId,
public void getChildAssocsByPropertyValue(
Long parentNodeId,
QName propertyQName,
Serializable nodeValue,
ChildAssocRefQueryCallback resultsCallback);
/**
* Used in ACL upgrade only to set the acl id with mimimal overhead
*
* @param nodeId
* @param id
*/
public void setNodeDefiningAclId(Long nodeId, long id);
/**
* Used by the re-encryptor to re-encrypt encryptable properties with a new encryption key.
*
* @param propertyDefs
* @return
*/
public List<NodePropertyEntity> selectProperties(Collection<PropertyDefinition> propertyDefs);
}

View File

@@ -85,7 +85,6 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
private static final String SELECT_STORE_ROOT_NODE_BY_REF = "alfresco.node.select_StoreRootNodeByRef";
private static final String INSERT_NODE = "alfresco.node.insert.insert_Node";
private static final String UPDATE_NODE = "alfresco.node.update_Node";
private static final String UPDATE_NODE_PATCH_ACL = "alfresco.node.update_NodePatchAcl";
private static final String DELETE_NODE_BY_ID = "alfresco.node.delete_NodeById";
private static final String DELETE_NODES_BY_TXN_COMMIT_TIME = "alfresco.node.delete_NodesByTxnCommitTime";
private static final String SELECT_NODE_BY_ID = "alfresco.node.select_NodeById";
@@ -318,12 +317,6 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
return template.update(UPDATE_NODE, nodeUpdate);
}
@Override
protected int updateNodePatchAcl(NodeUpdateEntity nodeUpdate)
{
return template.update(UPDATE_NODE_PATCH_ACL, nodeUpdate);
}
@Override
protected void updatePrimaryChildrenSharedAclId(
Long txnId,

View File

@@ -182,7 +182,7 @@ public class ADMAccessControlListDAO implements AccessControlListDAO
}
Acl newAcl = aclDaoComponent.createAccessControlList(properties, existing.getEntries(), actuallyInherited);
newDefiningAcl = newAcl.getId();
nodeDAO.setNodeDefiningAclId(nodeId, newDefiningAcl);
nodeDAO.setNodeAclId(nodeId, newDefiningAcl);
}
else if (existing.getProperties().getAclType() == ACLType.SHARED)
{
@@ -207,12 +207,12 @@ public class ADMAccessControlListDAO implements AccessControlListDAO
AccessControlListProperties properties = aclDaoComponent.getDefaultProperties();
Acl newAcl = aclDaoComponent.createAccessControlList(properties);
newDefiningAcl = newAcl.getId();
nodeDAO.setNodeDefiningAclId(nodeId, newDefiningAcl);
nodeDAO.setNodeAclId(nodeId, newDefiningAcl);
}
else
{
// Unset - simple inherit
nodeDAO.setNodeDefiningAclId(nodeId, inheritedAclId);
nodeDAO.setNodeAclId(nodeId, inheritedAclId);
}
}
}