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 JSITOutputClause dmn) {
final Id id = IdPropertyConverter.wbFromDMN(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());
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 (Objects.nonNull(outputValues)) {
outputValues.setParent(result);
}
if (Objects.nonNull(defaultOutputEntry)) {
defaultOutputEntry.setParent(result);
}
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression in project kie-wb-common by kiegroup.
the class OutputClauseLiteralExpressionPropertyConverter method wbFromDMN.
/**
* Returns a non-null instance of OutputClauseLiteralExpression. The Properties Panel needs
* non-null objects to bind therefore a concrete object must always be returned.
* @param dmn
* @return
*/
public static OutputClauseLiteralExpression wbFromDMN(final JSITLiteralExpression dmn) {
if (Objects.isNull(dmn)) {
return new OutputClauseLiteralExpression();
}
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
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 (Objects.nonNull(importedValues)) {
importedValues.setParent(result);
}
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression in project kie-wb-common by kiegroup.
the class OutputClauseLiteralExpressionPropertyConverterTest method testDMNFromWBWhenTextIsNull.
@Test
public void testDMNFromWBWhenTextIsNull() {
final OutputClauseLiteralExpression wb = new OutputClauseLiteralExpression();
wb.setText(null);
final JSITLiteralExpression dmn = OutputClauseLiteralExpressionPropertyConverter.dmnFromWB(wb);
assertThat(dmn).isNull();
}
use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression in project kie-wb-common by kiegroup.
the class OutputClauseLiteralExpressionPropertyConverterTest method testDMNFromWBWhenNonNullWithEmptyString.
@Test
public void testDMNFromWBWhenNonNullWithEmptyString() {
final OutputClauseLiteralExpression wb = new OutputClauseLiteralExpression();
wb.getText().setValue("");
final JSITLiteralExpression dmn = OutputClauseLiteralExpressionPropertyConverter.dmnFromWB(wb);
assertThat(dmn).isNull();
}
use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression in project kie-wb-common by kiegroup.
the class OutputClauseLiteralExpressionPropertyConverterTest method testDMNFromWBWhenNonNullWithNonEmptyString.
@Test
public void testDMNFromWBWhenNonNullWithNonEmptyString() {
final OutputClauseLiteralExpression wb = new OutputClauseLiteralExpression();
wb.getText().setValue(TEXT);
final JSITLiteralExpression dmn = OutputClauseLiteralExpressionPropertyConverter.dmnFromWB(wb);
assertThat(dmn).isNotNull();
verify(jsitLiteralExpression).setText(TEXT);
}
Aggregations