}
public static Date getCutOffTime(Entity entity, String nominalTime)
throws IvoryException {
ConfigurationStore store = ConfigurationStore.get();
ExpressionHelper evaluator = ExpressionHelper.get();
Date instanceStart = EntityUtil.parseDateUTC(nominalTime);
ExpressionHelper.setReferenceDate(instanceStart);
Date endTime = new Date();
Date feedCutOff = new Date(0);
if (entity.getEntityType() == EntityType.FEED) {
if (((Feed) entity).getLateArrival() == null) {
LOG.debug("Feed's " + entity.getName()
+ " late arrival cut-off is not configured, returning");
return feedCutOff;
}
String lateCutOff = ((Feed) entity).getLateArrival().getCutOff()
.toString();
endTime = EntityUtil.parseDateUTC(nominalTime);
long feedCutOffPeriod = evaluator.evaluate(lateCutOff, Long.class);
endTime = addTime(endTime, (int) feedCutOffPeriod);
return endTime;
} else if (entity.getEntityType() == EntityType.PROCESS) {
Process process = (Process) entity;
for (LateInput lp : process.getLateProcess().getLateInputs()) {
Feed feed = null;
String endInstanceTime = "";
for (Input input : process.getInputs().getInputs()) {
if (input.getName().equals(lp.getInput())) {
endInstanceTime = input.getEnd();
feed = store.get(EntityType.FEED, input.getFeed());
break;
}
}
if (feed.getLateArrival() == null) {
LOG.debug("Feed's " + feed.getName()