KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > identity > Membership


1 package org.jbpm.identity;
2
3 import java.io.*;
4
5 /**
6  * one association between user and a group.
7  * The name of the membership represents the role-name that
8  * the user fullfills in the group.
9  * A membership can be a position in an organisation, therefor
10  * permissions can be associated with a membership.
11  * The name of the membership can be used as the role name. Meaning
12  * which role does the user fullfill in the group.
13  */

14 public class Membership extends Entity implements Serializable {
15   
16   private static final long serialVersionUID = 1L;
17
18   protected String JavaDoc role = null;
19   protected User user = null;
20   protected Group group = null;
21   
22   // constructors /////////////////////////////////////////////////////////////
23

24   public Membership() {
25   }
26
27   public static Membership create(User user, String JavaDoc name, Group group) {
28     Membership membership = create(user, group);
29     membership.name = name;
30     return membership;
31   }
32
33   public static Membership create(User user, Group group) {
34     Membership membership = new Membership();
35     user.addMembership(membership);
36     group.addMembership(membership);
37     return membership;
38   }
39
40   // setters //////////////////////////////////////////////////////////////////
41
public void setUser(User user) {
42     this.user = user;
43   }
44   public void setGroup(Group group) {
45     this.group = group;
46   }
47
48   // getters //////////////////////////////////////////////////////////////////
49

50   public long getId() {
51     return id;
52   }
53   public Group getGroup() {
54     return group;
55   }
56   public User getUser() {
57     return user;
58   }
59   public String JavaDoc getRole() {
60     return role;
61   }
62   public void setRole(String JavaDoc role) {
63     this.role = role;
64   }
65 }
66
Popular Tags