Search in sources :

Example 1 with TUnaryTests

use of org.kie.dmn.model.v1_4.TUnaryTests in project drools by kiegroup.

the class DTSheetListener method newCell.

@Override
public void newCell(int row, int column, String value, int mergedColStart) {
    if (row == 0) {
        // TODO row 0 being the header.
        return;
    }
    if (curRule == null) {
        return;
    }
    if (value == null || value.isEmpty()) {
        LOG.trace("ignoring row {}, col {} having value {}", row, column, value);
        return;
    }
    if (column < headerInfo.gethIndex()) {
        valueCheck(row, column, value);
        UnaryTests ut = new TUnaryTests();
        ut.setText(eValue(value));
        curRule.getInputEntry().add(ut);
    } else if (column == headerInfo.gethIndex()) {
        valueCheck(row, column, value);
        LiteralExpression le = new TLiteralExpression();
        le.setText(eValue(value));
        curRule.getOutputEntry().add(le);
    } else {
        LOG.trace("ignoring row {}, col {} having value {}", row, column, value);
    }
}
Also used : TUnaryTests(org.kie.dmn.model.v1_2.TUnaryTests) 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) UnaryTests(org.kie.dmn.model.api.UnaryTests)

Example 2 with TUnaryTests

use of org.kie.dmn.model.v1_4.TUnaryTests 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)2 UnaryTests (org.kie.dmn.model.api.UnaryTests)2 TLiteralExpression (org.kie.dmn.model.v1_2.TLiteralExpression)2 TUnaryTests (org.kie.dmn.model.v1_2.TUnaryTests)2 Test (org.junit.Test)1 TDecisionRule (org.kie.dmn.model.v1_2.TDecisionRule)1