Search in sources :

Example 1 with PaloDimInputData

use of org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData in project pentaho-kettle by pentaho.

the class PaloDimInputDialog method doGetLevels.

private void doGetLevels() {
    if (buttonBaseElementsOnly.getSelection()) {
        tableViewFields.table.removeAll();
        tableViewFields.add(BaseMessages.getString(PKG, "PaloDimInputDialog.BaseElementName"), "0", comboDimension.getText(), "String");
    } else if (comboDimension.getText() != null && comboDimension.getText() != "") {
        try {
            if (addConnectionLine.getText() != null) {
                DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
                if (dbMeta != null) {
                    PaloDimInputData data = new PaloDimInputData(dbMeta);
                    tableViewFields.table.removeAll();
                    data.helper.connect();
                    List<PaloDimensionLevel> levels = data.helper.getDimensionLevels(comboDimension.getText());
                    for (int i = 0; i < levels.size(); i++) {
                        PaloDimensionLevel level = levels.get(i);
                        tableViewFields.add(level.getLevelName(), String.valueOf(level.getLevelNumber()), level.getFieldName());
                    }
                    tableViewFields.setRowNums();
                    tableViewFields.optWidth(true);
                    data.helper.disconnect();
                }
            }
        } catch (Exception ex) {
            new ErrorDialog(shell, BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"), ex);
        }
    } else {
        new ErrorDialog(shell, BaseMessages.getString("System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString("System.Dialog.GetFieldsFailed.Message"), new Exception(BaseMessages.getString(PKG, "PaloDimInputDialog.SelectDimensionFirstError")));
    }
}
Also used : PaloDimInputData(org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData) PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) ArrayList(java.util.ArrayList) List(java.util.List) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) KettleException(org.pentaho.di.core.exception.KettleException)

Example 2 with PaloDimInputData

use of org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData 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)

Aggregations

DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)2 KettleException (org.pentaho.di.core.exception.KettleException)2 PaloDimInputData (org.pentaho.di.trans.steps.palo.diminput.PaloDimInputData)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 PaloDimensionLevel (org.pentaho.di.palo.core.PaloDimensionLevel)1 PaloNameComparator (org.pentaho.di.palo.core.PaloNameComparator)1