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 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