Re: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder
Re: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder
- Subject: Re: Creating a fetch that returns the same results as using "session.user.meetings" in WOBuilder
- From: Chuck Hill <email@hidden>
- Date: Fri, 7 Apr 2006 11:48:28 -0700
On Apr 7, 2006, at 11:38 AM, David Holt wrote:
Hi all,
I use a displayGroup component to update information about a meeting.
I also have a display only component that uses a WORepetition to
display meeting information for meetings that a user is scheduled
to attend. I have always just bound to the meetings list using
"session.user.meetings" which gives the meetings that the logged in
user can see. The problem with this is that the data that gets
updated in the DisplayGroup component does not show up immediately
in the user's list of meetings (for example if they add one). I am
trying to implement Chuck's fetching fresh objects code from
Practical WebObjects, but that requires an EOFetchSpecification and
I am not sure how to recreate what WOBuilder does for me
automatically. How do I use the session as a qualifier for the user
that I want to access, and then how do I tell the user to refetch
the meetings objects? The code from Chuck's book looks like this
(the fetchSpec code) but is incomplete because it doesn't take into
account the session:
/** @TypeInfo Meeting */
public NSArray meetingsRepetition()
{
return meetingsRepetition;
}
public void setMeetingsRepetition(NSArray newMeetingsRepetition)
{
EOFetchSpecification fetchSpec = new EOFetchSpecification();
ApplicationUser user = ((Session)session()).user();
EOFetchSpecification fetchSpec = new EOFetchSpecification
("ApplicationUser",
qualifierForEnterpriseObject(user.editingContext(), user),
NSArray.EmptyArray);
fetchSpec.setRefreshesRefetchedObjects(true);
fetchSpec.setPrefetchingRelationshipKeyPaths(new NSArray
("meetings"));
meetingsRepetition = editingContext
().objectsWithFetchSpecification(fetchSpec);
// meetingsRepetition = newMeetingsRepetition;
}
Any pointers would be much appreciated. Thanks,
David
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
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