details: /erp/devel/pi/rev/aeb491794d7e
changeset: 11820:aeb491794d7e
user: Stefan Hühner <stefan.huehner <at> openbravo.com>
date: Mon May 02 11:57:58 2011 +0200
summary: [cleanup] whitelist legacy feature module in wadvalidation
- Add whitelisting feature to wad-validation (ignores all problems in a module)
- Use it for the 'legacy features' module which contains content removed from
core (unmodified) and would not pass the validation
diffstat:
build.xml | 4 +
src-wad/src/org/openbravo/wad/validation/WADValidationResult.java | 38 +++++-
src-wad/src/org/openbravo/wad/validation/WADValidator.java | 54
++++-----
src-wad/src/org/openbravo/wad/validation/WADValidator_data.xsql | 34 +++---
4 files changed, 75 insertions(+), 55 deletions(-)
diffs (truncated from 351 to 300 lines):
diff -r 05ebdc0d568f -r aeb491794d7e build.xml
--- a/build.xml Mon May 02 10:49:21 2011 +0200
+++ b/build.xml Mon May 02 11:57:58 2011 +0200
@@ -648,6 +648,10 @@
<ant dir="${base.src}" target="trl.clean" inheritAll="true"
inheritRefs="true" />
</target>
+ <target name="trl.remove.unused" depends="init">
+ <ant dir="${base.src}" target="trl.remove.unused" inheritAll="true"
inheritRefs="true" />
+ </target>
+
<target name="translate" depends="init">
<ant dir="${base.src}" target="translate" inheritAll="true"
inheritRefs="true" />
</target>
diff -r 05ebdc0d568f -r aeb491794d7e
src-wad/src/org/openbravo/wad/validation/WADValidationResult.java
--- a/src-wad/src/org/openbravo/wad/validation/WADValidationResult.java Mon May
02 10:49:21 2011 +0200
+++ b/src-wad/src/org/openbravo/wad/validation/WADValidationResult.java Mon May
02 11:57:58 2011 +0200
@@ -33,6 +33,12 @@
class WADValidationResult {
private static final Logger log =
Logger.getLogger(WADValidationResult.class);
+ /*
+ * Whitelist of modules for which all validation problems will be ignored
and not reported. So far
+ * only the special module "org.openbravo.deprecated.cleanupv3" is ignored.
+ */
+ private static final String[] moduleWhitelist = {
"677192D0C60F411384832241227360E3" };
+
/**
* Types of possible WAD validations, they have an identifier and a
description
*
@@ -71,8 +77,13 @@
* @param warning
* warning message
*/
+ public void addWarning(String moduleId, String moduleName, WADValidationType
validationType,
+ String warning) {
+ addToResult(moduleId, moduleName, warnings, validationType, warning);
+ }
+
public void addWarning(WADValidationType validationType, String warning) {
- addToResult(warnings, validationType, warning);
+ addWarning(null, null, validationType, warning);
}
/**
@@ -83,16 +94,27 @@
* @param warning
* error message
*/
- public void addError(WADValidationType validationType, String warning) {
- addToResult(errors, validationType, warning);
+ public void addError(String moduleId, String moduleName, WADValidationType
validationType,
+ String warning) {
+ addToResult(moduleId, moduleName, errors, validationType, warning);
}
- public void addModule(String moduleName) {
- modules.add(moduleName);
- }
+ private void addToResult(String moduleId, String moduleName,
+ Map<WADValidationType, List<String>> result, WADValidationType
validationType, String msg) {
- private void addToResult(Map<WADValidationType, List<String>> result,
- WADValidationType validationType, String msg) {
+ // if not called for general error
+ if (moduleId != null && moduleName != null) {
+ // skip modules in whilelist completely
+ for (String s : moduleWhitelist) {
+ if (s.equals(moduleId)) {
+ return;
+ }
+ }
+
+ if (!modules.contains(moduleName)) {
+ modules.add(moduleName);
+ }
+ }
List<String> msgList = result.get(validationType);
if (msgList == null) {
diff -r 05ebdc0d568f -r aeb491794d7e
src-wad/src/org/openbravo/wad/validation/WADValidator.java
--- a/src-wad/src/org/openbravo/wad/validation/WADValidator.java Mon May
02 10:49:21 2011 +0200
+++ b/src-wad/src/org/openbravo/wad/validation/WADValidator.java Mon May
02 11:57:58 2011 +0200
@@ -73,9 +73,8 @@
try {
WADValidatorData data[] = WADValidatorData.checkIdentifier(conn,
modules, checkAll);
for (WADValidatorData issue : data) {
- result.addError(WADValidationType.MISSING_IDENTIFIER, "Table " +
issue.objectname
- + " has not identifier.");
- result.addModule(issue.modulename);
+ result.addError(issue.moduleid, issue.modulename,
WADValidationType.MISSING_IDENTIFIER,
+ "Table " + issue.objectname + " has not identifier.");
}
} catch (Exception e) {
result.addWarning(WADValidationType.SQL,
@@ -91,16 +90,14 @@
// Check tables without key
WADValidatorData data[] = WADValidatorData.checkKey(conn, modules,
checkAll);
for (WADValidatorData issue : data) {
- result.addError(WADValidationType.MISSING_KEY, "Table " +
issue.objectname
- + " has not primary key.");
- result.addModule(issue.modulename);
+ result.addError(issue.moduleid, issue.modulename,
WADValidationType.MISSING_KEY, "Table "
+ + issue.objectname + " has not primary key.");
}
data = WADValidatorData.checkMultipleKey(conn, modules, checkAll);
for (WADValidatorData issue : data) {
- result.addError(WADValidationType.MULTIPLE_KEYS, "Table " +
issue.objectname
- + " has more than one key column.");
- result.addModule(issue.modulename);
+ result.addError(issue.moduleid, issue.modulename,
WADValidationType.MULTIPLE_KEYS, "Table "
+ + issue.objectname + " has more than one key column.");
}
} catch (Exception e) {
result.addWarning(WADValidationType.SQL,
@@ -115,14 +112,13 @@
try {
WADValidatorData data[] = WADValidatorData.checkModelObject(conn,
modules, checkAll);
for (WADValidatorData issue : data) {
- result.addError(WADValidationType.MODEL_OBJECT, issue.objecttype + " "
+ issue.objectname
- + " has classname: " + issue.currentvalue + ". But it should be in
"
- + issue.expectedvalue + " package.");
- result.addModule(issue.modulename);
+ result.addError(issue.moduleid, issue.modulename,
WADValidationType.MODEL_OBJECT,
+ issue.objecttype + " " + issue.objectname + " has classname: " +
issue.currentvalue
+ + ". But it should be in " + issue.expectedvalue + "
package.");
}
} catch (Exception e) {
result.addWarning(WADValidationType.SQL,
- "Error when executing query for validating moel object: " +
e.getMessage());
+ "Error when executing query for validating model object: " +
e.getMessage());
}
}
@@ -133,14 +129,13 @@
try {
WADValidatorData data[] = WADValidatorData.checkModelObjectMapping(conn,
modules, checkAll);
for (WADValidatorData issue : data) {
- result.addError(WADValidationType.MODEL_OBJECT_MAPPING,
issue.objecttype + " "
- + issue.objectname + " has mapping: " + issue.currentvalue
- + ". But it should start with /" + issue.expectedvalue + ".");
- result.addModule(issue.modulename);
+ result.addError(issue.moduleid, issue.modulename,
WADValidationType.MODEL_OBJECT_MAPPING,
+ issue.objecttype + " " + issue.objectname + " has mapping: " +
issue.currentvalue
+ + ". But it should start with /" + issue.expectedvalue + ".");
}
} catch (Exception e) {
result.addWarning(WADValidationType.SQL,
- "Error when executing query for validating moel object: " +
e.getMessage());
+ "Error when executing query for validating model object: " +
e.getMessage());
}
}
@@ -151,14 +146,13 @@
try {
WADValidatorData data[] = WADValidatorData.checkColumnName(conn,
modules, checkAll);
for (WADValidatorData issue : data) {
- result.addError(WADValidationType.COLUMN_NAME, issue.objecttype + " "
+ issue.objectname
- + " has value: " + issue.currentvalue + ". But it should start
with EM_"
- + issue.expectedvalue);
- result.addModule(issue.modulename);
+ result.addError(issue.moduleid, issue.modulename,
WADValidationType.COLUMN_NAME,
+ issue.objecttype + " " + issue.objectname + " has value: " +
issue.currentvalue
+ + ". But it should start with EM_" + issue.expectedvalue);
}
} catch (Exception e) {
result.addWarning(WADValidationType.SQL,
- "Error when executing query for validating moel object: " +
e.getMessage());
+ "Error when executing query for validating model object: " +
e.getMessage());
}
}
@@ -169,8 +163,8 @@
try {
WADValidatorData data[] = WADValidatorData.checkAuxiliarInput(conn,
modules, checkAll);
for (WADValidatorData issue : data) {
- result.addError(WADValidationType.AUXILIARINPUT, issue.objectname
- + " does not start by its module's DBPrefix: " +
issue.expectedvalue);
+ result.addError(issue.moduleid, issue.modulename,
WADValidationType.AUXILIARINPUT,
+ issue.objectname + " does not start by its module's DBPrefix: " +
issue.expectedvalue);
}
} catch (Exception e) {
result.addWarning(WADValidationType.SQL,
@@ -186,10 +180,10 @@
WADValidatorData data[] =
WADValidatorData.checkBaseReferenceWithParent(conn, modules,
checkAll);
for (WADValidatorData issue : data) {
- result.addError(WADValidationType.BASEREFERENCE_WITH_PARENT,
issue.objectname
- + " base reference has parent reference " + issue.currentvalue
- + ". Base references should not have parent reference.");
- result.addModule(issue.modulename);
+ result.addError(issue.moduleid, issue.modulename,
+ WADValidationType.BASEREFERENCE_WITH_PARENT, issue.objectname
+ + " base reference has parent reference " + issue.currentvalue
+ + ". Base references should not have parent reference.");
}
} catch (Exception e) {
result.addWarning(WADValidationType.SQL,
diff -r 05ebdc0d568f -r aeb491794d7e
src-wad/src/org/openbravo/wad/validation/WADValidator_data.xsql
--- a/src-wad/src/org/openbravo/wad/validation/WADValidator_data.xsql Mon May
02 10:49:21 2011 +0200
+++ b/src-wad/src/org/openbravo/wad/validation/WADValidator_data.xsql Mon May
02 11:57:58 2011 +0200
@@ -22,7 +22,7 @@
<SqlMethod name="checkIdentifier" type="preparedStatement" return="multiple">
<Sql>
<![CDATA[
- select t.tablename as objectName, m.name as moduleName
+ select t.tablename as objectName, m.name as moduleName,
m.ad_module_id as moduleId
from ad_table t, ad_module m, ad_package p
where not exists (select 1
from ad_column c
@@ -43,7 +43,7 @@
<SqlMethod name="checkKey" type="preparedStatement" return="multiple">
<Sql>
<![CDATA[
- select t.tablename as objectName, m.name as moduleName
+ select t.tablename as objectName, m.name as moduleName, m.ad_module_id
as moduleId
from ad_table t, ad_module m, ad_package p
where not exists (select 1
from ad_column c
@@ -62,7 +62,7 @@
<SqlMethod name="checkMultipleKey" type="preparedStatement"
return="multiple">
<Sql>
<![CDATA[
- select t.tablename as objectName, m.name as moduleName
+ select t.tablename as objectName, m.name as moduleName, m.ad_module_id
as moduleId
from ad_table t, ad_module m, ad_package p
where exists (select 1
from ad_column c
@@ -83,35 +83,35 @@
<SqlMethod name="checkModelObject" type="preparedStatement"
return="multiple">
<Sql>
<![CDATA[
- select to_char(p.name) as objectname, 'Process' as objectType,
o.classname as currentvalue, m.javapackage as expectedvalue, m.name as
moduleName
+ select to_char(p.name) as objectname, 'Process' as objectType,
o.classname as currentvalue, m.javapackage as expectedvalue, m.name as
moduleName, m.ad_module_id as moduleId
from ad_model_object o, ad_process p, ad_module m
where o.ad_process_id = p.ad_process_id
and p.ad_module_id = m.ad_module_id
and o.classname not like m.javapackage||'.%'
and (1=1 and m.javapackage in ('1') or to_char('Y')=to_char(?))
union
- select to_char(f.name), 'Form' as objectType, o.classname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName
+ select to_char(f.name), 'Form' as objectType, o.classname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName,
m.ad_module_id as moduleId
from ad_model_object o, ad_form f, ad_module m
where o.ad_form_id = f.ad_form_id
and f.ad_module_id = m.ad_module_id
and o.classname not like m.javapackage||'.%'
and (2=2 and m.javapackage in ('2') or to_char('Y')=to_char(?))
union
- select to_char(c.name), 'Callout' as objectType, o.classname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName
+ select to_char(c.name), 'Callout' as objectType, o.classname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName,
m.ad_module_id as moduleId
from ad_model_object o, ad_callout c, ad_module m
where o.ad_callout_id = c.ad_callout_id
and c.ad_module_id = m.ad_module_id
and o.classname not like m.javapackage||'.%'
and (3=3 and m.javapackage in ('3') or to_char('Y')=to_char(?))
union
- select to_char(r.name), 'Reference' as objectType, o.classname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName
+ select to_char(r.name), 'Reference' as objectType, o.classname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName,
m.ad_module_id as moduleId
from ad_model_object o, ad_reference r, ad_module m
where o.ad_reference_id = r.ad_reference_id
and r.ad_module_id = m.ad_module_id
and o.classname not like m.javapackage||'.%'
and (4=4 and m.javapackage in ('4') or to_char('Y')=to_char(?))
union
- select to_char(w.name||' >> '||t.name), 'Tab' as objectType,
o.classname as currentvalue, (case when m2.ad_module_id='0' then
'org.openbravo.erpWindows.*' else
'org.openbravo.erpWindows.'||m2.javapackage||'.%' end) as expectedvalue, m.name
as moduleName
+ select to_char(w.name||' >> '||t.name), 'Tab' as objectType,
o.classname as currentvalue, (case when m2.ad_module_id='0' then
'org.openbravo.erpWindows.*' else
'org.openbravo.erpWindows.'||m2.javapackage||'.%' end) as expectedvalue, m.name
as moduleName, m.ad_module_id as moduleId
from ad_model_object o, ad_window w, ad_tab t, ad_module m,
ad_module m2
where o.ad_tab_id = t.ad_tab_id
and t.ad_window_id = w.ad_window_id
@@ -138,7 +138,7 @@
<SqlMethod name="checkModelObjectMapping" type="preparedStatement"
return="multiple">
<Sql>
<![CDATA[
- select to_char(p.name) as objectname, 'Process' as objectType,
om.mappingname as currentvalue, m.javapackage as expectedvalue , m.name as
moduleName
+ select to_char(p.name) as objectname, 'Process' as objectType,
om.mappingname as currentvalue, m.javapackage as expectedvalue , m.name as
moduleName, m.ad_module_id as moduleId
from ad_model_object o, ad_process p, ad_module m,
ad_model_object_mapping om
where o.ad_process_id = p.ad_process_id
and p.ad_module_id = m.ad_module_id
@@ -148,7 +148,7 @@
and m.ad_module_id !='0'
and (1=1 and m.javapackage in ('1') or to_char('Y')=to_char(?))
union
- select to_char(f.name), 'Form' as objectType, om.mappingname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName
+ select to_char(f.name), 'Form' as objectType, om.mappingname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName,
m.ad_module_id as moduleId
from ad_model_object o, ad_form f, ad_module m,
ad_model_object_mapping om
where o.ad_form_id = f.ad_form_id
and f.ad_module_id = m.ad_module_id
@@ -158,7 +158,7 @@
and m.ad_module_id !='0'
and (2=2 and m.javapackage in ('2') or to_char('Y')=to_char(?))
union
- select to_char(c.name), 'Callout' as objectType, om.mappingname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName
+ select to_char(c.name), 'Callout' as objectType, om.mappingname as
currentvalue, m.javapackage as expectedvalue , m.name as moduleName,
m.ad_module_id as moduleId
from ad_model_object o, ad_callout c, ad_module m,
ad_model_object_mapping om
where o.ad_callout_id = c.ad_callout_id
and c.ad_module_id = m.ad_module_id
@@ -168,7 +168,7 @@
and m.ad_module_id !='0'
and (3=3 and m.javapackage in ('3') or to_char('Y')=to_char(?))
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits