Search in sources :

Example 11 with Description

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

the class UnaryTestsPropertyConverter method wbFromDMN.

public static UnaryTests wbFromDMN(final org.kie.dmn.model.v1_1.UnaryTests dmn) {
    if (dmn == null) {
        return null;
    }
    Id id = new Id(dmn.getId());
    Description description = new Description(dmn.getDescription());
    UnaryTests result = new UnaryTests(id, description, dmn.getText(), dmn.getExpressionLanguage());
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) UnaryTests(org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests)

Example 12 with Description

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

the class AddDecisionRuleCommand method newGraphCommand.

@Override
protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) {
    return new AbstractGraphCommand() {

        @Override
        protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) {
            return GraphCommandResultBuilder.SUCCESS;
        }

        @Override
        public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) {
            dtable.getRule().add(uiRowIndex, rule);
            for (int ie = 0; ie < dtable.getInput().size(); ie++) {
                final UnaryTests ut = new UnaryTests();
                ut.setText(AddInputClauseCommand.INPUT_CLAUSE_DEFAULT_VALUE);
                rule.getInputEntry().add(ut);
            }
            for (int oe = 0; oe < dtable.getOutput().size(); oe++) {
                final LiteralExpression le = new LiteralExpression();
                le.setText(AddOutputClauseCommand.OUTPUT_CLAUSE_DEFAULT_VALUE);
                rule.getOutputEntry().add(le);
            }
            final Description d = new Description();
            d.setValue(DESCRIPTION_DEFAULT_VALUE);
            rule.setDescription(d);
            return GraphCommandResultBuilder.SUCCESS;
        }

        @Override
        public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) {
            dtable.getRule().remove(rule);
            return GraphCommandResultBuilder.SUCCESS;
        }
    };
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) AbstractGraphCommand(org.kie.workbench.common.stunner.core.graph.command.impl.AbstractGraphCommand) GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) UnaryTests(org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests)

Example 13 with Description

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

the class OutputClausePropertyConverter method wbFromDMN.

public static OutputClause wbFromDMN(final org.kie.dmn.model.v1_1.OutputClause dmn) {
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    UnaryTests outputValues = UnaryTestsPropertyConverter.wbFromDMN(dmn.getOutputValues());
    LiteralExpression defaultOutputEntry = LiteralExpressionPropertyConverter.wbFromDMN(dmn.getDefaultOutputEntry());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    OutputClause result = new OutputClause();
    result.setId(id);
    result.setName(dmn.getName());
    result.setDescription(description);
    result.setOutputValues(outputValues);
    result.setDefaultOutputEntry(defaultOutputEntry);
    result.setTypeRef(typeRef);
    return result;
}
Also used : OutputClause(org.kie.workbench.common.dmn.api.definition.v1_1.OutputClause) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) 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)

Example 14 with Description

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

the class RelationPropertyConverter method wbFromDMN.

public static Relation wbFromDMN(final org.kie.dmn.model.v1_1.Relation dmn) {
    Id id = new Id(dmn.getId());
    Description description = new Description(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    List<org.kie.dmn.model.v1_1.InformationItem> column = dmn.getColumn();
    List<org.kie.dmn.model.v1_1.List> row = dmn.getRow();
    List<InformationItem> convertedColumn = column.stream().map(InformationItemPropertyConverter::wbFromDMN).collect(Collectors.toList());
    List<org.kie.workbench.common.dmn.api.definition.v1_1.List> convertedRow = row.stream().map(ListPropertyConverter::wbFromDMN).collect(Collectors.toList());
    Relation result = new Relation(id, description, typeRef, convertedColumn, convertedRow);
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation) List(java.util.List) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 15 with Description

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

the class TextAnnotationConverter method nodeFromDMN.

@Override
public Node<View<TextAnnotation>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.TextAnnotation dmn) {
    @SuppressWarnings("unchecked") Node<View<TextAnnotation>, ?> node = (Node<View<TextAnnotation>, ?>) factoryManager.newElement(dmn.getId(), TextAnnotation.class).asNode();
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Text text = new Text(dmn.getText());
    TextFormat textFormat = new TextFormat(dmn.getTextFormat());
    TextAnnotation textAnnotation = new TextAnnotation(id, description, text, textFormat, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
    node.getContent().setDefinition(textAnnotation);
    return node;
}
Also used : FontSet(org.kie.workbench.common.dmn.api.property.font.FontSet) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) BackgroundSet(org.kie.workbench.common.dmn.api.property.background.BackgroundSet) Node(org.kie.workbench.common.stunner.core.graph.Node) TextFormat(org.kie.workbench.common.dmn.api.property.dmn.TextFormat) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) TextAnnotation(org.kie.workbench.common.dmn.api.definition.v1_1.TextAnnotation) View(org.kie.workbench.common.stunner.core.graph.content.view.View)

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