• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Let's discuss a j2ee design pattern problem

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think in fact you only have one function list, and thus perhaps one "facade" (or Session Bean entry point) into your system. As you stated, the level of control should be handled through other approaches, such as limiting the available functions at the UI, or also through J2EE role-based security.
Kyle
 
Heroic work plunger man. Please allow me to introduce you to this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic