Search in sources :

Example 1 with PaloDimOutputData

use of org.pentaho.di.trans.steps.palo.dimoutput.PaloDimOutputData 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 2 with PaloDimOutputData

use of org.pentaho.di.trans.steps.palo.dimoutput.PaloDimOutputData in project pentaho-kettle by pentaho.

the class PaloDimOutputDialog method doGetFields.

private void doGetFields() {
    try {
        if (comboDimension.getText() != null) {
            if (addConnectionLine.getText() != null) {
                DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
                if (dbMeta != null) {
                    PaloDimOutputData data = new PaloDimOutputData(dbMeta);
                    tableViewFields.table.removeAll();
                    data.helper.connect();
                    List<PaloDimensionLevel> levels = data.helper.getDimensionLevels(comboDimension.getText());
                    for (PaloDimensionLevel level : levels) {
                        tableViewFields.add(String.valueOf(level.getLevelNumber()), level.getLevelName(), level.getFieldName());
                    }
                    tableViewFields.removeEmptyRows();
                    tableViewFields.setRowNums();
                    tableViewFields.optWidth(true);
                    data.helper.disconnect();
                }
            }
        } else {
            new ErrorDialog(shell, BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"), new Exception(BaseMessages.getString(PKG, "PaloDimOutputDialog.SelectDimensionsFirstError")));
        }
        this.fillPreviousFieldTableViewColumn();
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"), ke);
        tableViewFields.add();
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) PaloDimOutputData(org.pentaho.di.trans.steps.palo.dimoutput.PaloDimOutputData) PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel) 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)2 KettleException (org.pentaho.di.core.exception.KettleException)2 PaloDimOutputData (org.pentaho.di.trans.steps.palo.dimoutput.PaloDimOutputData)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 PaloDimensionLevel (org.pentaho.di.palo.core.PaloDimensionLevel)1 PaloNameComparator (org.pentaho.di.palo.core.PaloNameComparator)1