}
}
protected TimerDeclarationImpl parseTimer(Element timerEventDefinition, ScopeImpl timerActivity, String jobHandlerType) {
// TimeDate
TimerDeclarationType type = TimerDeclarationType.DATE;
Expression expression = parseExpression(timerEventDefinition, "timeDate");
// TimeCycle
if (expression == null) {
type = TimerDeclarationType.CYCLE;
expression = parseExpression(timerEventDefinition, "timeCycle");
}
// TimeDuration
if (expression == null) {
type = TimerDeclarationType.DURATION;
expression = parseExpression(timerEventDefinition, "timeDuration");
}
// neither date, cycle or duration configured!
if (expression==null) {
addError("Timer needs configuration (either timeDate, timeCycle or timeDuration is needed).", timerEventDefinition);
}
// Parse the timer declaration
// TODO move the timer declaration into the bpmn activity or next to the
// TimerSession
TimerDeclarationImpl timerDeclaration = new TimerDeclarationImpl(expression, type, jobHandlerType);
timerDeclaration.setJobHandlerConfiguration(timerActivity.getId());
timerDeclaration.setExclusive("true".equals(timerEventDefinition.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "exclusive", String.valueOf(JobEntity.DEFAULT_EXCLUSIVE))));
if(timerActivity.getId() == null) {
addError("Attribute \"id\" is required!",timerEventDefinition);
}
timerDeclaration.setActivityId(timerActivity.getId());
timerDeclaration.setJobConfiguration(type.toString() + ": " +expression.getExpressionText());
addJobDeclarationToProcessDefinition(timerDeclaration, timerActivity.getProcessDefinition());
return timerDeclaration;
}