Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.