KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > ejb > log > LogEntryDataBean


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13
14 package org.ejbca.core.ejb.log;
15
16
17 import javax.ejb.CreateException JavaDoc;
18
19 import org.ejbca.core.ejb.BaseEntityBean;
20 import org.ejbca.core.model.log.LogEntry;
21 import org.ejbca.util.StringTools;
22
23
24 import java.util.Date JavaDoc;
25
26 /** Entity bean should not be used directly, use though Session beans.
27  *
28  * Entity Bean representing a log entry in the log database.
29  * Information stored:
30  * <pre>
31  * id (Primary Key)
32  * admintype is pricipally the type of data stored in the admindata field, should be one of org.ejbca.core.model.log.Admin.TYPE_ constants.
33  * admindata is the data identifying the administrator, should be certificate snr or ip-address when no certificate could be retrieved.
34  * time is the time the event occured.
35  * username the name of the user involved or null if no user is involved.
36  * certificate the certificate involved in the event or null if no certificate is involved.
37  * event is id of the event, should be one of the org.ejbca.core.model.log.LogEntry.EVENT_ constants.
38  * comment an optional comment of the event.
39  * </pre>
40  *
41  * @ejb.bean
42  * description="This enterprise bean entity represents a Log Entry with accompanying data"
43  * display-name="LogEntryDataEB"
44  * name="LogEntryData"
45  * jndi-name="LogEntryData"
46  * view-type="local"
47  * type="CMP"
48  * reentrant="False"
49  * cmp-version="2.x"
50  * transaction-type="Container"
51  * schema="LogEntryDataBean"
52  * primkey-field="id"
53  *
54  * @ejb.pk
55  * generate="false"
56  * class="java.lang.Integer"
57  *
58  * @ejb.persistence table-name = "LogEntryData"
59  *
60  * @ejb.home
61  * generate="local"
62  * local-extends="javax.ejb.EJBLocalHome"
63  * local-class="org.ejbca.core.ejb.log.LogEntryDataLocalHome"
64  *
65  * @ejb.interface
66  * generate="local"
67  * local-extends="javax.ejb.EJBLocalObject"
68  * local-class="org.ejbca.core.ejb.log.LogEntryDataLocal"
69  *
70  * @ejb.transaction type="Required"
71  *
72  * @jonas.jdbc-mapping
73  * jndi-name="${datasource.jndi-name}"
74  *
75  * @version $Id: LogEntryDataBean.java,v 1.7 2006/11/10 09:29:11 anatom Exp $
76  */

77 public abstract class LogEntryDataBean extends BaseEntityBean {
78
79     /**
80      * @ejb.pk-field
81      * @ejb.persistence column-name="id"
82      * @ejb.interface-method view-type="local"
83      */

84     public abstract Integer JavaDoc getId();
85
86     /**
87      */

88     public abstract void setId(Integer JavaDoc id);
89
90     /**
91      * @ejb.persistence column-name="adminType"
92      * @ejb.interface-method view-type="local"
93      */

94     public abstract int getAdminType();
95
96     /**
97      */

98     public abstract void setAdminType(int admintype);
99
100     /**
101      * @ejb.persistence column-name="adminData"
102      * @ejb.interface-method view-type="local"
103      */

104     public abstract String JavaDoc getAdminData();
105
106     /**
107      */

108     public abstract void setAdminData(String JavaDoc admindata);
109
110     /** The id of the CA performing the event.
111      * @ejb.persistence column-name="caId"
112      * @ejb.interface-method view-type="local"
113      */

114     public abstract int getCaId();
115
116     /**
117      */

118     public abstract void setCaId(int caid);
119
120     /** Indicates the module (CA,RA ...) using the logsession bean.
121      * @ejb.persistence column-name="module"
122      * @ejb.interface-method view-type="local"
123      */

124     public abstract int getModule();
125
126     /**
127      */

128     public abstract void setModule(int module);
129
130     /**
131      * @ejb.persistence column-name="time"
132      */

133     public abstract long getTime();
134
135     /**
136      */

137     public abstract void setTime(long time);
138
139     /**
140      * @ejb.persistence column-name="username"
141      * @ejb.interface-method view-type="local"
142      */

143     public abstract String JavaDoc getUsername();
144
145     /** username must be called 'stripped' using StringTools.strip()
146      */

147     public abstract void setUsername(String JavaDoc username);
148
149     /**
150      * @ejb.persistence column-name="certificateSNR"
151      * @ejb.interface-method view-type="local"
152      */

153     public abstract String JavaDoc getCertificateSNR();
154
155     /**
156      */

157     public abstract void setCertificateSNR(String JavaDoc certificatesnr);
158
159     /**
160      * @ejb.persistence column-name="event"
161      * @ejb.interface-method view-type="local"
162      */

163     public abstract int getEvent();
164
165     /**
166      */

167     public abstract void setEvent(int event);
168
169     /**
170      * If you are using Weblogic and Oracle add:
171      * column-name="comment_"
172      * to the end of the ejb persistense line.
173      *
174      * The column-name is normally comment, but comment_ for oracle.
175      * @ejb.persistence column-name="@database.comment.column@"
176      * @ejb.interface-method view-type="local"
177      */

178     public abstract String JavaDoc getComment();
179
180     /**
181      */

182     public abstract void setComment(String JavaDoc comment);
183
184     /**
185      * @ejb.interface-method view-type="local"
186      */

187     public Date JavaDoc getTimeAsDate() {
188         return new Date JavaDoc(getTime());
189     }
190
191     /**
192      * DOCUMENT ME!
193      *
194      * @return DOCUMENT ME!
195      */

196     public LogEntry getLogEntry() {
197         return new LogEntry(getId().intValue(), getAdminType(), getAdminData(), getCaId(), getModule(), getTimeAsDate(), getUsername(), getCertificateSNR(), getEvent(), getComment());
198     }
199
200     /**
201      *
202      * @ejb.create-method view-type="local"
203      */

204     public Integer JavaDoc ejbCreate(Integer JavaDoc id, int admintype, String JavaDoc admindata, int caid, int module, Date JavaDoc time, String JavaDoc username, String JavaDoc certificatesnr, int event, String JavaDoc comment) throws CreateException JavaDoc {
205         setId(id);
206         setAdminType(admintype);
207         setAdminData(admindata);
208         setCaId(caid);
209         setModule(module);
210         setTime(time.getTime());
211         setUsername(StringTools.strip(username));
212         setCertificateSNR(certificatesnr);
213         setEvent(event);
214         setComment(comment);
215         return null;
216     }
217
218     /**
219      */

220     public void ejbPostCreate(Integer JavaDoc id, int admintype, String JavaDoc admindata, int caid, int module, Date JavaDoc time, String JavaDoc username, String JavaDoc certificatesnr, int event, String JavaDoc comment) {
221 // Do nothing. Required.
222
}
223 }
224
225
Popular Tags