use of org.camunda.bpm.model.cmmn.instance.RequiredRule in project camunda-bpm-platform by camunda.
the class ItemHandler method initializeRequiredRule.
protected void initializeRequiredRule(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
PlanItemControl itemControl = getItemControl(element);
PlanItemControl defaultControl = getDefaultControl(element);
RequiredRule requiredRule = null;
if (itemControl != null) {
requiredRule = itemControl.getRequiredRule();
}
if (requiredRule == null && defaultControl != null) {
requiredRule = defaultControl.getRequiredRule();
}
if (requiredRule != null) {
CaseControlRule caseRule = initializeCaseControlRule(requiredRule.getCondition(), context);
activity.setProperty(PROPERTY_REQUIRED_RULE, caseRule);
}
}
use of org.camunda.bpm.model.cmmn.instance.RequiredRule in project camunda-bpm-platform by camunda.
the class HumanTaskDicretionaryItemHandlerTest method testRequiredRule.
@Test
public void testRequiredRule() {
// given
ItemControl itemControl = createElement(discretionaryItem, "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(discretionaryItem, context);
// then
Object rule = newActivity.getProperty(PROPERTY_REQUIRED_RULE);
assertNotNull(rule);
assertTrue(rule instanceof CaseControlRule);
}
use of org.camunda.bpm.model.cmmn.instance.RequiredRule in project camunda-bpm-platform by camunda.
the class HumanTaskDicretionaryItemHandlerTest method testRequiredRuleByDefaultPlanItemControl.
@Test
public void testRequiredRuleByDefaultPlanItemControl() {
// given
PlanItemControl defaultControl = createElement(humanTask, "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(discretionaryItem, context);
// then
Object rule = newActivity.getProperty(PROPERTY_REQUIRED_RULE);
assertNotNull(rule);
assertTrue(rule instanceof CaseControlRule);
}
use of org.camunda.bpm.model.cmmn.instance.RequiredRule in project camunda-bpm-platform by camunda.
the class MilestoneDiscretionaryItemHandlerTest method testRequiredRule.
@Test
public void testRequiredRule() {
// given
ItemControl itemControl = createElement(discretionaryItem, "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(discretionaryItem, context);
// then
Object rule = newActivity.getProperty(PROPERTY_REQUIRED_RULE);
assertNotNull(rule);
assertTrue(rule instanceof CaseControlRule);
}
use of org.camunda.bpm.model.cmmn.instance.RequiredRule in project camunda-bpm-platform by camunda.
the class MilestonePlanItemHandlerTest method testRequiredRuleByDefaultPlanItemControl.
@Test
public void testRequiredRuleByDefaultPlanItemControl() {
// given
PlanItemControl defaultControl = createElement(milestone, "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);
}
Aggregations