Search in sources :

Example 1 with PaloCellOutputData

use of org.pentaho.di.trans.steps.palo.celloutput.PaloCellOutputData in project pentaho-kettle by pentaho.

the class PaloCellOutputDialog method doGetFields.

private void doGetFields() {
    try {
        List<String> cubeDimensions = null;
        if (comboCube.getText() != null && comboCube.getText() != "") {
            if (addConnectionLine.getText() != null) {
                DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
                if (dbMeta != null) {
                    PaloCellOutputData data = new PaloCellOutputData(dbMeta);
                    data.helper.connect();
                    cubeDimensions = data.helper.getCubeDimensions(comboCube.getText());
                    data.helper.disconnect();
                }
            }
            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(3, "String");
            }
            final TableItem item = new TableItem(tableViewFields.table, SWT.NONE);
            item.setText(1, "Cube Measure");
            item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN));
            tableViewFields.removeEmptyRows();
            tableViewFields.setRowNums();
            tableViewFields.optWidth(true);
            tableViewFields.setReadonly(true);
        } else {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"), new Exception(BaseMessages.getString(PKG, "PaloCellOutputDialog.SelectCubeFirstError")));
        }
        this.fillPreviousFieldTableViewColumn();
    } 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) PaloCellOutputData(org.pentaho.di.trans.steps.palo.celloutput.PaloCellOutputData) TableItem(org.eclipse.swt.widgets.TableItem) 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 PaloCellOutputData

use of org.pentaho.di.trans.steps.palo.celloutput.PaloCellOutputData in project pentaho-kettle by pentaho.

the class PaloCellOutputDialog 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) {
                PaloCellOutputData data = new PaloCellOutputData(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, "PaloCellOutputDialog.RetreiveCubesErrorTitle"), BaseMessages.getString(PKG, "PaloCellOutputDialog.RetreiveCubesError"), ex);
    }
}
Also used : PaloNameComparator(org.pentaho.di.palo.core.PaloNameComparator) PaloCellOutputData(org.pentaho.di.trans.steps.palo.celloutput.PaloCellOutputData) 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 PaloCellOutputData (org.pentaho.di.trans.steps.palo.celloutput.PaloCellOutputData)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