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.