Search in sources :

Example 1 with ContextEntry

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

the class ContextEntryPropertyConverter method wbFromDMN.

public static ContextEntry wbFromDMN(final org.kie.dmn.model.v1_1.ContextEntry dmn) {
    InformationItem variable = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
    Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
    ContextEntry result = new ContextEntry();
    result.setVariable(variable);
    result.setExpression(expression);
    return result;
}
Also used : Expression(org.kie.workbench.common.dmn.api.definition.v1_1.Expression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)

Example 2 with ContextEntry

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

the class ContextPropertyConverter method wbFromDMN.

public static Context wbFromDMN(final org.kie.dmn.model.v1_1.Context dmn) {
    Id id = new Id(dmn.getId());
    Description description = new Description(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    Context result = new Context(id, description, typeRef);
    for (org.kie.dmn.model.v1_1.ContextEntry ce : dmn.getContextEntry()) {
        ContextEntry ceConverted = ContextEntryPropertyConverter.wbFromDMN(ce);
        result.getContextEntry().add(ceConverted);
    }
    return result;
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)

Example 3 with ContextEntry

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

the class ContextPropertyConverter method dmnFromWB.

public static org.kie.dmn.model.v1_1.Context dmnFromWB(final Context wb) {
    org.kie.dmn.model.v1_1.Context result = new org.kie.dmn.model.v1_1.Context();
    result.setId(wb.getId().getValue());
    result.setDescription(wb.getDescription().getValue());
    QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
    for (ContextEntry ce : wb.getContextEntry()) {
        org.kie.dmn.model.v1_1.ContextEntry ceConverted = ContextEntryPropertyConverter.dmnFromWB(ce);
        result.getContextEntry().add(ceConverted);
    }
    return result;
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)

Example 4 with ContextEntry

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

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

the class ContextEditorDefinition method getModelClass.

@Override
public Optional<Context> getModelClass() {
    // Add one ContextEntry for the User to start with
    final Context context = new Context();
    final ContextEntry contextEntry = new ContextEntry();
    contextEntry.setVariable(new InformationItem());
    context.getContextEntry().add(contextEntry);
    // Add (default) "result" entry
    final ContextEntry resultEntry = new ContextEntry();
    resultEntry.setExpression(new LiteralExpression());
    context.getContextEntry().add(resultEntry);
    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)

Aggregations

ContextEntry (org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)7 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)6 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)5 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)4 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)3 Optional (java.util.Optional)2 QName (javax.xml.namespace.QName)2 XStream (com.thoughtworks.xstream.XStream)1 MarshallingContext (com.thoughtworks.xstream.converters.MarshallingContext)1 TypeHierarchyPermission (com.thoughtworks.xstream.security.TypeHierarchyPermission)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 Before (org.junit.Before)1 DMNMessage (org.kie.dmn.api.core.DMNMessage)1 DMNType (org.kie.dmn.api.core.DMNType)1 BusinessKnowledgeModelNode (org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode)1 DecisionNode (org.kie.dmn.api.core.ast.DecisionNode)1