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;
}
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;
}
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);
}
}
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);
}
}
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;
}
Aggregations