use of org.camunda.bpm.model.cmmn.instance.RepetitionRule in project camunda-bpm-platform by camunda.
the class StagePlanItemHandlerTest method testRepetitionRule.
@Test
public void testRepetitionRule() {
// 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
Object rule = newActivity.getProperty(PROPERTY_REPETITION_RULE);
assertNotNull(rule);
assertTrue(rule instanceof CaseControlRule);
}
use of org.camunda.bpm.model.cmmn.instance.RepetitionRule in project camunda-bpm-platform by camunda.
the class StagePlanItemHandlerTest 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));
}
use of org.camunda.bpm.model.cmmn.instance.RepetitionRule in project camunda-bpm-platform by camunda.
the class DecisionTaskPlanItemHandlerTest 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));
}
use of org.camunda.bpm.model.cmmn.instance.RepetitionRule in project camunda-bpm-platform by camunda.
the class DecisionTaskPlanItemHandlerTest 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.RepetitionRule in project camunda-cmmn-model by camunda.
the class RepetitionRuleImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(RepetitionRule.class, CMMN_ELEMENT_REPETITION_RULE).namespaceUri(CMMN11_NS).extendsType(CmmnElement.class).instanceProvider(new ModelTypeInstanceProvider<RepetitionRule>() {
public RepetitionRule newInstance(ModelTypeInstanceContext instanceContext) {
return new RepetitionRuleImpl(instanceContext);
}
});
nameAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_NAME).build();
contextRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_CONTEXT_REF).idAttributeReference(CaseFileItem.class).build();
/**
* Camunda extensions
*/
camundaRepeatOnStandardEventAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_REPEAT_ON_STANDARD_EVENT).namespace(CAMUNDA_NS).build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
conditionChild = sequenceBuilder.element(ConditionExpression.class).build();
typeBuilder.build();
}
Aggregations