Source Code Cross Referenced for Account.java in  » J2EE » fleXive » com » flexive » shared » security » 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 » J2EE » fleXive » com.flexive.shared.security 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***************************************************************
002:         *  This file is part of the [fleXive](R) project.
003:         *
004:         *  Copyright (c) 1999-2008
005:         *  UCS - unique computing solutions gmbh (http://www.ucs.at)
006:         *  All rights reserved
007:         *
008:         *  The [fleXive](R) project is free software; you can redistribute
009:         *  it and/or modify it under the terms of the GNU General Public
010:         *  License as published by the Free Software Foundation;
011:         *  either version 2 of the License, or (at your option) any
012:         *  later version.
013:         *
014:         *  The GNU General Public License can be found at
015:         *  http://www.gnu.org/copyleft/gpl.html.
016:         *  A copy is found in the textfile GPL.txt and important notices to the
017:         *  license from the author are found in LICENSE.txt distributed with
018:         *  these libraries.
019:         *
020:         *  This library is distributed in the hope that it will be useful,
021:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
022:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023:         *  GNU General Public License for more details.
024:         *
025:         *  For further information about UCS - unique computing solutions gmbh,
026:         *  please see the company website: http://www.ucs.at
027:         *
028:         *  For further information about [fleXive](R), please see the
029:         *  project website: http://www.flexive.org
030:         *
031:         *
032:         *  This copyright notice MUST APPEAR in all copies of the file!
033:         ***************************************************************/package com.flexive.shared.security;
034:
035:        import com.flexive.shared.AbstractSelectableObjectWithName;
036:        import com.flexive.shared.FxFormatUtils;
037:        import com.flexive.shared.FxLanguage;
038:        import com.flexive.shared.content.FxPK;
039:
040:        import java.io.Serializable;
041:        import java.util.Date;
042:
043:        /**
044:         * User account class.
045:         *
046:         * @author Gregor Schober (gregor.schober@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
047:         * @author Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
048:         */
049:        public class Account extends AbstractSelectableObjectWithName implements 
050:                Serializable {
051:            private static final long serialVersionUID = 5344820690672809623L;
052:
053:            /**
054:             * The guest user. Everyone who is not logged in is treated as GUEST
055:             */
056:            public static final long USER_GUEST = 1;
057:
058:            /**
059:             * The supervisor. This user is in all roles and may operate on all mandators
060:             */
061:            public static final long USER_GLOBAL_SUPERVISOR = 2;
062:
063:            /**
064:             * Dummy account (id if a null value cannot be applied)
065:             */
066:            public static final long NULL_ACCOUNT = 3;
067:
068:            /**
069:             * 01.01.3000
070:             */
071:            public static final Date VALID_FOREVER = new Date(32503676400000L);
072:
073:            private String name = null;
074:            private String loginName = null;
075:            private long id = -1;
076:            private long mandatorId = -1;
077:            private String email = null;
078:            private FxLanguage language = FxLanguage.DEFAULT;
079:            private boolean active = false;
080:            private boolean validated = false;
081:            private Date validFrom = null;
082:            private Date validTo = null;
083:            private long defaultNodeId = 0;
084:            private String description = null;
085:            private long contactDataId = -1;
086:            private boolean allowMultiLogin = false;
087:            private String updateToken;
088:            private FxPK contactData;
089:            private LifeCycleInfo lifeCycleInfo = null;
090:
091:            public Account() {
092:                /* empty constructor */
093:            }
094:
095:            public Account(long id, String name, String loginName,
096:                    long mandator, String email, FxLanguage language,
097:                    boolean active, boolean validated, Date validFrom,
098:                    Date validTo, long defaultNode, String description,
099:                    long contactDataId, boolean allowMultiLogin,
100:                    String updateToken, LifeCycleInfo lifeCycleInfo) {
101:                this .name = name;
102:                this .loginName = loginName;
103:                this .id = id;
104:                this .mandatorId = mandator;
105:                this .email = email;
106:                this .language = language;
107:                this .active = active;
108:                this .validated = validated;
109:                this .validFrom = (Date) validFrom.clone();
110:                this .validTo = (Date) validTo.clone();
111:                this .defaultNodeId = defaultNode;
112:                this .description = description;
113:                this .contactDataId = contactDataId;
114:                this .contactData = new FxPK(this .contactDataId);
115:                this .allowMultiLogin = allowMultiLogin;
116:                this .updateToken = updateToken;
117:                this .lifeCycleInfo = lifeCycleInfo;
118:            }
119:
120:            /**
121:             * Is this a system internal account?
122:             *
123:             * @return system internal account
124:             */
125:            public boolean isSystemInternalAccount() {
126:                return id <= NULL_ACCOUNT && id >= 0;
127:            }
128:
129:            /**
130:             * Is this account instance new? (i.e. not saved yet)
131:             *
132:             * @return if new
133:             */
134:            public boolean isNew() {
135:                return id < 0;
136:            }
137:
138:            /**
139:             * Returns the email of the user.
140:             *
141:             * @return the email of the user
142:             */
143:            public String getEmail() {
144:                return this .email;
145:            }
146:
147:            /**
148:             * Returns the language of the user.
149:             *
150:             * @return the language of the user
151:             */
152:            public FxLanguage getLanguage() {
153:                return this .language;
154:            }
155:
156:            /**
157:             * Returns the user name.
158:             *
159:             * @return the user name.
160:             */
161:            public String getName() {
162:                return this .name;
163:            }
164:
165:            /**
166:             * Returns the unique user id.
167:             *
168:             * @return the unique user id.
169:             */
170:            public long getId() {
171:                return this .id;
172:            }
173:
174:            /**
175:             * Returns the unique id of the mandator this user belongs to.
176:             *
177:             * @return the unique id of the mandator this user belongs to.
178:             */
179:            public long getMandatorId() {
180:                return this .mandatorId;
181:            }
182:
183:            /**
184:             * Returns the login name of the user.
185:             *
186:             * @return the login name of the user.
187:             */
188:            public String getLoginName() {
189:                return loginName;
190:            }
191:
192:            /**
193:             * Return true if the user is active.
194:             *
195:             * @return true if the user is active
196:             */
197:            public boolean isActive() {
198:                return this .active;
199:            }
200:
201:            /**
202:             * Returns true if the user is validated.
203:             *
204:             * @return true if the user is validated
205:             */
206:            public boolean isValidated() {
207:                return this .validated;
208:            }
209:
210:            /**
211:             * Returns the valid from date of the user.
212:             * <p/>
213:             * The valid from/to dates may be used to define a timeperiode
214:             * in which the user may LOG in.
215:             *
216:             * @return the valid from date of the user
217:             */
218:            public Date getValidFrom() {
219:                return (Date) this .validFrom.clone();
220:            }
221:
222:            /**
223:             * Returns the valid to date of the user.
224:             * <p/>
225:             * The valid from/to dates may be used to define a timeperiode
226:             * in which the user may LOG in.
227:             *
228:             * @return the valid to date of the user
229:             */
230:            public Date getValidTo() {
231:                return (Date) this .validTo.clone();
232:            }
233:
234:            /**
235:             * Returns the valid from date of the user.
236:             * <p/>
237:             * The valid from/to dates may be used to define a timeperiode
238:             * in which the user may LOG in.
239:             *
240:             * @return the valid from date of the user
241:             */
242:            public String getValidFromString() {
243:                return FxFormatUtils.toString(this .validFrom, null);
244:            }
245:
246:            /**
247:             * Returns the valid to date of the user.
248:             * <p/>
249:             * The valid from/to dates may be used to define a timeperiode
250:             * in which the user may LOG in.
251:             *
252:             * @return the valid to date of the user
253:             */
254:            public String getValidToString() {
255:                return FxFormatUtils.toString(this .validTo, null);
256:            }
257:
258:            /**
259:             * Gets the description if the user.
260:             * <p/>
261:             * The result may be a empty String (but is never null)
262:             *
263:             * @return the description if the user
264:             */
265:            public String getDescription() {
266:                return (this .description == null) ? "" : this .description;
267:            }
268:
269:            /**
270:             * Get the primary key of the contact data object holding further informations
271:             * of the user.
272:             *
273:             * @return the id of the contact data object
274:             */
275:            public FxPK getContactData() {
276:                return this .contactData;
277:            }
278:
279:            /**
280:             * Get the id of the contact data instance associated to this account
281:             *
282:             * @return contact data id
283:             */
284:            public long getContactDataId() {
285:                return contactDataId;
286:            }
287:
288:            /**
289:             * Returns the update token of this account. The update token may be used
290:             * in external API calls modifying this account to improve security.
291:             *
292:             * @return  the update token of this account
293:             */
294:            public String getUpdateToken() {
295:                return updateToken;
296:            }
297:
298:            /**
299:             * Returns the desired default node of the user.
300:             * May be -1 if no default node is defined.
301:             *
302:             * @return the desired default node of the user
303:             */
304:            public long getDefaultNode() {
305:                return this .defaultNodeId;
306:            }
307:
308:            /**
309:             * Is this account allowed to be logged in more than once?
310:             *
311:             * @return multi login allowed?
312:             */
313:            public boolean isAllowMultiLogin() {
314:                return this .allowMultiLogin;
315:            }
316:
317:            /**
318:             * Get the lifecycle information
319:             *
320:             * @return lifecycle information
321:             */
322:            public LifeCycleInfo getLifeCycleInfo() {
323:                return lifeCycleInfo;
324:            }
325:
326:            public void setName(String sName) {
327:                this .name = sName;
328:            }
329:
330:            public void setLoginName(String sLoginName) {
331:                this .loginName = sLoginName;
332:            }
333:
334:            public void setMandatorId(long iMandator) {
335:                this .mandatorId = iMandator;
336:            }
337:
338:            public void setEmail(String sEmail) {
339:                this .email = sEmail;
340:            }
341:
342:            public void setLanguage(FxLanguage language) {
343:                this .language = language;
344:            }
345:
346:            public void setActive(boolean bActive) {
347:                this .active = bActive;
348:            }
349:
350:            public void setValidated(boolean bValidated) {
351:                this .validated = bValidated;
352:            }
353:
354:            public void setValidFrom(Date dValidFrom) {
355:                this .validFrom = (Date) dValidFrom.clone();
356:            }
357:
358:            public void setValidTo(Date dValidTo) {
359:                this .validTo = (Date) dValidTo.clone();
360:            }
361:
362:            public void setDefaultNode(long lDefaultNode) {
363:                this .defaultNodeId = lDefaultNode;
364:            }
365:
366:            public void setDescription(String sDescription) {
367:                this .description = sDescription;
368:            }
369:
370:            public void setContactDataId(long lContactDataId) {
371:                this .contactDataId = lContactDataId;
372:                this .contactData = new FxPK(contactDataId);
373:            }
374:
375:            public void setAllowMultiLogin(boolean bAllowMultiLogin) {
376:                this.allowMultiLogin = bAllowMultiLogin;
377:            }
378:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.