Source Code Cross Referenced for SOCSContext.java in  » Portal » Open-Portal » com » sun » portal » wireless » taglibs » cal » socs » 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 » Portal » Open Portal » com.sun.portal.wireless.taglibs.cal.socs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright %G% Sun Microsystems, Inc. All Rights Reserved.
002:        // "%W% %E% Sun Microsystems"
003:
004:        package com.sun.portal.wireless.taglibs.cal.socs;
005:
006:        import javax.servlet.http.*;
007:        import javax.servlet.jsp.*;
008:        import javax.servlet.jsp.tagext.*;
009:
010:        import com.sun.portal.wireless.taglibs.base.Util;
011:        import com.sun.portal.wireless.taglibs.base.Context;
012:        import com.sun.portal.wireless.taglibs.cal.*;
013:        import com.sun.portal.log.common.PortalLogger;
014:
015:        import com.sun.comclient.calendar.CalendarStore;
016:        import com.sun.comclient.calendar.VEvent;
017:        import com.sun.comclient.calendar.VTodo;
018:        import com.sun.comclient.calendar.CalendarStoreException;
019:        import com.sun.comclient.calendar.CalendarException;
020:        import com.sun.comclient.calendar.OperationNotSupportedException;
021:
022:        import com.sun.comclient.calendar.socs.*;
023:
024:        import com.sun.comclient.calendar.ICalendar;
025:
026:        import java.util.logging.Logger;
027:        import java.util.logging.Level;
028:
029:        /**
030:         * SOCSContext - This Context adds SOCS specfic features to CalContext
031:         * This SOCSContext uses the same ContextCache,ContextType as CalContext.
032:         * Hence this instance replaces the CalContext but hold the CalContext as parentContext.
033:         * It delegates all the calls to this parentcontext and exposes the SOCS features only.
034:         * 
035:         * @version 1.0
036:         * @see com.sun.portal.wireless.taglibs.cal.Context
037:         */
038:
039:        public class SOCSContext extends CalContextHolder {
040:
041:            public static final String CONTEXT_CLASS_NAME = "com.sun.portal.wireless.taglibs.cal.socs.SOCSContext";
042:
043:            // Create a logger for this class
044:            private static Logger debugLogger = PortalLogger
045:                    .getLogger(SOCSContext.class);
046:
047:            /**
048:             * the default constructor
049:             */
050:            public SOCSContext() {
051:                super ();
052:            }
053:
054:            /**
055:             * Returns a SOCSContext for this session.
056:             * @param pageContext
057:             * @exception Exception   
058:             */
059:            public static CalContext getContext(PageContext pageContext)
060:                    throws Exception {
061:                return (SOCSContext) Context.getContext(pageContext,
062:                        CONTEXT_CLASS_NAME, CONTEXT_CACHE_CLASS_NAME,
063:                        CONTEXT_TYPE);
064:            }
065:
066:            //SOCS Specfic fetaures Follows
067:            private String[] calIds = new String[0]; //list of calids , could be subscribed calids or searchresults depends on Fetch 
068:
069:            /**
070:             * Set the user's subscribed Calendars as t
071:             * 
072:             */
073:            public void setCalIds(String[] subCals) {
074:                calIds = subCals;
075:            }
076:
077:            /**
078:             * gets the user's subscribed Calendars 
079:             * 
080:             * @return the list of subscribed calendars 
081:             */
082:            public String[] getCalIds() {
083:                return calIds;
084:            }
085:
086:            /**
087:             * Returns whether the calid list is empty or not
088:             * 
089:             * @return true if the calid list is empty
090:             *         false otherwise
091:             */
092:            public boolean isCalIdsEmpty() {
093:                return getCalIdsCount() == 0;
094:            }
095:
096:            /**
097:             * Get the count of the current calId list
098:             * 
099:             * @return the event list count
100:             */
101:            public int getCalIdsCount() {
102:                return (calIds != null) ? calIds.length : 0;
103:            }
104:
105:            /**
106:             * Get the Email addr of the user for Reminder from CalSession's property
107:             * @return the email Addr.
108:             */
109:            public String getReminderEmail() {
110:                CalendarStore calStore = getCalStore();
111:                String defEmail = calStore.getSession().getProperty(
112:                        "ceDefaultAlarmEmail");
113:                if ((defEmail == null) || (defEmail.equals(""))) {
114:                    if (calStore instanceof  SOCSCalendarStore) {
115:                        try {
116:                            defEmail = (((SOCSCalendarStore) calStore)
117:                                    .getSOCSSession()
118:                                    .getPreference("ceDefaultAlarmEmail"));
119:                            if (defEmail == null) {
120:                                defEmail = (((SOCSCalendarStore) calStore)
121:                                        .getSOCSSession().getPreference("mail"));
122:                            }
123:                        } catch (CalendarStoreException cs) {
124:                            debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", cs);
125:                        }
126:                    } else {
127:                        defEmail = " ";
128:                    }
129:                }
130:                if (defEmail != null)
131:                    defEmail = defEmail.trim();
132:                return (defEmail);
133:            }
134:
135:            /**
136:             * Checks if user is the Owner of this calendar
137:             * @return true if the user can modify it, false otherwise
138:             */
139:            public boolean isUserTheOwner() {
140:                try {
141:                    return getCalendar().isUserTheOwner();
142:                } catch (CalendarException ex) {
143:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", ex);
144:                } catch (OperationNotSupportedException ex1) {
145:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", ex1);
146:                }
147:                return true;
148:            }
149:
150:            /**
151:             * Checks if user has the modify permission for this calendar
152:             * @return true if the user can modify it, false otherwise
153:             */
154:            public boolean isWritePermGranted() {
155:                try {
156:                    String uid = getSessionProperty(CalendarACL.CAL_USER);
157:                    ICalendar ical = getCalendar();
158:                    CalendarACL calendarACL = new CalendarACL(ical);
159:                    return calendarACL.checkPermission(uid,
160:                            CalendarACL.CAL_COMPONENTS,
161:                            CalendarACL.CAL_WRITE_PERMISSION);
162:                } catch (CalendarException ex) {
163:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", ex);
164:                } catch (OperationNotSupportedException ex) {
165:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", ex);
166:                }
167:                return false;
168:            }
169:
170:            /**
171:             * Checks if user has the delete permission for this calendar
172:             * @return true if the user can delete it, false otherwise
173:             */
174:            public boolean isDeletePermGranted() {
175:                try {
176:                    String uid = getSessionProperty(CalendarACL.CAL_USER);
177:                    ICalendar ical = getCalendar();
178:                    CalendarACL calendarACL = new CalendarACL(ical);
179:                    return calendarACL.checkPermission(uid,
180:                            CalendarACL.CAL_COMPONENTS,
181:                            CalendarACL.CAL_DELETE_PERMISSION);
182:                } catch (CalendarException ex) {
183:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", ex);
184:                } catch (OperationNotSupportedException ex) {
185:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", ex);
186:                }
187:                return false;
188:            }
189:
190:            /**
191:             * Get the SubComponent Specific EventBean
192:             * @return an instance of SOCSEventBean
193:             */
194:            public EventBean toEventBean(VEvent event) {
195:                if (event instanceof  SOCSEvent) {
196:                    EventBean eb = new SOCSEventBean((SOCSEvent) event);
197:                    return eb;
198:                }
199:                return null;
200:            }
201:
202:            /**
203:             * Get the SubComponent Specific TaskBean
204:             * @return an instance of SOCSTaskBean
205:             */
206:            public TaskBean toTaskBean(VTodo task) {
207:                if (task instanceof  SOCSTodo) {
208:                    return new SOCSTaskBean((SOCSTodo) task);
209:                }
210:                return null;
211:            }
212:
213:        }
w___w_w__.__jav___a_2__s.__c_o___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.