Hello;

In my appfuse application I have made a Doctor class that implements
UserDetails, and an experimentor class which also implements
UserDetails. So you can be logged in and have a role of one of these.

I have a patient class which extends BaseObject and has all the CRUD
operations generated by Appgen (I am using appfus 1.9.4 with Spring as
the frame work).

What I would like to do is when I view the patient list I would like
to have 2 options (your role determines which option you get):

1. If you are logged in as a doctor you only see your patients (I am
going to implement my relationships following this tutorial
http://raibledesigns.com/wiki/Wiki.jsp?page=HibernateRelationships).

2. If you are logged in as an experimentor you see a drop down of
doctor names. Selecting one changes the list to be only those patients
associated with that doctor (doctorId is a forgeign key in the patient
table).

I am a little confused on the best way to implement this. What I was
thinking of doing for the Doctor scenario was adding to Doctor:

private List patients;

   /**
    * @return Returns the entries.
    *
    * @hibernate.bag name="entries" lazy="false" cascade="all"
    * @hibernate.collection-key column="patientId"
    * @hibernate.collection-one-to-many class="com.lukeshannon.model"
    */
   public List getPatients() {
       return patients;
   }

   public void setPatients(List patients) {
       this.patients = patients;
   }

Then I am thinking I need to do something in the PatientFormController:

<bean id="patientFormController"
class="com.lukeshannon.webapp.action.PatientFormController"
autowire="byName">
       <property name="validator" ref="beanValidator"/>
       <property name="formView" value="patientForm"/>
       <property name="successView" value="redirect:patients.html"/>
   </bean>

But here is where I get a little lost. I am still getting my head
around Spring (and the relationship tutorial uses Struts).

For the experimentor scenario I meantioned above I don't even know
where to start.

Can someone point me in the right direction? Is this there an easier
way to do this, perhaps even with Appgen? Is Struts easier to do
implement hibernate relationships in?

Thanks,

Luke

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to