From: Kartik T. <ka...@ef...> - 2005-12-27 14:35:43
|
Hi, We have been trying to use the Validity framework which is now a part of Project Wonder. We understand that ERXExtensions provides us with an option to enable the use of Validity - (er.extensions.ERXGenericRecord.useValidity = true). We set this flag to true to enable validity, but then noticed that the call to Validity Engine was throwing up an exception indicating that an invalid argument had been passed. This exception originated from ERXEntityClassDescription . We then realized that the call to validity had been moved to ERXEntityClassDescription a few months back. Earlier, while it was in ERXGenericRecord, validity worked fine. We understand that the appropriate place for validation is ERXEntityClassDescription and that's what could have prompted this change. However on examining the new code in ERXEntityClassDescription we found that the following code could be causing the problem - private void invokeValidityMethodWithType(int type) throws NSValidation.ValidationException{ try { Object dummy = null; Method m = validityMethods()[type]; m.invoke(sharedGSVEngineInstance(), new Object[]{this}); } . . . . . . . . } In the code above, if the type passed in is '0', Method m would hold a reference to an instance of validateEOObjectOnSave in GSVEngine - public boolean validateEOObjectOnSave(EOEnterpriseObject eoObject) validateEOObjectOnSave requires an enterprise object to be passed in as a parameter. However, if you notice in the ERXEntityClassDescription code above, you will find that an instance of ERXEntityClassDescription is being passed to the the GSVEngine's validateEOObjectOnSave. The same bit of code worked fine in ERXGenericRecord as 'this' in that class would refer to an instance of ERXGenericRecord. I guess the code in ERXEntityClassDescription might have to be changed to pass in an instance of ERXGenericRecord to the GSVEngine. Please do let us know what you feel about this. thanks & regards, Kartik |