details: /erp/devel/pi/rev/33950fa7447d
changeset: 6491:33950fa7447d
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Thu Feb 25 17:10:53 2010 +0100
summary: Fixed issue 12212. Validation was changed so that if somebody tries
to export a database object which is more than 30 characters long, an error
will be raised.
details: /erp/devel/pi/rev/45df2e899eb3
changeset: 6492:45df2e899eb3
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Thu Feb 25 17:22:26 2010 +0100
summary: Fixed issue 12421. Rebuild will stop if apply.module fails.
diffstat:
build.xml | 2 +-
src/org/openbravo/service/system/DatabaseValidator.java | 67 ++++++++++++
src/org/openbravo/service/system/SystemValidationResult.java | 2 +-
3 files changed, 69 insertions(+), 2 deletions(-)
diffs (108 lines):
diff -r 314b084f21b9 -r 45df2e899eb3 build.xml
--- a/build.xml Thu Feb 25 11:42:46 2010 +0100
+++ b/build.xml Thu Feb 25 17:22:26 2010 +0100
@@ -641,7 +641,7 @@
<target name="apply.module">
<updatesystemstatus v="RB31"/>
- <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask"
fork="true" maxmemory="${build.maxmemory}">
+ <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask"
fork="true" maxmemory="${build.maxmemory}" failonerror="true">
<arg line="'${base.src}'" />
<classpath refid="project.class.path" />
</java>
diff -r 314b084f21b9 -r 45df2e899eb3
src/org/openbravo/service/system/DatabaseValidator.java
--- a/src/org/openbravo/service/system/DatabaseValidator.java Thu Feb 25
11:42:46 2010 +0100
+++ b/src/org/openbravo/service/system/DatabaseValidator.java Thu Feb 25
17:22:26 2010 +0100
@@ -75,6 +75,72 @@
final SystemValidationResult result = new SystemValidationResult();
// read the tables
+ Database db = getDatabase();
+ for (int i = 0; i < db.getFunctionCount(); i++) {
+ if (db.getFunction(i).getName().length() > 30) {
+
result.addError(SystemValidationResult.SystemValidationType.INCORRECT_NAME_LENGTH,
+ "Name of Function " + db.getFunction(i).getName()
+ + " is too long. Only 30 characters allowed.");
+ }
+ }
+ for (int i = 0; i < db.getTriggerCount(); i++) {
+ if (db.getTrigger(i).getName().length() > 30) {
+
result.addError(SystemValidationResult.SystemValidationType.INCORRECT_NAME_LENGTH,
+ "Name of Trigger " + db.getTrigger(i).getName()
+ + " is too long. Only 30 characters allowed.");
+ }
+ }
+ for (int i = 0; i < db.getViewCount(); i++) {
+ if (db.getView(i).getName().length() > 30) {
+ result
+
.addError(SystemValidationResult.SystemValidationType.INCORRECT_NAME_LENGTH,
+ "Name of View " + db.getView(i).getName()
+ + " is too long. Only 30 characters allowed.");
+ }
+ }
+
+ for (int j = 0; j < db.getTableCount(); j++) {
+ org.apache.ddlutils.model.Table dbTable = db.getTable(j);
+ if (dbTable.getName().length() > 30) {
+
result.addError(SystemValidationResult.SystemValidationType.INCORRECT_NAME_LENGTH,
+ "Name of table " + dbTable.getName() + " is too long. Only 30
characters allowed.");
+ }
+ for (int i = 0; i < dbTable.getColumnCount(); i++) {
+ if (dbTable.getColumn(i).getName().length() > 30) {
+
result.addError(SystemValidationResult.SystemValidationType.INCORRECT_NAME_LENGTH,
+ "Name of column " + dbTable.getForeignKey(i).getName()
+ + " is too long. Only 30 characters allowed.");
+ }
+ }
+ for (int i = 0; i < dbTable.getCheckCount(); i++) {
+ if (dbTable.getCheck(i).getName().length() > 30) {
+
result.addError(SystemValidationResult.SystemValidationType.INCORRECT_NAME_LENGTH,
+ "Name of Check " + dbTable.getCheck(i).getName()
+ + " is too long. Only 30 characters allowed.");
+ }
+ }
+ for (int i = 0; i < dbTable.getForeignKeyCount(); i++) {
+ if (dbTable.getForeignKey(i).getName().length() > 30) {
+
result.addError(SystemValidationResult.SystemValidationType.INCORRECT_NAME_LENGTH,
+ "Name of ForeignKey " + dbTable.getForeignKey(i).getName()
+ + " is too long. Only 30 characters allowed.");
+ }
+ }
+ for (int i = 0; i < dbTable.getIndexCount(); i++) {
+ if (dbTable.getIndex(i).getName().length() > 30) {
+
result.addError(SystemValidationResult.SystemValidationType.INCORRECT_NAME_LENGTH,
+ "Name of Index " + dbTable.getIndex(i).getName()
+ + " is too long. Only 30 characters allowed.");
+ }
+ }
+ for (int i = 0; i < dbTable.getUniqueCount(); i++) {
+ if (dbTable.getUnique(i).getName().length() > 30) {
+
result.addError(SystemValidationResult.SystemValidationType.INCORRECT_NAME_LENGTH,
+ "Name of Unique " + dbTable.getUnique(i).getName()
+ + " is too long. Only 30 characters allowed.");
+ }
+ }
+ }
final OBCriteria<Table> tcs =
OBDal.getInstance().createCriteria(Table.class);
tcs.add(Expression.eq(Table.PROPERTY_VIEW, false));
@@ -108,6 +174,7 @@
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
diff -r 314b084f21b9 -r 45df2e899eb3
src/org/openbravo/service/system/SystemValidationResult.java
--- a/src/org/openbravo/service/system/SystemValidationResult.java Thu Feb
25 11:42:46 2010 +0100
+++ b/src/org/openbravo/service/system/SystemValidationResult.java Thu Feb
25 17:22:26 2010 +0100
@@ -32,7 +32,7 @@
public class SystemValidationResult {
public enum SystemValidationType {
- NAME_TOO_LONG, MODULE_ERROR, CUSTOMIZATION_ID, INCORRECT_DEFAULT_VALUE,
WRONG_NAME, WRONG_LENGTH, NO_PRIMARY_KEY_COLUMNS,
NOT_NULL_IN_DB_NOT_MANDATORY_IN_AD, MANDATORY_IN_AD_NULLABLE_IN_DB,
NOT_EXIST_IN_AD, NOT_EXIST_IN_DB, NOT_PART_OF_FOREIGN_KEY, WRONG_TYPE,
INCORRECT_CLIENT_ORG_PROPERTY_NAME, UNEQUAL_DEFAULTVALUE, INCORRECT_PK_NAME,
INCORRECT_FK_NAME, INCORRECT_CHECK_NAME, INCORRECT_UNIQUE_NAME,
INCORRECT_INDEX_NAME;
+ NAME_TOO_LONG, MODULE_ERROR, CUSTOMIZATION_ID, INCORRECT_DEFAULT_VALUE,
WRONG_NAME, WRONG_LENGTH, NO_PRIMARY_KEY_COLUMNS,
NOT_NULL_IN_DB_NOT_MANDATORY_IN_AD, MANDATORY_IN_AD_NULLABLE_IN_DB,
NOT_EXIST_IN_AD, NOT_EXIST_IN_DB, NOT_PART_OF_FOREIGN_KEY, WRONG_TYPE,
INCORRECT_CLIENT_ORG_PROPERTY_NAME, UNEQUAL_DEFAULTVALUE, INCORRECT_PK_NAME,
INCORRECT_FK_NAME, INCORRECT_CHECK_NAME, INCORRECT_UNIQUE_NAME,
INCORRECT_INDEX_NAME, INCORRECT_NAME_LENGTH;
public String getName() {
return this.getClass().getSimpleName();
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits