Re: WODynamicElementCreationException
Re: WODynamicElementCreationException
- Subject: Re: WODynamicElementCreationException
- From: Alexis Tual <email@hidden>
- Date: Mon, 06 Aug 2012 09:20:17 +1100
Hi,
AFAIK there's no exception thrown at runtime if a binding is not set but required by the API.
API is just an hint for the IDE tools. Maybe the solution is to add the validation logic in the ant tasks so we can detect at build times this kind of errors and avoid the extra code.
Alex
2012/8/5 Johann Werner
<email@hidden>
Hi list,
in many dynamic element classes there are some checks in the constructor if certain bindings exist or not. Example from ERAttachmentLink:
public ERAttachmentLink(String name, NSDictionary<String, WOAssociation> associations, WOElement template) {
super(name, associations, template);
_associations = associations.mutableClone();
_attachment = _associations.removeObjectForKey("attachment");
_download = _associations.removeObjectForKey("download");
if (_attachment == null) {
throw new WODynamicElementCreationException("<ERAttachmentLink> The 'attachment' binding is required.");
}
_configurationName = _associations.removeObjectForKey("configurationName");
}
Most of the components do have an API file (for those missing we will have to fix and add them) that WOLips uses to do binding validation within the component editor. In the API file you can set a binding as mandatory or even more complex rules by manually editing the file in a text editor. An API file should be present for a component as you will get instant feedback in the component editor while changing bindings.
Now looking at the checks in code this is sort of duplicated code. In the example above if I don't add the attachment binding to the ERAttachmendLink on a page of mine the component editor will already show an error whereas the exception that the binding is missing will only be thrown when a user will hit the enclosing page. So do we really need that extra logic in the constructors? I would tend to no (at least for those validations that can be covered by an API file), remove them and prefer keeping the API files correct. What is your opinion?
jw
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden