public class LibraryDocumentsQueryDataSourceDelegate 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();
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 =
(Document.INCLUDE_IN_PRIVATE_LIBRARY.isNot(true)).and(Document.INCLUDE_IN_LIBRARY.eq(true)).and(sender.qualifier());
return q;
}
}
100 : pageConfiguration = 'QueryLibraryDocument' => queryDataSourceDelegate =
"ca.cscw.delegates.LibraryDocumentsQueryDataSourceDelegate"
[er.directtoweb.ERDDelayedObjectCreationAssignment]
On 2013-09-25, at 12:23 PM, Theodore Petrosky <[email protected]> wrote:
> I have an entity 'Grid' that has an attribute 'isBillboard'. I created the
> list billboard tab with:
>
> public WOComponent listBillboardAction() {
>
> EOEditingContext ec = ERXEC.newEditingContext();
> ListPageInterface lpi = (ListPageInterface)
> D2W.factory().pageForConfigurationNamed("ListGrid", session());
>
> EODatabaseDataSource ds = new EODatabaseDataSource(ec, "Grid");
>
> ERXFetchSpecification<Grid> fs = new
> ERXFetchSpecification<Grid>(Grid.ENTITY_NAME,
> Grid.IS_COMPLETE.eq(false).and(Grid.IS_BILLBOARD.eq(true)), null);
>
> ds.setFetchSpecification(fs);
>
> lpi.setDataSource(ds);
>
> ((D2WComponent) lpi).d2wContext().takeValueForKey("ListBillboard",
> "navigationState");
>
> return (D2WPage) lpi;
> }
>
>
> How can I apply the same limit to a Query page? I don't want to put a control
> on the page to select 'isBillboard', i want isBillboard to be true
>
>
> public WOComponent queryBillboardAction() {
> QueryPageInterface qpi = (QueryPageInterface)
> D2W.factory().queryPageForEntityNamed("Grid", session());
>
> ((D2WComponent) qpi).d2wContext().takeValueForKey("ListBillboard",
> "navigationState");
>
> return (WOComponent) qpi;
>
> }
> _______________________________________________
> 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]