Search in sources :

Example 1 with PaloNameComparator

use of org.pentaho.di.palo.core.PaloNameComparator in project pentaho-kettle by pentaho.

the class PaloCubeDeleteDialog method doSelectConnection.

private void doSelectConnection(boolean clearCurrentData) {
    try {
        if (clearCurrentData) {
            comboCubeName.removeAll();
        }
        if (comboCubeName.getItemCount() > 1) {
            return;
        }
        if (addConnectionLine.getText() != null) {
            DatabaseMeta dbMeta = DatabaseMeta.findDatabase(jobMeta.getDatabases(), addConnectionLine.getText());
            if (dbMeta != null) {
                PaloHelper helper = new PaloHelper(dbMeta, DefaultLogLevel.getLogLevel());
                helper.connect();
                List<String> cubes = helper.getCubesNames();
                Collections.sort(cubes, new PaloNameComparator());
                for (String cubename : cubes) {
                    if (comboCubeName.indexOf(cubename) == -1) {
                        comboCubeName.add(cubename);
                    }
                }
                helper.disconnect();
            }
        }
    } catch (Exception ex) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "PaloDimInputFlatDialog.RetreiveDimensionsErrorTitle"), BaseMessages.getString(PKG, "PaloDimInputFlatDialog.RetreiveDimensionsError"), ex);
    }
}
Also used : PaloHelper(org.pentaho.di.palo.core.PaloHelper) PaloNameComparator(org.pentaho.di.palo.core.PaloNameComparator) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta)

Example 2 with PaloNameComparator

use of org.pentaho.di.palo.core.PaloNameComparator in project pentaho-kettle by pentaho.

the class PaloDimInputDialog method doSelectConnection.

private void doSelectConnection(boolean clearCurrentData) {
    try {
        if (clearCurrentData) {
            tableViewFields.table.removeAll();
            comboDimension.removeAll();
        }
        if (addConnectionLine.getText() != null) {
            DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
            if (dbMeta != null) {
                PaloDimInputData data = new PaloDimInputData(dbMeta);
                data.helper.connect();
                List<String> dimensions = data.helper.getDimensionsNames();
                Collections.sort(dimensions, new PaloNameComparator());
                for (String dimensionName : dimensions) {
                    if (comboDimension.indexOf(dimensionName) == -1) {
                        comboDimension.add(dimensionName);
                    }
                }
                data.helper.disconnect();
            }
        }
    } catch (Exception ex) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "PaloDimInputDialog.RetreiveDimensionsErrorTitle"), BaseMessages.getString(PKG, "PaloDimInputDialog.RetreiveDimensionsError"), ex);
    }
}
Also used : PaloDimInputData(org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData) PaloNameComparator(org.pentaho.di.palo.core.PaloNameComparator) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) KettleException(org.pentaho.di.core.exception.KettleException)

Example 3 with PaloNameComparator

use of org.pentaho.di.palo.core.PaloNameComparator in project pentaho-kettle by pentaho.

the class PaloDimOutputDialog method doSelectConnection.

private void doSelectConnection(boolean clearCurrentData) {
    try {
        if (clearCurrentData) {
            tableViewFields.table.removeAll();
            comboDimension.removeAll();
        }
        if (addConnectionLine.getText() != null) {
            DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
            if (dbMeta != null) {
                PaloDimOutputData data = new PaloDimOutputData(dbMeta);
                data.helper.connect();
                List<String> dimensions = data.helper.getDimensionsNames();
                Collections.sort(dimensions, new PaloNameComparator());
                for (String dimensionName : dimensions) {
                    if (comboDimension.indexOf(dimensionName) == -1) {
                        comboDimension.add(dimensionName);
                    }
                }
                data.helper.disconnect();
            }
        }
    } catch (Exception ex) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "PaloDimOutputDialog.RetreiveDimensionsErrorTitle"), BaseMessages.getString(PKG, "PaloDimOutputDialog.RetreiveDimensionsError"), ex);
    }
}
Also used : PaloDimOutputData(org.pentaho.di.trans.steps.palo.dimoutput.PaloDimOutputData) PaloNameComparator(org.pentaho.di.palo.core.PaloNameComparator) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) KettleException(org.pentaho.di.core.exception.KettleException)

