use of org.pentaho.agilebi.modeler.models.JoinRelationshipModel in project data-access by pentaho.
the class JoinDefinitionsStep method createJoin.
@Bindable
public void createJoin() {
JoinRelationshipModel join = new JoinRelationshipModel();
join.setLeftKeyFieldModel(this.joinGuiModel.getLeftKeyField());
join.setRightKeyFieldModel(this.joinGuiModel.getRightKeyField());
if (this.validator.isValid(join)) {
this.joinGuiModel.addJoin(join);
this.parentDatasource.setFinishable(this.validator.allTablesJoined());
} else {
((MultiTableDatasource) this.parentDatasource).displayErrors(this.validator.getError());
}
}
use of org.pentaho.agilebi.modeler.models.JoinRelationshipModel in project data-access by pentaho.
the class SerializeMultiTableServiceIT method getSchema.
private SchemaModel getSchema() {
List<JoinRelationshipModel> joins = new ArrayList<JoinRelationshipModel>();
JoinTableModel joinTable1 = new JoinTableModel();
joinTable1.setName("CUSTOMERS");
JoinTableModel joinTable2 = new JoinTableModel();
joinTable2.setName("PRODUCTS");
JoinRelationshipModel join1 = new JoinRelationshipModel();
JoinFieldModel lField1 = new JoinFieldModel();
lField1.setName("CUSTOMERNAME");
lField1.setParentTable(joinTable1);
join1.setLeftKeyFieldModel(lField1);
JoinFieldModel rField1 = new JoinFieldModel();
rField1.setName("PRODUCTCODE");
rField1.setParentTable(joinTable2);
join1.setRightKeyFieldModel(rField1);
joins.add(join1);
SchemaModel model = new SchemaModel();
model.setJoins(joins);
return model;
}
use of org.pentaho.agilebi.modeler.models.JoinRelationshipModel in project data-access by pentaho.
the class JoinMetadataIT method getSchemaModel.
private SchemaModel getSchemaModel() {
List<JoinRelationshipModel> joins = new ArrayList<JoinRelationshipModel>();
JoinTableModel joinTable1 = new JoinTableModel();
joinTable1.setName("CUSTOMERS");
JoinTableModel joinTable2 = new JoinTableModel();
joinTable2.setName("PRODUCTS");
JoinRelationshipModel join1 = new JoinRelationshipModel();
JoinFieldModel lField1 = new JoinFieldModel();
lField1.setName("CUSTOMERNAME");
lField1.setParentTable(joinTable1);
join1.setLeftKeyFieldModel(lField1);
JoinFieldModel rField1 = new JoinFieldModel();
rField1.setName("PRODUCTCODE");
rField1.setParentTable(joinTable2);
join1.setRightKeyFieldModel(rField1);
joins.add(join1);
SchemaModel model = new SchemaModel();
model.setJoins(joins);
return model;
}
use of org.pentaho.agilebi.modeler.models.JoinRelationshipModel in project data-access by pentaho.
the class MultitableGuiModel method computeJoins.
private void computeJoins(MultiTableDatasourceDTO dto) {
this.joins.clear();
for (JoinRelationshipModel join : dto.getSchemaModel().getJoins()) {
for (JoinTableModel selectedTable : this.selectedTables) {
if (tablesAreEqual(selectedTable.getName(), join.getLeftKeyFieldModel().getParentTable().getName())) {
join.getLeftKeyFieldModel().getParentTable().setName(selectedTable.getName());
} else {
if (tablesAreEqual(selectedTable.getName(), join.getRightKeyFieldModel().getParentTable().getName())) {
join.getRightKeyFieldModel().getParentTable().setName(selectedTable.getName());
}
}
}
}
this.joins.addAll(dto.getSchemaModel().getJoins());
}
use of org.pentaho.agilebi.modeler.models.JoinRelationshipModel in project data-access by pentaho.
the class TablesSelectionStep method checkExistingJoinsStillValid.
private void checkExistingJoinsStillValid() {
Set<String> allTables = new HashSet<String>();
for (JoinTableModel tbl : joinGuiModel.getSelectedTables()) {
allTables.add(tbl.getName());
}
List<JoinRelationshipModel> toRemove = new ArrayList<JoinRelationshipModel>();
for (JoinRelationshipModel join : joinGuiModel.getJoins()) {
if (!allTables.contains(join.getLeftKeyFieldModel().getParentTable().getName()) || !allTables.contains(join.getRightKeyFieldModel().getParentTable().getName())) {
toRemove.add(join);
}
}
for (JoinRelationshipModel join : toRemove) {
joinGuiModel.getJoins().remove(join);
}
}
Aggregations