Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

75496: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (5.0/Cloud)
      74568: Issue a warning when finding a nodes that have the checkout-checkin aspects but where the association is missing
       - This is quite likely caused by the nodes cache being incorrect, which leads to the incorrect aspects being picked up
       - If you get the warning 'Found node with xyz aspect but no association", then the cache may be incorrect.
       - TODO: Recovery code, which is possible, if this turns out to be an issue


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@77458 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-07-22 12:32:08 +00:00
parent 0b2efd4d2c
commit 24f0f78b56

View File

@@ -728,12 +728,16 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
{ {
List<AssociationRef> assocs = nodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK); List<AssociationRef> assocs = nodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK);
// It is a 1:1 relationship // It is a 1:1 relationship
if (assocs.size() > 0) if (assocs.size() == 0)
{
logger.warn("Found node with cm:checkedOut aspect but no association. Current node state: " + nodeService.getNodeStatus(nodeRef));
}
else if (assocs.size() > 1)
{
logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " association from node: " + nodeRef);
}
else
{ {
if (assocs.size() > 1)
{
logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " association from node: " + nodeRef);
}
workingCopy = assocs.get(0).getTargetRef(); workingCopy = assocs.get(0).getTargetRef();
} }
} }
@@ -749,12 +753,16 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
{ {
List<AssociationRef> assocs = nodeService.getSourceAssocs(nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK); List<AssociationRef> assocs = nodeService.getSourceAssocs(nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK);
// It is a 1:1 relationship // It is a 1:1 relationship
if (assocs.size() > 0) if (assocs.size() == 0)
{
logger.warn("Found node with cm:workingcopy aspect but no association. Current node state: " + nodeService.getNodeStatus(nodeRef));
}
else if (assocs.size() > 1)
{
logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " association to node: " + nodeRef);
}
else
{ {
if (assocs.size() > 1)
{
logger.warn("Found multiple " + ContentModel.ASSOC_WORKING_COPY_LINK + " associations to node: " + nodeRef);
}
original = assocs.get(0).getSourceRef(); original = assocs.get(0).getSourceRef();
} }
} }