KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > se > anatom > ejbca > common > UserDataVO


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 se.anatom.ejbca.common;
15
16 import java.io.Serializable JavaDoc;
17 import java.util.Date JavaDoc;
18
19 import org.ejbca.core.model.SecConst;
20 import org.ejbca.core.model.ra.ExtendedInformation;
21 import org.ejbca.util.StringTools;
22
23
24 /**
25  * TODO: remove this whole class method for EJBCA 3.3.
26  *
27  * Holds admin data collected from UserData in the database.
28  *
29  * @version $Id: UserDataVO.java,v 1.4 2006/01/30 06:30:02 herrvendil Exp $
30  */

31 public class UserDataVO implements Serializable JavaDoc {
32
33     // Public constants
34
public static final int NO_ENDENTITYPROFILE = 0;
35     public static final int NO_CERTIFICATEPROFILE = 0;
36
37
38     private String JavaDoc username;
39     private String JavaDoc subjectDN;
40     private int caid;
41     private String JavaDoc subjectAltName;
42     private String JavaDoc subjectEmail;
43     private String JavaDoc password;
44     private int status;
45     /** Type of user, from SecConst */
46     private int type;
47     private int endentityprofileid;
48     private int certificateprofileid;
49     private Date JavaDoc timecreated;
50     private Date JavaDoc timemodified;
51     private int tokentype;
52     private int hardtokenissuerid;
53     private ExtendedInformation extendedinformation;
54
55     /** Creates new empty UserDataVO */
56     public UserDataVO() {
57     }
58
59     /**
60      * Creates new UserDataVO. All fields are almos required in this constructor. Password must
61      * be set amnually though. This is so you should be sure what you do with the password.
62      *
63      * @param user DOCUMENT ME!
64      * @param dn DOCUMENT ME!
65      * @param subjectaltname DOCUMENT ME!
66      * @param email DOCUMENT ME!
67      * @param status DOCUMENT ME!
68      * @param type DOCUMENT ME!
69      * @param endentityprofileid DOCUMENT ME!
70      * @param certificateprofileid DOCUMENT ME!
71      * @param timecreated DOCUMENT ME!
72      * @param timemodified DOCUMENT ME!
73      * @param tokentype DOCUMENT ME!
74      * @param hardtokenissuerid DOCUMENT ME!
75      */

76     public UserDataVO(String JavaDoc user, String JavaDoc dn, int caid, String JavaDoc subjectaltname, String JavaDoc email, int status, int type, int endentityprofileid, int certificateprofileid,
77                          Date JavaDoc timecreated, Date JavaDoc timemodified, int tokentype, int hardtokenissuerid, ExtendedInformation extendedinfo) {
78         this.username=StringTools.strip(user);
79         this.password=null;
80         this.subjectDN=dn;
81         this.caid=caid;
82         this.subjectAltName=subjectaltname;
83         this.subjectEmail=email;
84         this.status=status;
85         this.type=type;
86         this.endentityprofileid=endentityprofileid;
87         this.certificateprofileid=certificateprofileid;
88         this.timecreated=timecreated;
89         this.timemodified=timemodified;
90         this.tokentype = tokentype;
91         this.hardtokenissuerid = hardtokenissuerid;
92         this.extendedinformation = extendedinfo;
93     }
94     public void setUsername(String JavaDoc user) { this.username=StringTools.strip(user);}
95     public String JavaDoc getUsername() {return username;}
96     public void setDN(String JavaDoc dn) {this.subjectDN=dn;}
97     public String JavaDoc getDN() {return subjectDN;}
98     public int getCAId(){return this.caid;}
99     public void setCAId(int caid){this.caid=caid;}
100     public void setSubjectAltName( String JavaDoc subjectaltname) { this.subjectAltName=subjectaltname; }
101     public String JavaDoc getSubjectAltName() {return this.subjectAltName;}
102     public void setEmail(String JavaDoc email) {this.subjectEmail = email;}
103     public String JavaDoc getEmail() {return subjectEmail;}
104     public void setPassword(String JavaDoc pwd) {this.password = pwd;}
105     public String JavaDoc getPassword() {return password;}
106     public void setStatus(int status) {this.status=status;}
107     public int getStatus() {return status;}
108     public void setType(int type) {this.type=type;}
109     public int getType() {return type;}
110     public void setEndEntityProfileId(int endentityprofileid) { this.endentityprofileid=endentityprofileid; }
111     public int getEndEntityProfileId(){ return this.endentityprofileid; }
112     public void setCertificateProfileId(int certificateprofileid) { this.certificateprofileid=certificateprofileid; }
113     public int getCertificateProfileId() {return this.certificateprofileid;}
114     public void setTimeCreated(Date JavaDoc timecreated) { this.timecreated=timecreated; }
115     public Date JavaDoc getTimeCreated() {return this.timecreated;}
116     public void setTimeModified(Date JavaDoc timemodified) { this.timemodified=timemodified; }
117     public Date JavaDoc getTimeModified() {return this.timemodified;}
118     public int getTokenType(){ return this.tokentype;}
119     public void setTokenType(int tokentype) {this.tokentype=tokentype;}
120     public int getHardTokenIssuerId() {return this.hardtokenissuerid;}
121     public void setHardTokenIssuerId(int hardtokenissuerid) { this.hardtokenissuerid=hardtokenissuerid;}
122
123     public boolean getAdministrator(){
124       return (type & SecConst.USER_ADMINISTRATOR) == SecConst.USER_ADMINISTRATOR;
125     }
126
127     public void setAdministrator(boolean administrator){
128       if(administrator)
129         type = type | SecConst.USER_ADMINISTRATOR;
130       else
131         type = type & (~SecConst.USER_ADMINISTRATOR);
132     }
133
134     public boolean getKeyRecoverable(){
135       return (type & SecConst.USER_KEYRECOVERABLE) == SecConst.USER_KEYRECOVERABLE;
136     }
137
138     public void setKeyRecoverable(boolean keyrecoverable){
139       if(keyrecoverable)
140         type = type | SecConst.USER_KEYRECOVERABLE;
141       else
142         type = type & (~SecConst.USER_KEYRECOVERABLE);
143     }
144
145     public boolean getSendNotification(){
146       return (type & SecConst.USER_SENDNOTIFICATION) == SecConst.USER_SENDNOTIFICATION;
147     }
148
149     public void setSendNotification(boolean sendnotification){
150       if(sendnotification)
151         type = type | SecConst.USER_SENDNOTIFICATION;
152       else
153         type = type & (~SecConst.USER_SENDNOTIFICATION);
154     }
155
156     /**
157      * @return Returns the extendedinformation.
158      */

159     public ExtendedInformation getExtendedinformation() {
160         return extendedinformation;
161     }
162     /**
163      * @param extendedinformation The extendedinformation to set.
164      */

165     public void setExtendedinformation(ExtendedInformation extendedinformation) {
166         this.extendedinformation = extendedinformation;
167     }
168 }
169
Popular Tags