use of org.kie.workbench.common.dmn.api.definition.model.LiteralExpressionPMMLDocumentModel in project kie-wb-common by kiegroup.
the class PMMLIncludedModelHandlerTest method makeTopLevelPMMLFunctionDefinition.
private FunctionDefinition makeTopLevelPMMLFunctionDefinition(final String documentName, final String modelName) {
final FunctionDefinition function = new FunctionDefinition();
function.setKind(FunctionDefinition.Kind.PMML);
final Context functionExpression = new Context();
function.setExpression(functionExpression);
final ContextEntry functionContextEntry1 = new ContextEntry();
final InformationItem functionContextEntry1Variable = new InformationItem();
final LiteralExpressionPMMLDocument functionContextEntry1Value = new LiteralExpressionPMMLDocument();
functionContextEntry1Variable.getName().setValue(LiteralExpressionPMMLDocument.VARIABLE_DOCUMENT);
functionContextEntry1.setVariable(functionContextEntry1Variable);
functionContextEntry1Value.getText().setValue("\"" + documentName + "\"");
functionContextEntry1.setExpression(functionContextEntry1Value);
final ContextEntry functionContextEntry2 = new ContextEntry();
final InformationItem functionContextEntry2Variable = new InformationItem();
final LiteralExpressionPMMLDocumentModel functionContextEntry2Value = new LiteralExpressionPMMLDocumentModel();
functionContextEntry2Variable.getName().setValue(LiteralExpressionPMMLDocumentModel.VARIABLE_MODEL);
functionContextEntry2.setVariable(functionContextEntry2Variable);
functionContextEntry2Value.getText().setValue("\"" + modelName + "\"");
functionContextEntry2.setExpression(functionContextEntry2Value);
functionExpression.getContextEntry().add(functionContextEntry1);
functionExpression.getContextEntry().add(functionContextEntry2);
return function;
}
Aggregations