KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > ejb > ra > raadmin > AdminPreferencesDataBean


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.ra.raadmin;
15
16 import java.util.HashMap JavaDoc;
17
18 import javax.ejb.CreateException JavaDoc;
19
20 import org.apache.log4j.Logger;
21 import org.ejbca.core.ejb.BaseEntityBean;
22 import org.ejbca.core.model.ra.raadmin.AdminPreference;
23
24
25
26
27 /**
28  * Entity bean should not be used directly, use though Session beans. Entity Bean representing
29  * admin preference. Information stored:
30  * <pre>
31  * Id (BigInteger SerialNumber)
32  * AdminPreference
33  * </pre>
34  *
35  * @version $Id: AdminPreferencesDataBean.java,v 1.5 2006/11/10 09:29:34 anatom Exp $
36  *
37  * @ejb.bean description="This enterprise bean entity represents a ra admins user preference."
38  * display-name="AdminPreferencesDataEB"
39  * name="AdminPreferencesData"
40  * jndi-name="AdminPreferencesData"
41  * view-type="local"
42  * type="CMP"
43  * reentrant="False"
44  * cmp-version="2.x"
45  * transaction-type="Container"
46  * schema="AdminPreferencesDataBean"
47  * primkey-field="id"
48  *
49  * @ejb.pk class="java.lang.String"
50  * generate="false"
51  *
52  * @ejb.persistence table-name = "AdminPreferencesData"
53  *
54  * @ejb.transaction type="Required"
55  *
56  * @ejb.home
57  * local-extends="javax.ejb.EJBLocalHome"
58  * local-class="org.ejbca.core.ejb.ra.raadmin.AdminPreferencesDataLocalHome"
59  *
60  * @ejb.interface
61  * local-extends="javax.ejb.EJBLocalObject"
62  * local-class="org.ejbca.core.ejb.ra.raadmin.AdminPreferencesDataLocal"
63  *
64  */

65 public abstract class AdminPreferencesDataBean extends BaseEntityBean {
66     private static final Logger log = Logger.getLogger(AdminPreferencesDataBean.class);
67
68     /**
69      * @ejb.pk-field
70      * @ejb.persistence column-name="id"
71      * @ejb.interface-method
72      */

73     public abstract String JavaDoc getId();
74
75     /**
76      */

77     public abstract void setId(String JavaDoc id);
78
79     /**
80      * @ejb.persistence column-name="data"
81      * @weblogic.ora.columntyp@
82      */

83     public abstract HashMap JavaDoc getData();
84     /**
85      */

86     public abstract void setData(HashMap JavaDoc data);
87
88     /**
89      * Method that returns the admin preference and updates it if nessesary.
90      *
91      * @return DOCUMENT ME!
92      * @ejb.interface-method
93      */

94     public AdminPreference getAdminPreference() {
95         AdminPreference returnval = new AdminPreference();
96         returnval.loadData(getData());
97
98         return returnval;
99     }
100
101     /**
102      * Method that saves the admin preference to database.
103      *
104      * @param adminpreference DOCUMENT ME!
105      * @ejb.interface-method
106      */

107     public void setAdminPreference(AdminPreference adminpreference) {
108         setData((HashMap JavaDoc) adminpreference.saveData());
109     }
110
111     //
112
// Fields required by Container
113
//
114

115     /**
116      * Entity Bean holding data of admin preferences.
117      *
118      * @param id the serialnumber.
119      * @param adminpreference is the AdminPreference.
120      *
121      * @return the primary key
122      * @ejb.create-method
123      */

124     public String JavaDoc ejbCreate(String JavaDoc id, AdminPreference adminpreference)
125         throws CreateException JavaDoc {
126         setId(id);
127         setAdminPreference(adminpreference);
128
129         log.debug("Created admin preference " + id);
130
131         return id;
132     }
133
134     /**
135      * DOCUMENT ME!
136      *
137      * @param id DOCUMENT ME!
138      * @param adminpreference DOCUMENT ME!
139      */

140     public void ejbPostCreate(String JavaDoc id, AdminPreference adminpreference) {
141         // Do nothing. Required.
142
}
143 }
144
Popular Tags