use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-cmmn-model by camunda.
the class ConditionExpressionImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ConditionExpression.class, CMMN_ELEMENT_CONDITION).namespaceUri(CMMN11_NS).extendsType(Expression.class).instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<ConditionExpression>() {
public ConditionExpression newInstance(ModelTypeInstanceContext instanceContext) {
return new ConditionExpressionImpl(instanceContext);
}
});
typeBuilder.build();
}
use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-cmmn-model by camunda.
the class Cmmn10Test method shouldGetMultipleIfPartConditions.
@Test
public void shouldGetMultipleIfPartConditions() {
CmmnModelInstance modelInstance = getCmmnModelInstance();
Sentry sentry = modelInstance.getModelElementsByType(Sentry.class).iterator().next();
IfPart ifPart = sentry.getIfPart();
assertThat(ifPart).isNotNull();
Collection<ConditionExpression> conditions = ifPart.getConditions();
assertThat(conditions).hasSize(2);
ConditionExpression condition = ifPart.getCondition();
assertThat(condition).isNotNull();
}
use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-cmmn-model by camunda.
the class Cmmn10Test method shouldGetExpressionTextContent.
@Test
public void shouldGetExpressionTextContent() {
CmmnModelInstance modelInstance = getCmmnModelInstance();
ConditionExpression expression = modelInstance.getModelElementsByType(ConditionExpression.class).iterator().next();
assertThat(expression.getBody()).isEqualTo("${value >= 100}");
assertThat(expression.getText()).isEqualTo("${value >= 100}");
}
use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-bpm-platform by camunda.
the class ItemHandler method initializeRepetitionRule.
protected void initializeRepetitionRule(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
PlanItemControl itemControl = getItemControl(element);
PlanItemControl defaultControl = getDefaultControl(element);
RepetitionRule repetitionRule = null;
if (itemControl != null) {
repetitionRule = itemControl.getRepetitionRule();
}
if (repetitionRule == null && defaultControl != null) {
repetitionRule = defaultControl.getRepetitionRule();
}
if (repetitionRule != null) {
ConditionExpression condition = repetitionRule.getCondition();
CaseControlRule caseRule = initializeCaseControlRule(condition, context);
activity.setProperty(PROPERTY_REPETITION_RULE, caseRule);
List<String> events = Arrays.asList(TERMINATE, COMPLETE);
String repeatOnStandardEvent = repetitionRule.getCamundaRepeatOnStandardEvent();
if (repeatOnStandardEvent != null && !repeatOnStandardEvent.isEmpty()) {
events = Arrays.asList(repeatOnStandardEvent);
}
activity.getProperties().set(CmmnProperties.REPEAT_ON_STANDARD_EVENTS, events);
}
}
use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-bpm-platform by camunda.
the class SentryHandler method initializeIfPart.
protected void initializeIfPart(IfPart ifPart, CmmnSentryDeclaration sentryDeclaration, CmmnHandlerContext context) {
if (ifPart == null) {
return;
}
Collection<ConditionExpression> conditions = ifPart.getConditions();
if (conditions.size() > 1) {
String id = sentryDeclaration.getId();
LOG.multipleIgnoredConditions(id);
}
ExpressionManager expressionManager = context.getExpressionManager();
ConditionExpression condition = conditions.iterator().next();
Expression conditionExpression = expressionManager.createExpression(condition.getText());
CmmnIfPartDeclaration ifPartDeclaration = new CmmnIfPartDeclaration();
ifPartDeclaration.setCondition(conditionExpression);
sentryDeclaration.setIfPart(ifPartDeclaration);
}
Aggregations