use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project kie-wb-common by kiegroup.
the class RelationEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
final Optional<Relation> expression = definition.getModelClass();
final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
assertThat(oEditor).isPresent();
final GridWidget editor = oEditor.get();
assertThat(editor).isInstanceOf(RelationGrid.class);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project kie-wb-common by kiegroup.
the class RelationGridTest method testInitialiseUiColumns.
@Test
public void testInitialiseUiColumns() throws Exception {
final String columnHeader = "first column";
relation.getColumn().add(new InformationItem() {
{
getName().setValue(columnHeader);
}
});
expression = Optional.of(relation);
setupGrid(0);
assertEquals(2, grid.getModel().getColumns().size());
assertTrue(grid.getModel().getColumns().get(0) instanceof RowNumberColumn);
assertEquals(columnHeader, grid.getModel().getColumns().get(1).getHeaderMetaData().get(0).getTitle());
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project kie-wb-common by kiegroup.
the class DeleteRelationColumnCommandTest method setup.
@Before
public void setup() {
this.relation = new Relation();
this.informationItem = new InformationItem();
this.relation.getColumn().add(informationItem);
this.uiModel = new BaseGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiModelColumn);
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiModelColumn).getIndex();
this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project drools by kiegroup.
the class RelationConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
Relation r = (Relation) parent;
for (InformationItem c : r.getColumn()) {
writeChildrenNode(writer, context, c, COLUMN);
}
for (org.kie.dmn.model.v1_1.List row : r.getRow()) {
writeChildrenNode(writer, context, row, ROW);
}
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Relation in project drools by kiegroup.
the class DMNEvaluatorCompiler method compileRelation.
private DMNExpressionEvaluator compileRelation(DMNCompilerContext ctx, DMNModelImpl model, DMNBaseNode node, String relationName, Relation expression) {
Relation relationDef = expression;
DMNRelationEvaluator relationEval = new DMNRelationEvaluator(node.getName(), node.getSource(), relationDef);
for (InformationItem col : relationDef.getColumn()) {
DMNCompilerHelper.checkVariableName(model, col, col.getName());
relationEval.addColumn(col.getName());
}
for (org.kie.dmn.model.v1_1.List row : relationDef.getRow()) {
java.util.List<DMNExpressionEvaluator> values = new ArrayList<>();
for (Expression expr : row.getExpression()) {
values.add(compileExpression(ctx, model, node, relationName, expr));
}
relationEval.addRow(values);
}
return relationEval;
}
Aggregations