Source Code Cross Referenced for SOCSEventBean.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:        package com.sun.portal.wireless.taglibs.cal.socs;
002:
003:        import com.sun.portal.wireless.taglibs.base.*;
004:        import com.sun.comclient.calendar.*;
005:        import com.sun.comclient.calendar.socs.*;
006:        import com.sun.portal.wireless.taglibs.cal.*;
007:        import com.sun.portal.log.common.PortalLogger;
008:
009:        import java.util.*;
010:        import java.util.logging.Logger;
011:        import java.util.logging.Level;
012:
013:        public class SOCSEventBean extends EventBean {
014:
015:            private SOCSEvent theEvent;
016:            private ReminderBean firstRemBean;
017:
018:            // Create a logger for this class
019:            private static Logger debugLogger = PortalLogger
020:                    .getLogger(SOCSEventBean.class);
021:
022:            /**
023:             * The constructor which creates a taglib SOCSEventBean out of JCAPI SOCSEvent
024:             * @param a JCAPI SOCSEvent
025:             */
026:
027:            public SOCSEventBean(SOCSEvent event) {
028:                super (event);
029:                this .theEvent = event;
030:            }
031:
032:            /**
033:             * Gets the JCAPI Event out of the taglib SOCSEventBean
034:             * @return JCAPI event object
035:             */
036:
037:            public VEvent getEvent() {
038:                return theEvent;
039:            }
040:
041:            /**
042:             *verifies  if the currentCalID is the Orgainzer of the Event
043:             *@return true if calId and Orgainzer are the same, false otherwise
044:             */
045:            public boolean isCalIdTheOrganizer() throws Exception {
046:                String calId = theEvent.getCalID();
047:                if (!isNew()) {
048:                    return theEvent.isCalIdTheOrganizer(calId);
049:                }
050:                return true;
051:            }
052:
053:            /**
054:             * Sets the RSVP response to the event
055:             * @param the ParticipantStatus as String.
056:             * @exception it throws exception for invalid values of participation status
057:             */
058:            public void setReply(String replyStatus) throws Exception {
059:                Attendee att = getCalIdAsAttendee();
060:                if (att != null) {
061:                    att.setParticipantStatus(replyStatus);
062:                }
063:            }
064:
065:            private Attendee getCalIdAsAttendee() {
066:                return theEvent.getAttendee(theEvent.getCalID());
067:            }
068:
069:            /**
070:             * Gets the RSVP response of this user in the event
071:             * @return the ParticipantStatus as String
072:             */
073:            public String getReply() throws Exception {
074:                Attendee att = getCalIdAsAttendee();
075:                if (att != null) {
076:                    return att.getParticipantStatus();
077:                }
078:                return "";
079:            }
080:
081:            /**
082:             * Returns whether the component is part of a recurrence.
083:             * <br><br>
084:             *
085:             * @return true if the component repeats
086:             */
087:            public boolean isRecurrence() throws Exception {
088:                return theEvent.isRecurring();
089:            }
090:
091:            /**
092:             * Set the Reminder Objcet
093:             * <br><br>
094:             * @param reminder
095:             */
096:            public void setReminderBean(ReminderBean remBean) throws Exception {
097:                //remove and add the first one as we do not
098:                //currently support multiple alarms
099:                VAlarm[] alarms = theEvent.getAlarmComponents();
100:                try {
101:                    if ((alarms != null) && (alarms.length > 0)) {
102:                        debugLogger.finer("PSMA_CSPWTCS0008");
103:                        theEvent.removeAlarmComponent(alarms[0]);
104:                    }
105:                    theEvent.addAlarmComponent(remBean.getAlarm());
106:                } catch (Exception e) {
107:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0009", e);
108:                }
109:            }
110:
111:            /**
112:             *   adds the attendees to the Component for group invite
113:             *    @param the string containing calendarids seperated by comma
114:             *    @exception throws exception
115:             *    TBD: for Aligo Adapter
116:             */
117:
118:            public void setAttendees(String attListCalIds) throws Exception {
119:                StringTokenizer strTok = new StringTokenizer(attListCalIds,
120:                        ",;");
121:                while (strTok.hasMoreTokens()) {
122:                    String token = strTok.nextToken().trim();
123:                    if (!token.equals("")) {
124:                        Attendee att = new Attendee(Attendee.INDIVIDUAL,
125:                                Attendee.REQ_PARTICIPANT, token);
126:                        att.setRSVPRequired(true);
127:                        component.addAttendee(att);
128:                    }
129:                }
130:            }
131:
132:            /**
133:             * Gets the list of attendees as a comma seperated string
134:             * @retun the string form of attendees calids
135:             */
136:            public String getAttendees() throws Exception {
137:                if (component.getAttendees() != null) {
138:                    Attendee[] attArr = component.getAttendees();
139:                    StringBuffer result = new StringBuffer();
140:                    for (int i = 0; i < attArr.length; i++) {
141:                        Attendee att = attArr[i];
142:                        result.append(att.getValue());
143:                        if (i != (attArr.length - 1)) {
144:                            result.append(",");
145:                        }
146:                    }
147:                    return result.toString();
148:                }
149:                return new String();
150:            }
151:
152:            /**
153:             * Verifies if there are attendees
154:             * @return true if any exist, false otherwise
155:             */
156:            public boolean isAttendeesEmpty() {
157:                boolean result = true;
158:                try {
159:                    result = (!component.hasAttendee());
160:                } catch (Exception ex) {
161:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0010", ex);
162:                }
163:                return result;
164:            }
165:
166:            public CollectionIterator getAttendeesIterator() throws Exception {
167:                Collection result = new Vector();
168:                Attendee[] attArr = component.getAttendees();
169:                if (attArr != null) {
170:                    for (int i = 0; i < attArr.length; i++) {
171:                        Attendee att = attArr[i];
172:                        if (att != null) {
173:                            result.add(new CalIdBean(att.getValue()));
174:                        }
175:                    }
176:                }
177:                return new CollectionIterator(result);
178:            }
179:
180:            public void setRemovedAttendee(String remove) throws Exception {
181:                StringTokenizer strTok = new StringTokenizer(remove, ",;");
182:                while (strTok.hasMoreTokens()) {
183:                    String token = strTok.nextToken().trim();
184:                    if (!token.equals("")) {
185:                        Attendee[] attArr = component.getAttendees();
186:                        if (attArr != null) {
187:                            for (int i = 0; i < attArr.length; i++) {
188:                                if (attArr[i].getValue().equals(token)) {
189:                                    component.removeAttendee(attArr[i]);
190:                                }
191:                            }
192:                        }
193:                    }
194:                }
195:            }
196:
197:            public VAlarm getFirstAlarm() throws Exception {
198:                VAlarm firstAlarm = null;
199:                VAlarm[] alarms = theEvent.getAlarmComponents();
200:                if ((alarms != null) && (alarms.length > 0)) {
201:                    firstAlarm = alarms[0];
202:                } else {
203:                    firstAlarm = theEvent.createAlarm();
204:                    theEvent.addAlarmComponent(firstAlarm);
205:                }
206:                if (firstAlarm == null) {
207:                    throw new Exception("No alrams set or able to create");
208:                }
209:                return firstAlarm;
210:            }
211:
212:            public ReminderBean getReminderBean() throws Exception {
213:                if (firstRemBean == null) {
214:                    try {
215:                        firstRemBean = toReminderBean(getFirstAlarm());
216:                    } catch (Exception ex) {
217:                        debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", ex);
218:                        throw ex;
219:                    }
220:                }
221:                return firstRemBean;
222:            }
223:
224:            protected ReminderBean toReminderBean(VAlarm alarm) {
225:                return new EmailReminderBean(alarm);
226:            }
227:
228:        }
w___w_w__._j__av___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.