Search in sources :

Example 6 with OutputClauseLiteralExpression

use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression in project kie-wb-common by kiegroup.

the class OutputClauseLiteralExpressionPropertyConverter method wbFromDMN.

public static OutputClauseLiteralExpression wbFromDMN(final org.kie.dmn.model.api.LiteralExpression dmn) {
    if (dmn == null) {
        return null;
    }
    final Id id = new Id(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn);
    final Text text = new Text(dmn.getText());
    final ImportedValues importedValues = ImportedValuesConverter.wbFromDMN(dmn.getImportedValues());
    final OutputClauseLiteralExpression result = new OutputClauseLiteralExpression(id, description, typeRef, text, importedValues);
    if (importedValues != null) {
        importedValues.setParent(result);
    }
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) OutputClauseLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression) ImportedValues(org.kie.workbench.common.dmn.api.definition.model.ImportedValues) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 7 with OutputClauseLiteralExpression

use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression in project kie-wb-common by kiegroup.

the class OutputClausePropertyConverter method wbFromDMN.

public static OutputClause wbFromDMN(final org.kie.dmn.model.api.OutputClause dmn) {
    final Id id = new Id(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final OutputClauseUnaryTests outputValues = OutputClauseUnaryTestsPropertyConverter.wbFromDMN(dmn.getOutputValues());
    final OutputClauseLiteralExpression defaultOutputEntry = OutputClauseLiteralExpressionPropertyConverter.wbFromDMN(dmn.getDefaultOutputEntry());
    final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn);
    final OutputClause result = new OutputClause();
    result.setId(id);
    result.setName(dmn.getName());
    result.setDescription(description);
    result.setOutputValues(outputValues);
    result.setDefaultOutputEntry(defaultOutputEntry);
    result.setTypeRef(typeRef);
    if (outputValues != null) {
        outputValues.setParent(result);
    }
    if (defaultOutputEntry != null) {
        defaultOutputEntry.setParent(result);
    }
    return result;
}
Also used : OutputClause(org.kie.workbench.common.dmn.api.definition.model.OutputClause) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) OutputClauseLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) OutputClauseUnaryTests(org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests)

Example 8 with OutputClauseLiteralExpression

use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression in project kie-wb-common by kiegroup.

the class OutputClauseLiteralExpressionPropertyConverterTest method testWBFromDMNWhenNonNull.

@Test
public void testWBFromDMNWhenNonNull() {
    when(jsitLiteralExpression.getText()).thenReturn(TEXT);
    final OutputClauseLiteralExpression wb = OutputClauseLiteralExpressionPropertyConverter.wbFromDMN(jsitLiteralExpression);
    assertThat(wb).isNotNull();
    assertThat(wb.getText().getValue()).isEqualTo(TEXT);
}
Also used : OutputClauseLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression) Test(org.junit.Test)

Example 9 with OutputClauseLiteralExpression

use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression in project kie-wb-common by kiegroup.

the class OutputClauseLiteralExpressionPropertyConverterTest method testWBFromDMNWhenNull.

@Test
public void testWBFromDMNWhenNull() {
    final OutputClauseLiteralExpression wb = OutputClauseLiteralExpressionPropertyConverter.wbFromDMN(null);
    assertThat(wb).isNotNull();
}
Also used : OutputClauseLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression) Test(org.junit.Test)

Aggregations

OutputClauseLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression)9 Test (org.junit.Test)5 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)4 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)4 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)4 JSITLiteralExpression (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITLiteralExpression)3 ImportedValues (org.kie.workbench.common.dmn.api.definition.model.ImportedValues)2 OutputClause (org.kie.workbench.common.dmn.api.definition.model.OutputClause)2 OutputClauseUnaryTests (org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests)2 Text (org.kie.workbench.common.dmn.api.property.dmn.Text)2 JSITOutputClause (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITOutputClause)1