Hi James,

You do it in the query source delegate.

You get your original query and then add whatever magic you need to do in the 
delegate.

public class WorkingGroupProjectsQueryDataSourceDelegate implements 
ERDQueryDataSourceDelegateInterface {
  public EODataSource queryDataSource(ERD2WQueryPage sender) {
    EODataSource ds = sender.dataSource();
    if (ds == null || !(ds instanceof EODatabaseDataSource)) {
      ds = new EODatabaseDataSource(sender.session().defaultEditingContext(), 
sender.entity().name());
      sender.setDataSource(ds);
    }

    EOFetchSpecification fs = ((EODatabaseDataSource) ds).fetchSpecification();
        // this is the line where you are getting your combined
        // qualifier from the private method below
    fs.setQualifier(qualifierFromSender(sender)); 
    fs.setIsDeep(sender.isDeep());
    fs.setUsesDistinct(sender.usesDistinct());
    fs.setRefreshesRefetchedObjects(sender.refreshRefetchedObjects());

    int limit = sender.fetchLimit();
    if (limit != 0) {
      fs.setFetchLimit(limit);
    }
    NSArray prefetchingRelationshipKeyPaths = 
sender.prefetchingRelationshipKeyPaths();
    if (prefetchingRelationshipKeyPaths != null && 
prefetchingRelationshipKeyPaths.count() > 0) {
      fs.setPrefetchingRelationshipKeyPaths(prefetchingRelationshipKeyPaths);
    }
    return ds;
  }

  private EOQualifier qualifierFromSender(ERD2WQueryPage sender) {
    WorkingGroup wg = WorkingGroup.wg();
    EOQualifier q = Project.WORKING_GROUP.eq(wg).and(sender.qualifier());
    return q;
  }

the .and(sender.qualifier()); in the qualifierFromSender method is whatever 
your page produces before passing it to the delegate. Here I am just ensuring 
that the projects listed in a project query page were created by the working 
group of the logged in user + whatever search criteria were entered on the 
query page.

David


On 2012-02-07, at 7:44 AM, James Cicenia wrote:

> Ok -
> 
> As i replaced my custom QueryPage with one out of the wonder box I am a bit 
> confused as usual.
> 
> I understand queryDataSourceDelegate.
> 
> I needed that for manipulating the qualifiers... ok, so far so good.
> 
> In my Query I have a custom component that lists ERTags they can search on. 
> However, that search
> can't be combined with the qualifier based search. I retrieve them from the 
> displayGroup's queryMatch
> dictionary, and then get the entities associated with the array of tags. I 
> would then Intersect this set
> of entities with those retrieved by the qualifier based query.
> 
> The question then becomes how can I do this with just pure D2W delegate / 
> rule interfaces?
> OR,
> Where do I put the code to merge the two results sets?
> 
> Thanks
> 
> James
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to