If the PERSON_KEY is the same (ie: 'person') for each of the entities you need 
to qualify against, you should be able to just use the string "person" in your 
qualifier.

private EOQualifier qualifierFromSender(ERD2WQueryPage sender) {
        return ERXQ.and(sender.qualifier(), ERXQ.equals("person", 
((Session)sender.session().user())));
}

D

--
David LeBer
Codeferous Software

On 2012-05-14, at 12:24 AM, Theodore Petrosky wrote:

> two things.
> 
> first I need to learn some java. is there a way to do this better?
> 
> private EOQualifier qualifierFromSender(ERD2WQueryPage sender) {
> 
>       EOQualifier q = sender.qualifier();
>       NSLog.out.appendln("*   sender.entityName()  " +  sender.entityName());
> 
>       Person sessionPerson = ((Session) sender.session()).user();
> 
>       if (sender.entityName().equals("MeetingChecklist")) {
>               q = ERXQ.and(ERXQ.equals(MeetingChecklist.PERSON_KEY, 
> sessionPerson));
>       }
> 
>       if (sender.entityName().equals("KickOffBrief")) {
>               q = ERXQ.and(ERXQ.equals(KickOffBrief.PERSON_KEY, 
> sessionPerson));
>       }
> 
>       if (sender.entityName().equals("CreativeBrief")) {
>               q = ERXQ.and(ERXQ.equals(CreativeBrief.PERSON_KEY, 
> sessionPerson));
>       }
> 
>       return q;
> }
> it works, but it is ugly.
> 
> I have these three 'if' statements. Each of the entities has a person key. Is 
> there a way to do something like:
> 
> q = ERXQ.and(ERXQ.equals(sender.entityName().PERSON_KEY, sessionPerson));
> 
> obviously this will fail as there is no way for the compiler to know that 
> sender.entityName() has a key called PERSON_KEY. I know it works, but I am 
> trying to learn new stuff.
> 
> 
> and 'b',
> 
> you said:
> 
>> 
>> Interesting. I thought that worked. Try setting the
>> auxiliaryQualifier instead of the qualifier on your database
>> datasource. Does that help?
>> 
> 
> I am hunting but I don't understand the 'auxiliaryQualifier' reference.
> 
> 
> --- On Sat, 5/12/12, Ramsey Gurley <[email protected]> wrote:
> 
>> From: Ramsey Gurley <[email protected]>
>> Subject: Re: limiting a fetch in a D2W list page
>> To: "Theodore Petrosky" <[email protected]>
>> Cc: "[email protected] Development" 
>> <[email protected]>
>> Date: Saturday, May 12, 2012, 12:25 PM
>> On May 12, 2012, at 6:24 AM, Theodore
>> Petrosky wrote:
>> 
>>> The documentation at D2W+Flow+Control seems to say that
>> I can create a 'delegate' copying what is there and create a
>> rule that ties my entity to it.
>>> 
>>> as there is no additional qualifier in:
>>> 
>>> private EOQualifier qualifierFromSender(ERD2WQueryPage
>> sender) {
>>>     EOQualifier q = sender.qualifier();
>>>         // q = ... create
>> your OR qualifier here
>>>        
>>         
>>>     NSLog.out.appendln("   
>>    *in the delegate     "
>> + q );
>>>         
>>>     return q;
>>> }
>>> 
>>> I only get the NSLog message when I enter the advanced
>> search area. I assumed with a delegate assigned to the
>> entity, that whenever I viewed the entity, the delegate
>> would fire. It doesn't fire if I just click the "Find"
>> button (so the delegate is not used). I have to stop
>> assuming.
>> 
>> Interesting. I thought that worked. Try setting the
>> auxiliaryQualifier instead of the qualifier on your database
>> datasource. Does that help?
>> 
>>> 
>>> also interesting 'ERDDelayedObjectCreationAssignment'
>> doesn't exist as a class to choose in the RuleModeler.
>> 
>> Copy paste :)
>> 
>>> 
>>> Lastly, how can I get the session method user() to
>> compare to?
>> 
>> sender.session().valueForKey("user")?
>> 
>>> 
>>> What am I missing?
>>> 
>>> Ted
>>> 
>>> --- On Fri, 5/11/12, Ramsey Gurley <[email protected]>
>> wrote:
>>> 
>>>> From: Ramsey Gurley <[email protected]>
>>>> Subject: Re: limiting a fetch in a D2W list page
>>>> To: "Theodore Petrosky" <[email protected]>
>>>> Cc: [email protected]
>>>> Date: Friday, May 11, 2012, 4:14 PM
>>>> http://wiki.wocommunity.org/display/WO/D2W+Flow+Control
>>>> 
>>>> See ERDQueryDataSourceDelegateInterface for Query
>> pages. I
>>>> don't think that works for the QueryAll page, but
>> you could
>>>> possibly use an editing context delegate in that
>> case.
>>>> 
>>>> Ramsey
>>>> 
>>>> 
>>>> On May 11, 2012, at 1:00 PM, Theodore Petrosky
>> wrote:
>>>> 
>>>>> my d2w app has a session user. when a user
>> selects a
>>>> tab, my MainNavigationController fires a method to
>> create
>>>> the list page. 
>>>>> 
>>>>> the method creates an EODatabaseDataSource and
>> then a
>>>> fetch spec that limits the result to rows that were
>> created
>>>> by THIS user.
>>>>> 
>>>>> ERXFetchSpecification<KickOffBrief> fs =
>> new
>>>> 
>> ERXFetchSpecification<KickOffBrief>(KickOffBrief.ENTITY_NAME,
>>>> ERXQ.equals(KickOffBrief.IS_FILED_KEY,
>>>> 
>> false).and(KickOffBrief.PERSON.eq(session().user())),
>>>> null);
>>>>> 
>>>>> How can I add the user qualification to the D2W
>> created
>>>> search query? Or when I am on a QueryKickOffBrief
>> page, how
>>>> do I add the
>> and(KickOffBrief.PERSON.eq(session().user())
>>>> qualifier to the resultant page?
>>>>> 
>>>>> Ted
>>>>> 
>>>>> 
>>>>> 
>> _______________________________________________
>>>>> 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/rgurley%40smarthealth.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/ramseygurley%40gmail.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/dleber_wodev%40codeferous.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