use of org.kie.dmn.model.api.FunctionKind in project kie-wb-common by kiegroup.
the class FunctionDefinitionPropertyConverter method wbFromDMN.
public static FunctionDefinition wbFromDMN(final org.kie.dmn.model.api.FunctionDefinition dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) {
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 Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression(), hasComponentWidthsConsumer);
final FunctionDefinition result = new FunctionDefinition(id, description, typeRef, expression);
if (expression != null) {
expression.setParent(result);
}
final FunctionKind kind = dmn.getKind();
switch(kind) {
case FEEL:
result.setKind(Kind.FEEL);
break;
case JAVA:
result.setKind(Kind.JAVA);
break;
case PMML:
result.setKind(Kind.PMML);
convertPMMLFunctionExpression(result);
break;
default:
result.setKind(Kind.FEEL);
break;
}
for (org.kie.dmn.model.api.InformationItem ii : dmn.getFormalParameter()) {
final InformationItem iiConverted = InformationItemPropertyConverter.wbFromDMN(ii);
if (iiConverted != null) {
iiConverted.setParent(result);
}
result.getFormalParameter().add(iiConverted);
}
return result;
}
Aggregations