Search in sources :

Example 26 with LiteralExpression

use of org.kie.dmn.model.api.LiteralExpression in project drools by kiegroup.

the class DecisionRuleConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DecisionRule dr = (DecisionRule) parent;
    for (UnaryTests ie : dr.getInputEntry()) {
        writeChildrenNode(writer, context, ie, INPUT_ENTRY);
    }
    for (LiteralExpression oe : dr.getOutputEntry()) {
        writeChildrenNode(writer, context, oe, OUTPUT_ENTRY);
    }
}
Also used : LiteralExpression(org.kie.dmn.model.api.LiteralExpression) UnaryTests(org.kie.dmn.model.api.UnaryTests) DecisionRule(org.kie.dmn.model.api.DecisionRule) TDecisionRule(org.kie.dmn.model.v1_1.TDecisionRule)

Example 27 with LiteralExpression

use of org.kie.dmn.model.api.LiteralExpression in project drools by kiegroup.

the class LiteralExpressionConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    LiteralExpression le = (LiteralExpression) parent;
    if (le.getText() != null)
        writeChildrenNodeAsValue(writer, context, le.getText(), TEXT);
    if (le.getImportedValues() != null)
        writeChildrenNode(writer, context, le.getImportedValues(), IMPORTED_VALUES);
}
Also used : LiteralExpression(org.kie.dmn.model.api.LiteralExpression) TLiteralExpression(org.kie.dmn.model.v1_4.TLiteralExpression)

Example 28 with LiteralExpression

use of org.kie.dmn.model.api.LiteralExpression in project drools by kiegroup.

the class LiteralExpressionConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    LiteralExpression le = (LiteralExpression) parent;
    String exprLanguage = reader.getAttribute(EXPR_LANGUAGE);
    le.setExpressionLanguage(exprLanguage);
}
Also used : LiteralExpression(org.kie.dmn.model.api.LiteralExpression) TLiteralExpression(org.kie.dmn.model.v1_4.TLiteralExpression)

Example 29 with LiteralExpression

use of org.kie.dmn.model.api.LiteralExpression in project drools by kiegroup.

the class LiteralExpressionConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    LiteralExpression le = (LiteralExpression) parent;
    if (le.getExpressionLanguage() != null)
        writer.addAttribute(EXPR_LANGUAGE, le.getExpressionLanguage());
}
Also used : LiteralExpression(org.kie.dmn.model.api.LiteralExpression) TLiteralExpression(org.kie.dmn.model.v1_4.TLiteralExpression)

Example 30 with LiteralExpression

use of org.kie.dmn.model.api.LiteralExpression in project kie-wb-common by kiegroup.

the class DecisionRulePropertyConverterTest method testWbFromDMN.

@Test
public void testWbFromDMN() {
    final UnaryTests inputEntry = new TUnaryTests();
    final LiteralExpression outputEntry = new TLiteralExpression();
    final org.kie.dmn.model.api.DecisionRule dmn = new TDecisionRule();
    dmn.setId(ID);
    dmn.setDescription(DESCRIPTION);
    dmn.getInputEntry().add(inputEntry);
    dmn.getOutputEntry().add(outputEntry);
    final org.kie.workbench.common.dmn.api.definition.model.DecisionRule wb = DecisionRulePropertyConverter.wbFromDMN(dmn);
    assertEquals(ID, wb.getId().getValue());
    assertEquals("", wb.getDescription().getValue());
    assertEquals(wb, wb.getInputEntry().get(0).getParent());
    assertEquals(wb, wb.getOutputEntry().get(0).getParent());
    assertEquals(1, wb.getAnnotationEntry().size());
    assertEquals(DESCRIPTION, wb.getAnnotationEntry().get(0).getText().getValue());
}
Also used : TLiteralExpression(org.kie.dmn.model.v1_2.TLiteralExpression) LiteralExpression(org.kie.dmn.model.api.LiteralExpression) TLiteralExpression(org.kie.dmn.model.v1_2.TLiteralExpression) TUnaryTests(org.kie.dmn.model.v1_2.TUnaryTests) TDecisionRule(org.kie.dmn.model.v1_2.TDecisionRule) TUnaryTests(org.kie.dmn.model.v1_2.TUnaryTests) UnaryTests(org.kie.dmn.model.api.UnaryTests) Test(org.junit.Test)

Aggregations

LiteralExpression (org.kie.dmn.model.api.LiteralExpression)31 UnaryTests (org.kie.dmn.model.api.UnaryTests)11 DecisionRule (org.kie.dmn.model.api.DecisionRule)9 TLiteralExpression (org.kie.dmn.model.v1_2.TLiteralExpression)8 InputClause (org.kie.dmn.model.api.InputClause)6 ArrayList (java.util.ArrayList)5 QName (javax.xml.namespace.QName)5 InformationItem (org.kie.dmn.model.api.InformationItem)5 Collections (java.util.Collections)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 Test (org.junit.Test)4 DMNMessage (org.kie.dmn.api.core.DMNMessage)4 DMNType (org.kie.dmn.api.core.DMNType)4 DMNNode (org.kie.dmn.api.core.ast.DMNNode)4 DMNExpressionEvaluator (org.kie.dmn.core.api.DMNExpressionEvaluator)4 Decision (org.kie.dmn.model.api.Decision)4 DecisionTable (org.kie.dmn.model.api.DecisionTable)4 Entry (java.util.Map.Entry)3 Objects (java.util.Objects)3