Re: Where D2W does it "Create" a new object?
Re: Where D2W does it "Create" a new object?
- Subject: Re: Where D2W does it "Create" a new object?
- From: David LeBer <email@hidden>
- Date: Wed, 27 Jan 2010 15:39:06 -0500
On 2010-01-27, at 3:15 PM, James Cicenia wrote:
> Hello -
>
>
> I am trying to use my custom page for a "CreateObject" type operation.
> However, when I use my custom page there is no temporary new object.
>
> I am using a direction action so do I have to put a CreateAndInsert there?
> IF so, how do I pass it to my page:
>
> public WOActionResults CreateFestivalAction() {
> ((Session)session()).currentFestival = (Festival) EOUtilities.createAndInsertInstance(session().defaultEditingContext(), "Festival");
> return D2W.factory().pageForConfigurationNamed ("CreateFestival", session());
> }
> Thanks
> James
Given that this rule exists:
10 (pageConfiguration like 'Create*' or pageConfiguration like 'Edit*') => task = "edit"
Then a pageConfiguration like CreateFestival will be an Edit page. In other words, a page that conforms to the EditPageInterface. EditPageInterface has a setObject method.
So:
public WOActionResults CreateFestivalAction() {
Festival festival = (Festival)EOUtilities.createAndInsertInstance(ERXEC.newEditingContext(), Festival.ENTITY_NAME);
((Session)session()).setCurrentFestival(festival);
EditPageInterface epi = (EditPageInterface)D2W.factory().pageForConfigurationNamed ("CreateFestival", session());
epi.setObject(festival);
return (WOActionResults)epi;
}
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
twitter: http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
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