Search in sources :

Example 1 with PaloCellInputData

use of org.pentaho.di.trans.steps.palo.cellinput.PaloCellInputData in project pentaho-kettle by pentaho.

the class PaloCellInputDialog method doGetDimensions.

private void doGetDimensions() {
    try {
        if (comboCube.getText() != null && comboCube.getText() != "") {
            if (addConnectionLine.getText() != null) {
                DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
                if (dbMeta != null) {
                    PaloCellInputData data = new PaloCellInputData(dbMeta);
                    data.helper.connect();
                    List<String> cubeDimensions = data.helper.getCubeDimensions(comboCube.getText());
                    tableViewFields.table.removeAll();
                    for (int i = 0; i < cubeDimensions.size(); i++) {
                        final TableItem item = new TableItem(tableViewFields.table, SWT.NONE);
                        item.setText(1, cubeDimensions.get(i));
                        item.setText(2, cubeDimensions.get(i));
                        item.setText(3, "String");
                    }
                    tableViewFields.removeEmptyRows();
                    tableViewFields.setRowNums();
                    tableViewFields.optWidth(true);
                    tableViewFields.setReadonly(true);
                    data.helper.disconnect();
                }
            }
        } else {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"), new Exception(BaseMessages.getString(PKG, "PaloCellInputDialog.SelectCubeFirstError")));
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TableItem(org.eclipse.swt.widgets.TableItem) 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)

Example 2 with PaloCellInputData

use of org.pentaho.di.trans.steps.palo.cellinput.PaloCellInputData 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)2 KettleException (org.pentaho.di.core.exception.KettleException)2 PaloCellInputData (org.pentaho.di.trans.steps.palo.cellinput.PaloCellInputData)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 TableItem (org.eclipse.swt.widgets.TableItem)1 PaloNameComparator (org.pentaho.di.palo.core.PaloNameComparator)1