Search in sources :

Example 1 with Expression

use of org.camunda.bpm.engine.impl.el.Expression in project camunda-bpm-platform by camunda.

the class ParseUtil method parseRetryIntervals.

public static FailedJobRetryConfiguration parseRetryIntervals(String retryIntervals) {
    if (retryIntervals != null && !retryIntervals.isEmpty()) {
        if (StringUtil.isExpression(retryIntervals)) {
            ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager();
            Expression expression = expressionManager.createExpression(retryIntervals);
            return new FailedJobRetryConfiguration(expression);
        }
        String[] intervals = StringUtil.split(retryIntervals, ",");
        int retries = intervals.length + 1;
        if (intervals.length == 1) {
            try {
                DurationHelper durationHelper = new DurationHelper(intervals[0]);
                if (durationHelper.isRepeat()) {
                    retries = durationHelper.getTimes();
                }
            } catch (Exception e) {
                LOG.logParsingRetryIntervals(intervals[0], e);
                return null;
            }
        }
        return new FailedJobRetryConfiguration(retries, Arrays.asList(intervals));
    } else {
        return null;
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) DurationHelper(org.camunda.bpm.engine.impl.calendar.DurationHelper) Expression(org.camunda.bpm.engine.impl.el.Expression) FailedJobRetryConfiguration(org.camunda.bpm.engine.impl.bpmn.parser.FailedJobRetryConfiguration) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) NotValidException(org.camunda.bpm.engine.exception.NotValidException)

Aggregations

ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 FailedJobRetryConfiguration (org.camunda.bpm.engine.impl.bpmn.parser.FailedJobRetryConfiguration)1 DurationHelper (org.camunda.bpm.engine.impl.calendar.DurationHelper)1 Expression (org.camunda.bpm.engine.impl.el.Expression)1 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)1