• 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
Qualifier to match on content of two to-many relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Qualifier to match on content of two to-many relationships


  • Subject: Qualifier to match on content of two to-many relationships
  • From: Paul Hoadley <email@hidden>
  • Date: Wed, 11 May 2016 07:52:27 +0930

Hello,

I have two entities, User and Notice, each of which has a to-many relationship to Role called roles. The business rule here works as follows. Say Notice.roles contains two Roles, R1 and R2. If User.roles contains either R1 or R2, then the Notice is applicable to that User—that is, Notice.roles says that for each Role, the Notice applies to any User that has that Role.

I have a static method on Notice to return an NSArray<Notice> applicable to some supplied User. (There are other matching criteria, but this is the part I want to try and simplify.) At the moment, I’m doing this:

NSMutableArray<EOQualifier> roleQuals = new NSMutableArray<EOQualifier>();
for (Role r : user.roles()) {
roleQuals.add(Notice.ROLES.containsObject(r));
}
EOQualifier roleQual = ERXQ.or(roleQuals);

While this works, it seems awkward. Is there a way to create this qualifier (which is essentially looking for any match between User.roles and Notice.roles) in one step?


-- 
Paul Hoadley
http://logicsquad.net/



 _______________________________________________
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: Qualifier to match on content of two to-many relationships
      • From: Aaron Rosenzweig <email@hidden>
    • Re: Qualifier to match on content of two to-many relationships
      • From: Paul Hoadley <email@hidden>
  • Prev by Date: Nefarious IE / javascript / D2W problem
  • Next by Date: Closure of WOCommunity Association
  • Previous by thread: Nefarious IE / javascript / D2W problem
  • Next by thread: Re: Qualifier to match on content of two to-many relationships
  • Index(es):
    • Date
    • Thread