mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Part of ALF-10699: Nodes not getting put into new transactions during various operations
- Mass ACL updates of primary children now update the version and transaction for the affected nodes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31108 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -184,7 +184,7 @@ Inbound settings from iBatis
|
||||
<mapper resource="alfresco/ibatis/#resource.dialect#/content-insert-SqlMap.xml"/>
|
||||
<mapper resource="alfresco/ibatis/#resource.dialect#/node-common-SqlMap.xml"/>
|
||||
<mapper resource="alfresco/ibatis/#resource.dialect#/node-select-children-SqlMap.xml"/>
|
||||
<mapper resource="alfresco/ibatis/#resource.dialect#/node-update-acl-SqlMap.xml"/>
|
||||
<mapper resource="alfresco/ibatis/#resource.dialect#/node-update-SqlMap.xml"/>
|
||||
<mapper resource="alfresco/ibatis/#resource.dialect#/node-insert-SqlMap.xml"/>
|
||||
<mapper resource="alfresco/ibatis/#resource.dialect#/patch-common-SqlMap.xml"/>
|
||||
<mapper resource="alfresco/ibatis/#resource.dialect#/permissions-common-SqlMap.xml"/>
|
||||
|
@@ -11,7 +11,9 @@
|
||||
update
|
||||
alf_node
|
||||
set
|
||||
acl_id = #{newSharedAclId}
|
||||
acl_id = #{newSharedAclId},
|
||||
version = version + 1,
|
||||
transaction_id = #{txnId}
|
||||
where id in
|
||||
(
|
||||
select n.id
|
||||
@@ -28,4 +30,25 @@
|
||||
)
|
||||
</update>
|
||||
|
||||
<!--
|
||||
Use ANSI subselect. This is not performant on MySQL.
|
||||
-->
|
||||
<update id="update_ChildrenTxns" parameterType="ChildAssoc">
|
||||
update
|
||||
alf_node
|
||||
set
|
||||
version = version + 1,
|
||||
n.transaction_id = #{parent.transaction.id}
|
||||
where id in
|
||||
(
|
||||
select
|
||||
ca.child_node_id
|
||||
from
|
||||
alf_child_assoc ca
|
||||
where
|
||||
ca.parent_node_id = #{parent.id}
|
||||
<if test="isPrimary == true">and ca.is_primary = #{isPrimary}</if>
|
||||
)
|
||||
</update>
|
||||
|
||||
</mapper>
|
@@ -12,7 +12,9 @@
|
||||
alf_child_assoc assoc
|
||||
join alf_node child on (child.id = assoc.child_node_id and assoc.is_primary = #{isPrimary})
|
||||
set
|
||||
child.acl_id = #{newSharedAclId}
|
||||
child.acl_id = #{newSharedAclId},
|
||||
child.version = child.version + 1,
|
||||
child.transaction_id = #{txnId}
|
||||
where
|
||||
assoc.parent_node_id = #{primaryParentNodeId}
|
||||
and
|
||||
@@ -22,4 +24,19 @@
|
||||
)
|
||||
</update>
|
||||
|
||||
<!--
|
||||
ANSI subselect is not performant on MySQL. Use non-ANSI join syntax.
|
||||
-->
|
||||
<update id="update_ChildrenTxns" parameterType="ChildAssoc">
|
||||
update
|
||||
alf_node n
|
||||
join alf_child_assoc ca on (ca.child_node_id = n.id)
|
||||
set
|
||||
n.version = n.version + 1,
|
||||
n.transaction_id = #{parentNode.transaction.id}
|
||||
where
|
||||
ca.parent_node_id = #{parentNode.id}
|
||||
<if test="isPrimary == true">and ca.is_primary = #{isPrimary}</if>
|
||||
</update>
|
||||
|
||||
</mapper>
|
@@ -1565,7 +1565,12 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
||||
Long optionalOldSharedAlcIdInAdditionToNull,
|
||||
Long newSharedAclId)
|
||||
{
|
||||
updatePrimaryChildrenSharedAclId(primaryParentNodeId, optionalOldSharedAlcIdInAdditionToNull, newSharedAclId);
|
||||
Long txnId = getCurrentTransactionId();
|
||||
updatePrimaryChildrenSharedAclId(
|
||||
txnId,
|
||||
primaryParentNodeId,
|
||||
optionalOldSharedAlcIdInAdditionToNull,
|
||||
newSharedAclId);
|
||||
invalidateCachesByNodeId(primaryParentNodeId, null, nodesCache);
|
||||
}
|
||||
|
||||
@@ -3362,12 +3367,6 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
||||
throw new DataIntegrityViolationException("Stale cache detected for Node #" + nodeId);
|
||||
}
|
||||
|
||||
private ParentAssocsInfo getParentAssocsCacheOnly(Long nodeId)
|
||||
{
|
||||
// can be null
|
||||
return parentAssocsCache.getValue(nodeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a node's parent associations.
|
||||
*/
|
||||
@@ -3848,6 +3847,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
||||
protected abstract int updateNode(NodeUpdateEntity nodeUpdate);
|
||||
protected abstract int updateNodePatchAcl(NodeUpdateEntity nodeUpdate);
|
||||
protected abstract void updatePrimaryChildrenSharedAclId(
|
||||
Long txnId,
|
||||
Long primaryParentNodeId,
|
||||
Long optionalOldSharedAlcIdInAdditionToNull,
|
||||
Long newSharedAlcId);
|
||||
|
@@ -27,6 +27,7 @@ package org.alfresco.repo.domain.node;
|
||||
*/
|
||||
public class PrimaryChildrenAclUpdateEntity
|
||||
{
|
||||
Long txnId;
|
||||
Long primaryParentNodeId;
|
||||
Long optionalOldSharedAclIdInAdditionToNull;
|
||||
Long newSharedAclId;
|
||||
@@ -35,6 +36,16 @@ public class PrimaryChildrenAclUpdateEntity
|
||||
{
|
||||
}
|
||||
|
||||
public Long getTxnId()
|
||||
{
|
||||
return txnId;
|
||||
}
|
||||
|
||||
public void setTxnId(Long txnId)
|
||||
{
|
||||
this.txnId = txnId;
|
||||
}
|
||||
|
||||
public Long getPrimaryParentNodeId()
|
||||
{
|
||||
return primaryParentNodeId;
|
||||
|
@@ -326,11 +326,13 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
|
||||
|
||||
@Override
|
||||
protected void updatePrimaryChildrenSharedAclId(
|
||||
Long txnId,
|
||||
Long primaryParentNodeId,
|
||||
Long optionalOldSharedAlcIdInAdditionToNull,
|
||||
Long newSharedAlcId)
|
||||
{
|
||||
PrimaryChildrenAclUpdateEntity primaryChildrenAclUpdateEntity = new PrimaryChildrenAclUpdateEntity();
|
||||
primaryChildrenAclUpdateEntity.setTxnId(txnId);
|
||||
primaryChildrenAclUpdateEntity.setPrimaryParentNodeId(primaryParentNodeId);
|
||||
primaryChildrenAclUpdateEntity.setOptionalOldSharedAclIdInAdditionToNull(optionalOldSharedAlcIdInAdditionToNull);
|
||||
primaryChildrenAclUpdateEntity.setNewSharedAclId(newSharedAlcId);
|
||||
|
Reference in New Issue
Block a user