Search in sources :

Example 36 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testVersionExpression.

@Test
public void testVersionExpression() {
    // given:
    String caseVersion = "${aVersion}";
    decisionTask.setCamundaDecisionVersion(caseVersion);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    DecisionTaskActivityBehavior behavior = (DecisionTaskActivityBehavior) activity.getActivityBehavior();
    BaseCallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider caseVersionValueProvider = callableElement.getVersionValueProvider();
    assertNotNull(caseVersionValueProvider);
    assertTrue(caseVersionValueProvider instanceof ElValueProvider);
    ElValueProvider valueProvider = (ElValueProvider) caseVersionValueProvider;
    assertEquals(caseVersion, valueProvider.getExpression().getExpressionText());
}
Also used : ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) DecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior) DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) BaseCallableElement(org.camunda.bpm.engine.impl.core.model.BaseCallableElement) ElValueProvider(org.camunda.bpm.engine.impl.el.ElValueProvider) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 37 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class BpmnParse method parseTenantId.

protected void parseTenantId(Element callingActivityElement, ActivityImpl activity, BaseCallableElement callableElement, String attrName) {
    ParameterValueProvider tenantIdValueProvider;
    String tenantId = callingActivityElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, attrName);
    if (tenantId != null && tenantId.length() > 0) {
        tenantIdValueProvider = createParameterValueProvider(tenantId, expressionManager);
    } else {
        tenantIdValueProvider = new DefaultCallableElementTenantIdProvider();
    }
    callableElement.setTenantIdProvider(tenantIdValueProvider);
}
Also used : ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)

Example 38 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class ProcessOrCaseTaskItemHandler method initializeInputParameter.

protected void initializeInputParameter(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, CallableElement callableElement) {
    ExpressionManager expressionManager = context.getExpressionManager();
    List<CamundaIn> inputs = getInputs(element);
    for (CamundaIn input : inputs) {
        // businessKey
        String businessKey = input.getCamundaBusinessKey();
        if (businessKey != null && !businessKey.isEmpty()) {
            ParameterValueProvider businessKeyValueProvider = createParameterValueProvider(businessKey, expressionManager);
            callableElement.setBusinessKeyValueProvider(businessKeyValueProvider);
        } else {
            // create new parameter
            CallableElementParameter parameter = new CallableElementParameter();
            callableElement.addInput(parameter);
            if (input.getCamundaLocal()) {
                parameter.setReadLocal(true);
            }
            // all variables
            String variables = input.getCamundaVariables();
            if ("all".equals(variables)) {
                parameter.setAllVariables(true);
                continue;
            }
            // source/sourceExpression
            String source = input.getCamundaSource();
            if (source == null || source.isEmpty()) {
                source = input.getCamundaSourceExpression();
            }
            ParameterValueProvider sourceValueProvider = createParameterValueProvider(source, expressionManager);
            parameter.setSourceValueProvider(sourceValueProvider);
            // target
            String target = input.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) CamundaIn(org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn)

Example 39 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class CallingTaskItemHandler method initializeVersion.

protected void initializeVersion(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement) {
    ExpressionManager expressionManager = context.getExpressionManager();
    String version = getVersion(element, activity, context);
    ParameterValueProvider versionProvider = createParameterValueProvider(version, expressionManager);
    callableElement.setVersionValueProvider(versionProvider);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)

Example 40 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class CallingTaskItemHandler method initializeTenantId.

protected void initializeTenantId(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement) {
    ParameterValueProvider tenantIdProvider;
    ExpressionManager expressionManager = context.getExpressionManager();
    String tenantId = getTenantId(element, activity, context);
    if (tenantId != null && tenantId.length() > 0) {
        tenantIdProvider = createParameterValueProvider(tenantId, expressionManager);
    } else {
        tenantIdProvider = new DefaultCallableElementTenantIdProvider();
    }
    callableElement.setTenantIdProvider(tenantIdProvider);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) DefaultCallableElementTenantIdProvider(org.camunda.bpm.engine.impl.core.model.DefaultCallableElementTenantIdProvider)

Aggregations

ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)42 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)26 Test (org.junit.Test)26 CallableElement (org.camunda.bpm.engine.impl.core.model.CallableElement)20 ConstantValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider)14 ElValueProvider (org.camunda.bpm.engine.impl.el.ElValueProvider)14 ExtensionElements (org.camunda.bpm.model.cmmn.instance.ExtensionElements)12 CaseTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior)10 ProcessTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.ProcessTaskActivityBehavior)10 CallableElementParameter (org.camunda.bpm.engine.impl.core.model.CallableElementParameter)10 CamundaIn (org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn)9 DecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior)6 DmnDecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior)6 BaseCallableElement (org.camunda.bpm.engine.impl.core.model.BaseCallableElement)6 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)5 CamundaOut (org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut)5 BpmnParseException (org.camunda.bpm.engine.BpmnParseException)3 NullValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.NullValueProvider)2 Element (org.camunda.bpm.engine.impl.util.xml.Element)2 DecisionRefExpression (org.camunda.bpm.model.cmmn.instance.DecisionRefExpression)2