use of org.camunda.bpm.model.cmmn.instance.ItemControl in project camunda-cmmn-model by camunda.
the class ItemControlImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ItemControl.class, CMMN_ELEMENT_ITEM_CONTROL).namespaceUri(CMMN11_NS).extendsType(PlanItemControl.class).instanceProvider(new ModelTypeInstanceProvider<ItemControl>() {
public ItemControl newInstance(ModelTypeInstanceContext instanceContext) {
return new ItemControlImpl(instanceContext);
}
});
typeBuilder.build();
}
use of org.camunda.bpm.model.cmmn.instance.ItemControl 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.ItemControl in project camunda-bpm-platform by camunda.
the class HumanTaskDicretionaryItemHandlerTest method testManualActivationRule.
@Test
public void testManualActivationRule() {
// given
ItemControl itemControl = createElement(discretionaryItem, "ItemControl_1", ItemControl.class);
ManualActivationRule manualActivationRule = createElement(itemControl, "ManualActivationRule_1", ManualActivationRule.class);
ConditionExpression expression = createElement(manualActivationRule, "Expression_1", ConditionExpression.class);
expression.setText("${true}");
Cmmn.validateModel(modelInstance);
// when
CmmnActivity newActivity = handler.handleElement(discretionaryItem, context);
// then
Object rule = newActivity.getProperty(PROPERTY_MANUAL_ACTIVATION_RULE);
assertNotNull(rule);
assertTrue(rule instanceof CaseControlRule);
}
use of org.camunda.bpm.model.cmmn.instance.ItemControl in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testRepetitionRuleStandardEvents.
@Test
public void testRepetitionRuleStandardEvents() {
// given
ItemControl itemControl = createElement(planItem, "ItemControl_1", ItemControl.class);
RepetitionRule repetitionRule = createElement(itemControl, "RepititionRule_1", RepetitionRule.class);
ConditionExpression expression = createElement(repetitionRule, "Expression_1", ConditionExpression.class);
expression.setText("${true}");
Cmmn.validateModel(modelInstance);
// when
CmmnActivity newActivity = handler.handleElement(planItem, context);
// then
List<String> events = newActivity.getProperties().get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS);
assertNotNull(events);
assertEquals(2, events.size());
assertTrue(events.contains(CaseExecutionListener.COMPLETE));
assertTrue(events.contains(CaseExecutionListener.TERMINATE));
}
use of org.camunda.bpm.model.cmmn.instance.ItemControl in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testRepetitionRuleCustomStandardEvents.
@Test
public void testRepetitionRuleCustomStandardEvents() {
// given
ItemControl itemControl = createElement(planItem, "ItemControl_1", ItemControl.class);
RepetitionRule repetitionRule = createElement(itemControl, "RepititionRule_1", RepetitionRule.class);
ConditionExpression expression = createElement(repetitionRule, "Expression_1", ConditionExpression.class);
expression.setText("${true}");
repetitionRule.setCamundaRepeatOnStandardEvent(CaseExecutionListener.DISABLE);
Cmmn.validateModel(modelInstance);
// when
CmmnActivity newActivity = handler.handleElement(planItem, context);
// then
List<String> events = newActivity.getProperties().get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS);
assertNotNull(events);
assertEquals(1, events.size());
assertTrue(events.contains(CaseExecutionListener.DISABLE));
}
Aggregations