use of org.kie.workbench.common.dmn.api.definition.model.InputClauseUnaryTests in project kie-wb-common by kiegroup.
the class InputClauseUnaryTestsPropertyConverter method wbFromDMN.
public static InputClauseUnaryTests wbFromDMN(final org.kie.dmn.model.api.UnaryTests dmn) {
if (dmn == null) {
return null;
}
final Id id = new Id(dmn.getId());
final QName key = new QName(DMNModelInstrumentedBase.Namespace.KIE.getUri(), ConstraintType.CONSTRAINT_KEY, DMNModelInstrumentedBase.Namespace.KIE.getPrefix());
final String constraintString = dmn.getAdditionalAttributes().getOrDefault(key, "");
final ConstraintType constraint = ConstraintType.fromString(constraintString);
final InputClauseUnaryTests result = new InputClauseUnaryTests(id, new Text(dmn.getText()), constraint);
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.InputClauseUnaryTests in project kie-wb-common by kiegroup.
the class InputClauseUnaryTestsPropertyConverterTest method testWbFromDMN.
private void testWbFromDMN(final ConstraintType constraintType) {
when(additionalAttributes.getOrDefault(key, "")).thenReturn(constraintType.value());
final InputClauseUnaryTests inputClause = InputClauseUnaryTestsPropertyConverter.wbFromDMN(dmnUnary);
assertEquals(inputClause.getConstraintType(), constraintType);
assertEquals(inputClause.getId().getValue(), ID);
assertEquals(inputClause.getText().getValue(), TEXT);
}
use of org.kie.workbench.common.dmn.api.definition.model.InputClauseUnaryTests in project kie-wb-common by kiegroup.
the class InputClauseUnaryTestsPropertyConverter method wbFromDMN.
public static InputClauseUnaryTests wbFromDMN(final JSITUnaryTests dmn) {
if (Objects.isNull(dmn)) {
return null;
}
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final QName key = new QName(DMNModelInstrumentedBase.Namespace.KIE.getUri(), ConstraintType.CONSTRAINT_KEY, XMLConstants.DEFAULT_NS_PREFIX);
final Map<QName, String> otherAttributes = JSITUnaryTests.getOtherAttributesMap(dmn);
final String constraintString = otherAttributes.getOrDefault(key, "");
final ConstraintType constraint = ConstraintType.fromString(constraintString);
final InputClauseUnaryTests result = new InputClauseUnaryTests(id, new Text(dmn.getText()), constraint);
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.InputClauseUnaryTests in project kie-wb-common by kiegroup.
the class InputClausePropertyConverter method wbFromDMN.
public static InputClause wbFromDMN(final JSITInputClause dmn) {
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final InputClauseLiteralExpression inputExpression = InputClauseLiteralExpressionPropertyConverter.wbFromDMN(dmn.getInputExpression());
final InputClauseUnaryTests inputValues = Optional.ofNullable(InputClauseUnaryTestsPropertyConverter.wbFromDMN(dmn.getInputValues())).orElse(new InputClauseUnaryTests());
final InputClause result = new InputClause(id, description, inputExpression, inputValues);
if (Objects.nonNull(inputExpression)) {
inputExpression.setParent(result);
}
inputValues.setParent(result);
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.InputClauseUnaryTests in project kie-wb-common by kiegroup.
the class InputClausePropertyConverter method wbFromDMN.
public static InputClause wbFromDMN(final org.kie.dmn.model.api.InputClause dmn) {
final Id id = new Id(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final InputClauseLiteralExpression inputExpression = InputClauseLiteralExpressionPropertyConverter.wbFromDMN(dmn.getInputExpression());
final InputClauseUnaryTests inputValues = InputClauseUnaryTestsPropertyConverter.wbFromDMN(dmn.getInputValues());
final InputClause result = new InputClause(id, description, inputExpression, inputValues);
if (inputExpression != null) {
inputExpression.setParent(result);
}
if (inputValues != null) {
inputValues.setParent(result);
}
return result;
}
Aggregations