Search in sources :

Example 1 with PaloHelper

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

the class PaloCubeCreate method execute.

@Override
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();
        database.createCube(realCubeName, dimensionNames.toArray(new String[dimensionNames.size()]));
        result.setResult(true);
        result.setNrLinesOutput(1);
    } catch (Exception e) {
        result.setNrErrors(1);
        e.printStackTrace();
        logError(toString(), "Error processing Palo Cube Create : " + 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 2 with PaloHelper

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

the class PaloCellOutput method init.

@Override
public final boolean init(StepMetaInterface smi, StepDataInterface sdi) {
    meta = (PaloCellOutputMeta) smi;
    data = (PaloCellOutputData) sdi;
    if (super.init(smi, sdi)) {
        try {
            this.logDebug("Meta Fields: " + meta.getFields().size());
            data.helper = new PaloHelper(meta.getDatabaseMeta(), getLogLevel());
            data.helper.connect();
            data.helper.loadCubeCache(meta.getCube(), meta.getEnableDimensionCache(), meta.getPreloadDimensionCache());
            data.batchCache.clear();
            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 3 with PaloHelper

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

the class PaloCellOutputMeta 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(this.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.measureField == null || Utils.isEmpty(this.measureField.getFieldName())) {
                cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Measure field is empty.", stepMeta);
                remarks.add(cr);
            } else {
                if (Utils.isEmpty(this.measureField.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 Output 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, "Input field for dimension " + field.getDimensionName() + " is empty.", stepMeta);
                        remarks.add(cr);
                    }
                    if (Utils.isEmpty(field.getFieldType())) {
                        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, "Input 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)

Example 4 with PaloHelper

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

the class PaloDimInputMeta method check.

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(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 Input 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, "Output 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 5 with PaloHelper

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

the class PaloDimOutput method init.

public final boolean init(StepMetaInterface smi, StepDataInterface sdi) {
    meta = (PaloDimOutputMeta) smi;
    data = (PaloDimOutputData) sdi;
    this.consolidations = new ConsolidationCollection();
    if (super.init(smi, sdi)) {
        try {
            this.logBasic("Meta Levels:" + meta.getLevels().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) ConsolidationCollection(org.pentaho.di.palo.core.ConsolidationCollection) KettleException(org.pentaho.di.core.exception.KettleException)

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