Search in sources :

Example 11 with ImportValidationFeedback

use of org.pentaho.di.imp.rule.ImportValidationFeedback in project pentaho-kettle by pentaho.

the class JobHasANoteImportRule method verifyRule.

@Override
public List<ImportValidationFeedback> verifyRule(Object subject) {
    List<ImportValidationFeedback> feedback = new ArrayList<ImportValidationFeedback>();
    if (!isEnabled()) {
        return feedback;
    }
    if (!(subject instanceof JobMeta)) {
        return feedback;
    }
    JobMeta jobMeta = (JobMeta) subject;
    if (jobMeta.nrNotes() == 0) {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "There is not even a single note in the job."));
    } else {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "At least one not is present in the job."));
    }
    return feedback;
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) ImportValidationFeedback(org.pentaho.di.imp.rule.ImportValidationFeedback) ArrayList(java.util.ArrayList)

Example 12 with ImportValidationFeedback

use of org.pentaho.di.imp.rule.ImportValidationFeedback in project pentaho-kettle by pentaho.

the class JobHasNoDisabledHopsImportRule method verifyRule.

@Override
public List<ImportValidationFeedback> verifyRule(Object subject) {
    List<ImportValidationFeedback> feedback = new ArrayList<ImportValidationFeedback>();
    if (!isEnabled()) {
        return feedback;
    }
    if (!(subject instanceof JobMeta)) {
        return feedback;
    }
    JobMeta jobMeta = (JobMeta) subject;
    for (int i = 0; i < jobMeta.nrJobHops(); i++) {
        JobHopMeta hop = jobMeta.getJobHop(i);
        if (!hop.isEnabled()) {
            feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "There is a disabled hop in the job."));
        }
    }
    if (feedback.isEmpty()) {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "All hops are enabled in this job."));
    }
    return feedback;
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobHopMeta(org.pentaho.di.job.JobHopMeta) ImportValidationFeedback(org.pentaho.di.imp.rule.ImportValidationFeedback) ArrayList(java.util.ArrayList)

Example 13 with ImportValidationFeedback

use of org.pentaho.di.imp.rule.ImportValidationFeedback in project pentaho-kettle by pentaho.

the class TransformationHasANoteImportRule method verifyRule.

@Override
public List<ImportValidationFeedback> verifyRule(Object subject) {
    List<ImportValidationFeedback> feedback = new ArrayList<ImportValidationFeedback>();
    if (!isEnabled()) {
        return feedback;
    }
    if (!(subject instanceof TransMeta)) {
        return feedback;
    }
    TransMeta transMeta = (TransMeta) subject;
    if (transMeta.nrNotes() == 0) {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "There is not even a single note in the transformation."));
    } else {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "At least one not is present in the transformation."));
    }
    return feedback;
}
Also used : ImportValidationFeedback(org.pentaho.di.imp.rule.ImportValidationFeedback) ArrayList(java.util.ArrayList) TransMeta(org.pentaho.di.trans.TransMeta)

Example 14 with ImportValidationFeedback

use of org.pentaho.di.imp.rule.ImportValidationFeedback in project pentaho-kettle by pentaho.

the class TransformationHasDescriptionImportRule method verifyRule.

@Override
public List<ImportValidationFeedback> verifyRule(Object subject) {
    List<ImportValidationFeedback> feedback = new ArrayList<ImportValidationFeedback>();
    if (!isEnabled()) {
        return feedback;
    }
    if (!(subject instanceof TransMeta)) {
        return feedback;
    }
    TransMeta transMeta = (TransMeta) subject;
    String description = transMeta.getDescription();
    if (Utils.isEmpty(description) || (minLength > 0 && description.length() < minLength)) {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "A description is not present or is too short."));
    } else {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "A description is present"));
    }
    return feedback;
}
Also used : ImportValidationFeedback(org.pentaho.di.imp.rule.ImportValidationFeedback) ArrayList(java.util.ArrayList) TransMeta(org.pentaho.di.trans.TransMeta)

Example 15 with ImportValidationFeedback

use of org.pentaho.di.imp.rule.ImportValidationFeedback in project pentaho-kettle by pentaho.

the class TransformationHasTransLogConfiguredImportRule method verifyRule.

@Override
public List<ImportValidationFeedback> verifyRule(Object subject) {
    List<ImportValidationFeedback> feedback = new ArrayList<ImportValidationFeedback>();
    if (!isEnabled()) {
        return feedback;
    }
    if (!(subject instanceof TransMeta)) {
        return feedback;
    }
    TransMeta transMeta = (TransMeta) subject;
    TransLogTable transLogTable = transMeta.getTransLogTable();
    if (!transLogTable.isDefined()) {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "The logging table is not defined"));
    } else {
        if (!Utils.isEmpty(schemaName)) {
            if (schemaName.equals(transLogTable.getSchemaName())) {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "The schema name is set to: " + schemaName));
            } else {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "The schema name is not set to: " + schemaName));
            }
        }
        if (!Utils.isEmpty(tableName)) {
            if (tableName.equals(transLogTable.getTableName())) {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "The table name is set to: " + tableName));
            } else {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "The table name is not set to: " + tableName));
            }
        }
        if (!Utils.isEmpty(connectionName)) {
            if (connectionName.equals(transLogTable.getDatabaseMeta().getName())) {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "The database connection used for logging is: " + connectionName));
            } else {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "The database connection used for logging is not: " + connectionName));
            }
        }
        if (feedback.isEmpty()) {
            feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "The logging table is correctly defined"));
        }
    }
    return feedback;
}
Also used : ImportValidationFeedback(org.pentaho.di.imp.rule.ImportValidationFeedback) ArrayList(java.util.ArrayList) TransMeta(org.pentaho.di.trans.TransMeta) TransLogTable(org.pentaho.di.core.logging.TransLogTable)

Aggregations

ImportValidationFeedback (org.pentaho.di.imp.rule.ImportValidationFeedback)15 ArrayList (java.util.ArrayList)10 JobMeta (org.pentaho.di.job.JobMeta)5 TransMeta (org.pentaho.di.trans.TransMeta)5 KettleException (org.pentaho.di.core.exception.KettleException)3 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 FileSystemException (org.apache.commons.vfs2.FileSystemException)2 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)2 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)1 JobLogTable (org.pentaho.di.core.logging.JobLogTable)1 TransLogTable (org.pentaho.di.core.logging.TransLogTable)1 JobHopMeta (org.pentaho.di.job.JobHopMeta)1 HasDatabasesInterface (org.pentaho.di.trans.HasDatabasesInterface)1 TransHopMeta (org.pentaho.di.trans.TransHopMeta)1