Search in sources :

Example 1 with JoinFieldModel

use of org.pentaho.agilebi.modeler.models.JoinFieldModel 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;
}
Also used : JoinTableModel(org.pentaho.agilebi.modeler.models.JoinTableModel) SchemaModel(org.pentaho.agilebi.modeler.models.SchemaModel) ArrayList(java.util.ArrayList) JoinFieldModel(org.pentaho.agilebi.modeler.models.JoinFieldModel) JoinRelationshipModel(org.pentaho.agilebi.modeler.models.JoinRelationshipModel)

Example 2 with JoinFieldModel

use of org.pentaho.agilebi.modeler.models.JoinFieldModel 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;
}
Also used : JoinTableModel(org.pentaho.agilebi.modeler.models.JoinTableModel) SchemaModel(org.pentaho.agilebi.modeler.models.SchemaModel) ArrayList(java.util.ArrayList) JoinFieldModel(org.pentaho.agilebi.modeler.models.JoinFieldModel) JoinRelationshipModel(org.pentaho.agilebi.modeler.models.JoinRelationshipModel)

Example 3 with JoinFieldModel

use of org.pentaho.agilebi.modeler.models.JoinFieldModel in project data-access by pentaho.

the class JoinDefinitionsStep method setBindings.

public void setBindings() {
    BindingFactory bf = new GwtBindingFactory(document);
    bf.createBinding(this.joinGuiModel.getLeftTables(), "children", this.leftTables, "elements");
    bf.createBinding(this.joinGuiModel.getRightTables(), "children", this.rightTables, "elements");
    bf.createBinding(this.leftTables, "selectedItem", this.joinGuiModel, "leftJoinTable");
    bf.createBinding(this.rightTables, "selectedItem", this.joinGuiModel, "rightJoinTable");
    bf.createBinding(this.joinGuiModel.getJoins(), "children", this.joinsList, "elements");
    bf.createBinding(this.joinsList, "selectedItem", this.joinGuiModel, "selectedJoin");
    bf.createBinding(this.leftTables, "selectedItem", this.leftKeyFieldList, "elements", new TableSelectionConvertor(this.leftTables));
    bf.createBinding(this.rightTables, "selectedItem", this.rightKeyFieldList, "elements", new TableSelectionConvertor(this.rightTables));
    this.leftKeyFieldBinding = bf.createBinding(this.leftKeyFieldList, "selectedIndex", this.joinGuiModel, "leftKeyField", new BindingConvertor<Integer, JoinFieldModel>() {

        @Override
        public JoinFieldModel sourceToTarget(final Integer index) {
            JoinTableModel joinTable = joinGuiModel.getLeftJoinTable();
            if (joinTable != null) {
                List<JoinFieldModel> fields = joinTable.getFields();
                if (index == -1 || fields.isEmpty()) {
                    return null;
                }
                return fields.get(index);
            }
            return null;
        }

        @Override
        public Integer targetToSource(final JoinFieldModel value) {
            return null;
        }
    });
    this.rightKeyFieldBinding = bf.createBinding(this.rightKeyFieldList, "selectedIndex", this.joinGuiModel, "rightKeyField", new BindingConvertor<Integer, JoinFieldModel>() {

        @Override
        public JoinFieldModel sourceToTarget(final Integer index) {
            JoinTableModel joinTable = joinGuiModel.getRightJoinTable();
            if (joinTable != null) {
                List<JoinFieldModel> fields = joinTable.getFields();
                if (index == -1 || fields.isEmpty()) {
                    return null;
                }
                return fields.get(index);
            }
            return null;
        }

        @Override
        public Integer targetToSource(final JoinFieldModel value) {
            return null;
        }
    });
}
Also used : JoinTableModel(org.pentaho.agilebi.modeler.models.JoinTableModel) GwtBindingFactory(org.pentaho.ui.xul.gwt.binding.GwtBindingFactory) JoinFieldModel(org.pentaho.agilebi.modeler.models.JoinFieldModel) BindingConvertor(org.pentaho.ui.xul.binding.BindingConvertor) BindingFactory(org.pentaho.ui.xul.binding.BindingFactory) GwtBindingFactory(org.pentaho.ui.xul.gwt.binding.GwtBindingFactory)

Aggregations

JoinFieldModel (org.pentaho.agilebi.modeler.models.JoinFieldModel)3 JoinTableModel (org.pentaho.agilebi.modeler.models.JoinTableModel)3 ArrayList (java.util.ArrayList)2 JoinRelationshipModel (org.pentaho.agilebi.modeler.models.JoinRelationshipModel)2 SchemaModel (org.pentaho.agilebi.modeler.models.SchemaModel)2 BindingConvertor (org.pentaho.ui.xul.binding.BindingConvertor)1 BindingFactory (org.pentaho.ui.xul.binding.BindingFactory)1 GwtBindingFactory (org.pentaho.ui.xul.gwt.binding.GwtBindingFactory)1