use of org.kie.workbench.common.dmn.api.definition.v1_1.Decision in project kie-wb-common by kiegroup.
the class DMNEditDecisionToolboxActionTest method setup.
@Before
public void setup() throws Exception {
decisionNode = new NodeImpl<>(E_UUID);
decision = new Decision();
final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
final View<Decision> nodeContent = new ViewImpl<>(decision, bounds);
decisionNode.setContent(nodeContent);
when(canvasHandler.getGraphIndex()).thenReturn(graphIndex);
when(graphIndex.get(eq(E_UUID))).thenReturn(decisionNode);
when(sessionManager.getCurrentSession()).thenReturn(session);
this.tested = new DMNEditDecisionToolboxAction(sessionManager, translationService, editExpressionEvent);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Decision 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