use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class OperatorPage method getOperatorCompletions.
void getOperatorCompletions(final Callback<String[]> callback) {
final AsyncPackageDataModelOracle oracle = presenter.getDataModelOracle();
oracle.getOperatorCompletions(plugin().getFactType(), plugin().getFactField(), callback);
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldPlugin method acceptParameterType.
private boolean acceptParameterType(final PortableParameterDefinition ppd) {
final AsyncPackageDataModelOracle oracle = presenter.getDataModelOracle();
if (nil(editingWrapper().getFactField())) {
return false;
}
if (nil(ppd.getClassName())) {
return false;
}
final String fieldClassName = oracle.getFieldClassName(patternWrapper().getFactType(), editingWrapper().getFactField());
return fieldClassName.equals(ppd.getClassName());
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class ActionWorkItemExecuteColumnSynchronizerTest method getOracle.
@Override
protected AsyncPackageDataModelOracle getOracle() {
final AsyncPackageDataModelOracle oracle = super.getOracle();
oracle.addModelFields(Collections.singletonMap("Applicant", new ModelField[] { modelField("this", "Applicant"), modelField("age", DataType.TYPE_NUMERIC_INTEGER) }));
return oracle;
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class ActionInsertFactColumnSynchronizerTest method getOracle.
@Override
protected AsyncPackageDataModelOracle getOracle() {
final AsyncPackageDataModelOracle oracle = super.getOracle();
oracle.addModelFields(Collections.singletonMap("Applicant", new ModelField[] { modelField("this", "Applicant"), modelField("age", DataType.TYPE_NUMERIC_INTEGER), modelField("name", DataType.TYPE_STRING), modelField("approved", DataType.TYPE_BOOLEAN) }));
return oracle;
}
use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle in project drools-wb by kiegroup.
the class RowExpanderTests method testExpansionWithLimitedEntry.
@Test
@SuppressWarnings("serial")
public void testExpansionWithLimitedEntry() {
GuidedDecisionTable52 model = new GuidedDecisionTable52();
model.setTableFormat(GuidedDecisionTable52.TableFormat.LIMITED_ENTRY);
final ModuleDataModelOracle projectLoader = ModuleDataModelOracleBuilder.newModuleOracleBuilder(new RawMVELEvaluator()).addFact("Driver").addField(new ModelField("age", Integer.class.getName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.BOTH, DataType.TYPE_NUMERIC_INTEGER)).addField(new ModelField("name", String.class.getName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.BOTH, DataType.TYPE_STRING)).addField(new ModelField("dateOfBirth", Boolean.class.getName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.BOTH, DataType.TYPE_DATE)).addField(new ModelField("approved", Boolean.class.getName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.BOTH, DataType.TYPE_BOOLEAN)).end().build();
// Emulate server-to-client conversions
final AsyncPackageDataModelOracle oracle = getOracle();
final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
dataModel.setModelFields(projectLoader.getModuleModelFields());
populateDataModelOracle(mock(Path.class), model, oracle, dataModel);
Pattern52 p1 = new Pattern52();
p1.setBoundName("c1");
p1.setFactType("Driver");
LimitedEntryConditionCol52 c1 = new LimitedEntryConditionCol52();
c1.setFactField("name");
c1.setOperator("==");
c1.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
c1.setValue(new DTCellValue52("Mike"));
p1.getChildColumns().add(c1);
model.getConditions().add(p1);
Pattern52 p2 = new Pattern52();
p2.setBoundName("c2");
p2.setFactType("Driver");
LimitedEntryConditionCol52 c2 = new LimitedEntryConditionCol52();
c2.setFactField("age");
c2.setOperator("==");
c2.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
c1.setValue(new DTCellValue52(25));
p2.getChildColumns().add(c2);
model.getConditions().add(p2);
LimitedEntryActionSetFieldCol52 a1 = new LimitedEntryActionSetFieldCol52();
a1.setBoundName("c1");
a1.setFactField("name");
a1.setValue(new DTCellValue52("a1name"));
model.getActionCols().add(a1);
LimitedEntryActionInsertFactCol52 a2 = new LimitedEntryActionInsertFactCol52();
a2.setBoundName("a2");
a2.setFactType("Driver");
a2.setFactField("name");
a2.setValue(new DTCellValue52("a2name"));
model.getActionCols().add(a2);
RowExpander re = new RowExpander(model, oracle);
List<RowExpander.ColumnValues> columns = re.getColumns();
assertEquals(6, columns.size());
assertEquals(1, columns.get(0).values.size());
assertEquals(1, columns.get(1).values.size());
assertEquals(2, columns.get(2).values.size());
assertEquals(2, columns.get(3).values.size());
assertEquals(1, columns.get(4).values.size());
assertEquals(1, columns.get(5).values.size());
assertEquals(Boolean.TRUE, columns.get(2).values.get(0).getBooleanValue());
assertEquals(Boolean.FALSE, columns.get(2).values.get(1).getBooleanValue());
assertEquals(Boolean.TRUE, columns.get(3).values.get(0).getBooleanValue());
assertEquals(Boolean.FALSE, columns.get(3).values.get(1).getBooleanValue());
assertEquals(Boolean.FALSE, columns.get(4).values.get(0).getBooleanValue());
assertEquals(Boolean.FALSE, columns.get(5).values.get(0).getBooleanValue());
RowExpander.RowIterator i = re.iterator();
List<List<DTCellValue52>> rows = new ArrayList<List<DTCellValue52>>();
while (i.hasNext()) {
List<DTCellValue52> row = i.next();
rows.add(row);
}
assertEquals(4, rows.size());
assertEquals("", rows.get(0).get(0).getStringValue());
assertEquals("", rows.get(0).get(1).getStringValue());
assertEquals(Boolean.TRUE, rows.get(0).get(2).getBooleanValue());
assertEquals(Boolean.TRUE, rows.get(0).get(3).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(0).get(4).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(0).get(5).getBooleanValue());
assertEquals("", rows.get(1).get(0).getStringValue());
assertEquals("", rows.get(1).get(1).getStringValue());
assertEquals(Boolean.TRUE, rows.get(1).get(2).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(1).get(3).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(1).get(4).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(1).get(5).getBooleanValue());
assertEquals("", rows.get(2).get(0).getStringValue());
assertEquals("", rows.get(2).get(1).getStringValue());
assertEquals(Boolean.FALSE, rows.get(2).get(2).getBooleanValue());
assertEquals(Boolean.TRUE, rows.get(2).get(3).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(2).get(4).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(2).get(5).getBooleanValue());
assertEquals("", rows.get(3).get(0).getStringValue());
assertEquals("", rows.get(3).get(1).getStringValue());
assertEquals(Boolean.FALSE, rows.get(3).get(2).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(3).get(3).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(3).get(4).getBooleanValue());
assertEquals(Boolean.FALSE, rows.get(3).get(5).getBooleanValue());
}
Aggregations