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.hardtoken;
013:
014: import java.util.Collection;
015: import java.util.Date;
016:
017: import org.ejbca.core.model.hardtoken.types.HardToken;
018: import org.ejbca.util.StringTools;
019:
020: /**
021: * This is a value class containing the data relating to a hard token sent between
022: * server and clients.
023: *
024: * @author TomSelleck
025: * @version $Id: HardTokenData.java,v 1.2 2007/05/07 11:56:50 herrvendil Exp $
026: */
027:
028: public class HardTokenData implements java.io.Serializable {
029:
030: // Public Constructors
031: /**
032: * Construtor of a hard token data.
033: *
034: * @param tokensn the tokensn
035: * @param username the username owning the token
036: * @param createtime time the token was created
037: * @param modifytime time whem token was modified or a copy was made.
038: * @param tokentype the hardtokenprofile used to create the token
039: * @param significantIssuerDN of the CA that the card belongs to
040: * @param hardtoken the actual hardtoken data
041: * @param copyof tokenSN of original or null of this is an original
042: * @param copies Collention of tokensn of tokens copied from this token, null if no copies have been made.
043: *
044: */
045: public HardTokenData(String tokensn, String username,
046: Date createtime, Date modifytime, int tokentype,
047: String significantIssuerDN, HardToken hardtoken,
048: String copyof, Collection copies) {
049: this .tokensn = tokensn;
050: this .username = StringTools.strip(username);
051: this .createtime = createtime;
052: this .modifytime = modifytime;
053: this .tokentype = tokentype;
054: this .significantIssuerDN = significantIssuerDN;
055: this .hardtoken = hardtoken;
056: this .copyof = copyof;
057: this .copies = copies;
058: }
059:
060: public HardTokenData() {
061: }
062:
063: // Public Methods
064:
065: public String getTokenSN() {
066: return this .tokensn;
067: }
068:
069: public void setTokenSN(String tokensn) {
070: this .tokensn = tokensn;
071: }
072:
073: public String getUsername() {
074: return this .username;
075: }
076:
077: public void setUsername(String username) {
078: this .username = StringTools.strip(username);
079: }
080:
081: public Date getCreateTime() {
082: return this .createtime;
083: }
084:
085: public void setCreateTime(Date createtime) {
086: this .createtime = createtime;
087: }
088:
089: public Date getModifyTime() {
090: return this .modifytime;
091: }
092:
093: public void setModifyTime(Date modifytime) {
094: this .modifytime = modifytime;
095: }
096:
097: public int getTokenType() {
098: return this .tokentype;
099: }
100:
101: public void setTokenType(int tokentype) {
102: this .tokentype = tokentype;
103: }
104:
105: public HardToken getHardToken() {
106: return this .hardtoken;
107: }
108:
109: public void setHardToken(HardToken hardtoken) {
110: this .hardtoken = hardtoken;
111: }
112:
113: public boolean isOriginal() {
114: return copyof == null;
115: }
116:
117: public String getCopyOf() {
118: return copyof;
119: }
120:
121: public String getSignificantIssuerDN() {
122: return significantIssuerDN;
123: }
124:
125: /**
126: * Returns a collection of (Strings) containing the tokenSN of all copies made
127: * of this token.
128: *
129: * @return A Collection of tokenSN or null of no copies have been made.
130: *
131: */
132: public Collection getCopies() {
133: return copies;
134: }
135:
136: // Private fields
137: private String tokensn;
138: private String username;
139: private Date createtime;
140: private Date modifytime;
141: private int tokentype;
142: private String significantIssuerDN;
143: private HardToken hardtoken;
144: private String copyof;
145: private Collection copies;
146:
147: }
|