Search in sources :

Example 26 with UnaryTests

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

the class InputClausePropertyConverter method dmnFromWB.

public static org.kie.dmn.model.api.InputClause dmnFromWB(final InputClause wb) {
    final org.kie.dmn.model.api.InputClause result = new org.kie.dmn.model.v1_2.TInputClause();
    result.setId(wb.getId().getValue());
    result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
    final org.kie.dmn.model.api.LiteralExpression expression = LiteralExpressionPropertyConverter.dmnFromWB(wb.getInputExpression());
    final UnaryTests inputValues = UnaryTestsPropertyConverter.dmnFromWB(wb.getInputValues());
    if (expression != null) {
        expression.setParent(result);
    }
    result.setInputExpression(expression);
    if (inputValues != null && StringUtils.nonEmpty(inputValues.getText())) {
        inputValues.setParent(result);
        result.setInputValues(inputValues);
    }
    return result;
}
Also used : InputClauseUnaryTests(org.kie.workbench.common.dmn.api.definition.model.InputClauseUnaryTests) UnaryTests(org.kie.dmn.model.api.UnaryTests)

Example 27 with UnaryTests

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

the class OutputClausePropertyConverter method dmnFromWB.

public static org.kie.dmn.model.api.OutputClause dmnFromWB(final OutputClause wb) {
    final org.kie.dmn.model.api.OutputClause result = new org.kie.dmn.model.v1_2.TOutputClause();
    result.setId(wb.getId().getValue());
    result.setName(wb.getName());
    result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
    final UnaryTests outputValues = UnaryTestsPropertyConverter.dmnFromWB(wb.getOutputValues());
    if (outputValues != null && StringUtils.nonEmpty(outputValues.getText())) {
        outputValues.setParent(result);
        result.setOutputValues(outputValues);
    }
    final LiteralExpression defaultOutputEntry = LiteralExpressionPropertyConverter.dmnFromWB(wb.getDefaultOutputEntry());
    if (defaultOutputEntry != null && StringUtils.nonEmpty(defaultOutputEntry.getText())) {
        defaultOutputEntry.setParent(result);
        result.setDefaultOutputEntry(defaultOutputEntry);
    }
    QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
    return result;
}
Also used : LiteralExpression(org.kie.dmn.model.api.LiteralExpression) OutputClauseLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression) OutputClauseUnaryTests(org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests) UnaryTests(org.kie.dmn.model.api.UnaryTests)

Aggregations

UnaryTests (org.kie.dmn.model.api.UnaryTests)27 LiteralExpression (org.kie.dmn.model.api.LiteralExpression)9 DecisionRule (org.kie.dmn.model.api.DecisionRule)5 TUnaryTests (org.kie.dmn.model.v1_2.TUnaryTests)5 Expression (org.kie.dmn.model.api.Expression)4 RuleAnnotation (org.kie.dmn.model.api.RuleAnnotation)3 TUnaryTests (org.kie.dmn.model.v1_1.TUnaryTests)3 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2 Entry (java.util.Map.Entry)2 Optional (java.util.Optional)2 UUID (java.util.UUID)2 Collectors (java.util.stream.Collectors)2 QName (javax.xml.namespace.QName)2 Resource (org.kie.api.io.Resource)2 DMNMessage (org.kie.dmn.api.core.DMNMessage)2 DMNType (org.kie.dmn.api.core.DMNType)2 TUnaryTests (org.kie.dmn.model.v1_3.TUnaryTests)2 TUnaryTests (org.kie.dmn.model.v1_4.TUnaryTests)2