View Javadoc
1   package org.apache.juddi.model;
2   /*
3    * Copyright 2001-2008 The Apache Software Foundation.
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  import java.util.Date;
19  import javax.persistence.Column;
20  import javax.persistence.Entity;
21  import javax.persistence.Id;
22  import javax.persistence.Table;
23  import javax.persistence.Temporal;
24  import javax.persistence.TemporalType;
25  /**
26   * @author <a href="mailto:kurt@apache.org">Kurt T Stam</a>
27   */
28  @Entity
29  @Table(name = "j3_auth_token")
30  public class AuthToken implements java.io.Serializable {
31  
32  	private static final long serialVersionUID = 1147567747533293480L;
33  	private String authToken;
34          private String ipaddress;
35  	private String authorizedName;
36  	private Date created;
37  	private Date lastUsed;
38  	private int numberOfUses;
39  	private int tokenState;
40  	
41  
42  	public AuthToken() {
43  	}
44  
45  	public AuthToken(String authToken, String authorizedName,
46  			String publisherName, Date created, Date lastUsed,
47  			int numberOfUses, int tokenState) {
48  		this.authToken = authToken;
49  		this.authorizedName = authorizedName;
50  		this.created = created;
51  		this.lastUsed = lastUsed;
52  		this.numberOfUses = numberOfUses;
53  		this.tokenState = tokenState;
54  	}
55  
56  	@Id
57  	@Column(name = "auth_token", nullable = false, length = 51)
58  	public String getAuthToken() {
59  		return this.authToken;
60  	}
61  	public void setAuthToken(String authToken) {
62  		this.authToken = authToken;
63  	}
64  
65  	@Column(name = "authorized_name", nullable = false, length = 255)
66  	public String getAuthorizedName() {
67  		return this.authorizedName;
68  	}
69  	public void setAuthorizedName(String authorizedName) {
70  		this.authorizedName = authorizedName;
71  	}
72  
73  	@Temporal(TemporalType.TIMESTAMP)
74  	@Column(name = "created", nullable = false, length = 29)
75  	public Date getCreated() {
76  		return this.created;
77  	}
78  	public void setCreated(Date created) {
79  		this.created = created;
80  	}
81  	
82  	@Temporal(TemporalType.TIMESTAMP)
83  	@Column(name = "last_used", nullable = false, length = 29)
84  	public Date getLastUsed() {
85  		return this.lastUsed;
86  	}
87  	public void setLastUsed(Date lastUsed) {
88  		this.lastUsed = lastUsed;
89  	}
90  
91  	@Column(name = "number_of_uses", nullable = false)
92  	public int getNumberOfUses() {
93  		return this.numberOfUses;
94  	}
95  	public void setNumberOfUses(int numberOfUses) {
96  		this.numberOfUses = numberOfUses;
97  	}
98  
99  	@Column(name = "token_state", nullable = false)
100 	public int getTokenState() {
101 		return this.tokenState;
102 	}
103 	public void setTokenState(int tokenState) {
104 		this.tokenState = tokenState;
105 	}
106 
107         /**
108          * @since 3.2
109          * @return ip address
110          */
111 	@Column(name = "ipaddress", nullable = true, length = 51)
112 	public String getIPAddress() {
113 		return this.ipaddress;
114 	}
115 	public void setIPAddress(String ip) {
116 		this.ipaddress=ip;
117 	}
118 
119 }