Search in sources :

Example 6 with InformationItem

use of org.kie.dmn.model.v1_1.InformationItem 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 7 with InformationItem

use of org.kie.dmn.model.v1_1.InformationItem 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 8 with InformationItem

use of org.kie.dmn.model.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class PMMLFunctionEditorDefinition method getModelClass.

@Override
public Optional<Context> getModelClass() {
    final Context context = new Context();
    final ContextEntry documentEntry = new ContextEntry();
    final InformationItem documentEntryVariable = new InformationItem();
    documentEntryVariable.setName(new Name(VARIABLE_DOCUMENT));
    documentEntry.setVariable(documentEntryVariable);
    documentEntry.setExpression(new LiteralExpression());
    context.getContextEntry().add(documentEntry);
    final ContextEntry modelEntry = new ContextEntry();
    final InformationItem modelEntryVariable = new InformationItem();
    modelEntryVariable.setName(new Name(VARIABLE_MODEL));
    modelEntry.setVariable(modelEntryVariable);
    modelEntry.setExpression(new LiteralExpression());
    context.getContextEntry().add(modelEntry);
    return Optional.of(context);
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) HasName(org.kie.workbench.common.dmn.api.definition.HasName)

Example 9 with InformationItem

use of org.kie.dmn.model.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class RelationEditorDefinition method getModelClass.

@Override
public Optional<Relation> getModelClass() {
    final Relation relation = new Relation();
    final InformationItem column = new InformationItem();
    final org.kie.workbench.common.dmn.api.definition.v1_1.List row = new org.kie.workbench.common.dmn.api.definition.v1_1.List();
    row.getExpression().add(new LiteralExpression());
    relation.getColumn().add(column);
    relation.getRow().add(row);
    return Optional.of(relation);
}
Also used : LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation)

Example 10 with InformationItem

use of org.kie.dmn.model.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class RelationPropertyConverter method dmnFromWB.

public static org.kie.dmn.model.v1_1.Relation dmnFromWB(final Relation wb) {
    org.kie.dmn.model.v1_1.Relation result = new org.kie.dmn.model.v1_1.Relation();
    result.setId(wb.getId().getValue());
    result.setDescription(wb.getDescription().getValue());
    QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
    for (InformationItem iitem : wb.getColumn()) {
        org.kie.dmn.model.v1_1.InformationItem iitemConverted = InformationItemPropertyConverter.dmnFromWB(iitem);
        result.getColumn().add(iitemConverted);
    }
    for (org.kie.workbench.common.dmn.api.definition.v1_1.List list : wb.getRow()) {
        org.kie.dmn.model.v1_1.List listConverted = ListPropertyConverter.dmnFromWB(list);
        result.getRow().add(listConverted);
    }
    return result;
}
Also used : InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation)

Aggregations

InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)19 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)10 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)7 InformationItem (org.kie.dmn.model.api.InformationItem)6 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)6 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)6 ContextEntry (org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)5 Optional (java.util.Optional)4 Binding (org.kie.workbench.common.dmn.api.definition.v1_1.Binding)4 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)4 Expression (org.kie.workbench.common.dmn.api.definition.v1_1.Expression)4 List (java.util.List)3 QName (javax.xml.namespace.QName)3 Before (org.junit.Before)3 BusinessKnowledgeModelNode (org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode)3 DecisionNode (org.kie.dmn.api.core.ast.DecisionNode)3 TInformationItem (org.kie.dmn.model.v1_1.TInformationItem)3 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)3 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2