On May 6, 2009, at 8:08 AM, Theodore Petrosky wrote:

- ValidationException e = Please provide a <b>Sub CategoryID</b>.

Is the subCategoryID a class attribute in your model?

Some hints on style though.

Add the current user to the ERXThreadStorage in Session.awake and add some convenience methods to ContactCategory to do the right thing (return the default category), than do something like this:

Override awakeFromInsertion on "Contact":

public void awakeFromInsertion(EOEditingContext editingContext) {
        super.awakeFromInsertion(editingContext);

        setContactCategory(ContactCatory.defaultCategory(editingContext));
setContactSubCategory(ContactCatory.defaultSubCategory(editingContext));

        if (ERXThreadStorage.valueForKey("currentUser") != null) {
                setUser(ERXThreadStorage.valueForKey(editingContext, 
"currentUser");
        }
}

Remember, you are in an object orientated environment and you should put business logic where it belongs: in the model.

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

This email sent to [email protected]

Reply via email to