Search in sources :

Example 21 with CallableElementParameter

use of org.camunda.bpm.engine.impl.core.model.CallableElementParameter in project camunda-bpm-platform by camunda.

the class CaseTaskPlanItemHandlerTest method testOutputVariables.

@Test
public void testOutputVariables() {
    // given:
    ExtensionElements extensionElements = addExtensionElements(caseTask);
    CamundaOut variablesElement = createElement(extensionElements, null, CamundaOut.class);
    variablesElement.setCamundaVariables("all");
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    CallableElementParameter parameter = callableElement.getOutputs().get(0);
    assertNotNull(parameter);
    assertTrue(parameter.isAllVariables());
}
Also used : CallableElement(org.camunda.bpm.engine.impl.core.model.CallableElement) ExtensionElements(org.camunda.bpm.model.cmmn.instance.ExtensionElements) CallableElementParameter(org.camunda.bpm.engine.impl.core.model.CallableElementParameter) CamundaOut(org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CaseTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior) Test(org.junit.Test)

Example 22 with CallableElementParameter

use of org.camunda.bpm.engine.impl.core.model.CallableElementParameter 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)

Aggregations

CallableElementParameter (org.camunda.bpm.engine.impl.core.model.CallableElementParameter)22 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)20 CallableElement (org.camunda.bpm.engine.impl.core.model.CallableElement)20 ExtensionElements (org.camunda.bpm.model.cmmn.instance.ExtensionElements)20 Test (org.junit.Test)20 CamundaIn (org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn)11 CamundaOut (org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut)11 CaseTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior)10 ProcessTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.ProcessTaskActivityBehavior)10 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)10 ConstantValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider)4 ElValueProvider (org.camunda.bpm.engine.impl.el.ElValueProvider)4 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)2