Search in sources :

Example 21 with RequiredRule

use of org.camunda.bpm.model.cmmn.instance.RequiredRule 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);
}
Also used : PlanItemControl(org.camunda.bpm.model.cmmn.instance.PlanItemControl) ItemControl(org.camunda.bpm.model.cmmn.instance.ItemControl) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) 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 22 with RequiredRule

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

the class RequiredRuleImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(RequiredRule.class, CMMN_ELEMENT_REQUIRED_RULE).namespaceUri(CMMN11_NS).extendsType(CmmnElement.class).instanceProvider(new ModelTypeInstanceProvider<RequiredRule>() {

        public RequiredRule newInstance(ModelTypeInstanceContext instanceContext) {
            return new RequiredRuleImpl(instanceContext);
        }
    });
    nameAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_NAME).build();
    contextRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_CONTEXT_REF).idAttributeReference(CaseFileItem.class).build();
    SequenceBuilder sequenceBuilder = typeBuilder.sequence();
    conditionChild = sequenceBuilder.element(ConditionExpression.class).build();
    typeBuilder.build();
}
Also used : CmmnElement(org.camunda.bpm.model.cmmn.instance.CmmnElement) SequenceBuilder(org.camunda.bpm.model.xml.type.child.SequenceBuilder) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext) RequiredRule(org.camunda.bpm.model.cmmn.instance.RequiredRule)

Aggregations

RequiredRule (org.camunda.bpm.model.cmmn.instance.RequiredRule)22 CaseControlRule (org.camunda.bpm.engine.impl.cmmn.CaseControlRule)21 PlanItemControl (org.camunda.bpm.model.cmmn.instance.PlanItemControl)21 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)20 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)20 Test (org.junit.Test)20 ItemControl (org.camunda.bpm.model.cmmn.instance.ItemControl)10 CmmnElement (org.camunda.bpm.model.cmmn.instance.CmmnElement)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