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


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/sections/tags/sakai_2-4-1/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/CourseDependentBean.java $
003:         * $Id: CourseDependentBean.java 21937 2007-02-27 00:10:58Z jholtzman@berkeley.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2005, 2006 The Regents of the University of California and The Regents of the University of Michigan
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.section.jsf.backingbean;
021:
022:        import java.io.Serializable;
023:        import java.util.HashSet;
024:        import java.util.Iterator;
025:        import java.util.List;
026:        import java.util.Locale;
027:        import java.util.Set;
028:
029:        import javax.faces.context.FacesContext;
030:
031:        import org.apache.commons.logging.Log;
032:        import org.apache.commons.logging.LogFactory;
033:        import org.sakaiproject.jsf.util.LocaleUtil;
034:        import org.sakaiproject.section.api.SectionManager;
035:        import org.sakaiproject.section.api.SectionManager.ExternalIntegrationConfig;
036:        import org.sakaiproject.section.api.coursemanagement.Course;
037:        import org.sakaiproject.section.api.coursemanagement.CourseSection;
038:        import org.sakaiproject.tool.section.jsf.JsfUtil;
039:
040:        /**
041:         * Base class for all JSF backing beans relying on knowledge of the current
042:         * course context.
043:         * 
044:         * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman</a>
045:         *
046:         */
047:        public class CourseDependentBean extends InitializableBean implements 
048:                Serializable {
049:
050:            private static final long serialVersionUID = 1L;
051:            private static final Log log = LogFactory
052:                    .getLog(CourseDependentBean.class);
053:
054:            private transient CourseBean courseBean;
055:
056:            private CourseBean getCourseBean() {
057:                if (courseBean == null) {
058:                    courseBean = (CourseBean) JsfUtil
059:                            .resolveVariable("courseBean");
060:                }
061:                return courseBean;
062:            }
063:
064:            /**
065:             * Gets the categories that are currently being used in this site context.
066:             * 
067:             * @param categories
068:             * @param sections
069:             * @return
070:             */
071:            protected Set<String> getUsedCategories() {
072:                Set<String> used = new HashSet<String>();
073:                List sections = getAllSiteSections();
074:                List categories = getSectionManager().getSectionCategories(
075:                        getSiteContext());
076:                for (Iterator iter = sections.iterator(); iter.hasNext();) {
077:                    CourseSection section = (CourseSection) iter.next();
078:                    String cat = section.getCategory();
079:                    if (categories.contains(cat)) {
080:                        used.add(cat);
081:                    }
082:                }
083:                return used;
084:            }
085:
086:            protected SectionManager getSectionManager() {
087:                return getCourseBean().getSectionManager();
088:            }
089:
090:            protected String getUserUid() {
091:                return getCourseBean().authn
092:                        .getUserUid(FacesContext.getCurrentInstance()
093:                                .getExternalContext().getRequest());
094:            }
095:
096:            protected ExternalIntegrationConfig getApplicationConfiguration() {
097:                ExternalIntegrationConfig config = getCourseBean().sectionManager
098:                        .getConfiguration(FacesContext.getCurrentInstance()
099:                                .getExternalContext().getRequest());
100:                if (log.isDebugEnabled())
101:                    log.debug("Application configuration = " + config);
102:                return config;
103:            }
104:
105:            protected String getSiteContext() {
106:                return getCourseBean().context.getContext(null);
107:            }
108:
109:            protected Course getCourse() {
110:                return getCourseBean().sectionManager
111:                        .getCourse(getSiteContext());
112:            }
113:
114:            protected List<CourseSection> getAllSiteSections() {
115:                return getCourseBean().sectionManager
116:                        .getSections(getSiteContext());
117:            }
118:
119:            protected Set getEnrolledSections(String userUid) {
120:                return getCourseBean().sectionManager.getSectionEnrollments(
121:                        userUid, getCourse().getUuid());
122:            }
123:
124:            protected String getCategoryName(String categoryId) {
125:                Locale locale = LocaleUtil.getLocale(FacesContext
126:                        .getCurrentInstance());
127:                return getCourseBean().sectionManager.getCategoryName(
128:                        categoryId, locale);
129:            }
130:
131:            protected List<String> getSectionCategories() {
132:                return getCourseBean().sectionManager
133:                        .getSectionCategories(getSiteContext());
134:            }
135:
136:            public boolean isSectionManagementEnabled() {
137:                return getCourseBean().authz.isSectionManagementAllowed(
138:                        getUserUid(), getSiteContext());
139:            }
140:
141:            public boolean isSectionOptionsManagementEnabled() {
142:                return getCourseBean().authz.isSectionOptionsManagementAllowed(
143:                        getUserUid(), getSiteContext());
144:            }
145:
146:            public boolean isSectionEnrollmentMangementEnabled() {
147:                return getCourseBean().authz
148:                        .isSectionEnrollmentMangementAllowed(getUserUid(),
149:                                getSiteContext());
150:            }
151:
152:            public boolean isSectionTaManagementEnabled() {
153:                return getCourseBean().authz.isSectionTaManagementAllowed(
154:                        getUserUid(), getSiteContext());
155:            }
156:
157:            public boolean isViewOwnSectionsEnabled() {
158:                return getCourseBean().authz.isViewOwnSectionsAllowed(
159:                        getUserUid(), getSiteContext());
160:            }
161:
162:            public boolean isViewAllSectionsEnabled() {
163:                return getCourseBean().authz.isViewAllSectionsAllowed(
164:                        getUserUid(), getSiteContext());
165:            }
166:
167:            public boolean isSectionAssignable() {
168:                return getCourseBean().authz.isSectionAssignable(getUserUid(),
169:                        getSiteContext());
170:            }
171:
172:            public PreferencesBean getPrefs() {
173:                return getCourseBean().getPrefs();
174:            }
175:
176:            public String getSiteRole() {
177:                return getCourseBean().authz.getRoleDescription(getUserUid(),
178:                        getSiteContext());
179:            }
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.