Search in sources :

Example 6 with Description

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

the class FunctionDefinitionPropertyConverter method wbFromDMN.

public static FunctionDefinition wbFromDMN(final org.kie.dmn.model.v1_1.FunctionDefinition dmn) {
    if (dmn == null) {
        return null;
    }
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
    FunctionDefinition result = new FunctionDefinition(id, description, typeRef, expression);
    result.getNsContext().putAll(dmn.getNsContext());
    for (Entry<javax.xml.namespace.QName, String> kv : dmn.getAdditionalAttributes().entrySet()) {
        QName convertedQName = QNamePropertyConverter.wbFromDMN(kv.getKey());
        result.getAdditionalAttributes().put(convertedQName, kv.getValue());
    }
    for (org.kie.dmn.model.v1_1.InformationItem ii : dmn.getFormalParameter()) {
        InformationItem iiConverted = InformationItemPropertyConverter.wbFromDMN(ii);
        result.getFormalParameter().add(iiConverted);
    }
    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) Expression(org.kie.workbench.common.dmn.api.definition.v1_1.Expression) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 7 with Description

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

the class InformationItemPropertyConverter method wbFromDMN.

public static InformationItem wbFromDMN(final org.kie.dmn.model.v1_1.InformationItem dmn) {
    if (dmn == null) {
        return null;
    }
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Name name = new Name(dmn.getName());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    InformationItem result = new InformationItem(id, description, name, typeRef);
    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) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 8 with Description

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

the class InputDataConverter method nodeFromDMN.

@Override
public Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.InputData dmn) {
    @SuppressWarnings("unchecked") Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(dmn.getId(), InputData.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());
    InputData inputData = new InputData(id, description, name, informationItem, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
    node.getContent().setDefinition(inputData);
    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) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) InputData(org.kie.workbench.common.dmn.api.definition.v1_1.InputData) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 9 with Description

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

the class KnowledgeSourceConverter method nodeFromDMN.

@Override
public Node<View<KnowledgeSource>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.KnowledgeSource dmn) {
    @SuppressWarnings("unchecked") Node<View<KnowledgeSource>, ?> node = (Node<View<KnowledgeSource>, ?>) factoryManager.newElement(dmn.getId(), KnowledgeSource.class).asNode();
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Name name = new Name(dmn.getName());
    KnowledgeSourceType ksType = new KnowledgeSourceType(dmn.getType());
    LocationURI locationURI = new LocationURI(dmn.getLocationURI());
    KnowledgeSource ks = new KnowledgeSource(id, description, name, ksType, locationURI, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
    node.getContent().setDefinition(ks);
    return node;
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) KnowledgeSourceType(org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType) Node(org.kie.workbench.common.stunner.core.graph.Node) 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) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.v1_1.KnowledgeSource) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 10 with Description

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

the class LiteralExpressionPropertyConverter method wbFromDMN.

public static LiteralExpression wbFromDMN(final org.kie.dmn.model.v1_1.LiteralExpression dmn) {
    if (dmn == null) {
        return null;
    }
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    String text = dmn.getText();
    String expressionLanguage = dmn.getExpressionLanguage();
    ImportedValues importedValues = ImportedValuesConverter.wbFromDMN(dmn.getImportedValues());
    LiteralExpression result = new LiteralExpression(id, description, typeRef, text, importedValues, expressionLanguage);
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) ImportedValues(org.kie.workbench.common.dmn.api.definition.v1_1.ImportedValues) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

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