Source Code Cross Referenced for User.java in  » XML-UI » xui32 » auction » model » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML UI » xui32 » auction.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package auction.model;
002:
003:        import auction.exceptions.BusinessException;
004:
005:        import java.io.Serializable;
006:        import java.util.*;
007:
008:        /**
009:         * A user of the CaveatEmptor auction application.
010:         *
011:         * @author Christian Bauer
012:         */
013:        public class User implements  Serializable, Comparable {
014:
015:            private Long id = null;
016:            private int version = 0;
017:
018:            private String firstname;
019:            private String lastname;
020:            private String username; // Unique and immutable
021:            private String password;
022:            private String email;
023:            private String phoneNumber;
024:
025:            private Address homeAddress;
026:
027:            private Collection<Book> booksForSale = new ArrayList<Book>();
028:
029:            private Date created = new Date();
030:
031:            /**
032:             * No-arg constructor for JavaBean tools
033:             */
034:            public User() {
035:            }
036:
037:            /**
038:             * Simple constructor.
039:             */
040:            public User(String firstname, String lastname, String username,
041:                    String password, String email, String phoneNumber) {
042:                this .firstname = firstname;
043:                this .lastname = lastname;
044:                this .username = username;
045:                this .password = password;
046:                this .email = email;
047:                this .phoneNumber = phoneNumber;
048:            }
049:
050:            // ********************** Accessor Methods ********************** //
051:
052:            public String getName() {
053:                return (firstname + " " + lastname);
054:            }
055:
056:            public Long getId() {
057:                return id;
058:            }
059:
060:            public int getVersion() {
061:                return version;
062:            }
063:
064:            public String getFirstname() {
065:                return firstname;
066:            }
067:
068:            public void setFirstname(String firstname) {
069:                this .firstname = firstname;
070:            }
071:
072:            public String getLastname() {
073:                return lastname;
074:            }
075:
076:            public void setLastname(String lastname) {
077:                this .lastname = lastname;
078:            }
079:
080:            public String getUsername() {
081:                return username;
082:            }
083:
084:            public void setUsername(String username) {
085:                this .username = username;
086:            }
087:
088:            public String getPassword() {
089:                return password;
090:            }
091:
092:            public void setPassword(String password) {
093:                this .password = password;
094:            }
095:
096:            public String getEmail() {
097:                return email;
098:            }
099:
100:            public void setEmail(String email) {
101:                this .email = email;
102:            }
103:
104:            public String getPhoneNumber() {
105:                return phoneNumber;
106:            }
107:
108:            public void setPhoneNumber(String phoneNumber) {
109:                this .phoneNumber = phoneNumber;
110:            }
111:
112:            public Address getHomeAddress() {
113:                return homeAddress;
114:            }
115:
116:            public void setHomeAddress(Address homeAddress) {
117:                this .homeAddress = homeAddress;
118:            }
119:
120:            public Collection<Book> getBooksForSale() {
121:                return booksForSale;
122:            }
123:
124:            public void setBooksForSale(Collection<Book> booksForSale) {
125:                this .booksForSale = booksForSale;
126:            }
127:
128:            public void removeBookForSale(Book book) {
129:                if (book == null)
130:                    throw (new IllegalArgumentException("Null Book"));
131:                booksForSale.remove(book);
132:            }
133:
134:            public Date getCreated() {
135:                return created;
136:            }
137:
138:            // ********************** Common Methods ********************** //
139:
140:            public boolean equals(Object o) {
141:                if (this  == o)
142:                    return true;
143:                if (!(o instanceof  User))
144:                    return false;
145:                final User user = (User) o;
146:                return getUsername().equals(user.getUsername());
147:            }
148:
149:            public int hashCode() {
150:                return getUsername().hashCode();
151:            }
152:
153:            public String toString() {
154:                return "User ('" + getId() + "'), " + "Username: '"
155:                        + getUsername() + "'";
156:            }
157:
158:            public int compareTo(Object o) {
159:                if (o instanceof  User)
160:                    // Don't compare Date objects! Use the time in milliseconds!
161:                    return Long.valueOf(this .getCreated().getTime()).compareTo(
162:                            Long.valueOf(((User) o).getCreated().getTime()));
163:                return 0;
164:            }
165:
166:            // ********************** Business Methods ********************** //
167:
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.