diff --git a/base/src/org/compiere/model/I_AD_System.java b/base/src/org/compiere/model/I_AD_System.java index a5d007546b..15effb8ff8 100644 --- a/base/src/org/compiere/model/I_AD_System.java +++ b/base/src/org/compiere/model/I_AD_System.java @@ -200,6 +200,15 @@ public interface I_AD_System */ public boolean isAutoErrorReport(); + /** Column name IsFailOnMissingModelValidator */ + public static final String COLUMNNAME_IsFailOnMissingModelValidator = "IsFailOnMissingModelValidator"; + + /** Set Fail on Missing Model Validator */ + public void setIsFailOnMissingModelValidator (boolean IsFailOnMissingModelValidator); + + /** Get Fail on Missing Model Validator */ + public boolean isFailOnMissingModelValidator(); + /** Column name IsJustMigrated */ public static final String COLUMNNAME_IsJustMigrated = "IsJustMigrated"; diff --git a/base/src/org/compiere/model/ModelValidationEngine.java b/base/src/org/compiere/model/ModelValidationEngine.java index 3b600e004f..f6e0f9925d 100644 --- a/base/src/org/compiere/model/ModelValidationEngine.java +++ b/base/src/org/compiere/model/ModelValidationEngine.java @@ -49,7 +49,9 @@ public class ModelValidationEngine } // get /** Engine Singleton */ - private static ModelValidationEngine s_engine = null; + private static ModelValidationEngine s_engine = null; + /* flag to indicate a missing model validation class */ + private static String missingModelValidationMessage = null; /************************************************************************** @@ -77,7 +79,8 @@ public class ModelValidationEngine { //logging to db will try to init ModelValidationEngine again! //log.warning(e.getLocalizedMessage()); - System.err.println(e.getLocalizedMessage()); + // System.err.println(e.getLocalizedMessage()); + missingModelValidationMessage = missingModelValidationMessage + e.toString() + " global" + '\n'; } // Go through all Clients and start Validators @@ -91,7 +94,7 @@ public class ModelValidationEngine } //logging to db will try to init ModelValidationEngine again! //log.config(toString()); - System.out.println(toString()); + // System.out.println(toString()); } // ModelValidatorEngine private void loadValidatorClasses(MClient client, String classNames) @@ -115,7 +118,8 @@ public class ModelValidationEngine { //logging to db will try to init ModelValidationEngine again! //log.log(Level.SEVERE, className + ": " + e.getMessage()); - System.err.println(className + ": " + e.getMessage()); + // System.err.println(className + ": " + e.getMessage()); + missingModelValidationMessage = missingModelValidationMessage + e.toString() + " on client " + client.getName() + '\n'; } } } @@ -132,7 +136,8 @@ public class ModelValidationEngine { //logging to db will try to init ModelValidationEngine again! //log.log(Level.SEVERE, className + ": " + e.getMessage()); - System.err.println(className + ": " + e.getMessage()); + // System.err.println(e.toString()); + missingModelValidationMessage = missingModelValidationMessage + e.toString() + " on client " + client.getName() + '\n'; } } @@ -187,6 +192,14 @@ public class ModelValidationEngine return error; } } + if (AD_User_ID == 0 && AD_Role_ID == 0) + ; // don't validate for user system on role system + else + if (missingModelValidationMessage != null) { + MSystem system = MSystem.get(Env.getCtx()); + if (system.isFailOnMissingModelValidator()) + return missingModelValidationMessage; + } return null; } // loginComplete diff --git a/base/src/org/compiere/model/X_AD_System.java b/base/src/org/compiere/model/X_AD_System.java index 34f6f2044e..638ad707df 100644 --- a/base/src/org/compiere/model/X_AD_System.java +++ b/base/src/org/compiere/model/X_AD_System.java @@ -46,6 +46,8 @@ public class X_AD_System extends PO implements I_AD_System, I_Persistent setInfo (null); setIsAllowStatistics (false); setIsAutoErrorReport (true); +// Y + setIsFailOnMissingModelValidator (true); // Y setName (null); setPassword (null); @@ -336,6 +338,27 @@ public class X_AD_System extends PO implements I_AD_System, I_Persistent return false; } + /** Set Fail on Missing Model Validator. + @param IsFailOnMissingModelValidator Fail on Missing Model Validator */ + public void setIsFailOnMissingModelValidator (boolean IsFailOnMissingModelValidator) + { + set_Value (COLUMNNAME_IsFailOnMissingModelValidator, Boolean.valueOf(IsFailOnMissingModelValidator)); + } + + /** Get Fail on Missing Model Validator. + @return Fail on Missing Model Validator */ + public boolean isFailOnMissingModelValidator () + { + Object oo = get_Value(COLUMNNAME_IsFailOnMissingModelValidator); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Just Migrated. @param IsJustMigrated Value set by Migration for post-Migation tasks. diff --git a/migration/331b-trunk/061_BF1851188.sql b/migration/331b-trunk/061_BF1851188.sql new file mode 100644 index 0000000000..2242937ec1 --- /dev/null +++ b/migration/331b-trunk/061_BF1851188.sql @@ -0,0 +1,23 @@ +-- Jan 8, 2008 7:04:17 PM COT +-- [ 1851188 ] Missing ModelValidator must fail client to start +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53324,0,'IsFailOnMissingModelValidator',TO_DATE('2008-01-08 19:04:14','YYYY-MM-DD HH24:MI:SS'),0,NULL,'D',NULL,'Y','Fail on Missing Model Validator','Fail on Missing Model Validator',TO_DATE('2008-01-08 19:04:14','YYYY-MM-DD HH24:MI:SS'),0) +; + +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53324 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,54093,53324,0,20,531,'IsFailOnMissingModelValidator',TO_DATE('2008-01-08 19:04:46','YYYY-MM-DD HH24:MI:SS'),0,'Y','D',1,'Y','N','N','N','N','Y','N','N','N','N','Y','Fail on Missing Model Validator',0,TO_DATE('2008-01-08 19:04:46','YYYY-MM-DD HH24:MI:SS'),0,1.000000000000) +; + +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=54093 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +ALTER TABLE AD_System ADD IsFailOnMissingModelValidator CHAR(1) DEFAULT 'Y' CHECK (IsFailOnMissingModelValidator IN ('Y','N')) NOT NULL +; + +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,54093,54236,0,440,TO_DATE('2008-01-08 19:08:25','YYYY-MM-DD HH24:MI:SS'),0,1,'D','Y','Y','Y','N','N','N','N','N','Fail on Missing Model Validator',235,0,TO_DATE('2008-01-08 19:08:25','YYYY-MM-DD HH24:MI:SS'),0) +; + +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=54236 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + diff --git a/migration/331b-trunk/postgresql/061_BF1851188.sql b/migration/331b-trunk/postgresql/061_BF1851188.sql new file mode 100644 index 0000000000..65fbe50710 --- /dev/null +++ b/migration/331b-trunk/postgresql/061_BF1851188.sql @@ -0,0 +1,23 @@ +-- Jan 8, 2008 7:04:17 PM COT +-- [ 1851188 ] Missing ModelValidator must fail client to start +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53324,0,'IsFailOnMissingModelValidator',TO_TIMESTAMP('2008-01-08 19:04:14','YYYY-MM-DD HH24:MI:SS'),0,NULL,'D',NULL,'Y','Fail on Missing Model Validator','Fail on Missing Model Validator',TO_TIMESTAMP('2008-01-08 19:04:14','YYYY-MM-DD HH24:MI:SS'),0) +; + +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53324 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,54093,53324,0,20,531,'IsFailOnMissingModelValidator',TO_TIMESTAMP('2008-01-08 19:04:46','YYYY-MM-DD HH24:MI:SS'),0,'Y','D',1,'Y','N','N','N','N','Y','N','N','N','N','Y','Fail on Missing Model Validator',0,TO_TIMESTAMP('2008-01-08 19:04:46','YYYY-MM-DD HH24:MI:SS'),0,1.000000000000) +; + +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=54093 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +ALTER TABLE AD_System ADD COLUMN IsFailOnMissingModelValidator CHAR(1) DEFAULT 'Y' CHECK (IsFailOnMissingModelValidator IN ('Y','N')) NOT NULL +; + +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,54093,54236,0,440,TO_TIMESTAMP('2008-01-08 19:08:25','YYYY-MM-DD HH24:MI:SS'),0,1,'D','Y','Y','Y','N','N','N','N','N','Fail on Missing Model Validator',235,0,TO_TIMESTAMP('2008-01-08 19:08:25','YYYY-MM-DD HH24:MI:SS'),0) +; + +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=54236 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; +