KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

20     // Attributes
21

22     /**
23      * The name of the action.
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 action data.
34      */

35     protected Action (ActionDBData 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 ActionFactory.getInstance();
55     }
56
57     /**
58      * Returns the name of the action.
59      *
60      * @return the name of the action.
61      */

62     public final String JavaDoc getName ()
63     {
64         return name;
65     }
66
67     /**
68      * Assigns the name of the action.
69      *
70      * @param name the name of the action.
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 events.
80      *
81      * @return all associated events.
82      * @exception com.teamkonzept.lib.TKException if an error occured during event retrieval.
83      */

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

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

108     public final void removeEvent (Event event)
109         throws TKException
110     {
111         super.removeAssociation(event);
112     }
113
114     /**
115      * Removes the associations with all events.
116      *
117      * @exception com.teamkonzept.lib.TKException if an error occured during event retrieval.
118      */

119     public final void removeEvents ()
120         throws TKException
121     {
122         super.removeAssociations();
123     }
124
125     /**
126      * Checks wether there is an association with the given event.
127      *
128      * @param event the event.
129      * @return <CODE>true</CODE> if there is an association with the
130      * given event, otherwise <CODE>false</CODE>.
131      * @exception com.teamkonzept.lib.TKException if an error occured during event retrieval.
132      */

133     public final boolean hasEvent (Event event)
134         throws TKException
135     {
136         return super.containsAssociation(event);
137     }
138
139     /**
140      * Returns all tasks referencing the action.
141      *
142      * @return all tasks referencing the action.
143      * @exception com.teamkonzept.lib.TKException if an error occured during task retrieval.
144      */

145     public final TKVector getTasks ()
146         throws TKException
147     {
148         return TaskFactory.getInstance().getTasks(this);
149     }
150
151 }
152
Popular Tags