Search in sources :

Example 16 with Description

use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.

the class DecisionTableEditorDefinition method getModelClass.

@Override
public Optional<DecisionTable> getModelClass() {
    final DecisionTable dtable = new DecisionTable();
    dtable.setHitPolicy(HitPolicy.ANY);
    dtable.setPreferredOrientation(DecisionTableOrientation.RULE_AS_ROW);
    final InputClause ic = new InputClause();
    final LiteralExpression le = new LiteralExpression();
    le.setText(INPUT_CLAUSE_EXPRESSION_TEXT);
    ic.setInputExpression(le);
    dtable.getInput().add(ic);
    final OutputClause oc = new OutputClause();
    oc.setName(OUTPUT_CLAUSE_NAME);
    dtable.getOutput().add(oc);
    final DecisionRule dr = new DecisionRule();
    final UnaryTests drut = new UnaryTests();
    drut.setText(INPUT_CLAUSE_UNARY_TEST_TEXT);
    dr.getInputEntry().add(drut);
    final LiteralExpression drle = new LiteralExpression();
    drle.setText(OUTPUT_CLAUSE_EXPRESSION_TEXT);
    dr.getOutputEntry().add(drle);
    final Description d = new Description();
    d.setValue(RULE_DESCRIPTION);
    dr.setDescription(d);
    dtable.getRule().add(dr);
    return Optional.of(dtable);
}
Also used : OutputClause(org.kie.workbench.common.dmn.api.definition.v1_1.OutputClause) DecisionTable(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) UnaryTests(org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests) InputClause(org.kie.workbench.common.dmn.api.definition.v1_1.InputClause) DecisionRule(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule)

Example 17 with Description

use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.

the class DecisionTableUIModelMapperTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.uiModel = new BaseGridData();
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiInputClauseColumn);
    this.uiModel.appendColumn(uiOutputClauseColumn);
    this.uiModel.appendColumn(uiDescriptionColumn);
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiInputClauseColumn).getIndex();
    doReturn(2).when(uiOutputClauseColumn).getIndex();
    doReturn(3).when(uiDescriptionColumn).getIndex();
    this.dtable = new DecisionTable();
    this.dtable.getInput().add(new InputClause());
    this.dtable.getOutput().add(new OutputClause());
    this.dtable.getRule().add(new DecisionRule() {

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

                {
                    setText("i1");
                }
            });
            getOutputEntry().add(new LiteralExpression() {

                {
                    setText("o1");
                }
            });
            setDescription(new Description("desc1"));
        }
    });
    this.dtable.getRule().add(new DecisionRule() {

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

                {
                    setText("i2");
                }
            });
            getOutputEntry().add(new LiteralExpression() {

                {
                    setText("o2");
                }
            });
            setDescription(new Description("desc2"));
        }
    });
    this.mapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector);
    this.cellValueSupplier = Optional::empty;
}
Also used : OutputClause(org.kie.workbench.common.dmn.api.definition.v1_1.OutputClause) DecisionTable(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable) DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Optional(java.util.Optional) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) UnaryTests(org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests) InputClause(org.kie.workbench.common.dmn.api.definition.v1_1.InputClause) DecisionRule(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule) Before(org.junit.Before)

Example 18 with Description

use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.

the class BusinessKnowledgeModelConverter method nodeFromDMN.

@Override
public Node<View<BusinessKnowledgeModel>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.BusinessKnowledgeModel dmn) {
    @SuppressWarnings("unchecked") Node<View<BusinessKnowledgeModel>, ?> node = (Node<View<BusinessKnowledgeModel>, ?>) factoryManager.newElement(dmn.getId(), BusinessKnowledgeModel.class).asNode();
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Name name = new Name(dmn.getName());
    InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
    FunctionDefinition functionDefinition = FunctionDefinitionPropertyConverter.wbFromDMN(dmn.getEncapsulatedLogic());
    BusinessKnowledgeModel bkm = new BusinessKnowledgeModel(id, description, name, informationItem, functionDefinition, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
    node.getContent().setDefinition(bkm);
    return node;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Node(org.kie.workbench.common.stunner.core.graph.Node) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) FontSet(org.kie.workbench.common.dmn.api.property.font.FontSet) BackgroundSet(org.kie.workbench.common.dmn.api.property.background.BackgroundSet) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.v1_1.BusinessKnowledgeModel) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 19 with Description

use of org.kie.workbench.common.dmn.api.property.dmn.Description 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 20 with Description

use of org.kie.workbench.common.dmn.api.property.dmn.Description 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)

Aggregations

Description (org.kie.workbench.common.dmn.api.property.dmn.Description)23 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)20 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)10 UnaryTests (org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests)7 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)7 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)6 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)6 BackgroundSet (org.kie.workbench.common.dmn.api.property.background.BackgroundSet)6 RectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet)6 FontSet (org.kie.workbench.common.dmn.api.property.font.FontSet)6 Node (org.kie.workbench.common.stunner.core.graph.Node)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)6 Expression (org.kie.workbench.common.dmn.api.definition.v1_1.Expression)4 DecisionRule (org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule)3 InputClause (org.kie.workbench.common.dmn.api.definition.v1_1.InputClause)3 OutputClause (org.kie.workbench.common.dmn.api.definition.v1_1.OutputClause)3 List (java.util.List)2 Optional (java.util.Optional)2 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.v1_1.BusinessKnowledgeModel)2 Decision (org.kie.workbench.common.dmn.api.definition.v1_1.Decision)2