Search in sources :

Example 1 with LiteralExpression

use of org.camunda.bpm.model.dmn.instance.LiteralExpression in project camunda-dmn-model by camunda.

the class LiteralExpressionImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(LiteralExpression.class, DMN_ELEMENT_LITERAL_EXPRESSION).namespaceUri(DMN11_NS).extendsType(Expression.class).instanceProvider(new ModelTypeInstanceProvider<LiteralExpression>() {

        public LiteralExpression newInstance(ModelTypeInstanceContext instanceContext) {
            return new LiteralExpressionImpl(instanceContext);
        }
    });
    expressionLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPRESSION_LANGUAGE).build();
    SequenceBuilder sequenceBuilder = typeBuilder.sequence();
    textChild = sequenceBuilder.element(Text.class).build();
    importedValuesChild = sequenceBuilder.element(ImportedValues.class).build();
    typeBuilder.build();
}
Also used : Expression(org.camunda.bpm.model.dmn.instance.Expression) LiteralExpression(org.camunda.bpm.model.dmn.instance.LiteralExpression) LiteralExpression(org.camunda.bpm.model.dmn.instance.LiteralExpression) 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)

Example 2 with LiteralExpression

use of org.camunda.bpm.model.dmn.instance.LiteralExpression in project camunda-engine-dmn by camunda.

the class DefaultDmnTransform method transformDecision.

protected DmnDecisionImpl transformDecision(Decision decision) {
    DmnElementTransformHandler<Decision, DmnDecisionImpl> handler = handlerRegistry.getHandler(Decision.class);
    DmnDecisionImpl dmnDecision = handler.handleElement(this, decision);
    this.decision = dmnDecision;
    // validate decision id
    if (dmnDecision.getKey() == null) {
        throw LOG.decisionIdIsMissing(dmnDecision);
    }
    Expression expression = decision.getExpression();
    if (expression == null) {
        LOG.decisionWithoutExpression(decision);
        return null;
    }
    if (expression instanceof DecisionTable) {
        DmnDecisionTableImpl dmnDecisionTable = transformDecisionTable((DecisionTable) expression);
        dmnDecision.setDecisionLogic(dmnDecisionTable);
    } else if (expression instanceof LiteralExpression) {
        DmnDecisionLiteralExpressionImpl dmnDecisionLiteralExpression = transformDecisionLiteralExpression(decision, (LiteralExpression) expression);
        dmnDecision.setDecisionLogic(dmnDecisionLiteralExpression);
    } else {
        LOG.decisionTypeNotSupported(expression, decision);
        return null;
    }
    return dmnDecision;
}
Also used : DecisionTable(org.camunda.bpm.model.dmn.instance.DecisionTable) DmnDecisionTableImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl) LiteralExpression(org.camunda.bpm.model.dmn.instance.LiteralExpression) InputExpression(org.camunda.bpm.model.dmn.instance.InputExpression) Expression(org.camunda.bpm.model.dmn.instance.Expression) DmnDecisionImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl) LiteralExpression(org.camunda.bpm.model.dmn.instance.LiteralExpression) DmnDecisionLiteralExpressionImpl(org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl) DmnDecision(org.camunda.bpm.dmn.engine.DmnDecision) Decision(org.camunda.bpm.model.dmn.instance.Decision)

Aggregations

Expression (org.camunda.bpm.model.dmn.instance.Expression)2 LiteralExpression (org.camunda.bpm.model.dmn.instance.LiteralExpression)2 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)1 DmnDecisionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)1 DmnDecisionLiteralExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl)1 DmnDecisionTableImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl)1 Decision (org.camunda.bpm.model.dmn.instance.Decision)1 DecisionTable (org.camunda.bpm.model.dmn.instance.DecisionTable)1 InputExpression (org.camunda.bpm.model.dmn.instance.InputExpression)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