Example 4 with PaloNameComparator

use of org.pentaho.di.palo.core.PaloNameComparator in project pentaho-kettle by pentaho.

the class PaloCubeCreateDialog method doBuildDimensionList.

private void doBuildDimensionList() {
    if (comboDropDown == null && addConnectionLine.getText() != null) {
        DatabaseMeta dbMeta = DatabaseMeta.findDatabase(jobMeta.getDatabases(), addConnectionLine.getText());
        if (dbMeta != null) {
            PaloHelper helper = new PaloHelper(dbMeta, DefaultLogLevel.getLogLevel());
            try {
                helper.connect();
                List<String> dimensionNames = helper.getDimensionsNames();
                List<String> dimensions = helper.getDimensionsNames();
                Collections.sort(dimensions, new PaloNameComparator());
                comboDropDown = new ColumnInfo("Field", ColumnInfo.COLUMN_TYPE_CCOMBO, dimensions.toArray(new String[dimensionNames.size()]), true);
                tableViewFields.setColumnInfo(0, comboDropDown);
            } catch (Exception ex) {
                new ErrorDialog(shell, BaseMessages.getString(PKG, "PaloCellOutputDialog.RetreiveCubesErrorTitle"), BaseMessages.getString(PKG, "PaloCellOutputDialog.RetreiveCubesError"), ex);
            } finally {
                helper.disconnect();
            }
        }
    }
}
Also used : PaloHelper(org.pentaho.di.palo.core.PaloHelper) PaloNameComparator(org.pentaho.di.palo.core.PaloNameComparator) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta)

Example 5 with PaloNameComparator

use of org.pentaho.di.palo.core.PaloNameComparator in project pentaho-kettle by pentaho.

the class PaloCellInputDialog method doSelectConnection.

private void doSelectConnection(boolean clearCurrentData) {
    try {
        if (clearCurrentData) {
            tableViewFields.table.removeAll();
            comboCube.removeAll();
        }
        if (addConnectionLine.getText() != null) {
            DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
            if (dbMeta != null) {
                PaloCellInputData data = new PaloCellInputData(dbMeta);
                data.helper.connect();
                List<String> cubes = data.helper.getCubesNames();
                Collections.sort(cubes, new PaloNameComparator());
                for (String cubeName : cubes) {
                    if (comboCube.indexOf(cubeName) == -1) {
                        comboCube.add(cubeName);
                    }
                }
                data.helper.disconnect();
            }
        }
    } catch (Exception ex) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "PaloCellInputDialog.RetreiveCubesErrorTitle"), BaseMessages.getString(PKG, "PaloCellInputDialog.RetreiveCubesError"), ex);
    }
}
Also used : PaloNameComparator(org.pentaho.di.palo.core.PaloNameComparator) PaloCellInputData(org.pentaho.di.trans.steps.palo.cellinput.PaloCellInputData) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) KettleException(org.pentaho.di.core.exception.KettleException)

Aggregations

DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)6 PaloNameComparator (org.pentaho.di.palo.core.PaloNameComparator)6 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)6 KettleException (org.pentaho.di.core.exception.KettleException)4 PaloHelper (org.pentaho.di.palo.core.PaloHelper)2 PaloCellInputData (org.pentaho.di.trans.steps.palo.cellinput.PaloCellInputData)1 PaloCellOutputData (org.pentaho.di.trans.steps.palo.celloutput.PaloCellOutputData)1 PaloDimInputData (org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData)1 PaloDimOutputData (org.pentaho.di.trans.steps.palo.dimoutput.PaloDimOutputData)1 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)1