final String moduleId = (getValidateModule() == null ? null : getValidateModule().getId());
for (Table adTable : adTables) {
final org.apache.ddlutils.model.Table dbTable = dbTablesByName.get(adTable.getDBTableName()
.toUpperCase());
final View view = dbViews.get(adTable.getDBTableName().toUpperCase());
if (view == null && dbTable == null) {
// in Application Dictionary not in Physical Table
if (moduleId == null
|| (adTable.getDataPackage().getModule() != null && adTable.getDataPackage()
.getModule().getId().equals(moduleId))) {
result.addError(SystemValidationResult.SystemValidationType.NOT_EXIST_IN_DB, "Table "
+ adTable.getDBTableName() + " defined in the Application Dictionary"
+ " but is not present in the database");
}
} else if (view != null) {
dbViews.remove(view.getName().toUpperCase());
} else {
if (moduleId == null
|| (adTable.getDataPackage().getModule() != null && adTable.getDataPackage()
.getModule().getId().equals(moduleId))) {
checkTableWithoutPrimaryKey(dbTable, result);
checkForeignKeys(dbTable, result);
checkMaxObjectNameLength(dbTable, result);
}
matchColumns(adTable, dbTable, result);
tmpDBTablesByName.remove(dbTable.getName().toUpperCase());
}
}
// only check this one if the global validate check is done
for (org.apache.ddlutils.model.Table dbTable : tmpDBTablesByName.values()) {
// ignore errors related to C_TEMP_SELECTION
if (!dbTable.getName().toUpperCase().startsWith("C_TEMP_SELECTION")) {
result.addError(SystemValidationResult.SystemValidationType.NOT_EXIST_IN_AD, "Table "
+ dbTable.getName() + " present in the database "
+ " but not defined in the Application Dictionary");
}
}
if (getValidateModule() == null) {
for (View view : dbViews.values()) {
// ignore errors related to C_TEMP_SELECTION
if (!view.getName().toUpperCase().startsWith("C_TEMP_SELECTION")) {
result.addWarning(SystemValidationResult.SystemValidationType.NOT_EXIST_IN_AD, "View "
+ view.getName() + " present in the database "
+ " but not defined in the Application Dictionary");
}
}
}