• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: creating new object D2W
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating new object D2W


  • Subject: Re: creating new object D2W
  • From: David Holt <email@hidden>
  • Date: Thu, 29 Mar 2012 16:37:40 -0700

See my note to Paul for an example of this.

Use ERXThreadStorage

David

On 2012-03-29, at 4:29 PM, Theodore Petrosky wrote:

> yes but I have other values like depending on who is logged in. the object is 'owned' by that user. I am storing the user in the session so i was thinking of:
>
> ((D2WComponent) component).object().takeValueForKey(session.currentUser, "person");
>
> init sounds good for the creationDate but what about this 'user'.
>
> Ted
>
> --- On Thu, 3/29/12, Ramsey Gurley <email@hidden> wrote:
>
>> From: Ramsey Gurley <email@hidden>
>> Subject: Re: creating new object D2W
>> To: "Theodore Petrosky" <email@hidden>
>> Cc: email@hidden
>> Date: Thursday, March 29, 2012, 5:16 PM
>>
>> On Mar 29, 2012, at 1:48 PM, Theodore Petrosky wrote:
>>
>>> I am creating an new object page with this.
>>>
>>> public EditPageInterface createBriefAction() {
>>>
>>>      EditPageInterface component =
>> D2W.factory().editPageForNewObjectWithConfigurationNamed("CreateBrief",
>> session());
>>>
>>    component.setNextPage(session().context().page());
>>>
>>>      if(component instanceof
>> D2WPage) {
>>>          D2WPage page =
>> (D2WPage)component;
>>>
>>    page.d2wContext().takeValueForKey("Brief.CreateBrief",
>> "navigationState");
>>>      }
>>>      return component;
>>> }
>>>
>>> I want to pass in a date to the object. is this the
>> 'correct' or mostest correct way:
>>>
>>> ((D2WComponent) component).object().takeValueForKey(
>> (new NSTimestamp()), "creationDate");
>>>
>>> Ted
>>
>>
>> Sounds like model logic. Do it in the model. If you just
>> want to set a create date, then use your EO's init()
>> method.
>>
>> public class Brief extends _Brief {
>>
>>     public void init(EOEditingContext ec) {
>>         super.init(ec);
>>         setCreationDate(new
>> NSTimestamp());
>>     }
>>
>> }
>>
>> And if code is just too cumbersome, you can do it in the
>> userInfo dictionary of Brief inside your model :-)
>>
>>
>>
>> You can read more about it here
>>
>> http://webobjects.mdimension.com/hudson/job/Wonder/javadoc/er/extensions/eof/ERXEntityClassDescription.html
>>
>> Just do it in init() unless you want to use vanilla
>> EOGenericRecords for some reason.
>>
>> Ramsey
>>
>>
>
> _______________________________________________
> 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

  • Follow-Ups:
    • Re: creating new object D2W
      • From: Ramsey Gurley <email@hidden>
References: 
 >Re: creating new object D2W (From: Theodore Petrosky <email@hidden>)

  • Prev by Date: Re: creating new object D2W
  • Next by Date: Re: D2W: Pattern for complex object creation
  • Previous by thread: Re: creating new object D2W
  • Next by thread: Re: creating new object D2W
  • Index(es):
    • Date
    • Thread