Source Code Cross Referenced for AuthorizationFacade.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » assessment » facade » authz » 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.tool.assessment.facade.authz 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/sam/trunk/component/src/java/org/sakaiproject/tool/assessment/facade/authz/AuthorizationFacade.java $
003:         * $Id: AuthorizationFacade.java 9273 2006-05-10 22:34:28Z daisyf@stanford.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.tool.assessment.facade.authz;
021:
022:        import java.util.Date;
023:
024:        import org.osid.authorization.Function;
025:        import org.osid.authorization.Qualifier;
026:        import org.osid.shared.Id;
027:
028:        import org.sakaiproject.tool.assessment.data.dao.authz.AuthorizationData;
029:        import org.sakaiproject.tool.assessment.data.ifc.authz.AuthorizationIfc;
030:
031:        public class AuthorizationFacade implements  AuthorizationIfc {
032:            /**
033:             * 
034:             */
035:            private static final long serialVersionUID = -262696599577971352L;
036:            private Id agentId;
037:            private Function function;
038:            private Qualifier qualifier;
039:            private long effectiveDate;
040:            private long expirationDate;
041:            private Id modifiedBy;
042:            private long modifiedDate;
043:            private boolean isExplicit;
044:            private boolean isActiveNow;
045:
046:            private AuthorizationIfc data;
047:            private String functionId;
048:            private String qualifierId;
049:            private Date authorizationEffectiveDate;
050:            private Date authorizationExpirationDate;
051:            private String agentIdString;
052:            private String lastModifiedBy;
053:            private Date lastModifiedDate;
054:            private Boolean isExplicitBoolean;
055:            private Boolean isActiveNowBoolean;
056:
057:            public AuthorizationFacade() {
058:                this .data = new AuthorizationData(); //should do a create method later
059:            }
060:
061:            public AuthorizationFacade(String agentIdString, String functionId,
062:                    String qualifierId, Date authorizationEffectiveDate,
063:                    Date authorizationExpirationDate, String lastModifiedBy,
064:                    Date lastModifiedDate, Boolean isExplicitBoolean) {
065:                this .data = new AuthorizationData(); //should do a create method later
066:                setAgentIdString(agentIdString);
067:                setFunctionId(functionId);
068:                setQualifierId(qualifierId);
069:                setAuthorizationEffectiveDate(authorizationEffectiveDate);
070:                setAuthorizationExpirationDate(authorizationExpirationDate);
071:                setLastModifiedBy(lastModifiedBy);
072:                setLastModifiedDate(lastModifiedDate);
073:                setIsExplicitBoolean(isExplicitBoolean);
074:            }
075:
076:            public AuthorizationFacade(AuthorizationIfc data) {
077:                this .data = data;
078:                this .agentIdString = data.getAgentIdString();
079:                this .functionId = data.getFunctionId();
080:                this .qualifierId = data.getQualifierId();
081:                this .authorizationEffectiveDate = data
082:                        .getAuthorizationEffectiveDate();
083:                this .authorizationExpirationDate = data
084:                        .getAuthorizationExpirationDate();
085:                this .lastModifiedBy = data.getLastModifiedBy();
086:                this .lastModifiedDate = data.getLastModifiedDate();
087:                this .isExplicitBoolean = data.getIsExplicitBoolean();
088:            }
089:
090:            public Id getAgentId() {
091:                return null;
092:            }
093:
094:            public String getAgentIdString() {
095:                return data.getAgentIdString();
096:            }
097:
098:            public void setAgentIdString(String id) {
099:                this .agentIdString = id;
100:                data.setAgentIdString(id);
101:            }
102:
103:            public Function getFunction() {
104:                return null;
105:            }
106:
107:            public Qualifier getQualifier() {
108:                return null;
109:            }
110:
111:            public long getEffectiveDate() {
112:                Date d = data.getAuthorizationEffectiveDate();
113:                if (d != null)
114:                    return d.getTime();
115:                else
116:                    return 0;
117:            }
118:
119:            public long getExpirationDate() {
120:                Date d = data.getAuthorizationExpirationDate();
121:                if (d != null)
122:                    return d.getTime();
123:                else
124:                    return 0;
125:            }
126:
127:            public Id getModifiedBy() {
128:                return null;
129:            }
130:
131:            public long getModifiedDate() {
132:                Date d = data.getLastModifiedDate();
133:                if (d != null)
134:                    return d.getTime();
135:                else
136:                    return 0;
137:
138:            }
139:
140:            public void updateExpirationDate(long expirationDate) {
141:                this .expirationDate = expirationDate;
142:                setAuthorizationExpirationDate(new Date(expirationDate));
143:            }
144:
145:            public void updateEffectiveDate(long effectiveDate) {
146:                this .effectiveDate = effectiveDate;
147:                setAuthorizationEffectiveDate(new Date(effectiveDate));
148:            }
149:
150:            public boolean getIsExplicit() {
151:                return data.getIsExplicitBoolean().booleanValue();
152:            }
153:
154:            public void setIsExplicit(boolean type) {
155:                this .isExplicit = type;
156:                data.setIsExplicitBoolean(Boolean.valueOf(type));
157:            }
158:
159:            public boolean isActiveNow() {
160:                int effectiveVal = (getEffectiveDate() == 0) ? 0 : 1;
161:                int expirationVal = (getExpirationDate() == 0) ? 0 : 2;
162:
163:                // current time in ms
164:                long nowMillis = (new Date()).getTime();
165:                boolean returnVal = false;
166:
167:                switch (effectiveVal + expirationVal) {
168:                case 0: // both are 0
169:                    returnVal = true;
170:                    break;
171:
172:                case 1: // effectiveDate is not 0
173:                    if (nowMillis > getEffectiveDate())
174:                        returnVal = true;
175:                    else
176:                        returnVal = false;
177:
178:                    break;
179:                case 2: // expirationDate is not null
180:                    if (nowMillis < getExpirationDate())
181:                        returnVal = true;
182:                    else
183:                        returnVal = false;
184:
185:                    break;
186:
187:                case 3: // both effectiveDate and expirationDate are not null
188:                    if ((nowMillis > getEffectiveDate())
189:                            && (nowMillis < getExpirationDate()))
190:                        returnVal = true;
191:                    else
192:                        returnVal = false;
193:                }
194:                return returnVal;
195:            }
196:
197:            public AuthorizationIfc getData() {
198:                return this .data;
199:            }
200:
201:            public void setAgentId(String id) {
202:            }
203:
204:            public String getFunctionId() {
205:                return data.getFunctionId();
206:            }
207:
208:            public void setFunctionId(String id) {
209:                this .functionId = id;
210:                data.setFunctionId(id);
211:            }
212:
213:            public String getQualifierId() {
214:                return data.getQualifierId();
215:            }
216:
217:            public void setQualifierId(String id) {
218:                this .qualifierId = id;
219:                data.setQualifierId(id);
220:            }
221:
222:            public void setAuthorizationEffectiveDate(Date cal) {
223:                this .authorizationEffectiveDate = cal;
224:                data.setAuthorizationEffectiveDate(cal);
225:                if (cal != null)
226:                    this .effectiveDate = cal.getTime();
227:            }
228:
229:            public void setAuthorizationExpirationDate(Date cal) {
230:                this .authorizationExpirationDate = cal;
231:                data.setAuthorizationExpirationDate(cal);
232:                if (cal != null)
233:                    this .expirationDate = cal.getTime();
234:            }
235:
236:            public String getLastModifiedBy() {
237:                return data.getLastModifiedBy();
238:            }
239:
240:            public void setLastModifiedBy(String id) {
241:                this .lastModifiedBy = id;
242:                data.setLastModifiedBy(id);
243:            }
244:
245:            public Date getLastModifiedDate() {
246:                return data.getLastModifiedDate();
247:            }
248:
249:            public void setLastModifiedDate(Date cal) {
250:                this .lastModifiedDate = cal;
251:                data.setLastModifiedDate(cal);
252:            }
253:
254:            public Boolean getIsExplicitBoolean() {
255:                return data.getIsExplicitBoolean();
256:            }
257:
258:            public void setIsExplicitBoolean(Boolean type) {
259:                this .isExplicitBoolean = type;
260:                data.setIsExplicitBoolean(type);
261:            }
262:
263:            public void setIsActiveNowBoolean(Boolean isActiveNowBoolean) {
264:            }
265:
266:            public Boolean getIsActiveNowBoolean() {
267:                return data.getIsActiveNowBoolean();
268:            }
269:
270:            public Date getAuthorizationEffectiveDate() {
271:                return data.getAuthorizationEffectiveDate();
272:            }
273:
274:            public Date getAuthorizationExpirationDate() {
275:                return data.getAuthorizationExpirationDate();
276:            }
277:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.