开发者

looking for a modeling pattern

Hi: I am working with a task publish system.

In the system,there are some department,for example:develop/sell/product and etc.

Some tasks belong to different department.

And the most import model:the user.

People who use this system are only the bosses of the different department and their boss(the biggest boss) ).

These person all work in the admin page,common boss can only publish and see the taskes in his/her department.He/she can add/remove/modify the task(where the modify means that he can set the status of the task:DONE/DOING/NOT START开发者_StackOverflow社区),all of his/her operation should be verified by the biggest boss.

The biggest boss can see/add/remove/modify all the tasks from all the department,also he/she can add remove user(the common boss),set the permisson of the user(tasks of which department the user can see).

=================== The following is my own design:

Department
  String name;//name of this department

  List<Task> listAllTasks();// list all tasks belong to this department

Task
  String name;
  String desc;//description of this task
  Date startTime;//when this task will start
  Date endTime;
  int status; //is this task done? doing? not starting?
  String executorName; //the name of the person who will responsible for this task(here the person does not need to be common boss,just a name).
  Department depart;//which department does this task belong to ?

Boss
  String loginName;
  String realName;
  String password;
  Department depart;//which department does this boss belong to ?

The above is all my idea,I have no idea to continue to make the authority design.

For example,how about the biggest boss,of course he/she does not belong to any departments,but he have the biggest authority.

Anyone can do me a favor?

BTW,I will use the hibernate as the DAO and the struts2 as the web controller.


Change your Boss class to Person then add a @ManyToOne Person superior(assuming every employee has only one superior above).

@ManyToMany List<Person> superiorList=new ArrayList<Person>() if there are more than one superiors for each employee;

If a person is a boos(the highest authority in the organization tree) , superior or superiorList will be empty.

For roles

Create a role class

Role 
@OneToMany List<Task> taskList = new ArrayList<Task>();
role_code

put many to one role in Person class if one person can assign to only one role

@ManyToOne Role role

or

@ManyToMany List<Role> roleList

if a person can be assigned many roles.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