Source Code Cross Referenced for Approval.java in  » Authentication-Authorization » ejbca » org » ejbca » core » model » approval » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Authentication Authorization » ejbca » org.ejbca.core.model.approval 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*************************************************************************
002:         *                                                                       *
003:         *  EJBCA: The OpenSource Certificate Authority                          *
004:         *                                                                       *
005:         *  This software is free software; you can redistribute it and/or       *
006:         *  modify it under the terms of the GNU Lesser General Public           *
007:         *  License as published by the Free Software Foundation; either         *
008:         *  version 2.1 of the License, or any later version.                    *
009:         *                                                                       *
010:         *  See terms of license at gnu.org.                                     *
011:         *                                                                       *
012:         *************************************************************************/package org.ejbca.core.model.approval;
013:
014:        import java.io.Externalizable;
015:        import java.io.IOException;
016:        import java.io.ObjectInput;
017:        import java.io.ObjectOutput;
018:        import java.math.BigInteger;
019:        import java.security.cert.X509Certificate;
020:        import java.util.Date;
021:
022:        import org.ejbca.util.CertTools;
023:
024:        /**
025:         * Class representing one approval of a request data. 
026:         * Includes information like:
027:         * Approval admin certificate
028:         * isApproved (rejected otherwise)
029:         * ApprovalDate
030:         * Comment
031:         *  
032:         * 
033:         * Approvals is sorted by dates.
034:         * 
035:         * @author Philip Vendil
036:         * @version $Id: Approval.java,v 1.2 2006/07/30 18:19:02 herrvendil Exp $
037:         */
038:
039:        public class Approval implements  Comparable, Externalizable {
040:
041:            private static final long serialVersionUID = -1L;
042:
043:            private static final int LATEST_VERSION = 1;
044:
045:            private String adminCertIssuerDN = null;
046:            private String adminCertSerialNumber = null;
047:            private boolean approved = false;
048:            private Date approvalDate = null;
049:            private String comment = null;
050:            private String approvalSignature = null;
051:            private String username = null;
052:
053:            /**
054:             * @param approved
055:             * @param apDate
056:             * @param comment
057:             */
058:            public Approval(String comment) {
059:                super ();
060:                this .approvalDate = new Date();
061:                this .comment = comment;
062:            }
063:
064:            /**
065:             * Constuctor used in externaliziation only
066:             */
067:            public Approval() {
068:            }
069:
070:            /**
071:             * @return Returns the adminCertIssuerDN.
072:             */
073:            public String getAdminCertIssuerDN() {
074:                return adminCertIssuerDN;
075:            }
076:
077:            /**
078:             * @return Returns the adminCertSerialNumber.
079:             */
080:            public BigInteger getAdminCertSerialNumber() {
081:                return new BigInteger(adminCertSerialNumber, 16);
082:            }
083:
084:            /**
085:             * @return Returns the approvalDate.
086:             */
087:            public Date getApprovalDate() {
088:                return approvalDate;
089:            }
090:
091:            /**
092:             * @return Returns the approved.
093:             */
094:            public boolean isApproved() {
095:                return approved;
096:            }
097:
098:            /**
099:             * @return Returns the comment.
100:             */
101:            public String getComment() {
102:                return comment;
103:            }
104:
105:            /**
106:             * @return Returns the username of the approving administrator
107:             */
108:            public String getUsername() {
109:                return username;
110:            }
111:
112:            /**
113:             * The cert and username of the approving administrator. Should only be set
114:             * by the ApprovalSessionBean
115:             * 
116:             * 
117:             */
118:            public void setApprovalCertificateAndUsername(boolean approved,
119:                    X509Certificate approvalAdminCert, String username) {
120:                this .approved = approved;
121:                this .adminCertSerialNumber = approvalAdminCert
122:                        .getSerialNumber().toString(16);
123:                this .adminCertIssuerDN = CertTools
124:                        .getIssuerDN(approvalAdminCert);
125:                this .username = username;
126:            }
127:
128:            /**
129:             * Sort by approval date
130:             */
131:            public int compareTo(Object arg0) {
132:                return approvalDate.compareTo(((Approval) arg0).approvalDate);
133:            }
134:
135:            public void writeExternal(ObjectOutput out) throws IOException {
136:                out.writeInt(LATEST_VERSION);
137:                out.writeObject(this .adminCertIssuerDN);
138:                out.writeObject(this .adminCertSerialNumber);
139:                out.writeBoolean(this .approved);
140:                out.writeObject(this .approvalDate);
141:                out.writeObject(this .comment);
142:                out.writeObject(this .approvalSignature);
143:                out.writeObject(this .username);
144:            }
145:
146:            public void readExternal(ObjectInput in) throws IOException,
147:                    ClassNotFoundException {
148:
149:                int version = in.readInt();
150:                if (version == 1) {
151:                    this .adminCertIssuerDN = (String) in.readObject();
152:                    this .adminCertSerialNumber = (String) in.readObject();
153:                    this .approved = in.readBoolean();
154:                    this .approvalDate = (Date) in.readObject();
155:                    this .comment = (String) in.readObject();
156:                    this .approvalSignature = (String) in.readObject();
157:                    this .username = (String) in.readObject();
158:                }
159:
160:            }
161:
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.