Search in sources :

Example 11 with CheckResult

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

the class FilesFromResultMeta 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) {
    // See if we have input streams leading to this step!
    if (input.length > 0) {
        CheckResult cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "FilesFromResultMeta.CheckResult.StepExpectingNoReadingInfoFromOtherSteps"), stepMeta);
        remarks.add(cr);
    } else {
        CheckResult cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "FilesFromResultMeta.CheckResult.NoInputReceivedError"), stepMeta);
        remarks.add(cr);
    }
}
Also used : CheckResult(org.pentaho.di.core.CheckResult)

Example 12 with CheckResult

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

the class FilesToResultMeta 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) {
    // See if we have input streams leading to this step!
    if (input.length > 0) {
        CheckResult cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "FilesToResultMeta.CheckResult.StepReceivingInfoFromOtherSteps"), stepMeta);
        remarks.add(cr);
    } else {
        CheckResult cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "FilesToResultMeta.CheckResult.NoInputReceivedError"), stepMeta);
        remarks.add(cr);
    }
}
Also used : CheckResult(org.pentaho.di.core.CheckResult)

Example 13 with CheckResult

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

the class FilterRowsMeta 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 = "";
    checkTarget(stepMeta, "true", getTrueStepname(), output).ifPresent(remarks::add);
    checkTarget(stepMeta, "false", getFalseStepname(), output).ifPresent(remarks::add);
    if (condition.isEmpty()) {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.NoConditionSpecified"), stepMeta);
    } else {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.ConditionSpecified"), stepMeta);
    }
    remarks.add(cr);
    // Look up fields in the input stream <prev>
    if (prev != null && prev.size() > 0) {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.StepReceivingFields", prev.size() + ""), stepMeta);
        remarks.add(cr);
        List<String> orphanFields = getOrphanFields(condition, prev);
        if (orphanFields.size() > 0) {
            error_message = BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.FieldsNotFoundFromPreviousStep") + Const.CR;
            for (String field : orphanFields) {
                error_message += "\t\t" + field + Const.CR;
            }
            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta);
        } else {
            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.AllFieldsFoundInInputStream"), stepMeta);
        }
        remarks.add(cr);
    } else {
        error_message = BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.CouldNotReadFieldsFromPreviousStep") + Const.CR;
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, 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, "FilterRowsMeta.CheckResult.StepReceivingInfoFromOtherSteps"), stepMeta);
        remarks.add(cr);
    } else {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "FilterRowsMeta.CheckResult.NoInputReceivedFromOtherSteps"), stepMeta);
        remarks.add(cr);
    }
}
Also used : CheckResult(org.pentaho.di.core.CheckResult)

Example 14 with CheckResult

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

the class FlattenerMeta 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 (input.length > 0) {
        cr = new CheckResult(CheckResult.TYPE_RESULT_OK, BaseMessages.getString(PKG, "FlattenerMeta.CheckResult.StepReceivingInfoFromOtherSteps"), stepMeta);
        remarks.add(cr);
    } else {
        cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "FlattenerMeta.CheckResult.NoInputReceivedFromOtherSteps"), stepMeta);
        remarks.add(cr);
    }
}
Also used : CheckResult(org.pentaho.di.core.CheckResult)

Example 15 with CheckResult

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

the class DimensionLookupMeta method checkLookup.

