• 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: Digging up a Session object from an EOGenericRecord
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Digging up a Session object from an EOGenericRecord


  • Subject: Re: Digging up a Session object from an EOGenericRecord
  • From: Jérémy DE ROYER <email@hidden>
  • Date: Sat, 7 Mar 2009 14:04:49 +0100

Hi,

We do superclass the EOEditingContext according to Chuck's method with his ValidatingEditingContext.

When créating the "new" editing context, we pass our Session.

So it's easy to get the session from a enterprise object : this.editingContext().getSession().


public Session() { super();

		setDefaultEditingContext(new ValidatingEditingContext(this));
	}

Jérémy

Le 7 mars 09 à 13:37, Riccardo De Menna a écrit :

Hi folks,

I've encountered this issue (or similar ones) very often now and I'd love to know how others tackle the problem.

I have implemented a standard way of adding a special timestamp to all my records in my TGenericRecord (subclass of EOGenericRecord, superclass of all my eo). The timestamp holds information on when a record was last modified as well as who did it.
To do this I need to query my session for something like a "currentUser" method inside the validateTimestamp method of my eo...


Is there a way to climb up to the Session from an EO?

One possible (failed) attempt:

One first clumsy attempt of mine was to override defaultEditingContext() in my Session object and setting the ec delegate object to the session itself before returning it. Then from the eo I would ask for the ec.delegate() and get the session back.
Should work in theory, even though I dislike the fact that I use the delegate() that's meant for other things. In practice it doesn't...
When I factor in my D2W pages my eo don't have the same ec I passed in at factory creation time and so there's no session there.


Am I blind? Is there a fast an easy way to do it?

rdm
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@ingencys.net


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: Digging up a Session object from an EOGenericRecord
      • From: Riccardo De Menna <email@hidden>
References: 
 >Digging up a Session object from an EOGenericRecord (From: Riccardo De Menna <email@hidden>)

  • Prev by Date: Re: Digging up a Session object from an EOGenericRecord
  • Next by Date: Re: Digging up a Session object from an EOGenericRecord
  • Previous by thread: Re: Digging up a Session object from an EOGenericRecord
  • Next by thread: Re: Digging up a Session object from an EOGenericRecord
  • Index(es):
    • Date
    • Thread