Hi Ramsey,

Am 13.03.2012 um 01:49 schrieb Ramsey Gurley:

> On Mar 12, 2012, at 4:21 PM, Fabian Peters wrote:
> 
>> Hi Ramsey,
>> 
>>>> swallowed in ERD2WPage since d2wContext().propertyKey() is null. Setting 
>>>> the propertyKey from the exception resolves this:
>>>> 
>>>>            if (d2wContext().propertyKey() == null && erv.propertyKey() != 
>>>> null) {
>>>>                d2wContext().setPropertyKey(erv.propertyKey());
>>>>            }                   
>>>> 
>>>> Maybe this (or some better solution) should be added to ERD2W?
>>> 
>>> I don't remember exactly why I didn't do this, but I think it broke query 
>>> validation.  Hence why I wanted to make a pluggable validation delegate.  
>>> The logic in there has become so overloaded, it's difficult to make changes 
>>> without breaking something for someone, somewhere :-)
>> 
>> I haven't yet looked into query validation. How could I test this?
> 
> I don't remember what broke or how I broke it.  It was quite a while ago.
> 
> Pushing the propertyKey into the d2wContext there will have other 
> consequences though. Taking a second look at the code, it looks like you'll 
> get errors if you try this in a nested page that propogates exceptions.

My understanding of D2W is still quite limited, so I'm not sure I really 
understand what this would mean. When would a nested page throw an exception 
for which d2wContext().propertyKey() == null in validationFailedWithException? 
Could we add a check via shouldPropagateExceptions() and/or 
shouldCollectValidationExceptions()? Or just use a copy of the context?

I'm creating quite a few objects in embedded page configurations here and the 
code does indeed get called when saving a (valid) new object that is then 
getting set up as the destination of the relationship. But the validation error 
is not getting displayed, probably because the relevant update container is not 
being refreshed. When clicking on next, the validation is run again and no 
exception is thrown.

I've tried this with a classic ERD2WWizardCreationPageTemplate and the result 
is the same, i.e. the method is getting called but the exception is not getting 
displayed.

>>>> It seems to me that the whole validationKeys approach is unusable 
>>>> otherwise?
>>> 
>>> Using validateKeys would be the correct approach.  But were you actually 
>>> able to display the error with validateKeys on an ERMODWizard page?  Last 
>>> time I tried that, it didn't work...
>>> 
>>> https://github.com/projectwonder/wonder/issues/97
>> 
>> Well, with the modification above it works for me. That's the only thing I 
>> had to change for it to work. 
> 
> Good to know. If no one else is having the issue, I can close it.

Just to be sure: I do have the issue, modifying ERD2WPage fixes it.

>> I still wonder why this missing validation seems not to bother anybody.
> 
> I think it's more complicated than that. The property key is not guaranteed 
> to be an attribute or relationship. But if you'd like to try something 
> different, you can always clone the wizard page template and create your own 
> logic.

Sure, I'm not saying it's a simple thing to do and I certainly don't want to 
complain. I guess I'm just so impressed with D2W and all the things people have 
implemented already that I feel I must be missing something here. It should be 
possible to check which property keys are being displayed on the current 
tab/step, then check for each of them whether it's a mandatory relationship and 
validate accordingly.

>> I'd expect validation of mandatory to-ones to "just work". It's no fun if 
>> you edit something and on the 7th step you're told you forgot to set a 
>> property on the 1st step. Or is there something I'm overlooking?
> 
> It would also be no fun if a validation error from step four showed up in 
> step one :-)  

;-)

> The EO can't be validated until the last step when creating. If you want to 
> validate parts of the EO before leaving a step, then validateKeys is 
> currently the place to do it.

Thanks, it's good to know I'm not ignoring something helpful.

cheers, Fabian

>> 
>> cheers, Fabian
>> 
>>> Ramsey
>>> 
>>>> 
>>>> Any input appreciated!
>>>> 
>>>> cheers, Fabian
>>>> 
>>>> 
>>>> Am 26.08.2011 um 17:51 schrieb Ramsey Gurley:
>>>> 
>>>>> 
>>>>> On Aug 26, 2011, at 2:05 AM, David Avendasora wrote:
>>>>> 
>>>>>> Hey D2Wers,
>>>>>> 
>>>>>> So, I have business logic that executes in the setter of one of my 
>>>>>> attributes.
>>>>> 
>>>>> In the setter?  Any reason why you don't use validate<Key>() or maybe 
>>>>> validateFor*()?  I've learned the hard way that business logic in a 
>>>>> setter is a sign of bad things to come.  It's like exposing PKs and FKs.  
>>>>> It works… sorta, for a while… but sooner or later… BLAM!
>>>>> 
>>>>>> It's checking to make sure that at least one of a set of objects has a 
>>>>>> flag set. If you try to remove the flag off the last object it should 
>>>>>> not allow it and throw and exception.
>>>>>> 
>>>>>> All that works just fine. 
>>>>>> 
>>>>>> Now I want to catch that exception and display it to the user in a 
>>>>>> friendly way. Ideally basically the same as how standard validation 
>>>>>> exceptions are displayed in red at the top of the page in ERModernLook.
>>>>>> 
>>>>>> I've tried throwing a ValidationException and also tried other 
>>>>>> exceptions, and either it is ignored with no user feedback 
>>>>>> (ValidationException), or I get the standard, completely disruptive 
>>>>>> exception page (for all others).
>>>>>> 
>>>>>> I've tried to find the extension point to put in my own exception 
>>>>>> handling, but it's apparently not where I thought it was - 
>>>>>> ERD2WInspectPage#tryToSaveChanges.
>>>>>> 
>>>>>> Am I doing it wrong, or just looking in the wrong place?
>>>>>> 
>>>>>> Dave
>>>>> 
>>>>> I suspect your validation exception may be getting swallowed in 
>>>>> ERD2WPage's validationFailedWithException method.  Put a breakpoint in 
>>>>> there and follow the execution.  If you throw an ERXValidationException 
>>>>> and the d2wContext().propertyKey() is null, then the exception never 
>>>>> makes it into the error messages dictionary.
>>>>> 
>>>>> I've planned on fixing this, but I want to make the validation handling 
>>>>> use a plugable delegate with a default similar to the one now.  That way, 
>>>>> I hope to build a new implementation so that I can provide enhanced 
>>>>> validation on something like an editable list page where you may have 
>>>>> multiple objects with different validation exceptions related to them.
>>>>> 
>>>>> Ramsey
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> http://lists.apple.com/mailman/options/webobjects-dev/lists.fabian%40e-lumo.com
>>>>> 
>>>>> This email sent to lists.fab...@e-lumo.com
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
>>>> 
>>>> This email sent to rgur...@smarthealth.com
>>> 
>> 
> 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to