mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'feature-2.7/RM-6337_AccessionVisibilityBackport' into 'release/V2.7'
Backport fix from master See merge request records-management/records-management!1019
This commit is contained in:
@@ -811,63 +811,77 @@ 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);
|
||||||
NodeRef nextDa = getNextDispositionActionNodeRef(nodeRef);
|
DispositionAction nextDa = getNextDispositionAction(nodeRef);
|
||||||
if (di != null &&
|
if (di != null &&
|
||||||
this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
|
this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
|
||||||
nextDa != null)
|
nextDa != null)
|
||||||
{
|
{
|
||||||
// If it has an asOf date and it is greater than now the action is eligible
|
// for accession step we can have also AND between step conditions
|
||||||
Date asOf = (Date)this.nodeService.getProperty(nextDa, PROP_DISPOSITION_AS_OF);
|
Boolean combineSteps = false;
|
||||||
if (asOf != null &&
|
if (nextDa.getName().equals("accession"))
|
||||||
asOf.before(new Date()))
|
|
||||||
{
|
{
|
||||||
result = true;
|
NodeRef accessionNodeRef = di.getDispositionActionDefinitionByName("accession").getNodeRef();
|
||||||
}
|
if (accessionNodeRef != null) {
|
||||||
|
Boolean combineStepsProp = (Boolean)this.nodeService.getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS);
|
||||||
if (!result)
|
if (combineStepsProp != null)
|
||||||
{
|
|
||||||
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa);
|
|
||||||
DispositionActionDefinition dad = da.getDispositionActionDefinition();
|
|
||||||
if (dad != null)
|
|
||||||
{
|
|
||||||
boolean firstComplete = dad.eligibleOnFirstCompleteEvent();
|
|
||||||
|
|
||||||
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(nextDa, ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL);
|
|
||||||
for (ChildAssociationRef assoc : assocs)
|
|
||||||
{
|
{
|
||||||
NodeRef eventExecution = assoc.getChildRef();
|
combineSteps = combineStepsProp;
|
||||||
Boolean isCompleteValue = (Boolean)this.nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_COMPLETE);
|
}
|
||||||
boolean isComplete = false;
|
}
|
||||||
if (isCompleteValue != null)
|
}
|
||||||
{
|
Date asOf = (Date)this.nodeService.getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF);
|
||||||
isComplete = isCompleteValue.booleanValue();
|
Boolean asOfDateInPast = false;
|
||||||
|
if (asOf != null)
|
||||||
|
{
|
||||||
|
asOfDateInPast = asOf.before(new Date());
|
||||||
|
}
|
||||||
|
if (asOfDateInPast && !combineSteps)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(!asOfDateInPast && combineSteps)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef());
|
||||||
|
DispositionActionDefinition dad = da.getDispositionActionDefinition();
|
||||||
|
if (dad != null)
|
||||||
|
{
|
||||||
|
boolean firstComplete = dad.eligibleOnFirstCompleteEvent();
|
||||||
|
|
||||||
// implement AND and OR combination of event completions
|
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(nextDa.getNodeRef(), ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL);
|
||||||
if (isComplete)
|
for (ChildAssociationRef assoc : assocs)
|
||||||
|
{
|
||||||
|
NodeRef eventExecution = assoc.getChildRef();
|
||||||
|
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
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ package org.alfresco.module.org_alfresco_module_rm.jscript.app;
|
|||||||
|
|
||||||
import static org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel.READ_RECORDS;
|
import static org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel.READ_RECORDS;
|
||||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_COMBINE_DISPOSITION_STEP_CONDITIONS;
|
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_COMBINE_DISPOSITION_STEP_CONDITIONS;
|
||||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_RS_DISPOSITION_EVENTS;
|
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_DISPOSITION_EVENT_COMBINATION;
|
||||||
import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED;
|
import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -485,6 +485,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS
|
|||||||
HashMap properties = ((HashMap) rmNodeValues.get("properties"));
|
HashMap properties = ((HashMap) rmNodeValues.get("properties"));
|
||||||
properties.put("combineDispositionStepConditions", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_COMBINE_DISPOSITION_STEP_CONDITIONS));
|
properties.put("combineDispositionStepConditions", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_COMBINE_DISPOSITION_STEP_CONDITIONS));
|
||||||
properties.put("incompleteDispositionEvent", details.getEventName());
|
properties.put("incompleteDispositionEvent", details.getEventName());
|
||||||
|
properties.put("dispositionEventCombination", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_DISPOSITION_EVENT_COMBINATION));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user