mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -400,13 +400,6 @@
|
|||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="update_NodePatchAcl" parameterType="NodeUpdate">
|
|
||||||
update alf_node set
|
|
||||||
<if test="updateAclId == true"> acl_id = #{aclId,jdbcType=BIGINT}</if>
|
|
||||||
where
|
|
||||||
id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="update_NodeAssoc" parameterType="NodeAssoc">
|
<update id="update_NodeAssoc" parameterType="NodeAssoc">
|
||||||
update alf_node_assoc set
|
update alf_node_assoc set
|
||||||
assoc_index = #{assocIndex}
|
assoc_index = #{assocIndex}
|
||||||
|
@@ -1574,17 +1574,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
invalidateCachesByNodeId(primaryParentNodeId, null, nodesCache);
|
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)
|
public void deleteNode(Long nodeId)
|
||||||
{
|
{
|
||||||
Node node = getNodeNotNull(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
|
* 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
|
* @param nodePair the node to check
|
||||||
* the node to check
|
|
||||||
* @param path
|
|
||||||
* a set containing the nodes in the path to the node
|
|
||||||
*/
|
*/
|
||||||
public void cycleCheck(Pair<Long, NodeRef> nodePair)
|
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);
|
final Set<ChildAssociationRef> path = new HashSet<ChildAssociationRef>(97);
|
||||||
CyclicChildRelationshipException toThrow;
|
CyclicChildRelationshipException toThrow;
|
||||||
@@ -3085,7 +3074,9 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)
|
Pair<Long, NodeRef> childNodePair)
|
||||||
{
|
{
|
||||||
ChildAssociationRef childAssociationRef = childAssocPair.getSecond();
|
ChildAssociationRef childAssociationRef = childAssocPair.getSecond();
|
||||||
@@ -3845,7 +3836,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
protected abstract int updateStore(StoreEntity store);
|
protected abstract int updateStore(StoreEntity store);
|
||||||
protected abstract Long insertNode(NodeEntity node);
|
protected abstract Long insertNode(NodeEntity node);
|
||||||
protected abstract int updateNode(NodeUpdateEntity nodeUpdate);
|
protected abstract int updateNode(NodeUpdateEntity nodeUpdate);
|
||||||
protected abstract int updateNodePatchAcl(NodeUpdateEntity nodeUpdate);
|
|
||||||
protected abstract void updatePrimaryChildrenSharedAclId(
|
protected abstract void updatePrimaryChildrenSharedAclId(
|
||||||
Long txnId,
|
Long txnId,
|
||||||
Long primaryParentNodeId,
|
Long primaryParentNodeId,
|
||||||
|
@@ -711,30 +711,16 @@ public interface NodeDAO extends NodeBulkLoader
|
|||||||
public Long getMaxTxnCommitTime();
|
public Long getMaxTxnCommitTime();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Select children by property values
|
||||||
* @param parentNodeId
|
|
||||||
* @param childNodeTypeQNames
|
|
||||||
* @param value
|
|
||||||
* @param resultsCallback
|
|
||||||
*/
|
*/
|
||||||
public void getChildAssocsByPropertyValue(Long parentNodeId,
|
public void getChildAssocsByPropertyValue(
|
||||||
|
Long parentNodeId,
|
||||||
QName propertyQName,
|
QName propertyQName,
|
||||||
Serializable nodeValue,
|
Serializable nodeValue,
|
||||||
ChildAssocRefQueryCallback resultsCallback);
|
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.
|
* 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);
|
public List<NodePropertyEntity> selectProperties(Collection<PropertyDefinition> propertyDefs);
|
||||||
}
|
}
|
||||||
|
@@ -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 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 INSERT_NODE = "alfresco.node.insert.insert_Node";
|
||||||
private static final String UPDATE_NODE = "alfresco.node.update_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_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 DELETE_NODES_BY_TXN_COMMIT_TIME = "alfresco.node.delete_NodesByTxnCommitTime";
|
||||||
private static final String SELECT_NODE_BY_ID = "alfresco.node.select_NodeById";
|
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);
|
return template.update(UPDATE_NODE, nodeUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int updateNodePatchAcl(NodeUpdateEntity nodeUpdate)
|
|
||||||
{
|
|
||||||
return template.update(UPDATE_NODE_PATCH_ACL, nodeUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updatePrimaryChildrenSharedAclId(
|
protected void updatePrimaryChildrenSharedAclId(
|
||||||
Long txnId,
|
Long txnId,
|
||||||
|
@@ -182,7 +182,7 @@ public class ADMAccessControlListDAO implements AccessControlListDAO
|
|||||||
}
|
}
|
||||||
Acl newAcl = aclDaoComponent.createAccessControlList(properties, existing.getEntries(), actuallyInherited);
|
Acl newAcl = aclDaoComponent.createAccessControlList(properties, existing.getEntries(), actuallyInherited);
|
||||||
newDefiningAcl = newAcl.getId();
|
newDefiningAcl = newAcl.getId();
|
||||||
nodeDAO.setNodeDefiningAclId(nodeId, newDefiningAcl);
|
nodeDAO.setNodeAclId(nodeId, newDefiningAcl);
|
||||||
}
|
}
|
||||||
else if (existing.getProperties().getAclType() == ACLType.SHARED)
|
else if (existing.getProperties().getAclType() == ACLType.SHARED)
|
||||||
{
|
{
|
||||||
@@ -207,12 +207,12 @@ public class ADMAccessControlListDAO implements AccessControlListDAO
|
|||||||
AccessControlListProperties properties = aclDaoComponent.getDefaultProperties();
|
AccessControlListProperties properties = aclDaoComponent.getDefaultProperties();
|
||||||
Acl newAcl = aclDaoComponent.createAccessControlList(properties);
|
Acl newAcl = aclDaoComponent.createAccessControlList(properties);
|
||||||
newDefiningAcl = newAcl.getId();
|
newDefiningAcl = newAcl.getId();
|
||||||
nodeDAO.setNodeDefiningAclId(nodeId, newDefiningAcl);
|
nodeDAO.setNodeAclId(nodeId, newDefiningAcl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Unset - simple inherit
|
// Unset - simple inherit
|
||||||
nodeDAO.setNodeDefiningAclId(nodeId, inheritedAclId);
|
nodeDAO.setNodeAclId(nodeId, inheritedAclId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user