in jbpm/jbpm-flow/src/main/java/org/jbpm/ruleflow/core/validation/RuleFlowProcessValidator.java [870:936]
private void validateTimer(final Timer timer,
final org.kie.api.definition.process.Node node,
final RuleFlowProcess process,
final List<ProcessValidationError> errors) {
if (timer.getDelay() == null && timer.getDate() == null) {
addErrorMessage(process,
node,
errors,
"Has timer with no delay or date specified.");
} else {
if (timer.getDelay() != null && !timer.getDelay().contains("#{")) {
try {
switch (timer.getTimeType()) {
case Timer.TIME_CYCLE:
if (!KieCronExpression.isValidExpression(timer.getDelay())) {
// when using ISO date/time period is not set
DateTimeUtils.parseRepeatableDateTime(timer.getDelay());
}
break;
case Timer.TIME_DURATION:
DateTimeUtils.parseDuration(timer.getDelay());
break;
case Timer.TIME_DATE:
DateTimeUtils.parseDateAsDuration(timer.getDate());
break;
default:
break;
}
} catch (RuntimeException e) {
if (!isExpression(process, timer.getDelay())) {
addErrorMessage(process,
node,
errors,
"Could not parse delay '" + timer.getDelay() + "': " + e.getMessage());
}
}
}
}
if (timer.getPeriod() != null && !timer.getPeriod().contains("#{")) {
try {
if (!KieCronExpression.isValidExpression(timer.getPeriod())) {
// when using ISO date/time period is not set
DateTimeUtils.parseRepeatableDateTime(timer.getPeriod());
}
} catch (RuntimeException e) {
if (!isExpression(process, timer.getPeriod())) {
addErrorMessage(process,
node,
errors,
"Could not parse period '" + timer.getPeriod() + "': " + e.getMessage());
}
}
}
if (timer.getDate() != null && !timer.getDate().contains("#{")) {
try {
DateTimeUtils.parseDateAsDuration(timer.getDate());
} catch (RuntimeException e) {
if (!isExpression(process, timer.getDate())) {
addErrorMessage(process,
node,
errors,
"Could not parse date '" + timer.getDate() + "': " + e.getMessage());
}
}
}
}