mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM-6337 Code review changes
This commit is contained in:
@@ -811,7 +811,6 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
public boolean isNextDispositionActionEligible(NodeRef nodeRef)
|
public boolean isNextDispositionActionEligible(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
// Get the disposition instructions
|
// Get the disposition instructions
|
||||||
DispositionSchedule di = getDispositionSchedule(nodeRef);
|
DispositionSchedule di = getDispositionSchedule(nodeRef);
|
||||||
DispositionAction nextDa = getNextDispositionAction(nodeRef);
|
DispositionAction nextDa = getNextDispositionAction(nodeRef);
|
||||||
@@ -819,70 +818,69 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
|
this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
|
||||||
nextDa != null)
|
nextDa != null)
|
||||||
{
|
{
|
||||||
Boolean combineSteps = null;
|
// for accession step we can have also AND between step conditions
|
||||||
|
Boolean combineSteps = false;
|
||||||
if (nextDa.getName().equals("accession"))
|
if (nextDa.getName().equals("accession"))
|
||||||
{
|
{
|
||||||
NodeRef accessionNodeRef = di.getDispositionActionDefinitionByName("accession").getNodeRef();
|
NodeRef accessionNodeRef = di.getDispositionActionDefinitionByName("accession").getNodeRef();
|
||||||
combineSteps = (Boolean)nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS);
|
if (accessionNodeRef != null) {
|
||||||
}
|
if (this.nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS) != null)
|
||||||
|
{
|
||||||
// If it has an asOf date and it is greater than now the action is eligible
|
combineSteps = (Boolean)this.nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS);
|
||||||
Date asOf = (Date)this.nodeService.getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF);
|
}
|
||||||
if (asOf != null &&
|
|
||||||
asOf.before(new Date()))
|
|
||||||
{
|
|
||||||
result = true;
|
|
||||||
if (combineSteps == null || !combineSteps)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(combineSteps != null && combineSteps)
|
Date asOf = (Date)this.nodeService.getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF);
|
||||||
|
Boolean asOfDateInPast = false;
|
||||||
|
if (asOf != null)
|
||||||
|
{
|
||||||
|
asOfDateInPast = ((Date) this.nodeService.getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF)).before(new Date());
|
||||||
|
}
|
||||||
|
if (asOfDateInPast && !combineSteps)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(!asOfDateInPast && combineSteps)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef());
|
||||||
if (!result || (result && combineSteps))
|
DispositionActionDefinition dad = da.getDispositionActionDefinition();
|
||||||
|
if (dad != null)
|
||||||
{
|
{
|
||||||
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef());
|
boolean firstComplete = dad.eligibleOnFirstCompleteEvent();
|
||||||
DispositionActionDefinition dad = da.getDispositionActionDefinition();
|
|
||||||
if (dad != null)
|
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(nextDa.getNodeRef(), ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL);
|
||||||
|
for (ChildAssociationRef assoc : assocs)
|
||||||
{
|
{
|
||||||
boolean firstComplete = dad.eligibleOnFirstCompleteEvent();
|
NodeRef eventExecution = assoc.getChildRef();
|
||||||
|
Boolean isCompleteValue = (Boolean)this.nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_COMPLETE);
|
||||||
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(nextDa.getNodeRef(), ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL);
|
boolean isComplete = false;
|
||||||
for (ChildAssociationRef assoc : assocs)
|
if (isCompleteValue != null)
|
||||||
{
|
{
|
||||||
NodeRef eventExecution = assoc.getChildRef();
|
isComplete = isCompleteValue.booleanValue();
|
||||||
Boolean isCompleteValue = (Boolean)this.nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_COMPLETE);
|
|
||||||
boolean isComplete = false;
|
|
||||||
if (isCompleteValue != null)
|
|
||||||
{
|
|
||||||
isComplete = isCompleteValue.booleanValue();
|
|
||||||
|
|
||||||
// implement AND and OR combination of event completions
|
// implement AND and OR combination of event completions
|
||||||
if (isComplete)
|
if (isComplete)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
if (firstComplete)
|
||||||
{
|
{
|
||||||
result = true;
|
break;
|
||||||
if (firstComplete)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
if (!firstComplete)
|
||||||
{
|
{
|
||||||
result = false;
|
break;
|
||||||
if (!firstComplete)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user