use of org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable in project kie-wb-common by kiegroup.
the class DeleteInputClauseCommandTest method setup.
@Before
public void setup() {
this.dtable = new DecisionTable();
this.inputClause = new InputClause();
this.dtable.getInput().add(inputClause);
this.uiModel = new DMNGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiInputClauseColumn);
this.uiModel.appendColumn(uiDescriptionColumn);
this.uiModelMapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector);
this.command = spy(new DeleteInputClauseCommand(dtable, uiModel, DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT, uiModelMapper, canvasOperation));
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiInputClauseColumn).getIndex();
doReturn(2).when(uiDescriptionColumn).getIndex();
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable in project kie-wb-common by kiegroup.
the class SetBuiltinAggregatorCommandTest method makeCommand.
private void makeCommand(final BuiltinAggregator aggregator) {
this.dtable = new DecisionTable();
this.dtable.setAggregation(aggregator);
this.command = new SetBuiltinAggregatorCommand(dtable, NEW_AGGREGATOR, canvasOperation);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable in project kie-wb-common by kiegroup.
the class DecisionTablePropertyConverter method dmnFromWB.
public static org.kie.dmn.model.v1_1.DecisionTable dmnFromWB(final DecisionTable wb) {
org.kie.dmn.model.v1_1.DecisionTable result = new org.kie.dmn.model.v1_1.DecisionTable();
result.setId(wb.getId().getValue());
result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
for (InputClause input : wb.getInput()) {
result.getInput().add(InputClausePropertyConverter.dmnFromWB(input));
}
for (OutputClause input : wb.getOutput()) {
result.getOutput().add(OutputClausePropertyConverter.dmnFromWB(input));
}
for (DecisionRule dr : wb.getRule()) {
result.getRule().add(DecisionRulePropertyConverter.dmnFromWB(dr));
}
if (wb.getHitPolicy() != null) {
result.setHitPolicy(org.kie.dmn.model.v1_1.HitPolicy.fromValue(wb.getHitPolicy().value()));
}
if (wb.getAggregation() != null) {
result.setAggregation(org.kie.dmn.model.v1_1.BuiltinAggregator.fromValue(wb.getAggregation().value()));
}
if (wb.getPreferredOrientation() != null) {
result.setPreferredOrientation(org.kie.dmn.model.v1_1.DecisionTableOrientation.fromValue(wb.getPreferredOrientation().value()));
}
result.setOutputLabel(wb.getOutputLabel());
return result;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable 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