KickJava   Java API By Example, From Geeks To Geeks.

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


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.EndEntityProfile;
23
24
25
26
27 /**
28  * Entity bean should not be used directly, use though Session beans. Entity Bean representing a
29  * end entity profile in the ra. Information stored:
30  * <pre>
31  * id (Primary key)
32  * Profile name
33  * Profile data
34  * </pre>
35  *
36  * @version $Id: EndEntityProfileDataBean.java,v 1.4 2006/11/10 09:29:34 anatom Exp $
37  *
38  * @ejb.bean description="This enterprise bean entity represents a profile"
39  * display-name="EndEntityProfileDataEB"
40  * name="EndEntityProfileData"
41  * jndi-name="EndEntityProfileData"
42  * view-type="local"
43  * type="CMP"
44  * reentrant="False"
45  * cmp-version="2.x"
46  * transaction-type="Container"
47  * schema="EndEntityProfileDataBean"
48  * primkey-field="id"
49  *
50  * @ejb.pk class="java.lang.Integer"
51  * generate="false"
52  *
53  * @ejb.persistence table-name = "EndEntityProfileData"
54  *
55  * @ejb.transaction type="Required"
56  *
57  * @ejb.home
58  * local-extends="javax.ejb.EJBLocalHome"
59  * local-class="org.ejbca.core.ejb.ra.raadmin.EndEntityProfileDataLocalHome"
60  *
61  * @ejb.interface
62  * local-extends="javax.ejb.EJBLocalObject"
63  * local-class="org.ejbca.core.ejb.ra.raadmin.EndEntityProfileDataLocal"
64  *
65 * @ejb.finder
66  * description="findByProfileName"
67  * signature="org.ejbca.core.ejb.ra.raadmin.EndEntityProfileDataLocal findByProfileName(java.lang.String name)"
68  * query="SELECT OBJECT(a) from EndEntityProfileDataBean a WHERE a.profileName=?1"
69  *
70  * @ejb.finder
71  * description="findAll"
72  * signature="java.util.Collection findAll()"
73  * query="SELECT OBJECT(a) from EndEntityProfileDataBean a"
74  */

75 public abstract class EndEntityProfileDataBean extends BaseEntityBean implements java.io.Serializable JavaDoc {
76     private static final Logger log = Logger.getLogger(EndEntityProfileDataBean.class);
77
78     /**
79      * @ejb.pk-field
80      * @ejb.persistence column-name="id"
81      * @ejb.interface-method
82      */

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

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

93     public abstract String JavaDoc getProfileName();
94
95     /**
96      * @ejb.interface-method
97      */

98     public abstract void setProfileName(String JavaDoc profilename);
99
100     /**
101      * @ejb.persistence column-name="data"
102      * @weblogic.ora.columntyp@
103      */

104     public abstract HashMap JavaDoc getData();
105
106     /**
107      */

108     public abstract void setData(HashMap JavaDoc data);
109
110     /**
111      * Method that returns the end entity profiles and updates it if nessesary.
112      *
113      * @return DOCUMENT ME!
114      * @ejb.interface-method
115      */

116     public EndEntityProfile getProfile() {
117         EndEntityProfile returnval = new EndEntityProfile();
118         returnval.loadData(getData());
119
120         return returnval;
121     }
122
123     /**
124      * Method that saves the admin preference to database.
125      *
126      * @param profile DOCUMENT ME!
127      * @ejb.interface-method
128      */

129     public void setProfile(EndEntityProfile profile) {
130         setData((HashMap JavaDoc) profile.saveData());
131     }
132
133     //
134
// Fields required by Container
135
//
136

137     /**
138      * Entity Bean holding data of a end entity profile.
139      *
140      * @param profilename DOCUMENT ME!
141      * @param profilename
142      * @param profile is the EndEntityProfile.
143      *
144      * @return null
145      * @ejb.create-method
146      */

147     public Integer JavaDoc ejbCreate(Integer JavaDoc id, String JavaDoc profilename, EndEntityProfile profile)
148         throws CreateException JavaDoc {
149         setId(id);
150         setProfileName(profilename);
151         setProfile(profile);
152         log.debug("Created profile " + profilename);
153
154         return id;
155     }
156
157     /**
158      * DOCUMENT ME!
159      *
160      * @param id DOCUMENT ME!
161      * @param profilename DOCUMENT ME!
162      * @param profile DOCUMENT ME!
163      */

164     public void ejbPostCreate(Integer JavaDoc id, String JavaDoc profilename, EndEntityProfile profile) {
165         // Do nothing. Required.
166
}
167 }
168
Popular Tags