View Javadoc
1   /******************************************************************************
2    * Account.java - a user bean
3    * 
4    * BSAccount - BuckoSoft Web Account Manager 
5    * Copyright(c) 2007 - Dick Balaska and BuckoSoft, Corp.
6    * 
7    */
8   package com.buckosoft.BSAccount.domain;
9   
10  import java.io.Serializable;
11  import java.util.Date;
12  
13  /** An account in the BSAccount system.
14   * This object is mostly private to BSAccount and deals with system issues.
15   * You probably want to look at BSAccountUser for a usable User object.
16   * @author dick
17   *
18   */
19  public class BSAccount implements Serializable {
20  
21  	/** normal user state */
22  	public final static String	STATE_OK = "ok";
23  	/** born a virgin */
24  	public final static String	STATE_VIRGIN = "Virgin";
25  	/** account has been written to disk and awaits validation */
26  	public final static String	STATE_NEWBIE = "Newbie"; 
27  	/** account has been validated, password deleted, registerToken loaded */
28  	public final static String	STATE_NEEDPWD = "NeedPwd";
29  
30    /* Private Fields */
31  
32  	private static final long serialVersionUID = 1L;
33  
34  	private	int		userId = 0;
35  	private String	username;
36  	private String	email;
37  	private	boolean	hasPassword;
38  	private	int		registerToken;
39  	private	Date	lastAccess;
40  	private	Date	registerDate;
41  	private String	status = STATE_NEWBIE;
42  
43  	// User Optional fields
44  	private	String	webPage;
45  	private String	firstName;
46  	private String	lastName;
47  	private String	address1;
48  	private String	address2;
49  	private String	city;
50  	private String	state;
51  	private String	zip;
52  	private String	country;
53  	private String	phone;
54  
55  	/* JavaBeans Properties */
56  
57  	public String getUsername() {
58  		return username;
59  	}
60  	public void setUsername(String username) {
61  		this.username = username;
62  	}
63  	/**
64  	 * @return the userId
65  	 */
66  	public int getUserId() {
67  		return userId;
68  	}
69  	/**
70  	 * @param userId the userId to set
71  	 */
72  	public void setUserId(int userId) {
73  		this.userId = userId;
74  	}
75  	/** Return whether this account has a valid password assigned to it.
76  	 * @return the hasPassword
77  	 */
78  	public boolean isHasPassword() {
79  		return hasPassword;
80  	}
81  	/**
82  	 * @param hasPassword the hasPassword to set
83  	 */
84  	public void setHasPassword(boolean hasPassword) {
85  		this.hasPassword = hasPassword;
86  	}
87  
88  	public String getEmail() {
89  		return email;
90  	}
91  	public void setEmail(String email) {
92  		this.email = email;
93  	}
94  	public String getFirstName() {
95  		return firstName;
96  	}
97  	public void setFirstName(String firstName) {
98  		this.firstName = firstName;
99  	}
100 	public String getLastName() {
101 		return lastName;
102 	}
103 	public void setLastName(String lastName) {
104 		this.lastName = lastName;
105 	}
106 	public String getStatus() {
107 		return status;
108 	}
109 	public void setStatus(String status) {
110 		this.status = status;
111 	}
112 	public String getAddress1() {
113 		return address1;
114 	}
115 	public void setAddress1(String address1) {
116 		this.address1 = address1;
117 	}
118 	public String getAddress2() {
119 		return address2;
120 	}
121 	public void setAddress2(String address2) {
122 		this.address2 = address2;
123 	}
124 	public String getCity() {
125 		return city;
126 	}
127 	public void setCity(String city) {
128 		this.city = city;
129 	}
130 	public String getState() {
131 		return state;
132 	}
133 	public void setState(String state) {
134 		this.state = state;
135 	}
136 	public String getZip() {
137 		return zip;
138 	}
139 	public void setZip(String zip) {
140 		this.zip = zip;
141 	}
142 	public String getCountry() {
143 		return country;
144 	}
145 	public void setCountry(String country) {
146 		this.country = country;
147 	}
148 	public String getPhone() {
149 		return phone;
150 	}
151 	public void setPhone(String phone) {
152 		this.phone = phone;
153 	}
154 	/**
155 	 * @return the lastAccess
156 	 */
157 	public Date getLastAccess() {
158 		return lastAccess;
159 	}
160 	/**
161 	 * @param lastAccess the lastAccess to set
162 	 */
163 	public void setLastAccess(Date lastAccess) {
164 		this.lastAccess = lastAccess;
165 	}
166 	/**
167 	 * @return the registerDate
168 	 */
169 	public Date getRegisterDate() {
170 		return registerDate;
171 	}
172 	/**
173 	 * @param registerDate the registerDate to set
174 	 */
175 	public void setRegisterDate(Date registerDate) {
176 		this.registerDate = registerDate;
177 	}
178 	/** Return the random number that was emailed to the user.
179 	 * @return the registerToken
180 	 */
181 	public int getRegisterToken() {
182 		return registerToken;
183 	}
184 	/**
185 	 * @param registerToken the registerToken to set
186 	 */
187 	public void setRegisterToken(int registerToken) {
188 		this.registerToken = registerToken;
189 	}
190 	/**
191 	 * @return the webPage
192 	 */
193 	public String getWebPage() {
194 		return webPage;
195 	}
196 	/**
197 	 * @param webPage the webPage to set
198 	 */
199 	public void setWebPage(String webPage) {
200 		this.webPage = webPage;
201 	}
202 
203 	public	boolean	isRegisteredUser() {
204 		if (this.userId > 0)
205 			return(true);
206 		return(false);
207 	}
208 }