• 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: Auto-filtering EOF queries based on the current client
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto-filtering EOF queries based on the current client


  • Subject: Re: Auto-filtering EOF queries based on the current client
  • From: David LeBer <email@hidden>
  • Date: Tue, 4 Sep 2007 15:15:50 -0400


On 4-Sep-07, at 2:45 PM, Guido Neitzer wrote:

On 04.09.2007, at 12:08, Sam Barnum wrote:

Certain entities are "global", meaning shared among all clients. A good example would be a table containing status names for jobs. This is the same for all clients.

Are you sure about that? I have the experience that some clients want more or less entries in these tables, therefor such tables get set up per client in my app. You can automate that on the client entity to create the entries.


Now the tricky part. I'd like to automate this filtering, so I don't have to explicitly qualify "client=A" for every fetch against Projects I do. Ideally, a user can use a D2W interface to do a search for projects beginning with "P", and it will only return results for his client.

I use a modified D2W list page [1], where I specify an restricting qualifier. This list page adds a qualifier based on two rules to the list qualifier:


task = 'list' => restrictingObjectKey = 'client' [80]
task = 'list' => restrictingObject = session.currentClient [80]

I stole Guido's code :-) and extended it so I can pass in a custom EOQualifier as well for those time when I need to get fancy (item isActive AND item belongs to Phil)


I have more rules to exclude some entities from that, but it works nice. In combination I have on all entities, that are not global a check in awakeFromFetch that the client for this object and the current client in the session are the same - if not it throws an exception.

Also I have modified my EOGenericRecord superclass to set the "client", the "createdBy" and the "creationTime" automatically. I do this by checking whether these attribute keys are available and get the information from the ERXThreadStorage, where it is put during Session.awake().

I do this too, though I conditionally generate the awakeFromInsetion and willUpdate code in my EOGenrator templates instead of in a superclass.


;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
--
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
  • Follow-Ups:
    • Re: Auto-filtering EOF queries based on the current client
      • From: Guido Neitzer <email@hidden>
References: 
 >Auto-filtering EOF queries based on the current client (From: Sam Barnum <email@hidden>)
 >Re: Auto-filtering EOF queries based on the current client (From: Guido Neitzer <email@hidden>)

  • Prev by Date: Re: Auto-filtering EOF queries based on the current client
  • Next by Date: Re: Auto-filtering EOF queries based on the current client
  • Previous by thread: Re: Auto-filtering EOF queries based on the current client
  • Next by thread: Re: Auto-filtering EOF queries based on the current client
  • Index(es):
    • Date
    • Thread