Re: editingContextShouldFetchObjects equivalent for EODataSource/EODataBaseDataSource?
Re: editingContextShouldFetchObjects equivalent for EODataSource/EODataBaseDataSource?
- Subject: Re: editingContextShouldFetchObjects equivalent for EODataSource/EODataBaseDataSource?
- From: Fabian Peters <email@hidden>
- Date: Mon, 05 Dec 2011 22:27:00 +0100
Hi Ramsey,
Am 05.12.2011 um 22:11 schrieb Ramsey Gurley:
> On Dec 5, 2011, at 1:37 PM, Fabian Peters wrote:
>
>> Hi Ramsey,
>>
>> Am 05.12.2011 um 21:22 schrieb Ramsey Gurley:
>>
>>> setAuxiliaryQualifier()?
>>
>> Well, can the auxiliary qualifier be set in a centralized manner? I didn't find any hint how to do that.
>
> That depends on how you are arriving at your list. If you're landing there after an ERD2WQueryPage, you can substitute your own datasource class with a ERDQueryDataSourceDelegateInterface:
>
> http://wiki.objectstyle.org/confluence/display/WO/D2W+Flow+Control
Interestingly, my EC delegate does what its supposed to do in this case. I guess here it's the EC that does the fetching, not the datasource but I really haven't looked into it.
> If you are embedding the page yourself with ERXD2WList, then you bind it directly with the datasource binding.
>
> If you are getting there using an ERD2WDirectAction method, you would need to override the prepareListPage method in your direct action subclass to provide it there.
This is what I settled on for now. For some reason, prepareListPage is protected, so I just overrode dynamicPageForActionNamed and called myOwnPrepareListPage.
> If you're coming in from a QueryAll page, you might have a bit more work to do as I believe the QueryAll page uses the aux qualifier already.
>
> If you're creating your DisplayGroup in the woo file, I don't know. I've never done that before :-)
>
>>
>> Right now I've subclassed EODatabaseDataSource and am adding the qualifier to the fetch spec in the constructor after calling super. When instantiating my subclass directly it works as expected. But I cannot seem to convince my application to use my subclass instead of EODatabaseDataSource:
>>
>> ERXPatcher.setClassForName(ELEODatabaseDataSource.class, "EODatabaseDataSource");
>> EODataSource ds = new EODatabaseDataSource(ERXEC.newEditingContext(), "Product");
>> System.out.println("Application.Application: " + ds.getClass().getCanonicalName());
>>
>> Gives:
>>
>> Application.Application: com.webobjects.eoaccess.EODatabaseDataSource
>>
>> I haven't used ERXPatcher for quite some time - are there any preconditions for it to work?
>
> That only works if the class is instantiated using _NSUtilities.classWithName(), which is not the case with EODatabaseDataSource objects. You need to create the datasource yourself if you subclass which leaves you in pretty much the same place as using the aux qualifier.
I see, thanks a lot for your help, much appreciated!
cheers, Fabian
> Ramsey
>
>>
>> cheers, Fabian
>>
>>> Ramsey
>>>
>>> On Dec 5, 2011, at 11:27 AM, Fabian Peters wrote:
>>>
>>>> Hi all,
>>>>
>>>> I'm happily using an EC delegate in a multi-tenant app to add restricting qualifiers in editingContextShouldFetchObjects. Now I'd like to make more use of D2W and am looking for an equivalent when dealing with EODataBaseDataSource. I've looked at EODatabaseContext.Delegate's databaseContextShouldSelectObjects, but the documentation says "The delegate should not modify fetchSpec's qualifier or fetch order".
>>>>
>>>> If there's no other way I guess I could subclass EODataBaseDataSource and use ERXPatcher.setClassForName(), but that seems rather drastic?
>>>>
>>>> Fabian _______________________________________________
>>>> 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
>>>
>>
>
_______________________________________________
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