Search in sources :

Example 1 with ExpressionManager

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

the class ItemHandler method initializeFieldDeclaration.

protected FieldDeclaration initializeFieldDeclaration(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CamundaField field) {
    String name = field.getCamundaName();
    String type = Expression.class.getName();
    Object value = getFixedValue(field);
    if (value == null) {
        ExpressionManager expressionManager = context.getExpressionManager();
        value = getExpressionValue(field, expressionManager);
    }
    return new FieldDeclaration(name, type, value);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString) FieldDeclaration(org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration)

Example 2 with ExpressionManager

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

the class ProcessOrCaseTaskItemHandler method initializeOutputParameter.

protected void initializeOutputParameter(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CallableElement callableElement) {
    ExpressionManager expressionManager = context.getExpressionManager();
    List<CamundaOut> outputs = getOutputs(element);
    for (CamundaOut output : outputs) {
        // create new parameter
        CallableElementParameter parameter = new CallableElementParameter();
        callableElement.addOutput(parameter);
        // all variables
        String variables = output.getCamundaVariables();
        if ("all".equals(variables)) {
            parameter.setAllVariables(true);
            continue;
        }
        // source/sourceExpression
        String source = output.getCamundaSource();
        if (source == null || source.isEmpty()) {
            source = output.getCamundaSourceExpression();
        }
        ParameterValueProvider sourceValueProvider = createParameterValueProvider(source, expressionManager);
        parameter.setSourceValueProvider(sourceValueProvider);
        // target
        String target = output.getCamundaTarget();
        parameter.setTarget(target);
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) CallableElementParameter(org.camunda.bpm.engine.impl.core.model.CallableElementParameter) CamundaOut(org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut)

Example 3 with ExpressionManager

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

the class SentryHandler method initializeIfPart.

protected void initializeIfPart(IfPart ifPart, CmmnSentryDeclaration sentryDeclaration, CmmnHandlerContext context) {
    if (ifPart == null) {
        return;
    }
    Collection<ConditionExpression> conditions = ifPart.getConditions();
    if (conditions.size() > 1) {
        String id = sentryDeclaration.getId();
        LOG.multipleIgnoredConditions(id);
    }
    ExpressionManager expressionManager = context.getExpressionManager();
    ConditionExpression condition = conditions.iterator().next();
    Expression conditionExpression = expressionManager.createExpression(condition.getText());
    CmmnIfPartDeclaration ifPartDeclaration = new CmmnIfPartDeclaration();
    ifPartDeclaration.setCondition(conditionExpression);
    sentryDeclaration.setIfPart(ifPartDeclaration);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) CmmnIfPartDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnIfPartDeclaration) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression)

Example 4 with ExpressionManager

use of org.camunda.bpm.engine.impl.el.ExpressionManager 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)

Example 5 with ExpressionManager

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

the class HumanTaskItemHandler method initializeTaskDefinitionName.

protected void initializeTaskDefinitionName(CmmnElement element, TaskDefinition taskDefinition, CmmnHandlerContext context) {
    String name = getName(element);
    if (name == null) {
        HumanTask definition = getDefinition(element);
        name = definition.getName();
    }
    if (name != null) {
        ExpressionManager expressionManager = context.getExpressionManager();
        Expression nameExpression = expressionManager.createExpression(name);
        taskDefinition.setNameExpression(nameExpression);
    }
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) Expression(org.camunda.bpm.engine.delegate.Expression) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask)

Aggregations

ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)27 Expression (org.camunda.bpm.engine.delegate.Expression)14 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)8 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)5 FieldDeclaration (org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration)4 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)4 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)4 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)3 CamundaExpression (org.camunda.bpm.model.cmmn.instance.camunda.CamundaExpression)3 CamundaField (org.camunda.bpm.model.cmmn.instance.camunda.CamundaField)3 CamundaScript (org.camunda.bpm.model.cmmn.instance.camunda.CamundaScript)3 HumanTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)2 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)2 CallableElementParameter (org.camunda.bpm.engine.impl.core.model.CallableElementParameter)2 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 CaseExecutionListener (org.camunda.bpm.engine.delegate.CaseExecutionListener)1 CaseVariableListener (org.camunda.bpm.engine.delegate.CaseVariableListener)1 TaskListener (org.camunda.bpm.engine.delegate.TaskListener)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1