KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > hardtoken > HardTokenData


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 org.ejbca.core.model.hardtoken;
15
16 import java.util.Collection JavaDoc;
17 import java.util.Date JavaDoc;
18
19 import org.ejbca.core.model.hardtoken.types.HardToken;
20 import org.ejbca.util.StringTools;
21
22
23 /**
24  * This is a value class containing the data relating to a hard token sent between
25  * server and clients.
26  *
27  * @author TomSelleck
28  * @version $Id: HardTokenData.java,v 1.1 2006/01/17 20:31:52 anatom Exp $
29  */

30
31 public class HardTokenData implements java.io.Serializable JavaDoc {
32
33     // Public Constructors
34
/**
35      * Construtor of a hard token data.
36      *
37      * @param tokensn the tokensn
38      * @param username the username owning the token
39      * @param createtime time the token was created
40      * @param modifytime time whem token was modified or a copy was made.
41      * @param tokentype the hardtokenprofile used to create the token
42      * @param hardtoken the actual hardtoken data
43      * @param copyof tokenSN of original or null of this is an original
44      * @param copies Collention of tokensn of tokens copied from this token, null if no copies have been made.
45      *
46      */

47     public HardTokenData(String JavaDoc tokensn, String JavaDoc username, Date JavaDoc createtime, Date JavaDoc modifytime,
48                          int tokentype, HardToken hardtoken, String JavaDoc copyof,
49                          Collection JavaDoc copies){
50       this.tokensn=tokensn;
51       this.username=StringTools.strip(username);
52       this.createtime=createtime;
53       this.modifytime=modifytime;
54       this.tokentype=tokentype;
55       this.hardtoken=hardtoken;
56       this.copyof=copyof;
57       this.copies=copies;
58     }
59
60     public HardTokenData(){
61     }
62
63     // Public Methods
64

65     public String JavaDoc getTokenSN(){ return this.tokensn; }
66     public void setTokenSN(String JavaDoc tokensn){ this.tokensn=tokensn; }
67
68     public String JavaDoc getUsername(){ return this.username; }
69     public void setUsername(String JavaDoc username){ this.username=StringTools.strip(username); }
70
71     public Date JavaDoc getCreateTime(){ return this.createtime; }
72     public void setCreateTime(Date JavaDoc createtime){ this.createtime=createtime; }
73
74     public Date JavaDoc getModifyTime(){ return this.modifytime; }
75     public void setModifyTime(Date JavaDoc modifytime){ this.modifytime=modifytime; }
76
77     public int getTokenType(){ return this.tokentype; }
78     public void setTokenType(int tokentype){ this.tokentype=tokentype; }
79
80     public HardToken getHardToken(){ return this.hardtoken; }
81     public void setHardToken(HardToken hardtoken){ this.hardtoken=hardtoken; }
82     
83     public boolean isOriginal(){
84       return copyof==null;
85     }
86     
87     public String JavaDoc getCopyOf(){
88       return copyof;
89     }
90     
91     /**
92      * Returns a collection of (Strings) containing the tokenSN of all copies made
93      * of this token.
94      *
95      * @return A Collection of tokenSN or null of no copies have been made.
96      *
97      */

98     public Collection JavaDoc getCopies(){
99       return copies;
100     }
101
102     // Private fields
103
private String JavaDoc tokensn;
104     private String JavaDoc username;
105     private Date JavaDoc createtime;
106     private Date JavaDoc modifytime;
107     private int tokentype;
108     private HardToken hardtoken;
109     private String JavaDoc copyof;
110     private Collection JavaDoc copies;
111 }
112
Popular Tags