KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.jbpm.identity;
2
3 import java.io.*;
4 import java.security.*;
5 import java.util.*;
6
7 /**
8  * common supertype for users, groups and memberships
9  * that manages the name and permissions.
10  */

11 public class Entity implements Serializable {
12
13   private static final long serialVersionUID = 1L;
14   
15   long id = 0;
16   protected String JavaDoc name = null;
17   /* permissions is a set of java.security.Permission's */
18   protected Set permissions = null;
19   
20   // constructors /////////////////////////////////////////////////////////////
21

22   public Entity() {
23   }
24
25   public Entity(String JavaDoc name) {
26     this.name = name;
27   }
28
29   public Entity(String JavaDoc name, Set permissions) {
30     this.name = name;
31     this.permissions = permissions;
32   }
33   
34   // permissions //////////////////////////////////////////////////////////////
35

36   public void addPermission(Permission permission) {
37     if (permissions==null) permissions = new HashSet();
38     permissions.add(permission);
39   }
40   public Set getPermissions() {
41     return permissions;
42   }
43   public void removePermission(Permission permission) {
44     if (permissions!=null) {
45       permissions.remove(permission);
46     }
47   }
48
49   // getters //////////////////////////////////////////////////////////////////
50

51   public long getId() {
52     return id;
53   }
54   public String JavaDoc getName() {
55     return name;
56   }
57 }
58
Popular Tags