• 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: EOKeyValueQualifier.evaluateWithObject on EOQualifier.QualifierContains selector?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOKeyValueQualifier.evaluateWithObject on EOQualifier.QualifierContains selector?


  • Subject: Re: EOKeyValueQualifier.evaluateWithObject on EOQualifier.QualifierContains selector?
  • From: Johann Werner <email@hidden>
  • Date: Tue, 07 Feb 2012 21:32:10 +0100

Hi Kieran,

I think the very same qualifier should have the same result should it be used on a fetch spec or on an array. This would be the behavior someoneI should expect (at least I would expect that). But I can't say which way would be better—to have the keypath return a flattened array or to let the qualifier internally flatten the array. Probably the more compatible way would be the latter one (in not breaking others code) but the former the more logical as to match the fetching behavior.

jw


Am 07.02.2012 um 00:11 schrieb Kieran Kelleher:

So, I had an interesting problem that I had not come across before. In my REST controllers I have a baseQualifier() which restricts objects to those that the user has access to. This base qualifier is used for the FetchSpec in the indexAction and used for in-memory evaluation to check object access privileges for single object actions such as show and update.

In one controller I had a qualifier keypath (constructed using ERXKeys of course, but just keeping it simple here to illustrate) that qualified Prospect objects (basically mailing name/address objects):

prospectLists.campaigns.program.location.customer.reseller

The first key is a flattened many-to-many.

The second key is a toMany

The remaining keys are toOne.

The qualifier is basically

new EOKeyValueQualifier("dataLists.campaigns.program.location.customer.reseller", 
EOQualifier.QualifierOperatorContains, reseller);

This qualifier returns the correct objects when used in a FetchSpec.

However using the same qualifier.evaluateWithObject(...) against any of the objects returned in the fetchspec is false!

Debugging shows that for in-memory evaluation, we have an array of arrays of 'reseller', instead of the expected array of 'reseller' objects, which probably makes sense since the keypath is toMany.toMany.toOne.toOne.toOne.toOne.

The workaround for this rest controller was easy, but it raises the question:

Should we expect in memory evaluateWithObject to always be true on objects that the qualifier fetches with SQL?

Should valueForKeyPath default impl. return a flattened array of objects, or should the qualifier class flatten the array of objects in evaluateWithObject, or ........?

Any opinions?

Regards, Kieran


 _______________________________________________
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

References: 
 >EOKeyValueQualifier.evaluateWithObject on EOQualifier.QualifierContains selector? (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: rule dependent on boolean
  • Next by Date: Delay with EO deletion?
  • Previous by thread: EOKeyValueQualifier.evaluateWithObject on EOQualifier.QualifierContains selector?
  • Next by thread: rule dependent on boolean
  • Index(es):
    • Date
    • Thread