use of org.camunda.bpm.model.cmmn.instance.ManualActivationRule 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.model.cmmn.instance.ManualActivationRule 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.model.cmmn.instance.ManualActivationRule in project camunda-cmmn-model by camunda.
the class ManualActivationRuleImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ManualActivationRule.class, CMMN_ELEMENT_MANUAL_ACTIVATION_RULE).namespaceUri(CMMN11_NS).extendsType(CmmnElement.class).instanceProvider(new ModelTypeInstanceProvider<ManualActivationRule>() {
public ManualActivationRule newInstance(ModelTypeInstanceContext instanceContext) {
return new ManualActivationRuleImpl(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();
}
Aggregations