KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > ui > web > admin > rainterface > RevokedInfoView


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 /*
15  * RevokedInfoView.java
16  *
17  * Created on den 1 maj 2002, 07:55
18  */

19 package org.ejbca.ui.web.admin.rainterface;
20
21 import java.io.Serializable JavaDoc;
22 import java.math.BigInteger JavaDoc;
23 import java.util.ArrayList JavaDoc;
24 import java.util.Date JavaDoc;
25
26 import org.ejbca.core.model.ca.crl.RevokedCertInfo;
27
28
29
30
31 /**
32  * DOCUMENT ME!
33  *
34  * @author Philip Vendil
35  */

36 public class RevokedInfoView implements Serializable JavaDoc {
37     // Public constants.
38

39     /**
40      * Creates a new instance of RevokedInfoView
41      *
42      * @param revokedcertinfo DOCUMENT ME!
43      */

44     public RevokedInfoView(RevokedCertInfo revokedcertinfo) {
45         this.revokedcertinfo = revokedcertinfo;
46     }
47
48     // Public methods.
49
public String JavaDoc getCertificateSerialNumberAsString() {
50         return this.revokedcertinfo.getUserCertificate().toString(16);
51     }
52
53     /**
54      * DOCUMENT ME!
55      *
56      * @return DOCUMENT ME!
57      */

58     public BigInteger JavaDoc getCertificateSerialNumber() {
59         return this.revokedcertinfo.getUserCertificate();
60     }
61
62     /**
63      * DOCUMENT ME!
64      *
65      * @return DOCUMENT ME!
66      */

67     public Date JavaDoc getRevocationDate() {
68         return this.revokedcertinfo.getRevocationDate();
69     }
70
71     /**
72      * DOCUMENT ME!
73      *
74      * @return DOCUMENT ME!
75      */

76     public String JavaDoc[] getRevokationReasons() {
77         String JavaDoc[] dummy = { "" };
78         ArrayList JavaDoc reasons = new ArrayList JavaDoc();
79         int reason = this.revokedcertinfo.getReason();
80
81         if ((reason >= 0) && (reason < HIGN_REASON_BOUNDRARY)) {
82             // Add this reason.
83
reasons.add(reasontexts[reason]);
84         }
85
86         return (String JavaDoc[]) reasons.toArray(dummy);
87     }
88
89     public boolean isRevoked(){
90         return this.revokedcertinfo.getReason() != RevokedCertInfo.NOT_REVOKED;
91     }
92
93     // Private constants.
94
public static final String JavaDoc[] reasontexts = {
95         "UNSPECIFIED", "KEYCOMPROMISE", "CACOMPROMISE", "AFFILIATIONCHANGED", "SUPERSEDED",
96         "CESSATIONOFOPERATION", "CERTIFICATEHOLD", "UNUSED", "REMOVEFROMCRL", "PRIVILEGESWITHDRAWN",
97         "AACOMPROMISE"
98     };
99     public static final int HIGN_REASON_BOUNDRARY = 11;
100
101     // Private fields.
102
private RevokedCertInfo revokedcertinfo;
103 }
104
Popular Tags