Search in sources :

Example 66 with LiteralExpression

use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.

the class DecisionRulePropertyConverter method wbFromDMN.

public static DecisionRule wbFromDMN(final org.kie.dmn.model.v1_1.DecisionRule dmn) {
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    DecisionRule result = new DecisionRule();
    result.setId(id);
    result.setDescription(description);
    for (org.kie.dmn.model.v1_1.UnaryTests ie : dmn.getInputEntry()) {
        result.getInputEntry().add(UnaryTestsPropertyConverter.wbFromDMN(ie));
    }
    for (org.kie.dmn.model.v1_1.LiteralExpression oe : dmn.getOutputEntry()) {
        result.getOutputEntry().add(LiteralExpressionPropertyConverter.wbFromDMN(oe));
    }
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) DecisionRule(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule)

Example 67 with LiteralExpression

use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.

the class DecisionRulePropertyConverter method dmnFromWB.

public static org.kie.dmn.model.v1_1.DecisionRule dmnFromWB(final DecisionRule wb) {
    org.kie.dmn.model.v1_1.DecisionRule result = new org.kie.dmn.model.v1_1.DecisionRule();
    result.setId(wb.getId().getValue());
    result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
    for (UnaryTests ie : wb.getInputEntry()) {
        result.getInputEntry().add(UnaryTestsPropertyConverter.dmnFromWB(ie));
    }
    for (LiteralExpression oe : wb.getOutputEntry()) {
        result.getOutputEntry().add(LiteralExpressionPropertyConverter.dmnFromWB(oe));
    }
    return result;
}
Also used : LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) UnaryTests(org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests) DecisionRule(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule)

Example 68 with LiteralExpression

use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.

the class InputClausePropertyConverter method wbFromDMN.

public static InputClause wbFromDMN(final org.kie.dmn.model.v1_1.InputClause dmn) {
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    LiteralExpression inputExpression = LiteralExpressionPropertyConverter.wbFromDMN(dmn.getInputExpression());
    UnaryTests inputValues = UnaryTestsPropertyConverter.wbFromDMN(dmn.getInputValues());
    InputClause result = new InputClause(id, description, inputExpression, inputValues);
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) UnaryTests(org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests) InputClause(org.kie.workbench.common.dmn.api.definition.v1_1.InputClause)

Example 69 with LiteralExpression

use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project drools by kiegroup.

the class LiteralExpressionConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    LiteralExpression le = (LiteralExpression) parent;
    if (le.getExpressionLanguage() != null)
        writer.addAttribute(EXPR_LANGUAGE, le.getExpressionLanguage());
}
Also used : LiteralExpression(org.kie.dmn.model.v1_1.LiteralExpression)

Example 70 with LiteralExpression

use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project drools by kiegroup.

the class LiteralExpressionConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    LiteralExpression le = (LiteralExpression) parent;
    if (le.getText() != null)
        writeChildrenNodeAsValue(writer, context, le.getText(), TEXT);
    // TODO Or if-else ?
    if (le.getImportedValues() != null)
        writeChildrenNode(writer, context, le.getImportedValues(), IMPORTED_VALUES);
}
Also used : LiteralExpression(org.kie.dmn.model.v1_1.LiteralExpression)

Aggregations

LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)60 Test (org.junit.Test)27 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)18 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)18 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)18 List (org.kie.workbench.common.dmn.api.definition.v1_1.List)13 Before (org.junit.Before)11 Optional (java.util.Optional)10 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)10 UnaryTests (org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests)10 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)10 HasName (org.kie.workbench.common.dmn.api.definition.HasName)9 LiteralExpression (org.kie.dmn.model.v1_1.LiteralExpression)8 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)8 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)8 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)8 DecisionRule (org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule)7 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)7 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)7 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)7