KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > acl > Role


1 package de.webman.acl;
2
3 import com.teamkonzept.lib.TKException;
4 import com.teamkonzept.lib.TKVector;
5 import de.webman.acl.db.RoleDBData;
6
7 /**
8  * A role groups one ore more tasks into a logical unit.
9  *
10  * @version 1.0
11  * @since 1.0
12  * @author © 2001 Webman AG
13  */

14 public class Role
15     extends WMObject
16 {
17
18     // $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/Role.java,v 1.1 2001/08/20 08:25:07 mischa Exp $
19

20     // Attributes
21

22     /**
23      * The name of the role.
24      */

25     private String JavaDoc name = null;
26
27
28     // Constructors
29

30     /**
31      * Provide instantion only to package classes or subclasses.
32      *
33      * @param data the initial role data.
34      */

35     protected Role (RoleDBData data)
36     {
37         super(data);
38
39         this.name = data.getName();
40     }
41
42
43     // Method implementations
44

45     /**
46      * Returns the factory of the object.
47      *
48      * @return the factory of the object.
49      * @exception com.teamkonzept.lib.TKException if an error occured during factory retrieval.
50      */

51     public final ObjectFactory getFactory ()
52         throws TKException
53     {
54         return RoleFactory.getInstance();
55     }
56
57     /**
58      * Returns the name of the role.
59      *
60      * @return the name of the role.
61      */

62     public final String JavaDoc getName ()
63     {
64         return name;
65     }
66
67     /**
68      * Assigns the name of the role.
69      *
70      * @param name the name of the role.
71      */

72     public final void setName (String JavaDoc name)
73     {
74         super.modifyAttribute(this.name, name);
75         this.name = name;
76     }
77
78     /**
79      * Returns all associated tasks.
80      *
81      * @return all associated tasks.
82      * @exception com.teamkonzept.lib.TKException if an error occured during task retrieval.
83      */

84     public final TKVector getTasks ()
85         throws TKException
86     {
87         return TaskFactory.getInstance().getObjects(super.getAssociations());
88     }
89
90     /**
91      * Adds an association with the given task.
92      *
93      * @param task the task.
94      * @exception com.teamkonzept.lib.TKException if an error occured during task retrieval.
95      */

96     public final void addTask (Task task)
97         throws TKException
98     {
99         super.addAssociation(task);
100     }
101
102     /**
103      * Removes the association with the given task.
104      *
105      * @param task the task.
106      * @exception com.teamkonzept.lib.TKException if an error occured during task retrieval.
107      */

108     public final void removeTask (Task task)
109         throws TKException
110     {
111         super.removeAssociation(task);
112     }
113
114     /**
115      * Checks wether there is an association with the given task.
116      *
117      * @param task the task.
118      * @return <CODE>true</CODE> if there is an association with the
119      * given task, otherwise <CODE>false</CODE>.
120      * @exception com.teamkonzept.lib.TKException if an error occured during task retrieval.
121      */

122     public final boolean hasTask (Task task)
123         throws TKException
124     {
125         return super.containsAssociation(task);
126     }
127
128     /**
129      * Removes the associations with all tasks.
130      *
131      * @exception com.teamkonzept.lib.TKException if an error occured during task retrieval.
132      */

133     public final void removeTasks ()
134         throws TKException
135     {
136         super.removeAssociations();
137     }
138
139 }
140
Popular Tags