Re: Limiting EOGenericRecord Relationship with a Session Value?
Re: Limiting EOGenericRecord Relationship with a Session Value?
- Subject: Re: Limiting EOGenericRecord Relationship with a Session Value?
- From: Jim Pearson <email@hidden>
- Date: Tue, 25 Nov 2003 11:06:12 -0500 (GMT-05:00)
Paul,
If you set the model up such that:
A Building has Persons;
and
A Person has Rooms;
Then, you would select a Building in the workflow and pick or search for a Person related to the Building. The second repitition could then point something like currentPerson.rooms for the item list and currentRoom in the repetition item.
The relationship from Building to Room is important (perhaps) for other parts of the application, but not for showing a building's person's rooms.
HTH
jimp
-----Original Message-----
From: Paul Mathews <email@hidden>
Sent: Nov 25, 2003 10:27 AM
To: email@hidden
Subject: Limiting EOGenericRecord Relationship with a Session Value?
Hi all
I was hoping for some advice, being somewhat new to webobjects.
I have a model that is in the form
Building <--->> Room
^ ^
| |
v v
v v
Person_Building Person_Room
^ ^
^ ^
| |
-- > Person <----
Basically a there are many buildings with many rooms in each. A Person can be
granted access to a Building and a limit number of rooms within the building.
No in displaying this I was using a Repetition to display the Buldings in a
list and setting the masterObject to the Person logged in. The Person object
is kept in the Session object.
The problem is when I use a second repetition to display the Rooms for the
build (well that part is easy) but to limit the list of room to the Person
that is logged in is where I am comming apart.
1. Is there a better way to structure this model ?
2 I have tried adding a custom routine to the Building.java class module. The
problem there if I try and access the session().PersionID() routine it
complains about session being unknown. The routine is as follows...
public class Building extends EOGenericRecord {
...
/** @TypeInfo Room */
public NSArray myRooms() {
NSMutableDictionary d = new NSMutableDictionary();
-> // Session s = (Session) session(); !!! Error !!!
-> d.takeValueForKey(s.PersonID, "personName");
d.takeValueForKey(this.roomName(), "roomName");
EOModelGroup mg = EOModelGroup.defaultGroup();
EOFetchSpecification fs = mg.fetchSpecificationNamed("myrooms","Room");
fs = fs.fetchSpecificationWithQualifierBindings(d);
EOEditingContext ec = this.editingContext();
return (NSArray)ec.objectsWithFetchSpecification(fs);
}
...
I know know that session() can not be used in a EOGenericRecord, so I was
wondering if anyone has any other ideas?
Thanks all
These things are hard to describe in a short message, so if more info is
needed just hammer me with it.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.