Search in sources :

Example 16 with CheckResult

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);
    }
}
Also used : CheckResult(org.pentaho.di.core.CheckResult)

Example 17 with CheckResult

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);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) CheckResult(org.pentaho.di.core.CheckResult) Database(org.pentaho.di.core.database.Database) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 18 with CheckResult

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);
    }
}
Also used : CheckResult(org.pentaho.di.core.CheckResult) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 19 with CheckResult

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);
    }
}
Also used : CheckResult(org.pentaho.di.core.CheckResult) FileInputList(org.pentaho.di.core.fileinput.FileInputList)

Example 20 with CheckResult

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);
}
Also used : CheckResult(org.pentaho.di.core.CheckResult)

Aggregations

CheckResult (org.pentaho.di.core.CheckResult)204 KettleException (org.pentaho.di.core.exception.KettleException)35 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)35 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)26 Database (org.pentaho.di.core.database.Database)25 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)19 FileInputList (org.pentaho.di.core.fileinput.FileInputList)14 StreamInterface (org.pentaho.di.trans.step.errorhandling.StreamInterface)7 KettleStepException (org.pentaho.di.core.exception.KettleStepException)6 File (java.io.File)4 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)4 PaloHelper (org.pentaho.di.palo.core.PaloHelper)4 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)3 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)3 Date (java.util.Date)2 KettlePluginException (org.pentaho.di.core.exception.KettlePluginException)2 KettleRowException (org.pentaho.di.core.exception.KettleRowException)2 KettleValueException (org.pentaho.di.core.exception.KettleValueException)2 RowMeta (org.pentaho.di.core.row.RowMeta)2 DimensionField (org.pentaho.di.palo.core.DimensionField)2