Search in sources :

Example 6 with PaloHelper

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

the class PaloDimOutputMeta method check.

public final void check(final List<CheckResultInterface> remarks, final TransMeta transMeta, final StepMeta stepMeta, final RowMetaInterface prev, final String[] input, final String[] output, final RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
    CheckResult cr;
    if (databaseMeta != null) {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, "Connection exists", stepMeta);
        remarks.add(cr);
        final PaloHelper helper = new PaloHelper(databaseMeta, DefaultLogLevel.getLogLevel());
        try {
            helper.connect();
            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, "Connection to database OK", stepMeta);
            remarks.add(cr);
            if (!Utils.isEmpty(dimension)) {
                cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, "The name of the dimension is entered", stepMeta);
                remarks.add(cr);
            } else {
                cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "The name of the dimension is missing.", stepMeta);
                remarks.add(cr);
            }
            if (this.levels == null || this.levels.size() == 0) {
                cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Dimension Output Fields are empty.", stepMeta);
                remarks.add(cr);
            } else {
                for (PaloDimensionLevel level : this.levels) {
                    if (Utils.isEmpty(level.getLevelName())) {
                        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Level Name for Level " + level.getLevelNumber() + " is empty.", stepMeta);
                        remarks.add(cr);
                    }
                    if (Utils.isEmpty(level.getFieldName())) {
                        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Input Field Name for Level " + level.getLevelNumber() + " is empty.", stepMeta);
                        remarks.add(cr);
                    }
                    if (Utils.isEmpty(level.getFieldType())) {
                        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Level Type for Level " + level.getLevelNumber() + " is empty.", stepMeta);
                        remarks.add(cr);
                    }
                }
            }
        } catch (KettleException e) {
            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "An error occurred: " + e.getMessage(), stepMeta);
            remarks.add(cr);
        } finally {
            helper.disconnect();
        }
    } else {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Please select or create a connection to use", stepMeta);
        remarks.add(cr);
    }
}
Also used : PaloHelper(org.pentaho.di.palo.core.PaloHelper) KettleException(org.pentaho.di.core.exception.KettleException) PaloDimensionLevel(org.pentaho.di.palo.core.PaloDimensionLevel) CheckResult(org.pentaho.di.core.CheckResult)

Example 7 with PaloHelper

use of org.pentaho.di.palo.core.PaloHelper 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 8 with PaloHelper

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

the class PaloCubeDelete method execute.

public Result execute(Result prevResult, int nr) throws KettleException {
    Result result = new Result(nr);
    result.setResult(false);
    logDetailed(toString(), "Start of processing");
    // String substitution..
    String realCubeName = environmentSubstitute(getCubeName());
    PaloHelper database = new PaloHelper(this.getDatabaseMeta(), getLogLevel());
    try {
        database.connect();
        int cubesremoved = database.removeCube(realCubeName);
        result.setResult(true);
        result.setNrLinesOutput(cubesremoved);
    } catch (Exception e) {
        result.setNrErrors(1);
        e.printStackTrace();
        logError(toString(), "Error processing Palo Cube Delete : " + e.getMessage());
    } finally {
        database.disconnect();
    }
    return result;
}
Also used : PaloHelper(org.pentaho.di.palo.core.PaloHelper) KettleException(org.pentaho.di.core.exception.KettleException) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) Result(org.pentaho.di.core.Result)

Example 9 with PaloHelper

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

the class PaloCellInput method init.

public final boolean init(StepMetaInterface smi, StepDataInterface sdi) {
    meta = (PaloCellInputMeta) smi;
    data = (PaloCellInputData) sdi;
    if (super.init(smi, sdi)) {
        try {
            this.logDebug("Meta Fields: " + meta.getFields().size());
            data.helper = new PaloHelper(meta.getDatabaseMeta(), getLogLevel());
            data.helper.connect();
            return true;
        } catch (Exception e) {
            logError("An error occurred, processing will be stopped: " + e.getMessage());
            setErrors(1);
            stopAll();
        }
    }
    return false;
}
Also used : PaloHelper(org.pentaho.di.palo.core.PaloHelper) KettleException(org.pentaho.di.core.exception.KettleException)

Example 10 with PaloHelper

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

the class PaloCellInputMeta method check.

@Override
public void check(final List<CheckResultInterface> remarks, final TransMeta transMeta, final StepMeta stepMeta, final RowMetaInterface prev, final String[] input, final String[] output, final RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
    CheckResult cr;
    if (databaseMeta != null) {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, "Connection exists", stepMeta);
        remarks.add(cr);
        final PaloHelper helper = new PaloHelper(databaseMeta, DefaultLogLevel.getLogLevel());
        try {
            helper.connect();
            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, "Connection to database OK", stepMeta);
            remarks.add(cr);
            if (!Utils.isEmpty(cube)) {
                cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, "The name of the cube is entered", stepMeta);
                remarks.add(cr);
            } else {
                cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "The name of the cube is missing.", stepMeta);
                remarks.add(cr);
            }
            if (this.cubeMeasure == null) {
                cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Measure field is empty.", stepMeta);
                remarks.add(cr);
            } else {
                if (Utils.isEmpty(this.cubeMeasure.getFieldName())) {
                    cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Measure field Name is empty.", stepMeta);
                    remarks.add(cr);
                }
                if (Utils.isEmpty(this.cubeMeasure.getFieldType())) {
                    cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Measure field Type is empty.", stepMeta);
                    remarks.add(cr);
                }
            }
            if (this.fields == null || this.fields.size() == 0) {
                cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Cell Input Fields are empty.", stepMeta);
                remarks.add(cr);
            } else {
                for (DimensionField field : this.fields) {
                    if (Utils.isEmpty(field.getFieldName())) {
                        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Output field for dimension " + field.getDimensionName() + " is empty.", stepMeta);
                        remarks.add(cr);
                    }
                    if (Utils.isEmpty(field.getFieldType())) {
                        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Output field type for dimension " + field.getDimensionName() + " is empty.", stepMeta);
                        remarks.add(cr);
                    }
                }
            }
        } catch (KettleException e) {
            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "An error occurred: " + e.getMessage(), stepMeta);
            remarks.add(cr);
        } finally {
            helper.disconnect();
        }
    } else {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Please select or create a connection to use", stepMeta);
        remarks.add(cr);
    }
}
Also used : PaloHelper(org.pentaho.di.palo.core.PaloHelper) KettleException(org.pentaho.di.core.exception.KettleException) DimensionField(org.pentaho.di.palo.core.DimensionField) CheckResult(org.pentaho.di.core.CheckResult)

Aggregations

PaloHelper (org.pentaho.di.palo.core.PaloHelper)14 KettleException (org.pentaho.di.core.exception.KettleException)12 CheckResult (org.pentaho.di.core.CheckResult)4 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)4 Result (org.pentaho.di.core.Result)2 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)2 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)2 KettleStepException (org.pentaho.di.core.exception.KettleStepException)2 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)2 DimensionField (org.pentaho.di.palo.core.DimensionField)2 PaloDimensionLevel (org.pentaho.di.palo.core.PaloDimensionLevel)2 PaloNameComparator (org.pentaho.di.palo.core.PaloNameComparator)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 ConsolidationCollection (org.pentaho.di.palo.core.ConsolidationCollection)1 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)1