KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > ejb > authorization > AdminEntityDataBean


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.authorization;
15
16 import javax.ejb.CreateException JavaDoc;
17 import org.apache.log4j.Logger;
18 import org.ejbca.core.ejb.BaseEntityBean;
19 import org.ejbca.core.model.authorization.AdminEntity;
20
21
22 /** Entity bean should not be used directly, use though Session beans.
23  *
24  * Entity Bean representing a admin entity in EJBCA authorization module
25  * Information stored:
26  * <pre>
27  * matchwith
28  * matchtype
29  * matchvalue
30  * </pre>
31  *
32  * @ejb.bean
33  * description="This enterprise bean entity represents a user entity"
34  * display-name="AdminEntityDataEB"
35  * name="AdminEntityData"
36  * jndi-name="AdminEntityData"
37  * view-type="local"
38  * type="CMP"
39  * reentrant="False"
40  * cmp-version="2.x"
41  * transaction-type="Container"
42  * schema="AdminEntityDataBean"
43  *
44  * @ejb.pk
45  * generate="false"
46  * class="org.ejbca.core.ejb.authorization.AdminEntityPK"
47  * extends="java.lang.Object"
48  * implements="java.io.Serializable"
49  *
50  * @ejb.persistence table-name = "AdminEntityData"
51  *
52  * @ejb.transaction type="Required"
53  *
54  * @ejb.home
55  * generate="local"
56  * local-extends="javax.ejb.EJBLocalHome"
57  * local-class="org.ejbca.core.ejb.authorization.AdminEntityDataLocalHome"
58  *
59  * @ejb.interface
60  * generate="local"
61  * local-extends="javax.ejb.EJBLocalObject"
62  * local-class="org.ejbca.core.ejb.authorization.AdminEntityDataLocal"
63  *
64  */

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

73     public abstract int getPrimKey();
74
75     /**
76      */

77     public abstract void setPrimKey(int primKey);
78
79     /**
80      * @ejb.persistence column-name="matchWith"
81      * @ejb.interface-method view-type="local"
82      */

83     public abstract int getMatchWith();
84
85     /**
86      * @ejb.persistence column-name="matchType"
87      * @ejb.interface-method view-type="local"
88      */

89     public abstract int getMatchType();
90
91     /**
92      * @ejb.persistence column-name="matchValue"
93      * @ejb.interface-method view-type="local"
94      */

95     public abstract String JavaDoc getMatchValue();
96
97     /**
98      */

99     public abstract void setMatchWith(int matchwith);
100
101     /**
102      */

103     public abstract void setMatchType(int matchtype);
104
105     /**
106      */

107     public abstract void setMatchValue(String JavaDoc matchvalue);
108
109
110     /**
111      * @ejb.interface-method view-type="local"
112      */

113     public AdminEntity getAdminEntity(int caid){
114       return new AdminEntity(getMatchWith(), getMatchType(), getMatchValue(), caid);
115     }
116
117
118     /**
119      *
120      * @ejb.create-method
121      */

122     public AdminEntityPK ejbCreate(String JavaDoc admingroupname, int caid, int matchwith, int matchtype, String JavaDoc matchvalue) throws CreateException JavaDoc {
123         AdminEntityPK ret = new AdminEntityPK(admingroupname, caid, matchwith, matchtype, matchvalue);
124         setPrimKey(ret.primKey);
125         setMatchWith(matchwith);
126         setMatchType(matchtype);
127         setMatchValue(matchvalue);
128         log.debug("Created admin entity "+ matchvalue);
129         return ret;
130     }
131
132     public void ejbPostCreate(String JavaDoc admingroupname, int caid, int matchwith, int matchtype, String JavaDoc matchvalue) {
133         // Do nothing. Required.
134
}
135 }
136
Popular Tags