I'm in charge of a
j2ee project. let me introduce it in short:
there's four type of user in this project: guest, common user, handler, administrator. Different type of user have different function list. accordint to this, I designed a structure: Guest and RegisteredUser extends CallCenterUser, and CommonUser, Handler, Administrator extends RegisteredUser. Each of them is a Session Bean. Of course, these Session Beans invokes some other Entity Beans, such as PersonInfoBean, ApplyFormBean, TroubleTypeBean, TableIndexBean and so on.
In the web layer, I created four javabean: Guest, CommonUser, Handler, Administrator. each of them correspond a Session Bean of the same name in EJB layer.
Then I user
struts in the web presentation layer to invoke these
java beans to create user interface: a call center website.
after I have done half of my work, I found this design is not good, and far from perfect. espeaically in the java bean programming, because some of them have same functions, I have to write them twice or more in each java bean.
the reason why I seperate user type explicitly is each of them has different function list, in short, there's a control to limit their action. but lately I found the control should not be made in the javabean or session bean, but in the
jsp pages and struts classes.
so, I'm confused. maybe what I should do is simply write a single session bean to implement all functions and a javabean to pack the session bean. and leave the function control to the web presentatino layer.
I think this problem is a very common problem, and I'm sure most of j2ee developer has encontered it. If you haven't found a solution just like me, let's discuss it. If you have good idea or "perfect" solution. please tell me.