Source Code Cross Referenced for JatUser.java in  » Web-Framework » JAT » com » jat » business » 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 » Web Framework » JAT » com.jat.business 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.jat.business;
002:
003:        import com.jat.business.authentication.AuthenticationException;
004:        import com.jat.business.privileges.PrivilegeFactory;
005:        import com.jat.business.privileges.PrivilegeList;
006:        import com.jat.core.log.LogManager;
007:
008:        /**
009:         * <p>Title: JAT</p>
010:         * <p>Description: </p>
011:         * <p>Copyright: Copyright (c) 2004 -2005 Stefano Fratini (stefano.fratini@gmail.com)</p>
012:         * <p>Distributed under the terms of the GNU Lesser General Public License, v2.1 or later</p>
013:         * @author stf
014:         * @version 1.2
015:         * @since 1.0
016:         */
017:
018:        public abstract class JatUser extends BusinessObject {
019:
020:            public final static String JAT_USER = "JAT_USER";
021:
022:            public static String FIRST_NAME = "FIRST_NAME";
023:            public static String LAST_NAME = "LAST_NAME";
024:            public static String USERNAME = "USERNAME";
025:            public static String PASSWORD = "PASSWORD";
026:            public static String PROFILE = "PROFILE";
027:
028:            public JatUser(String dataSourceName)
029:                    throws AuthenticationException {
030:                super (dataSourceName);
031:                try {
032:                } catch (Exception ex) {
033:                    LogManager.sendError(this .getClass().getName()
034:                            + ":: init privilege loader exception: " + ex);
035:                    throw new AuthenticationException(this .getClass().getName()
036:                            + ":: init privilege loader exception: "
037:                            + ex.getMessage());
038:                }
039:            }
040:
041:            public boolean hasPrivilege(String functionality, Object object)
042:                    throws BusinessException {
043:                boolean ret = true;
044:                try {
045:                    if (this .getProfile() != null)
046:                        ret = this .getPrivileges().hasPrivilege(functionality,
047:                                this , object);
048:                } finally {
049:                    LogManager.sendDebug(this .getClass().getName()
050:                            + "::hasPrivilege: user '" + this .getUsername()
051:                            + "' profile: '" + this .getProfile() + "' "
052:                            + (ret ? "" : "not ") + "has privilege for '"
053:                            + functionality + "' and for object: " + object);
054:                    return ret;
055:                }
056:            }
057:
058:            public String getUsername() {
059:                return this .getField(USERNAME);
060:            }
061:
062:            public String getFirstName() {
063:                return this .getField(FIRST_NAME);
064:            }
065:
066:            public String getLastName() {
067:                return this .getField(LAST_NAME);
068:            }
069:
070:            public long getAuthenticationTime() {
071:                return this .authenticationTime;
072:            }
073:
074:            public String getProfile() {
075:                String profile = this .getField(PROFILE);
076:                if (profile == null || profile.trim().equals(""))
077:                    profile = "guess";
078:                return profile;
079:            }
080:
081:            public PrivilegeList getPrivileges() throws BusinessException {
082:                if (this .privileges == null)
083:                    this .privileges = PrivilegeFactory.getDefault()
084:                            .getPrivileges(this );
085:                return this .privileges;
086:            }
087:
088:            public String toString() {
089:                String privileges = "''";
090:                try {
091:                    privileges = this .getPrivileges().toString();
092:                } catch (BusinessException ex) {
093:                }
094:                return super .toString() + " privileges: " + privileges;
095:            }
096:
097:            protected void setProfile(String profile)
098:                    throws AuthenticationException {
099:                if (profile == null || profile.trim().equals(""))
100:                    throw new AuthenticationException("Not validofile");
101:                this .putField(PROFILE, profile);
102:            }
103:
104:            protected String getPassword() {
105:                return this .getField(PASSWORD);
106:            }
107:
108:            protected void setUsername(String username)
109:                    throws AuthenticationException {
110:                if (username == null || username.trim().equals(""))
111:                    throw new AuthenticationException("Not valid username");
112:                this .putField(USERNAME, username);
113:            }
114:
115:            protected void setPassword(String password)
116:                    throws AuthenticationException {
117:                if (password == null || password.trim().equals(""))
118:                    throw new AuthenticationException("Not valid password");
119:                this .putField(PASSWORD, password);
120:            }
121:
122:            private long authenticationTime;
123:            private PrivilegeList privileges = null;
124:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.