private void checkLookup(List<CheckResultInterface> remarks, StepMeta stepinfo, RowMetaInterface prev) {
    int i;
    boolean error_found = false;
    String error_message = "";
    boolean first;
    CheckResult cr;
    if (databaseMeta != null) {
        Database db = createDatabaseObject();
        // TODO SB: share variable space
        try {
            db.connect();
            if (!Utils.isEmpty(tableName)) {
                String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tableName);
                RowMetaInterface tableFields = db.getTableFields(schemaTable);
                if (tableFields != null) {
                    if (prev != null && prev.size() > 0) {
                        // Start at the top, see if the key fields exist:
                        first = true;
                        boolean warning_found = false;
                        for (i = 0; i < keyStream.length; i++) {
                            // Does the field exist in the input stream?
                            String strfield = keyStream[i];
                            // 
                            ValueMetaInterface strvalue = prev.searchValueMeta(strfield);
                            if (strvalue == null) {
                                if (first) {
                                    first = false;
                                    error_message += BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.KeyhasProblem") + Const.CR;
                                }
                                error_found = true;
                                error_message += "\t\t" + keyField + BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.KeyNotPresentInStream") + Const.CR;
                            } else {
                                // does the field exist in the dimension table?
                                String dimfield = keyLookup[i];
                                ValueMetaInterface dimvalue = tableFields.searchValueMeta(dimfield);
                                if (dimvalue == null) {
                                    if (first) {
                                        first = false;
                                        error_message += BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.KeyhasProblem2") + Const.CR;
                                    }
                                    error_found = true;
                                    error_message += "\t\t" + dimfield + BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.KeyNotPresentInDimensiontable") + schemaTable + ")" + Const.CR;
                                } else {
                                    // Is the streamvalue of the same type as the dimension value?
                                    if (strvalue.getType() != dimvalue.getType()) {
                                        if (first) {
                                            first = false;
                                            error_message += BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.KeyhasProblem3") + Const.CR;
                                        }
                                        warning_found = true;
                                        error_message += "\t\t" + strfield + " (" + strvalue.getOrigin() + BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.KeyNotTheSameTypeAs") + dimfield + " (" + schemaTable + ")" + Const.CR;
                                        error_message += BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.WarningInfoInDBConversion");
                                    }
                                }
                            }
                        }
                        if (error_found) {
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
                        } else if (warning_found) {
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_WARNING, error_message, stepinfo);
                        } else {
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.AllKeysFieldsFound"), stepinfo);
                        }
                        remarks.add(cr);
                        // In case of lookup, the first column of the UpIns dialog table contains the table field
                        error_found = false;
                        for (i = 0; i < fieldLookup.length; i++) {
                            String lufield = fieldLookup[i];
                            if (lufield != null && lufield.length() > 0) {
                                // Checking compare field: lufield
                                ValueMetaInterface v = tableFields.searchValueMeta(lufield);
                                if (v == null) {
                                    if (first) {
                                        first = false;
                                        error_message += BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.FieldsToRetrieveNotExistInDimension") + Const.CR;
                                    }
                                    error_found = true;
                                    error_message += "\t\t" + lufield + Const.CR;
                                }
                            }
                        }
                        if (error_found) {
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
                        } else {
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.AllFieldsToRetrieveFound"), stepinfo);
                        }
                        remarks.add(cr);
                        /* Also, check the fields: tk, version, from-to, ... */
                        if (tableFields.indexOfValue(keyField) < 0) {
                            error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.TechnicalKeyNotFound", keyField) + Const.CR;
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
                        } else {
                            error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.TechnicalKeyFound", keyField) + Const.CR;
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, error_message, stepinfo);
                        }
                        remarks.add(cr);
                        if (tableFields.indexOfValue(versionField) < 0) {
                            error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.VersionFieldNotFound", versionField) + Const.CR;
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
                        } else {
                            error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.VersionFieldFound", versionField) + Const.CR;
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, error_message, stepinfo);
                        }
                        remarks.add(cr);
                        if (tableFields.indexOfValue(dateFrom) < 0) {
                            error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.StartOfDaterangeFieldNotFound", dateFrom) + Const.CR;
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
                        } else {
                            error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.StartOfDaterangeFieldFound", dateFrom) + Const.CR;
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, error_message, stepinfo);
                        }
                        remarks.add(cr);
                        if (tableFields.indexOfValue(dateTo) < 0) {
                            error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.EndOfDaterangeFieldNotFound", dateTo) + Const.CR;
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
                        } else {
                            error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.EndOfDaterangeFieldFound", dateTo);
                            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, error_message, stepinfo);
                        }
                        remarks.add(cr);
                    } else {
                        error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.CouldNotReadFieldsFromPreviousStep") + Const.CR;
                        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
                        remarks.add(cr);
                    }
                } else {
                    error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.CouldNotReadTableInfo");
                    cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
                    remarks.add(cr);
                }
            }
        } catch (KettleException e) {
            error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.CouldNotConnectDB") + e.getMessage();
            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
            remarks.add(cr);
        }
    } else {
        error_message = BaseMessages.getString(PKG, "DimensionLookupMeta.CheckResult.InvalidConnection");
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepinfo);
        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)

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