details: https://code.openbravo.com/erp/stable/2.50/rev/eb0bd3712933
changeset: 9569:eb0bd3712933
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Mon Jul 11 16:12:53 2011 +0200
summary: Fixed issue 17594. Validation for foreign keys will now be correct.
diffstat:
src/org/openbravo/service/system/DatabaseValidator.java | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diffs (41 lines):
diff -r 3e7ae5381605 -r eb0bd3712933
src/org/openbravo/service/system/DatabaseValidator.java
--- a/src/org/openbravo/service/system/DatabaseValidator.java Mon Jul 11
13:15:38 2011 +0200
+++ b/src/org/openbravo/service/system/DatabaseValidator.java Mon Jul 11
16:12:53 2011 +0200
@@ -208,10 +208,10 @@
}
}
for (int i = 0; i < database.getTableCount(); i++) {
- checkForeignKeys(database.getTable(i), result);
+ checkForeignKeys(validateModule, database.getTable(i), result);
}
for (int i = 0; i < database.getModifiedTableCount(); i++) {
- checkForeignKeys(database.getModifiedTable(i), result);
+ checkForeignKeys(validateModule, database.getModifiedTable(i), result);
}
// only check this one if the global validate check is done
@@ -318,7 +318,8 @@
return null;
}
- private void checkForeignKeys(org.apache.ddlutils.model.Table table,
SystemValidationResult result) {
+ private void checkForeignKeys(Module module, org.apache.ddlutils.model.Table
table,
+ SystemValidationResult result) {
final Entity entity =
ModelProvider.getInstance().getEntityByTableName(table.getName());
if (entity == null) {
// can happen with mismatches
@@ -347,6 +348,14 @@
continue;
}
+ // if the property doesn't belong to the module, then it shouldn't be
checked, as the
+ // physical model will not contain it
+ if (module != null
+ && (property.getModule() == null || !module.getId()
+ .equals(property.getModule().getId()))) {
+ continue;
+ }
+
boolean found = false;
for (ForeignKey fk : table.getForeignKeys()) {
for (Reference reference : fk.getReferences()) {
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits