KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > messenger > audit > AuditEvent


1 /**
2  * $RCSfile: AuditEvent.java,v $
3  * $Revision: 1.1 $
4  * $Date: 2004/10/21 06:08:42 $
5  *
6  * Copyright (C) 2004 Jive Software. All rights reserved.
7  *
8  * This software is published under the terms of the GNU Public License (GPL),
9  * a copy of which is included in this distribution.
10  */

11
12 package org.jivesoftware.messenger.audit;
13
14 import org.jivesoftware.messenger.Session;
15 import java.util.Date JavaDoc;
16
17 /**
18  * Defines the known event types used with audits on arbitrary
19  * data/events.
20  *
21  * @author Iain Shigeoka
22  */

23 public class AuditEvent {
24
25     /**
26      * All user generated codes must be equal to or greater than this constant
27      * to avoid clashing with Jive Messenger event codes.
28      */

29     public static final int USER_CODES = 100;
30
31     private Session session;
32     private Date JavaDoc time;
33     private int code;
34     private int reason;
35     private String JavaDoc data;
36
37     /**
38      * Create a new audit event.
39      *
40      * @param eventSession the session that triggered the event or null
41      * if no session is associated with this event.
42      * @param timestamp the date/time the event occured.
43      * @param eventCode a code indicating the type of event that occured.
44      * @param eventReason a second code indicating more details about the event type.
45      * @param eventData arbitrary string data associated with the event or null.
46      */

47     public AuditEvent(Session eventSession, Date JavaDoc timestamp, int eventCode, int eventReason,
48             String JavaDoc eventData)
49     {
50         this.session = eventSession;
51         this.time = timestamp;
52         this.code = eventCode;
53         this.reason = eventReason;
54         this.data = eventData;
55     }
56
57     /**
58      * Obtain the primary type of event.
59      *
60      * @return the code indicating the event's type.
61      */

62     public int getCode() {
63         return code;
64     }
65
66     /**
67      * Set the primary type of event.
68      *
69      * @param code the code indicating the event's type.
70      */

71     public void setCode(int code) {
72         this.code = code;
73     }
74
75     /**
76      * Obtain the data associated with the event.
77      *
78      * @return the data associated with the event
79      */

80     public String JavaDoc getData() {
81         return data;
82     }
83
84     /**
85      * Set the data associated with the event.
86      *
87      * @param data the data associated with the event.
88      */

89     public void setData(String JavaDoc data) {
90         this.data = data;
91     }
92
93     /**
94      * Obtain the subtype of event.
95      *
96      * @return the code indicating the event's subtype
97      */

98     public int getReason() {
99         return reason;
100     }
101
102     /**
103      * Set the subtype of event.
104      *
105      * @param reason the code indicating the event's subtype.
106      */

107     public void setReason(int reason) {
108         this.reason = reason;
109     }
110
111     /**
112      * Obtain the session associated with the event.
113      *
114      * @return the session associated with the event.
115      */

116     public Session getSession() {
117         return session;
118     }
119
120     /**
121      * Set the session associated with the event.
122      *
123      * @param session the session associated with the event.
124      */

125     public void setSession(Session session) {
126         this.session = session;
127     }
128
129     /**
130      * Obtain the timestamp of when the event occured.
131      *
132      * @return the time the event occured.
133      */

134     public Date JavaDoc getTimestamp() {
135         return time;
136     }
137
138     /**
139      * Set the timestamp of when the event occured.
140      *
141      * @param time the time the event occured.
142      */

143     public void setTimestamp(Date JavaDoc time) {
144         this.time = time;
145     }
146 }
Popular Tags