use of org.camunda.bpm.engine.impl.cmmn.CaseControlRule 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);
}
use of org.camunda.bpm.engine.impl.cmmn.CaseControlRule in project camunda-bpm-platform by camunda.
the class DecisionTaskPlanItemHandlerTest method testRequiredRule.
@Test
public void testRequiredRule() {
// given
ItemControl itemControl = createElement(planItem, "ItemControl_1", ItemControl.class);
RequiredRule requiredRule = createElement(itemControl, "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);
}
use of org.camunda.bpm.engine.impl.cmmn.CaseControlRule 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);
}
use of org.camunda.bpm.engine.impl.cmmn.CaseControlRule 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);
}
}
use of org.camunda.bpm.engine.impl.cmmn.CaseControlRule in project camunda-bpm-platform by camunda.
the class PlanItemDefinitionActivityBehavior method evaluateRepetitionRule.
protected boolean evaluateRepetitionRule(CmmnActivityExecution execution) {
CmmnActivity activity = execution.getActivity();
Object repetitionRule = activity.getProperty(PROPERTY_REPETITION_RULE);
if (repetitionRule != null) {
CaseControlRule rule = (CaseControlRule) repetitionRule;
return rule.evaluate(execution);
}
return false;
}
Aggregations