mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Changed calculating as of date
This commit is contained in:
@@ -266,7 +266,9 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
{
|
{
|
||||||
final NextActionFromDisposition dsNextAction = getDispositionActionByNameForRecord(nodeRef);
|
final NextActionFromDisposition dsNextAction = getDispositionActionByNameForRecord(nodeRef);
|
||||||
|
|
||||||
if (dsNextAction != null && !dsNextAction.getWriteMode().equals(WriteMode.READ_ONLY))
|
if (dsNextAction != null)
|
||||||
|
{
|
||||||
|
if (!dsNextAction.getWriteMode().equals(WriteMode.READ_ONLY))
|
||||||
{
|
{
|
||||||
final NodeRef action = dsNextAction.getNextActionNodeRef();
|
final NodeRef action = dsNextAction.getNextActionNodeRef();
|
||||||
final String dispositionActionName = dsNextAction.getNextActionName();
|
final String dispositionActionName = dsNextAction.getNextActionName();
|
||||||
@@ -285,6 +287,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
dsNodeRef = dsNextAction.getDispositionNodeRef();
|
dsNodeRef = dsNextAction.getDispositionNodeRef();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -695,11 +698,18 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty);
|
contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (period.getPeriodType().equals("immediately"))
|
||||||
|
{
|
||||||
|
contextDate = (Date)nodeService.getProperty(nodeRef, ContentModel.PROP_CREATED);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// for now use 'NOW' as the default context date
|
// for now use 'NOW' as the default context date
|
||||||
// TODO set the default period property ... cut off date or last disposition date depending on context
|
// TODO set the default period property ... cut off date or last disposition date depending on context
|
||||||
contextDate = new Date();
|
contextDate = new Date();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate the as of date
|
// Calculate the as of date
|
||||||
if (contextDate != null)
|
if (contextDate != null)
|
||||||
@@ -1006,6 +1016,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
|
|
||||||
public Date getDispositionActionDate(NodeRef record, NodeRef dispositionSchedule, String dispositionActionName)
|
public Date getDispositionActionDate(NodeRef record, NodeRef dispositionSchedule, String dispositionActionName)
|
||||||
{
|
{
|
||||||
|
DispositionSchedule ds = new DispositionScheduleImpl(serviceRegistry, nodeService, dispositionSchedule);
|
||||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(dispositionSchedule);
|
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(dispositionSchedule);
|
||||||
if (assocs != null && assocs.size() > 0)
|
if (assocs != null && assocs.size() > 0)
|
||||||
{
|
{
|
||||||
@@ -1013,16 +1024,8 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
|||||||
{
|
{
|
||||||
if (assoc != null && assoc.getQName().getLocalName().contains(dispositionActionName))
|
if (assoc != null && assoc.getQName().getLocalName().contains(dispositionActionName))
|
||||||
{
|
{
|
||||||
Date newAsOfDate = null;
|
DispositionActionDefinition actionDefinition = ds.getDispositionActionDefinition(assoc.getChildRef().getId());
|
||||||
Period dispositionPeriod = (Period) nodeService.getProperty(assoc.getChildRef(), PROP_DISPOSITION_PERIOD);
|
return calculateAsOfDate(record, actionDefinition, true);
|
||||||
Date recordCreationDate = (Date)nodeService.getProperty(record, ContentModel.PROP_CREATED);
|
|
||||||
|
|
||||||
if (dispositionPeriod != null)
|
|
||||||
{
|
|
||||||
// calculate the new as of date as we have been provided a new period
|
|
||||||
newAsOfDate = dispositionPeriod.getNextDate(recordCreationDate);
|
|
||||||
}
|
|
||||||
return newAsOfDate;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user