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


001:        /**********************************************************************************
002:         *
003:         * $Id: GradebookBean.java 22061 2007-03-01 22:54:37Z ray@media.berkeley.edu $
004:         *
005:         ***********************************************************************************
006:         *
007:         * Copyright (c) 2005 The Regents of the University of California, The MIT Corporation
008:         *
009:         * Licensed under the Educational Community License, Version 1.0 (the "License");
010:         * you may not use this file except in compliance with the License.
011:         * You may obtain a copy of the License at
012:         *
013:         *      http://www.opensource.org/licenses/ecl1.php
014:         *
015:         * Unless required by applicable law or agreed to in writing, software
016:         * distributed under the License is distributed on an "AS IS" BASIS,
017:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018:         * See the License for the specific language governing permissions and
019:         * limitations under the License.
020:         *
021:         **********************************************************************************/package org.sakaiproject.tool.gradebook.ui;
022:
023:        import javax.faces.context.FacesContext;
024:        import javax.servlet.ServletRequest;
025:        import javax.servlet.http.HttpServletRequest;
026:        import javax.servlet.http.HttpSession;
027:
028:        import org.apache.commons.logging.Log;
029:        import org.apache.commons.logging.LogFactory;
030:
031:        import org.sakaiproject.section.api.SectionAwareness;
032:
033:        import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException;
034:        import org.sakaiproject.tool.gradebook.Gradebook;
035:        import org.sakaiproject.tool.gradebook.business.GradebookManager;
036:        import org.sakaiproject.tool.gradebook.facades.*;
037:
038:        /**
039:         * Provide a UI handle to the selected gradebook.
040:         *
041:         * Since all application-specific backing beans (a group that doesn't include
042:         * authentication handlers) require a gradebook ID to use with any of the
043:         * business or facade services, this bean is also a reasonable place to centralize
044:         * configuration of and access to those services.
045:         */
046:        public class GradebookBean extends InitializableBean {
047:            private static final Log logger = LogFactory
048:                    .getLog(GradebookBean.class);
049:
050:            private Long gradebookId;
051:            private String gradebookUid;
052:
053:            // These interfaces are defined application-wide (through Spring, although the
054:            // UI classes don't know that).
055:            private GradebookManager gradebookManager;
056:            private SectionAwareness sectionAwareness;
057:            private UserDirectoryService userDirectoryService;
058:            private Authn authnService;
059:            private Authz authzService;
060:            private ContextManagement contextManagementService;
061:            private EventTrackingService eventTrackingService;
062:            private ConfigurationBean configurationBean;
063:
064:            /**
065:             * @return Returns the gradebookId.
066:             */
067:            public final Long getGradebookId() {
068:                refreshFromRequest();
069:                return gradebookId;
070:            }
071:
072:            private final void setGradebookId(Long gradebookId) {
073:                this .gradebookId = gradebookId;
074:            }
075:
076:            /**
077:             * @param newGradebookUid The gradebookId to set.
078:             * Since this is coming from the client, the application should NOT
079:             * trust that the current user actually has access to the gradebook
080:             * with this UID. This design assumes that authorization will come
081:             * into play on each request.
082:             */
083:            public final void setGradebookUid(String newGradebookUid) {
084:                Long newGradebookId = null;
085:                if (newGradebookUid != null) {
086:                    Gradebook gradebook = null;
087:                    try {
088:                        gradebook = getGradebookManager().getGradebook(
089:                                newGradebookUid);
090:                    } catch (GradebookNotFoundException gnfe) {
091:                        logger
092:                                .error("Request made for inaccessible gradebookUid="
093:                                        + newGradebookUid);
094:                        newGradebookUid = null;
095:                    }
096:                    newGradebookId = gradebook.getId();
097:                    if (logger.isInfoEnabled())
098:                        logger.info("setGradebookUid gradebookUid="
099:                                + newGradebookUid + ", gradebookId="
100:                                + newGradebookId);
101:                }
102:                this .gradebookUid = newGradebookUid;
103:                setGradebookId(newGradebookId);
104:            }
105:
106:            private final void refreshFromRequest() {
107:                String requestUid = contextManagementService
108:                        .getGradebookUid(FacesContext.getCurrentInstance()
109:                                .getExternalContext().getRequest());
110:                if ((requestUid != null) && (!requestUid.equals(gradebookUid))) {
111:                    if (logger.isInfoEnabled())
112:                        logger.info("resetting gradebookUid from "
113:                                + gradebookUid);
114:                    setGradebookUid(requestUid);
115:                }
116:            }
117:
118:            /**
119:             * Static method to pick up the gradebook UID, if any, held by the current GradebookBean, if any.
120:             * Meant to be called from a servlet filter.
121:             */
122:            public static String getGradebookUidFromRequest(
123:                    ServletRequest request) {
124:                String gradebookUid = null;
125:                HttpSession session = ((HttpServletRequest) request)
126:                        .getSession();
127:                GradebookBean gradebookBean = (GradebookBean) session
128:                        .getAttribute("gradebookBean");
129:                if (gradebookBean != null) {
130:                    gradebookUid = gradebookBean.gradebookUid;
131:                }
132:                return gradebookUid;
133:            }
134:
135:            // The following getters are used by other backing beans. The setters are used only by
136:            // the bean factory.
137:
138:            /**
139:             * @return Returns the gradebookManager.
140:             */
141:            public GradebookManager getGradebookManager() {
142:                return gradebookManager;
143:            }
144:
145:            /**
146:             * @param gradebookManager The gradebookManager to set.
147:             */
148:            public void setGradebookManager(GradebookManager gradebookManager) {
149:                this .gradebookManager = gradebookManager;
150:            }
151:
152:            public SectionAwareness getSectionAwareness() {
153:                return sectionAwareness;
154:            }
155:
156:            public void setSectionAwareness(SectionAwareness sectionAwareness) {
157:                this .sectionAwareness = sectionAwareness;
158:            }
159:
160:            /**
161:             * @return Returns the userDirectoryService.
162:             */
163:            public UserDirectoryService getUserDirectoryService() {
164:                return userDirectoryService;
165:            }
166:
167:            /**
168:             * @param userDirectoryService The userDirectoryService to set.
169:             */
170:            public void setUserDirectoryService(
171:                    UserDirectoryService userDirectoryService) {
172:                this .userDirectoryService = userDirectoryService;
173:            }
174:
175:            /**
176:             * @return Returns the authnService.
177:             */
178:            public Authn getAuthnService() {
179:                return authnService;
180:            }
181:
182:            /**
183:             * @param authnService The authnService to set.
184:             */
185:            public void setAuthnService(Authn authnService) {
186:                this .authnService = authnService;
187:            }
188:
189:            public Authz getAuthzService() {
190:                return authzService;
191:            }
192:
193:            public void setAuthzService(Authz authzService) {
194:                this .authzService = authzService;
195:            }
196:
197:            /**
198:             * @return Returns the contextManagementService.
199:             */
200:            public ContextManagement getContextManagementService() {
201:                return contextManagementService;
202:            }
203:
204:            /**
205:             * @param contextManagementService The contextManagementService to set.
206:             */
207:            public void setContextManagementService(
208:                    ContextManagement contextManagementService) {
209:                this .contextManagementService = contextManagementService;
210:            }
211:
212:            public EventTrackingService getEventTrackingService() {
213:                return eventTrackingService;
214:            }
215:
216:            public void setEventTrackingService(
217:                    EventTrackingService eventTrackingService) {
218:                this .eventTrackingService = eventTrackingService;
219:            }
220:
221:            public ConfigurationBean getConfigurationBean() {
222:                return configurationBean;
223:            }
224:
225:            public void setConfigurationBean(ConfigurationBean configurationBean) {
226:                this.configurationBean = configurationBean;
227:            }
228:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.