use of org.kie.workbench.common.dmn.api.definition.v1_1.OutputClause in project drools by kiegroup.
the class DMNCompilerImpl method resolveTypeRef.
public DMNType resolveTypeRef(DMNModelImpl dmnModel, DMNNode node, NamedElement model, DMNModelInstrumentedBase localElement, QName typeRef) {
if (typeRef != null) {
QName nsAndName = getNamespaceAndName(localElement, dmnModel.getImportAliasesForNS(), typeRef);
DMNType type = dmnModel.getTypeRegistry().resolveType(nsAndName.getNamespaceURI(), nsAndName.getLocalPart());
if (type == null && DMNModelInstrumentedBase.URI_FEEL.equals(nsAndName.getNamespaceURI())) {
if (model instanceof Decision && ((Decision) model).getExpression() instanceof DecisionTable) {
DecisionTable dt = (DecisionTable) ((Decision) model).getExpression();
if (dt.getOutput().size() > 1) {
// implicitly define a type for the decision table result
CompositeTypeImpl compType = new CompositeTypeImpl(dmnModel.getNamespace(), model.getName() + "_Type", model.getId(), dt.getHitPolicy().isMultiHit());
for (OutputClause oc : dt.getOutput()) {
DMNType fieldType = resolveTypeRef(dmnModel, node, model, oc, oc.getTypeRef());
compType.addField(oc.getName(), fieldType);
}
dmnModel.getTypeRegistry().registerType(compType);
return compType;
} else if (dt.getOutput().size() == 1) {
return resolveTypeRef(dmnModel, node, model, dt.getOutput().get(0), dt.getOutput().get(0).getTypeRef());
}
}
} else if (type == null) {
MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, localElement, dmnModel, null, null, Msg.UNKNOWN_TYPE_REF_ON_NODE, typeRef.toString(), localElement.getParentDRDElement().getIdentifierString());
}
return type;
}
return dmnModel.getTypeRegistry().resolveType(DMNModelInstrumentedBase.URI_FEEL, BuiltInType.UNKNOWN.getName());
}
Aggregations