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