RM-5244 - added extra check for efficiency

This commit is contained in:
Ana Bozianu
2017-05-31 17:10:43 +03:00
parent b2b936b28f
commit e886317bf5

View File

@@ -456,8 +456,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD)) if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD))
{ {
generateRecordIdentifier(nodeService, identifierService, nodeRef); generateRecordIdentifier(nodeService, identifierService, nodeRef);
// RM-5244 - workaround to make sure the incomplete aspect is removed reevaluateIncompleteTag(nodeRef);
incompleteNodeTagger.beforeCommit(false);
} }
return null; return null;
} }
@@ -481,8 +480,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
if (ContentData.hasContent(contentData) && contentData.getSize() > 0) if (ContentData.hasContent(contentData) && contentData.getSize() > 0)
{ {
appendIdentifierToName(nodeService, nodeRef); appendIdentifierToName(nodeService, nodeRef);
// RM-5244 - workaround to make sure the incomplete aspect is removed reevaluateIncompleteTag(nodeRef);
incompleteNodeTagger.beforeCommit(false);
} }
} }
} }
@@ -1847,8 +1845,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
if (nodeService.exists(nodeRef) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE)) if (nodeService.exists(nodeRef) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE))
{ {
generateRecordIdentifier(nodeService, identifierService, nodeRef); generateRecordIdentifier(nodeService, identifierService, nodeRef);
// RM-5244 - workaround to make sure the incomplete aspect is removed reevaluateIncompleteTag(nodeRef);
incompleteNodeTagger.beforeCommit(false);
} }
} }
@@ -1907,4 +1904,22 @@ public class RecordServiceImpl extends BaseBehaviourBean
OnRecordRejection policy = onRecordRejectionDelegate.get(qnames); OnRecordRejection policy = onRecordRejectionDelegate.get(qnames);
policy.onRecordRejection(nodeRef); policy.onRecordRejection(nodeRef);
} }
/**
* RM-5244 - workaround to make sure the incomplete aspect is removed
*
* @param nodeRef the node to reevaluate for
*/
private void reevaluateIncompleteTag(NodeRef nodeRef)
{
/*
* Check if the node has the aspect because the reevaluation is expensive.
* If the node doesn't have the aspect it means IncompleteNodeTagger didn't load before TransactionBehaviourQueue
* and we don't need to reevaluate.
*/
if(nodeService.hasAspect(nodeRef, ContentModel.ASPECT_INCOMPLETE))
{
incompleteNodeTagger.beforeCommit(false);
}
}
} }