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,31 +818,32 @@ 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
|
|
||||||
Date asOf = (Date)this.nodeService.getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF);
|
|
||||||
if (asOf != null &&
|
|
||||||
asOf.before(new Date()))
|
|
||||||
{
|
{
|
||||||
result = true;
|
combineSteps = (Boolean)this.nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS);
|
||||||
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
else if(!asOfDateInPast && combineSteps)
|
||||||
else if(combineSteps != null && combineSteps)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result || (result && combineSteps))
|
|
||||||
{
|
|
||||||
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef());
|
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef());
|
||||||
DispositionActionDefinition dad = da.getDispositionActionDefinition();
|
DispositionActionDefinition dad = da.getDispositionActionDefinition();
|
||||||
if (dad != null)
|
if (dad != null)
|
||||||
@@ -881,8 +881,6 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user