Search in sources :

Example 31 with PlanItemControl

use of org.camunda.bpm.model.cmmn.instance.PlanItemControl in project camunda-bpm-platform by camunda.

the class TaskPlanItemHandlerTest method testManualActivationRuleByDefaultPlanItemControl.

@Test
public void testManualActivationRuleByDefaultPlanItemControl() {
    // given
    PlanItemControl defaultControl = createElement(task, "ItemControl_1", DefaultControl.class);
    ManualActivationRule manualActivationRule = createElement(defaultControl, "ManualActivationRule_1", ManualActivationRule.class);
    ConditionExpression expression = createElement(manualActivationRule, "Expression_1", ConditionExpression.class);
    expression.setText("${true}");
    Cmmn.validateModel(modelInstance);
    // when
    CmmnActivity newActivity = handler.handleElement(planItem, context);
    // then
    Object rule = newActivity.getProperty(PROPERTY_MANUAL_ACTIVATION_RULE);
    assertNotNull(rule);
    assertTrue(rule instanceof CaseControlRule);
}
Also used : ManualActivationRule(org.camunda.bpm.model.cmmn.instance.ManualActivationRule) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) PlanItemControl(org.camunda.bpm.model.cmmn.instance.PlanItemControl) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CaseControlRule(org.camunda.bpm.engine.impl.cmmn.CaseControlRule) Test(org.junit.Test)

Example 32 with PlanItemControl

use of org.camunda.bpm.model.cmmn.instance.PlanItemControl in project camunda-bpm-platform by camunda.

the class TaskPlanItemHandlerTest method testRequiredRuleByDefaultPlanItemControl.

@Test
public void testRequiredRuleByDefaultPlanItemControl() {
    // given
    PlanItemControl defaultControl = createElement(task, "ItemControl_1", DefaultControl.class);
    RequiredRule requiredRule = createElement(defaultControl, "RequiredRule_1", RequiredRule.class);
    ConditionExpression expression = createElement(requiredRule, "Expression_1", ConditionExpression.class);
    expression.setText("${true}");
    Cmmn.validateModel(modelInstance);
    // when
    CmmnActivity newActivity = handler.handleElement(planItem, context);
    // then
    Object rule = newActivity.getProperty(PROPERTY_REQUIRED_RULE);
    assertNotNull(rule);
    assertTrue(rule instanceof CaseControlRule);
}
Also used : ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) PlanItemControl(org.camunda.bpm.model.cmmn.instance.PlanItemControl) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) RequiredRule(org.camunda.bpm.model.cmmn.instance.RequiredRule) CaseControlRule(org.camunda.bpm.engine.impl.cmmn.CaseControlRule) Test(org.junit.Test)

Example 33 with PlanItemControl

use of org.camunda.bpm.model.cmmn.instance.PlanItemControl in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testRequiredRuleByDefaultPlanItemControl.

@Test
public void testRequiredRuleByDefaultPlanItemControl() {
    // given
    PlanItemControl defaultControl = createElement(decisionTask, "ItemControl_1", DefaultControl.class);
    RequiredRule requiredRule = createElement(defaultControl, "RequiredRule_1", RequiredRule.class);
    ConditionExpression expression = createElement(requiredRule, "Expression_1", ConditionExpression.class);
    expression.setText("${true}");
    Cmmn.validateModel(modelInstance);
    // when
    CmmnActivity newActivity = handler.handleElement(planItem, context);
    // then
    Object rule = newActivity.getProperty(PROPERTY_REQUIRED_RULE);
    assertNotNull(rule);
    assertTrue(rule instanceof CaseControlRule);
}
Also used : ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) PlanItemControl(org.camunda.bpm.model.cmmn.instance.PlanItemControl) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) RequiredRule(org.camunda.bpm.model.cmmn.instance.RequiredRule) CaseControlRule(org.camunda.bpm.engine.impl.cmmn.CaseControlRule) Test(org.junit.Test)

Example 34 with PlanItemControl

use of org.camunda.bpm.model.cmmn.instance.PlanItemControl in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testManualActivationRuleByDefaultPlanItemControl.

@Test
public void testManualActivationRuleByDefaultPlanItemControl() {
    // given
    PlanItemControl defaultControl = createElement(decisionTask, "ItemControl_1", DefaultControl.class);
    ManualActivationRule manualActivationRule = createElement(defaultControl, "ManualActivationRule_1", ManualActivationRule.class);
    ConditionExpression expression = createElement(manualActivationRule, "Expression_1", ConditionExpression.class);
    expression.setText("${true}");
    Cmmn.validateModel(modelInstance);
    // when
    CmmnActivity newActivity = handler.handleElement(planItem, context);
    // then
    Object rule = newActivity.getProperty(PROPERTY_MANUAL_ACTIVATION_RULE);
    assertNotNull(rule);
    assertTrue(rule instanceof CaseControlRule);
}
Also used : ManualActivationRule(org.camunda.bpm.model.cmmn.instance.ManualActivationRule) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) PlanItemControl(org.camunda.bpm.model.cmmn.instance.PlanItemControl) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CaseControlRule(org.camunda.bpm.engine.impl.cmmn.CaseControlRule) Test(org.junit.Test)

Example 35 with PlanItemControl

use of org.camunda.bpm.model.cmmn.instance.PlanItemControl in project camunda-bpm-platform by camunda.

the class ItemHandler method initializeManualActivationRule.

protected void initializeManualActivationRule(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    PlanItemControl itemControl = getItemControl(element);
    PlanItemControl defaultControl = getDefaultControl(element);
    ManualActivationRule manualActivationRule = null;
    if (itemControl != null) {
        manualActivationRule = itemControl.getManualActivationRule();
    }
    if (manualActivationRule == null && defaultControl != null) {
        manualActivationRule = defaultControl.getManualActivationRule();
    }
    if (manualActivationRule != null) {
        CaseControlRule caseRule = initializeCaseControlRule(manualActivationRule.getCondition(), context);
        activity.setProperty(PROPERTY_MANUAL_ACTIVATION_RULE, caseRule);
    }
}
Also used : ManualActivationRule(org.camunda.bpm.model.cmmn.instance.ManualActivationRule) PlanItemControl(org.camunda.bpm.model.cmmn.instance.PlanItemControl) CaseControlRule(org.camunda.bpm.engine.impl.cmmn.CaseControlRule)

Aggregations

PlanItemControl (org.camunda.bpm.model.cmmn.instance.PlanItemControl)36 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)33 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)32 Test (org.junit.Test)32 CaseControlRule (org.camunda.bpm.engine.impl.cmmn.CaseControlRule)25 RepetitionRule (org.camunda.bpm.model.cmmn.instance.RepetitionRule)15 RequiredRule (org.camunda.bpm.model.cmmn.instance.RequiredRule)11 ManualActivationRule (org.camunda.bpm.model.cmmn.instance.ManualActivationRule)9 CmmnElement (org.camunda.bpm.model.cmmn.instance.CmmnElement)1 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1 SequenceBuilder (org.camunda.bpm.model.xml.type.child.SequenceBuilder)1