mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/2.0.1.x to HEAD:
55708: [RM-904] Actions are missing within Records Management Site for Record Series and its children. Patches are implemented as components. Components are loaded in a single thread. The work of a patch should be wrapped in its own transaction to isolate it from the changes of other patches and allowing patches to commit work before working on the next patch.Moved all work of RMv2ModelPatch into the RetryingTransactionCallback. RetryingTransactionHelper set to create new thread. Add RetryingTransactionHelper to RMv2FilePlanNodeRefPatch. Move all of the work of the patch into the callback. Helper creates new thread. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@56010 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
<property name="permissionService" ref="PermissionService"/>
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="filePlanRoleService" ref="filePlanRoleService" />
|
||||
<property name="retryingTransactionHelper" ref="retryingTransactionHelper"/>
|
||||
</bean>
|
||||
|
||||
<bean id="org_alfresco_module_rm_RMv2SavedSearchPatch"
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.repo.domain.node.NodeDAO;
|
||||
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||
import org.alfresco.repo.domain.qname.QNameDAO;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.Period;
|
||||
@@ -61,6 +62,7 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
|
||||
private PermissionService permissionService;
|
||||
private FilePlanService filePlanService;
|
||||
private FilePlanRoleService filePlanRoleService;
|
||||
private RetryingTransactionHelper retryingTransactionHelper;
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
@@ -103,6 +105,11 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
|
||||
this.filePlanRoleService = filePlanRoleService;
|
||||
}
|
||||
|
||||
public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper)
|
||||
{
|
||||
this.retryingTransactionHelper = retryingTransactionHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filePlanService file plan service
|
||||
*/
|
||||
@@ -117,7 +124,21 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
|
||||
@Override
|
||||
protected void executePatch() throws Throwable
|
||||
{
|
||||
Pair<Long, QName> aspectPair = qnameDAO.getQName(ASPECT_FILE_PLAN_COMPONENT);
|
||||
retryingTransactionHelper.doInTransaction(new Work(), false, true);
|
||||
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug(" ... complete RM Module RMv2FilePlanNodeRef Patch");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class Work implements RetryingTransactionHelper.RetryingTransactionCallback<Integer>
|
||||
{
|
||||
@Override
|
||||
public Integer execute() throws Throwable
|
||||
{
|
||||
Pair<Long, QName> aspectPair = qnameDAO.getQName(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT);
|
||||
if (aspectPair != null)
|
||||
{
|
||||
List<Long> filePlanComponents = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID());
|
||||
@@ -175,5 +196,9 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
|
||||
behaviourFilter.enableBehaviour();
|
||||
}
|
||||
}
|
||||
|
||||
// nothing to do
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -51,6 +51,7 @@ public class RMv2ModelPatch extends ModulePatchComponent
|
||||
private QNameDAO qnameDAO;
|
||||
private RetryingTransactionHelper retryingTransactionHelper;
|
||||
|
||||
|
||||
public void setPatchDAO(PatchDAO patchDAO)
|
||||
{
|
||||
this.patchDAO = patchDAO;
|
||||
@@ -88,6 +89,32 @@ public class RMv2ModelPatch extends ModulePatchComponent
|
||||
}
|
||||
|
||||
private void updateQName(QName qnameBefore, QName qnameAfter, String reindexClass)
|
||||
{
|
||||
|
||||
Work work = new Work(qnameBefore, qnameAfter, reindexClass);
|
||||
retryingTransactionHelper.doInTransaction(work, false, true);
|
||||
|
||||
}
|
||||
|
||||
private class Work implements RetryingTransactionHelper.RetryingTransactionCallback<Integer>
|
||||
{
|
||||
private QName qnameBefore;
|
||||
private QName qnameAfter;
|
||||
private String reindexClass;
|
||||
|
||||
Work(QName qnameBefore, QName qnameAfter, String reindexClass)
|
||||
{
|
||||
this.qnameBefore = qnameBefore;
|
||||
this.qnameAfter = qnameAfter;
|
||||
this.reindexClass = reindexClass;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute()
|
||||
*/
|
||||
@Override
|
||||
public Integer execute() throws Throwable
|
||||
{
|
||||
Long maxNodeId = patchDAO.getMaxAdmNodeID();
|
||||
|
||||
@@ -97,8 +124,16 @@ public class RMv2ModelPatch extends ModulePatchComponent
|
||||
{
|
||||
for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE)
|
||||
{
|
||||
Work work = new Work(before.getFirst(), i, reindexClass);
|
||||
retryingTransactionHelper.doInTransaction(work, false, true);
|
||||
if ("TYPE".equals(reindexClass))
|
||||
{
|
||||
List<Long> nodeIds = patchDAO.getNodesByTypeQNameId(before.getFirst(), i, i + BATCH_SIZE);
|
||||
nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds);
|
||||
}
|
||||
else if ("ASPECT".equals(reindexClass))
|
||||
{
|
||||
List<Long> nodeIds = patchDAO.getNodesByAspectQNameId(before.getFirst(), i, i + BATCH_SIZE);
|
||||
nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds);
|
||||
}
|
||||
}
|
||||
|
||||
qnameDAO.updateQName(qnameBefore, qnameAfter);
|
||||
@@ -115,46 +150,9 @@ public class RMv2ModelPatch extends ModulePatchComponent
|
||||
logger.debug(" ... no need to update qname " + qnameBefore.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Work implements RetryingTransactionHelper.RetryingTransactionCallback<Integer>
|
||||
{
|
||||
private long qnameId;
|
||||
private long lower;
|
||||
private String reindexClass;
|
||||
|
||||
Work(long qnameId, long lower, String reindexClass)
|
||||
{
|
||||
this.qnameId = qnameId;
|
||||
this.lower = lower;
|
||||
this.reindexClass = reindexClass;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute()
|
||||
*/
|
||||
@Override
|
||||
public Integer execute() throws Throwable
|
||||
{
|
||||
if ("TYPE".equals(reindexClass))
|
||||
{
|
||||
List<Long> nodeIds = patchDAO.getNodesByTypeQNameId(qnameId, lower, lower + BATCH_SIZE);
|
||||
nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds);
|
||||
return nodeIds.size();
|
||||
}
|
||||
else if ("ASPECT".equals(reindexClass))
|
||||
{
|
||||
List<Long> nodeIds = patchDAO.getNodesByAspectQNameId(qnameId, lower, lower + BATCH_SIZE);
|
||||
nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds);
|
||||
return nodeIds.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
//nothing to do
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user