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