Source Code Cross Referenced for AgentImpl.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » metaobj » shared » model » impl » 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 » sakai » org.sakaiproject.metaobj.shared.model.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-impl/api-impl/src/java/org/sakaiproject/metaobj/shared/model/impl/AgentImpl.java $
003:         * $Id: AgentImpl.java 14225 2006-09-05 17:39:44Z chmaurer@iupui.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.metaobj.shared.model.impl;
021:
022:        import java.util.ArrayList;
023:        import java.util.List;
024:
025:        import org.apache.commons.codec.digest.DigestUtils;
026:        import org.sakaiproject.metaobj.shared.mgt.HomeFactory;
027:        import org.sakaiproject.metaobj.shared.model.Agent;
028:        import org.sakaiproject.metaobj.shared.model.Artifact;
029:        import org.sakaiproject.metaobj.shared.model.Id;
030:        import org.sakaiproject.metaobj.shared.model.StructuredArtifact;
031:
032:        public class AgentImpl implements  Agent {
033:            static public final String ID = "id";
034:            static public final String REAL_NAME = "realName";
035:            static public final String EMAIL = "email";
036:            static public final String ROLES = "roles";
037:
038:            private Id id;
039:            private Id eid;
040:            private StructuredArtifact profile;
041:            private String[] roles;
042:            private HomeFactory homeFactory;
043:            private String displayName;
044:            private String md5Password;
045:            private String password;
046:            private String role;
047:            private boolean initialized = false;
048:
049:            public AgentImpl() {
050:
051:            }
052:
053:            public AgentImpl(Id id) {
054:                this .id = id;
055:            }
056:
057:            public AgentImpl(StructuredArtifact profile) {
058:                this .profile = profile;
059:            }
060:
061:            public Id getId() {
062:                return id;
063:            }
064:
065:            public void setId(Id id) {
066:                this .id = id;
067:            }
068:
069:            public Id getEid() {
070:                return eid;
071:            }
072:
073:            public void setEid(Id eid) {
074:                this .eid = eid;
075:            }
076:
077:            public Artifact getProfile() {
078:                return profile;
079:            }
080:
081:            public void setProfile(StructuredArtifact profile) {
082:                this .profile = profile;
083:            }
084:
085:            public Object getProperty(String key) {
086:                return profile.get(key);
087:            }
088:
089:            public String getDisplayName() {
090:                return displayName;
091:            }
092:
093:            public boolean isInRole(String role) {
094:
095:                for (int i = 0; i < getRoles().length; i++) {
096:                    if (role.equals(getRoles()[i])) {
097:                        return true;
098:                    }
099:                }
100:
101:                return false;
102:            }
103:
104:            public boolean isInitialized() {
105:                return initialized;
106:            }
107:
108:            public void setInitialized(boolean initialized) {
109:                this .initialized = initialized;
110:            }
111:
112:            public void setDisplayName(String displayName) {
113:                this .displayName = displayName;
114:            }
115:
116:            /**
117:             * I imagine this will probably move into a authz call and out of here
118:             *
119:             * @return
120:             */
121:            public String[] getRoles() {
122:                /*      if (roles == null) {
123:                 //TODO implement for multiple roles
124:                 roles = new String[1];
125:                 roles[0] = (String) profile.get("role");
126:                 }
127:                 */
128:                roles = new String[1];
129:                roles[0] = role;
130:
131:                return roles;
132:            }
133:
134:            public void setRoles(String[] roles) {
135:                this .roles = roles;
136:            }
137:
138:            public HomeFactory getHomeFactory() {
139:                return homeFactory;
140:            }
141:
142:            public void setHomeFactory(HomeFactory homeFactory) {
143:                this .homeFactory = homeFactory;
144:            }
145:
146:            public String getPassword() {
147:                return getMd5Password();
148:            }
149:
150:            public String getClearPassword() {
151:                return password;
152:            }
153:
154:            public void setPassword(String password) {
155:                this .password = password;
156:                this .md5Password = DigestUtils.md5Hex(password);
157:            }
158:
159:            public String getMd5Password() {
160:                return md5Password;
161:            }
162:
163:            public void setMd5Password(String md5Password) {
164:                this .md5Password = md5Password;
165:            }
166:
167:            public String getRole() {
168:                return role;
169:            }
170:
171:            public List getWorksiteRoles(String worksiteId) {
172:                return new ArrayList();
173:            }
174:
175:            public List getWorksiteRoles() {
176:                return new ArrayList();
177:            }
178:
179:            public boolean isRole() {
180:                return false;
181:            }
182:
183:            public void setRole(String role) {
184:                this .role = role;
185:            }
186:
187:            public String naturalKey() {
188:                return "" + displayName;
189:            }
190:
191:            public boolean equals(Object o) {
192:                if (this  == o) {
193:                    return true;
194:                }
195:                if (!(o instanceof  AgentImpl)) {
196:                    return false;
197:                }
198:
199:                final AgentImpl agent = (AgentImpl) o;
200:                return naturalKey().equals(agent.naturalKey());
201:            }
202:
203:            public int hashCode() {
204:                return naturalKey().hashCode();
205:            }
206:
207:            /**
208:             * Returns the name of this principal.
209:             *
210:             * @return the name of this principal.
211:             */
212:            public String getName() {
213:                return getDisplayName();
214:            }
215:
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.