Source Code Cross Referenced for UserInfo.java in  » ERP-CRM-Financial » SourceTap-CRM » com » sourcetap » sfa » util » 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 » ERP CRM Financial » SourceTap CRM » com.sourcetap.sfa.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * 
003:         * Copyright (c) 2004 SourceTap - www.sourcetap.com
004:         *
005:         *  The contents of this file are subject to the SourceTap Public License 
006:         * ("License"); You may not use this file except in compliance with the 
007:         * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
008:         * Software distributed under the License is distributed on an  "AS IS"  basis,
009:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
010:         * the specific language governing rights and limitations under the License.
011:         *
012:         * The above copyright notice and this permission notice shall be included
013:         * in all copies or substantial portions of the Software.
014:         *
015:         */
016:
017:        package com.sourcetap.sfa.util;
018:
019:        import java.util.List;
020:
021:        import org.ofbiz.base.util.Debug;
022:        import org.ofbiz.base.util.UtilFormatOut;
023:        import org.ofbiz.base.util.UtilMisc;
024:        import org.ofbiz.entity.GenericDelegator;
025:        import org.ofbiz.entity.GenericEntityException;
026:        import org.ofbiz.entity.GenericValue;
027:
028:        /**
029:         * DOCUMENT ME!
030:         *
031:         */
032:        public class UserInfo {
033:            public static final String module = UserInfo.class.getName();
034:            String partyId;
035:            String roleId;
036:            String userName;
037:            String userFullName;
038:            String accountId;
039:
040:            public UserInfo() {
041:                partyId = null;
042:                roleId = null;
043:                userName = null;
044:                accountId = null;
045:            }
046:
047:            public UserInfo(GenericDelegator delegator, String userId,
048:                    String accountId) {
049:                try {
050:                    GenericValue contactGV = delegator.findByPrimaryKey(
051:                            "Contact", UtilMisc.toMap("contactId", userId));
052:                    if (contactGV == null)
053:                        throw new IllegalArgumentException("Invalid User ID");
054:                    if (!accountId.equals(contactGV.getString("accountId")))
055:                        throw new IllegalArgumentException(
056:                                "Account ID does not match User Info");
057:
058:                    List loginInfo = delegator.findByAnd("UserLogin", UtilMisc
059:                            .toMap("partyId", userId), null);
060:                    if ((loginInfo == null) || (loginInfo.size() < 1))
061:                        throw new IllegalArgumentException(
062:                                "Invalid User Login Info");
063:
064:                    GenericValue loginGV = (GenericValue) loginInfo.get(0);
065:
066:                    String userName = loginGV.getString("userLoginId");
067:                    String contactName = "";
068:                    String roleId = UtilFormatOut.checkNull(contactGV
069:                            .getString("roleId"));
070:
071:                    String firstName = (contactGV.getString("firstName") == null) ? ""
072:                            : contactGV.getString("firstName");
073:                    String lastName = (contactGV.getString("lastName") == null) ? ""
074:                            : contactGV.getString("lastName");
075:
076:                    if (((firstName != null) && !firstName.equals(""))
077:                            || ((lastName != null) && !lastName.equals(""))) {
078:                        contactName = firstName + " " + lastName;
079:                    } else {
080:                        contactName = userName;
081:                    }
082:
083:                    init(userId, roleId, userName, contactName, accountId);
084:
085:                } catch (GenericEntityException e) {
086:                    Debug.logError("Error loading UserInfo information"
087:                            + e.getMessage(), module);
088:                    throw new IllegalArgumentException(
089:                            "Unable to load User Info");
090:                }
091:
092:            }
093:
094:            public UserInfo(String partyId, String roleId, String userName,
095:                    String userFullName, String accountId) {
096:                init(partyId, roleId, userName, userFullName, accountId);
097:            }
098:
099:            public void init(String partyId, String roleId, String userName,
100:                    String userFullName, String accountId) {
101:                setPartyId(partyId);
102:                setRoleId(roleId);
103:                setUserName(userName);
104:                setUserFullName(userFullName);
105:                setAccountId(accountId);
106:            }
107:
108:            /**
109:             * DOCUMENT ME!
110:             *
111:             * @return 
112:             */
113:            public String getPartyId() {
114:                return partyId;
115:            }
116:
117:            /**
118:             * DOCUMENT ME!
119:             *
120:             * @return 
121:             */
122:            public String getRoleId() {
123:                return roleId;
124:            }
125:
126:            /**
127:             * DOCUMENT ME!
128:             *
129:             * @return 
130:             */
131:            public String getUserName() {
132:                return userName;
133:            }
134:
135:            /**
136:             * DOCUMENT ME!
137:             *
138:             * @return 
139:             */
140:            public String getUserFullName() {
141:                return userFullName;
142:            }
143:
144:            /**
145:             * DOCUMENT ME!
146:             *
147:             * @return 
148:             */
149:            public String getAccountId() {
150:                return accountId;
151:            }
152:
153:            /**
154:             * DOCUMENT ME!
155:             *
156:             * @param partyId_ 
157:             */
158:            public void setPartyId(String partyId_) {
159:                partyId = partyId_;
160:            }
161:
162:            /**
163:             * DOCUMENT ME!
164:             *
165:             * @param roleId_ 
166:             */
167:            public void setRoleId(String roleId_) {
168:                roleId = roleId_;
169:            }
170:
171:            /**
172:             * DOCUMENT ME!
173:             *
174:             * @param userName_ 
175:             */
176:            public void setUserName(String userName_) {
177:                userName = userName_;
178:            }
179:
180:            /**
181:             * DOCUMENT ME!
182:             *
183:             * @param userFullName_ 
184:             */
185:            public void setUserFullName(String userFullName_) {
186:                userFullName = userFullName_;
187:            }
188:
189:            /**
190:             * DOCUMENT ME!
191:             *
192:             * @param accountId_ 
193:             */
194:            public void setAccountId(String accountId_) {
195:                accountId = accountId_;
196:            }
197:
198:            /**
199:             * DOCUMENT ME!
200:             *
201:             * @return 
202:             */
203:            public String toString() {
204:                return "[partyId]" + partyId + "[roleId]" + roleId
205:                        + "[userName]" + userName + "[accountId]" + accountId;
206:            }
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.