use of org.camunda.bpm.engine.impl.calendar.BusinessCalendar in project camunda-bpm-platform by camunda.
the class TimerDeclarationImpl method initializeConfiguration.
protected void initializeConfiguration(ExecutionEntity context, TimerEntity job) {
BusinessCalendar businessCalendar = Context.getProcessEngineConfiguration().getBusinessCalendarManager().getBusinessCalendar(type.calendarName);
if (description == null) {
throw new ProcessEngineException("Timer '" + context.getActivityId() + "' was not configured with a valid duration/time");
}
String dueDateString = null;
Date duedate = null;
// ACT-1415: timer-declaration on start-event may contain expressions NOT
// evaluating variables but other context, evaluating should happen nevertheless
VariableScope scopeForExpression = context;
if (scopeForExpression == null) {
scopeForExpression = StartProcessVariableScope.getSharedInstance();
}
Object dueDateValue = description.getValue(scopeForExpression);
if (dueDateValue instanceof String) {
dueDateString = (String) dueDateValue;
} else if (dueDateValue instanceof Date) {
duedate = (Date) dueDateValue;
} else {
throw new ProcessEngineException("Timer '" + context.getActivityId() + "' was not configured with a valid duration/time, either hand in a java.util.Date or a String in format 'yyyy-MM-dd'T'hh:mm:ss'");
}
if (duedate == null) {
duedate = businessCalendar.resolveDuedate(dueDateString);
}
job.setDuedate(duedate);
if (type == TimerDeclarationType.CYCLE && jobHandlerType != TimerCatchIntermediateEventJobHandler.TYPE) {
// See ACT-1427: A boundary timer with a cancelActivity='true', doesn't need to repeat itself
if (!isInterruptingTimer) {
String prepared = prepareRepeat(dueDateString);
job.setRepeat(prepared);
}
}
}
Aggregations