KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > approval > ApprovalDataVO


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 package org.ejbca.core.model.approval;
14
15 import java.io.Serializable JavaDoc;
16 import java.util.Collection JavaDoc;
17 import java.util.Date JavaDoc;
18
19 import org.ejbca.core.model.SecConst;
20
21
22
23 /**
24  * Value Object containing all the information about an approval
25  * such as approvalid, approvaltype, endentityprofileid, caid,
26  * reqadmincertissuerdn, reqadmincertsn, status, approvals (Collection),
27  * requestdata, requestdate, expiredate, remainingapprovals
28  *
29  * @author Philip Vendil
30  * @version $Id: ApprovalDataVO.java,v 1.4 2006/09/27 09:28:26 herrvendil Exp $
31  */

32
33 public class ApprovalDataVO implements Serializable JavaDoc {
34
35     private static final long serialVersionUID = -1L;
36     
37     // Status constants
38
public static final int STATUS_WAITINGFORAPPROVAL = -1;
39     public static final int STATUS_APPROVED = 0;
40     public static final int STATUS_REJECTED = -2;
41     public static final int STATUS_EXPIRED = -3;
42     public static final int STATUS_EXPIREDANDNOTIFIED = -4; // Used to mark that the requestor havebee notified that the request havebeen expired.
43
public static final int STATUS_EXECUTED = -5;
44     public static final int STATUS_EXECUTIONFAILED = -6;
45     public static final int STATUS_EXECUTIONDENIED = -7;
46     
47     
48     // Approval types
49

50     public static final int APPROVALTYPE_DUMMY = 0;
51     public static final int APPROVALTYPE_VIEWHARDTOKENDATA = 1;
52     public static final int APPROVALTYPE_ADDENDENTITY = 2;
53     public static final int APPROVALTYPE_EDITENDENTITY = 3;
54     public static final int APPROVALTYPE_CHANGESTATUSENDENTITY = 4;
55     public static final int APPROVALTYPE_KEYRECOVERY = 5;
56     
57     //IMPORTANT REMEMBER TO SET THE RESOURCES IN BOTH INTERNAL AND ADMINWEB LANGUAGE FILES
58
public static final String JavaDoc[] APPROVALTYPENAMES = {"DUMMY","APVIEWHARDTOKENDATA","APADDENDENTITY","APEDITENDENTITY",
59                                                       "APCHANGESTATUSENDENTITY", "APKEYRECOVERY"};
60     
61     /**
62      * Used to indicate that the approcal is applicable to any ca.
63      */

64     public static final int ANY_CA = SecConst.ALLCAS;
65     
66     /**
67      * Used to indicate that the approcal is applicable to any end entity profile.
68      */

69     public static final int ANY_ENDENTITYPROFILE = SecConst.PROFILE_NO_PROFILE;
70     
71     
72     private int id = 0;
73     private int approvalId = 0;
74     private int approvalType = 0;
75     private int endEntityProfileiId = 0;
76     private int cAId = 0;
77     private String JavaDoc reqadmincertissuerdn = null;
78     private String JavaDoc reqadmincertsn = null;
79     private int status = 0;
80     private Collection JavaDoc approvals = null;
81     private ApprovalRequest approvalRequest = null;
82     private Date JavaDoc requestDate = null;
83     private Date JavaDoc expireDate = null;
84     private int remainingApprovals = 0;
85     
86     
87     
88     /**
89      * @param id unique row id
90      * @param approvalId Constructed from action data as actiontype, admin, username etc. It should
91      * result in the same approvalid if the admin tries to request the same action twice.
92      * @param approvalType Type of action that should be approved, should be one of ApprovalDataVO.APPROVALTYPE_
93      * constants ex: ApprovalDataVO.APPROVALTYPE_VIEWHARDTOKENDATA
94      * @param endEntityProfileiId For RA specific approval requests should the related end entity profile id be specified
95     * for non ra request should this field be set to ApprovalDataVO.ANY_ENDENTITYPROFILE
96      * @param cAId For CA specific approval requests should the related ca id be specified
97     * for non ca request should this field be set to ApprovalDataVO.ANY_CA
98      * @param reqadmincertissuerdn The issuerdn of the administrator certificate that generated the request.
99      * @param reqadmincertsn The serialnumber of the administrator certificate that generated the request. String in Hex
100      * @param status Should be one of ApprovalDataVO.STATUS_ constants
101      * @param approvals Collection of created Approvals (never null)
102      * @param approvalRequest The ApprovalRequest
103      * @param requestDate Date the request for approval were added
104      * @param expireDate Date the request for action or the approvel action will expire, Long.MAX_VALUE
105      * means that the request/approval never expires
106      * @param remainingApprovals Indicates the number of approvals that remains in order to execute the action.
107      */

108     public ApprovalDataVO(int id, int approvalId, int approvalType, int endEntityProfileiId, int cAId, String JavaDoc reqadmincertissuerdn, String JavaDoc reqadmincertsn, int status, Collection JavaDoc approvals, ApprovalRequest approvalRequest, Date JavaDoc requestDate, Date JavaDoc expireDate, int remainingApprovals) {
109         super();
110         this.id = id;
111         this.approvalId = approvalId;
112         this.approvalType = approvalType;
113         this.endEntityProfileiId = endEntityProfileiId;
114         this.cAId = cAId;
115         this.reqadmincertissuerdn = reqadmincertissuerdn;
116         this.reqadmincertsn = reqadmincertsn;
117         this.status = status;
118         this.approvals = approvals;
119         this.approvalRequest = approvalRequest;
120         this.requestDate = requestDate;
121         this.expireDate = expireDate;
122         this.remainingApprovals = remainingApprovals;
123     }
124     /**
125      * Constructed from action data as actiontype, admin, username etc. It should
126      * result in the same approvalid if the admin tries to request the same action twice.
127      *
128      * @return Returns the approvalId.
129      */

130     public int getApprovalId() {
131         return approvalId;
132     }
133     /**
134      * The ApprovalRequest
135      *
136      * @return Returns the approvalRequest.
137      */

138     public ApprovalRequest getApprovalRequest() {
139         return approvalRequest;
140     }
141     
142     /**
143      * Collection of created Approvals (never null)
144      *
145      * @return Returns the approvals.
146      */

147     public Collection JavaDoc getApprovals() {
148         return approvals;
149     }
150     
151     /**
152      * Type of action that should be approved, should be one of ApprovalDataVO.APPROVALTYPE_
153      * constants ex: ApprovalDataVO.APPROVALTYPE_VIEWHARDTOKENDATA
154      *
155      * @return Returns the approvalType.
156      */

157     public int getApprovalType() {
158         return approvalType;
159     }
160     
161     /**
162      * For CA specific approval requests should the related ca id be specified
163      * for non ca request should this field be set to ApprovalDataVO.ANY_CA
164      *
165      * @return Returns the cAId.
166      */

167     public int getCAId() {
168         return cAId;
169     }
170     
171     /**
172      * For RA specific approval requests should the related end entity profile id be specified
173      * for non ra request should this field be set to ApprovalDataVO.ANY_ENDENTITYPROFILE
174      *
175      * @return Returns the endEntityProfileiId.
176      */

177     public int getEndEntityProfileiId() {
178         return endEntityProfileiId;
179     }
180     
181     /**
182      * Date the request for action or the approvel action will expire, Long.MAX_VALUE
183      * means that the request/approval never expires
184      *
185      * @return Returns the expireDate.
186      */

187     public Date JavaDoc getExpireDate() {
188         return expireDate;
189     }
190     
191     /**
192      * @return Returns the id.
193      */

194     public int getId() {
195         return id;
196     }
197     
198     /**
199      * Indicates the number of approvals that remains in order to execute the action
200      * @return Returns the remainingApprovals.
201      */

202     public int getRemainingApprovals() {
203         return remainingApprovals;
204     }
205     
206     /**
207      * The issuerdn of the administrator certificate that generated the request.
208      *
209      * @return Returns the reqadmincertissuerdn.
210      */

211     public String JavaDoc getReqadmincertissuerdn() {
212         return reqadmincertissuerdn;
213     }
214     
215     /**
216      * The serialnumber of the administrator certificate that generated the request. String in Hex
217      *
218      * @return Returns the reqadmincertsn.
219      */

220     public String JavaDoc getReqadmincertsn() {
221         return reqadmincertsn;
222     }
223     
224     /**
225      * Date the request for approval were added
226      *
227      * @return Returns the requestDate.
228      */

229     public Date JavaDoc getRequestDate() {
230         return requestDate;
231     }
232     
233     /**
234      * Should be one of ApprovalDataVO.STATUS_ constants
235      *
236      * @return Returns the status.
237      */

238     public int getStatus() {
239         return status;
240     }
241     
242           
243
244
245 }
246
Popular Tags