Search in sources :

Example 16 with UnaryTests

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

the class MoveRowsCommandTest method appendRow.

private void appendRow(final int rowIndex, final String rowIdentifier) {
    final String inValue = "in " + rowIdentifier;
    final String outValue = "out " + rowIdentifier;
    dtable.getRule().add(new DecisionRule() {

        {
            getInputEntry().add(new UnaryTests() {

                {
                    setText(inValue);
                }
            });
            getOutputEntry().add(new LiteralExpression() {

                {
                    setText(outValue);
                }
            });
        }
    });
    final DMNGridRow uiRow = new DMNGridRow();
    uiModel.appendRow(uiRow);
    uiModel.setCellValue(rowIndex, 0, new BaseGridCellValue<>(rowIndex + 1));
    uiModel.setCellValue(rowIndex, 1, new BaseGridCellValue<>(inValue));
    uiModel.setCellValue(rowIndex, 2, new BaseGridCellValue<>(outValue));
    rowsUnderTest.add(uiRow);
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) 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 17 with UnaryTests

use of org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests 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 18 with UnaryTests

use of org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests 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 19 with UnaryTests

use of org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests 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 20 with UnaryTests

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

the class ItemDefinitionPropertyConverter method wbFromDMN.

public static ItemDefinition wbFromDMN(final org.kie.dmn.model.v1_1.ItemDefinition dmn) {
    if (dmn == null) {
        return null;
    }
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    Name name = new Name(dmn.getName());
    ItemDefinition result = new ItemDefinition();
    result.setId(id);
    result.setName(name);
    result.setDescription(description);
    result.setTypeRef(typeRef);
    result.setTypeLanguage(dmn.getTypeLanguage());
    result.setIsCollection(dmn.isIsCollection());
    UnaryTests utConverted = UnaryTestsPropertyConverter.wbFromDMN(dmn.getAllowedValues());
    result.setAllowedValues(utConverted);
    for (org.kie.dmn.model.v1_1.ItemDefinition child : dmn.getItemComponent()) {
        ItemDefinition convertedChild = ItemDefinitionPropertyConverter.wbFromDMN(child);
        result.getItemComponent().add(convertedChild);
    }
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) ItemDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) UnaryTests(org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Aggregations

UnaryTests (org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests)14 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)10 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)8 DecisionRule (org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule)7 UnaryTests (org.kie.dmn.model.v1_1.UnaryTests)6 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)5 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)5 InputClause (org.kie.workbench.common.dmn.api.definition.v1_1.InputClause)4 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)4 AbstractGraphCommand (org.kie.workbench.common.stunner.core.graph.command.impl.AbstractGraphCommand)4 DecisionTable (org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable)3 OutputClause (org.kie.workbench.common.dmn.api.definition.v1_1.OutputClause)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 Before (org.junit.Before)2 DMNType (org.kie.dmn.api.core.DMNType)2 BaseDMNTypeImpl (org.kie.dmn.core.impl.BaseDMNTypeImpl)2 UnaryTest (org.kie.dmn.feel.runtime.UnaryTest)2