RM-6337 Code review changes

This commit is contained in:
Roxana Lucanu-Ghetu
2018-05-29 15:21:59 +03:00
parent 6961f0aa18
commit 4659a93e71

View File

@@ -811,7 +811,6 @@ public class DispositionServiceImpl extends ServiceBaseImpl
public boolean isNextDispositionActionEligible(NodeRef nodeRef)
{
boolean result = false;
// Get the disposition instructions
DispositionSchedule di = getDispositionSchedule(nodeRef);
DispositionAction nextDa = getNextDispositionAction(nodeRef);
@@ -819,31 +818,32 @@ public class DispositionServiceImpl extends ServiceBaseImpl
this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
nextDa != null)
{
Boolean combineSteps = null;
// for accession step we can have also AND between step conditions
Boolean combineSteps = false;
if (nextDa.getName().equals("accession"))
{
NodeRef accessionNodeRef = di.getDispositionActionDefinitionByName("accession").getNodeRef();
combineSteps = (Boolean)nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS);
}
// If it has an asOf date and it is greater than now the action is eligible
Date asOf = (Date)this.nodeService.getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF);
if (asOf != null &&
asOf.before(new Date()))
if (accessionNodeRef != null) {
if (this.nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS) != null)
{
result = true;
if (combineSteps == null || !combineSteps)
combineSteps = (Boolean)this.nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS);
}
}
}
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(combineSteps != null && combineSteps)
else if(!asOfDateInPast && combineSteps)
{
return false;
}
if (!result || (result && combineSteps))
{
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef());
DispositionActionDefinition dad = da.getDispositionActionDefinition();
if (dad != null)
@@ -881,8 +881,6 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
}
}
}
return result;
}