use of org.pentaho.di.core.CheckResult in project pentaho-kettle by pentaho.
the class DummyTransMeta method check.
public void check(List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
CheckResult cr;
if (prev == null || prev.size() == 0) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_WARNING, BaseMessages.getString(PKG, "DummyTransMeta.CheckResult.NotReceivingFields"), stepMeta);
remarks.add(cr);
} else {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "DummyTransMeta.CheckResult.StepRecevingData", prev.size() + ""), stepMeta);
remarks.add(cr);
}
// See if we have input streams leading to this step!
if (input.length > 0) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "DummyTransMeta.CheckResult.StepRecevingData2"), stepMeta);
remarks.add(cr);
} else {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "DummyTransMeta.CheckResult.NoInputReceivedFromOtherSteps"), stepMeta);
remarks.add(cr);
}
}
use of org.pentaho.di.core.CheckResult in project pentaho-kettle by pentaho.
the class DynamicSQLRowMeta method check.
public void check(List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
CheckResult cr;
String error_message = "";
// See if we have input streams leading to this step!
if (input.length > 0) {
cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "DynamicSQLRowMeta.CheckResult.ReceivingInfo"), stepMeta);
remarks.add(cr);
} else {
cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "DynamicSQLRowMeta.CheckResult.NoInputReceived"), stepMeta);
remarks.add(cr);
}
// Check for SQL field
if (Utils.isEmpty(sqlfieldname)) {
cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "DynamicSQLRowMeta.CheckResult.SQLFieldNameMissing"), stepMeta);
remarks.add(cr);
} else {
ValueMetaInterface vfield = prev.searchValueMeta(sqlfieldname);
if (vfield == null) {
cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "DynamicSQLRowMeta.CheckResult.SQLFieldNotFound", sqlfieldname), stepMeta);
} else {
cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "DynamicSQLRowMeta.CheckResult.SQLFieldFound", sqlfieldname, vfield.getOrigin()), stepMeta);
}
remarks.add(cr);
}
if (databaseMeta != null) {
Database db = new Database(loggingObject, databaseMeta);
// Keep track of this one for cancelQuery
databases = new Database[] { db };
try {
db.connect();
if (sql != null && sql.length() != 0) {
error_message = "";
RowMetaInterface r = db.getQueryFields(sql, true);
if (r != null) {
cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "DynamicSQLRowMeta.CheckResult.QueryOK"), stepMeta);
remarks.add(cr);
} else {
error_message = BaseMessages.getString(PKG, "DynamicSQLRowMeta.CheckResult.InvalidDBQuery");
cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta);
remarks.add(cr);
}
}
} catch (KettleException e) {
error_message = BaseMessages.getString(PKG, "DynamicSQLRowMeta.CheckResult.ErrorOccurred") + e.getMessage();
cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta);
remarks.add(cr);
} finally {
db.disconnect();
}
} else {
error_message = BaseMessages.getString(PKG, "DynamicSQLRowMeta.CheckResult.InvalidConnection");
cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta);
remarks.add(cr);
}
}
use of org.pentaho.di.core.CheckResult in project pentaho-kettle by pentaho.
the class Edi2XmlMeta method check.
@Override
public void check(List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
CheckResult cr;
// See if we have input streams leading to this step!
if (input.length > 0) {
cr = new CheckResult(CheckResult.TYPE_RESULT_OK, "Step is receiving input from other steps.", stepMeta);
remarks.add(cr);
} else {
cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, "No input received from other steps!", stepMeta);
remarks.add(cr);
}
// is the input field there?
String realInputField = transMeta.environmentSubstitute(getInputField());
if (prev.searchValueMeta(realInputField) != null) {
cr = new CheckResult(CheckResult.TYPE_RESULT_OK, "Step is seeing input field: " + realInputField, stepMeta);
remarks.add(cr);
if (prev.searchValueMeta(realInputField).isString()) {
cr = new CheckResult(CheckResult.TYPE_RESULT_OK, "Field " + realInputField + " is a string type", stepMeta);
remarks.add(cr);
} else {
cr = new CheckResult(CheckResult.TYPE_RESULT_OK, "Field " + realInputField + " is not a string type!", stepMeta);
remarks.add(cr);
}
} else {
cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, "Step is not seeing input field: " + realInputField + "!", stepMeta);
remarks.add(cr);
}
}
use of org.pentaho.di.core.CheckResult in project pentaho-kettle by pentaho.
the class ExcelInputMeta method check.
@Override
public void check(List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
CheckResult cr;
// See if we get input...
if (input.length > 0) {
if (!isAcceptingFilenames()) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "ExcelInputMeta.CheckResult.NoInputError"), stepMeta);
remarks.add(cr);
} else {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "ExcelInputMeta.CheckResult.AcceptFilenamesOk"), stepMeta);
remarks.add(cr);
}
} else {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "ExcelInputMeta.CheckResult.NoInputOk"), stepMeta);
remarks.add(cr);
}
FileInputList fileList = getFileList(transMeta);
if (fileList.nrOfFiles() == 0) {
if (!isAcceptingFilenames()) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "ExcelInputMeta.CheckResult.ExpectedFilesError"), stepMeta);
remarks.add(cr);
}
} else {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "ExcelInputMeta.CheckResult.ExpectedFilesOk", StringUtil.EMPTY_STRING + fileList.nrOfFiles()), stepMeta);
remarks.add(cr);
}
}
use of org.pentaho.di.core.CheckResult in project pentaho-kettle by pentaho.
the class ExcelOutputMeta method check.
@Override
public void check(List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
CheckResult cr;
// Check output fields
if (prev != null && prev.size() > 0) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "ExcelOutputMeta.CheckResult.FieldsReceived", "" + prev.size()), stepMeta);
remarks.add(cr);
String error_message = "";
boolean error_found = false;
// Starting from selected fields in ...
for (int i = 0; i < outputFields.length; i++) {
int idx = prev.indexOfValue(outputFields[i].getName());
if (idx < 0) {
error_message += "\t\t" + outputFields[i].getName() + Const.CR;
error_found = true;
}
}
if (error_found) {
error_message = BaseMessages.getString(PKG, "ExcelOutputMeta.CheckResult.FieldsNotFound", error_message);
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta);
remarks.add(cr);
} else {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "ExcelOutputMeta.CheckResult.AllFieldsFound"), stepMeta);
remarks.add(cr);
}
}
// See if we have input streams leading to this step!
if (input.length > 0) {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "ExcelOutputMeta.CheckResult.ExpectedInputOk"), stepMeta);
remarks.add(cr);
} else {
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "ExcelOutputMeta.CheckResult.ExpectedInputError"), stepMeta);
remarks.add(cr);
}
cr = new CheckResult(CheckResultInterface.TYPE_RESULT_COMMENT, BaseMessages.getString(PKG, "ExcelOutputMeta.CheckResult.FilesNotChecked"), stepMeta);
remarks.add(cr);
}
Aggregations