• 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: ERModernDirectToWeb question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERModernDirectToWeb question


  • Subject: Re: ERModernDirectToWeb question
  • From: David Avendasora <email@hidden>
  • Date: Thu, 24 Feb 2011 00:30:22 -0500

On Feb 23, 2011, at 2:34 PM, David Holt wrote:

In the delegate class I put the following qualifierFromSenderMethod.

  private EOQualifier qualifierFromSender(ERD2WQueryPage sender) {
    NSMutableArray<Object> args = new NSMutableArray<Object>();
    args.addObject(((Session)session()).schoolBoard().boardName());
    args.addObject(((Session)session()).school().name());
    EOQualifier qual = (EOQualifier.qualifierWithQualifierFormat( " schoolBoard.boardName = %@ and schools.name = %@ ", args));   
    ERXAndQualifier finalQual1 = new ERXAndQualifier(new NSArray<EOQualifier>(qual, sender.qualifier()));
    return finalQual1;
  }

the code below assumes the use of the Wonder templates for EOGenerate

  private EOQualifier qualifierFromSender(ERD2WQueryPage sender) {
    SchoolBoard sb = (((Session)session()).schoolBoard());
    School aSchool = (((Session)session()).school());
    EOQualifier q = School_Admin.SCHOOLBOARD.eq(sb).and(School_Admin.SCHOOLS.eq(aSchool)).and(sender.qualifier());
    return q;
  }

Hi Paul,

Just a note to emphasize that the rewrite of your code that David Holt did above is and _excellent_ example of the much simpler code that can be written if you take advantage of Wonder. This code is not only simpler, but much safer as the compiler will watch your back and display an error if you decide to change the name of an entity, attribute or relationship in the model (EOQualifier.qualifierWithQualifierFormat is _evil_. Don't use it. It pushes errors out to run-time).

Also, match on _EOs_ not strings or FKs/PKs if at all possible. It just simplifies your code and the less code you write the less chance there is for errors. Trust EOF to know what to do when comparing EOs.

Dave


 _______________________________________________
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: 
 >Fwd: ERModernDirectToWeb question (From: David Holt <email@hidden>)

  • Prev by Date: Re: Amazon EC2 Image
  • Next by Date: Re: Employing mod_deflate Apache module
  • Previous by thread: Fwd: ERModernDirectToWeb question
  • Next by thread: Re: ERModernDirectToWeb question
  • Index(es):
    • Date
    • Thread