Source Code Cross Referenced for SOCSTaskBean.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:        /**
002:         * $Id: SOCSTaskBean.java,v 1.12 2005/09/21 10:51:35 dg154973 Exp $
003:         * Copyright 2003 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.wireless.taglibs.cal.socs;
014:
015:        import com.sun.portal.wireless.taglibs.base.*;
016:        import com.sun.comclient.calendar.*;
017:        import com.sun.comclient.calendar.socs.*;
018:        import com.sun.portal.wireless.taglibs.cal.*;
019:        import com.sun.portal.log.common.PortalLogger;
020:
021:        import java.util.*;
022:        import java.util.logging.Logger;
023:        import java.util.logging.Level;
024:
025:        public class SOCSTaskBean extends TaskBean {
026:
027:            private SOCSTodo theTask;
028:            private String modifier;
029:            private ReminderBean firstRemBean;
030:
031:            // Create a logger for this class
032:            private static Logger debugLogger = PortalLogger
033:                    .getLogger(SOCSTaskBean.class);
034:
035:            /**
036:             * Creates a taglib SOCSTaskBean from JCAPI SOCSTask
037:             */
038:            public SOCSTaskBean(SOCSTodo task) {
039:                super (task);
040:                this .theTask = task;
041:            }
042:
043:            /**
044:             * Gets the JCAPI VTodo object from SOCSTaskBean
045:             * <br><br>
046:             * @return JCAPI task object
047:             */
048:
049:            public VTodo getTask() {
050:                return theTask;
051:            }
052:
053:            /**
054:             * Returns true if the todo is recurrent
055:             * <br><br>
056:             * @return true if the todo is recurrent
057:             * @throws Exception indicating error in processing
058:             */
059:
060:            public boolean isRecurrence() throws Exception {
061:                return theTask.isRecurring();
062:            }
063:
064:            /**
065:             * Returns the recurrence pattern of this todo 
066:             * <br><br>
067:             * @return first recurrence pattern object, null if does not exist
068:             * @throws Exception indicating error in processing
069:             */
070:
071:            public RecurrencePattern getRecurrencePattern() throws Exception {
072:
073:                if ((theTask.getRecurrenceRules() != null)
074:                        && (theTask.getRecurrenceRules().length > 0)) {
075:                    return theTask.getRecurrenceRules()[0];
076:                }
077:                return null;
078:            }
079:
080:            /**
081:             * Sets the recurrence pattern for this todo
082:             * NOTE: Currently setting only one recurrence pattern is supported
083:             * <br><br>
084:             * @param rPattern recurrence pattern for this todo
085:             * @throws Exception indicating error in processing
086:             */
087:
088:            public void setRecurrencePattern(RecurrencePattern rPattern)
089:                    throws Exception {
090:                RecurrencePattern[] rules = theTask.getRecurrenceRules();
091:                if (rules != null && rules.length > 0) {
092:                    theTask.removeAllRecurrenceRules();
093:                }
094:                theTask.addRecurrenceRule(rPattern);
095:            }
096:
097:            /**
098:             * Sets the location for a todo
099:             * <br><br>
100:             * @param String location to be set
101:             * @throws Exception indicating error in processing
102:             */
103:            public void setLocation(String loc) throws Exception {
104:                theTask.setLocation(loc);
105:            }
106:
107:            /**
108:             * Returns location of a todo
109:             * <br><br>
110:             * @return String location of the todo
111:             * @throws Exception indicating error in processing
112:             */
113:            public String getLocation() throws Exception {
114:                return theTask.getLocation();
115:            }
116:
117:            /**
118:             * Returns the status of the todo
119:             * <br><br>
120:             * @return status of this todo
121:             * @throws Exception indicating error in processing
122:             */
123:
124:            public String getStatus() throws Exception {
125:                return theTask.getStatus();
126:            }
127:
128:            /**
129:             * Sets the status of this todo
130:             * <br><br>
131:             * @param String status of this todo
132:             * @see com.sun.comclient.calendar.socs.SOCSTodo
133:             */
134:
135:            public void setStatus(String status) {
136:                try {
137:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0011", status);
138:
139:                    if ((status.equalsIgnoreCase(SOCSTodo.STATUS_NEEDS_ACTION))
140:                            || (status
141:                                    .equalsIgnoreCase(SOCSTodo.STATUS_IN_PROCESS))
142:                            || (status
143:                                    .equalsIgnoreCase(SOCSTodo.STATUS_COMPLETED))
144:                            || (status
145:                                    .equalsIgnoreCase(SOCSTodo.STATUS_CANCELLED))) {
146:                        //Also set the percent to 100 if task is completed
147:                        if (status.equalsIgnoreCase(SOCSTodo.STATUS_COMPLETED)) {
148:                            theTask.setStatus(status);
149:                            theTask.setPercent(100);
150:                        } else {
151:                            theTask.setStatus(SOCSTodo.STATUS_IN_PROCESS);
152:                            theTask.setPercent(0);
153:                        }
154:                    }
155:
156:                } catch (Exception ex) {
157:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", ex);
158:                }
159:            }
160:
161:            /**
162:             * Returns the Recurrence Modifier of this todo
163:             * <br><br>
164:             * @return String Recurrence Modifier 
165:             */
166:            public String getRecurrenceModifier() {
167:                return modifier;
168:            }
169:
170:            /**
171:             * Returns the modifier of this todo
172:             * <br><br>
173:             * @return String modifier
174:             */
175:
176:            public String getModifier() {
177:                return getRecurrenceModifier();
178:            }
179:
180:            /**
181:             * Sets the Recurrence Modifier of this todo
182:             * <br><br>
183:             * @param String Recurrence Modifier 
184:             */
185:
186:            public void setRecurrenceModifier(String mod) {
187:                modifier = mod;
188:            }
189:
190:            /**
191:             * Sets the modifier of this todo
192:             * <br><br>
193:             * @param String modifier 
194:             */
195:
196:            public void setModifier(String mod) {
197:                setRecurrenceModifier(mod);
198:            }
199:
200:            /**
201:             * Adds the attendees to the SchedulingComponent for group invite
202:             * <br><br>
203:             * @param string containing calendarid(s) seperated by comma
204:             * @throws Exception indicating error in processing
205:             */
206:
207:            public void setAttendees(String attListCalIds) throws Exception {
208:                StringTokenizer strTok = new StringTokenizer(attListCalIds,
209:                        ",;");
210:                while (strTok.hasMoreTokens()) {
211:                    String token = strTok.nextToken().trim();
212:                    if (!token.equals("")) {
213:                        Attendee att = new Attendee(Attendee.INDIVIDUAL,
214:                                Attendee.REQ_PARTICIPANT, token);
215:                        att.setRSVPRequired(true);
216:                        component.addAttendee(att);
217:                    }
218:                }
219:            }
220:
221:            /**
222:             * Returns the list of attendees as a comma seperated string
223:             * <br><br>
224:             * @return String containing attendees list
225:             * @throws Exception in case of error
226:             */
227:            public String getAttendees() throws Exception {
228:                if (component.getAttendees() != null) {
229:                    Attendee[] attArr = component.getAttendees();
230:                    StringBuffer result = new StringBuffer();
231:                    for (int i = 0; i < attArr.length; i++) {
232:                        Attendee att = attArr[i];
233:                        result.append(att.getValue());
234:                        if (i != attArr.length) {
235:                            result.append(",");
236:                        }
237:                    }
238:                    return result.toString();
239:                }
240:                return new String();
241:            }
242:
243:            /** Checks presence of any attendees
244:             * <br><br>
245:             * @return true if number of attendees is zero
246:             * @throws Exception in case of error
247:             */
248:            public boolean isAttendeesEmpty() {
249:                boolean result = true;
250:                try {
251:                    result = (!component.hasAttendee());
252:                } catch (Exception ex) {
253:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0007", ex);
254:                }
255:                return result;
256:            }
257:
258:            /**
259:             * Returns a collection iterator object containing all 
260:             * attendee objects
261:             * <br><br>
262:             * @return CollectionIterator containing attendee objects
263:             * @throws Exception in case of error
264:             */
265:
266:            public CollectionIterator getAttendeesIterator() throws Exception {
267:                Collection result = new Vector();
268:                Attendee[] attArr = component.getAttendees();
269:                if (attArr != null) {
270:                    for (int i = 0; i < attArr.length; i++) {
271:                        Attendee att = attArr[i];
272:                        if (att != null) {
273:                            result.add(new CalIdBean(att.getValue()));
274:                        }
275:                    }
276:                }
277:                return new CollectionIterator(result);
278:            }
279:
280:            /**
281:             * Removes parameter string attendee from the list of attendees
282:             * <br><br>
283:             * @throws Exception in case of error
284:             */
285:            public void setRemovedAttendee(String remove) throws Exception {
286:                StringTokenizer strTok = new StringTokenizer(remove, ",;");
287:                while (strTok.hasMoreTokens()) {
288:                    String token = strTok.nextToken().trim();
289:                    if (!token.equals("")) {
290:                        Attendee[] attArr = component.getAttendees();
291:                        if (attArr != null) {
292:                            for (int i = 0; i < attArr.length; i++) {
293:                                if (attArr[i].getValue().equals(token)) {
294:                                    component.removeAttendee(attArr[i]);
295:                                }
296:                            }
297:                        }
298:                    }
299:                }
300:            }
301:
302:            /**
303:             * Returns the first reminder/alarm
304:             * <br><br>
305:             * @return VAlarm the first reminder
306:             * @throws Exception in case of error
307:             */
308:
309:            public VAlarm getFirstAlarm() throws Exception {
310:                VAlarm firstAlarm = null;
311:                VAlarm[] alarms = theTask.getAlarmComponents();
312:                if ((alarms != null) && (alarms.length > 0)) {
313:                    firstAlarm = alarms[0];
314:                } else {
315:                    firstAlarm = theTask.createAlarm();
316:                    theTask.addAlarmComponent(firstAlarm);
317:                }
318:                if (firstAlarm == null) {
319:                    debugLogger.info("PSMA_CSPWTCS0012");
320:                }
321:                return firstAlarm;
322:            }
323:
324:            /**
325:             * Returns a ReminderBean instance associated with the todo
326:             * <br><br>
327:             * @return ReminderBean  instance for this todo
328:             * @throws Exception in case of processing error
329:             */
330:
331:            public ReminderBean getReminderBean() throws Exception {
332:                if (firstRemBean == null) {
333:                    try {
334:                        firstRemBean = toReminderBean(getFirstAlarm());
335:                    } catch (Exception ex) {
336:                        debugLogger.log(Level.INFO, "PSMA_CSPWTCS0013", ex);
337:                        throw ex;
338:                    }
339:                }
340:                return firstRemBean;
341:            }
342:
343:            protected ReminderBean toReminderBean(VAlarm alarm) {
344:                return new EmailReminderBean(alarm);
345:            }
346:
347:            /**
348:             * Checks if the todo is an all day todo
349:             * <br><br>
350:             * @return true if the task is an all day todo
351:             */
352:            public boolean isAllDay() throws Exception {
353:                return theTask.isAllDay();
354:            }
355:
356:            /**
357:             * Set this todo as all day
358:             * <br><br>
359:             * @param boolean allday indicating an All Day todo
360:             */
361:
362:            public void setAllDay(boolean allday) throws Exception {
363:                if (allday) {
364:                    theTask.setAllDay(true);
365:                } else {
366:                    theTask.setAllDay(false);
367:                }
368:            }
369:
370:            /**
371:             * Checks if the task has a due date 
372:             * <br><br>
373:             * @return true if the todo has a due date
374:             */
375:            public boolean isDue() {
376:                return theTask.hasProperty(SOCSTodo.DUE);
377:            }
378:
379:            /**
380:             * Set this todo with no due date
381:             * <br><br>
382:             * @param boolean flag when false sets duedate to false
383:             */
384:
385:            public void setDue(boolean flag) {
386:                if (!flag) {
387:                    theTask.removeProperty(SOCSTodo.DUE);
388:                }
389:            }
390:
391:            /**
392:             * Returns the completion status of the todo
393:             * <br><br>
394:             * @return true if the todo status is complete
395:             */
396:
397:            public boolean isCompleted() {
398:                try {
399:                    if (theTask.isCompleted()) {
400:                        return true;
401:                    } else {
402:                        return false;
403:                    }
404:                } catch (Exception e) {
405:                    debugLogger.log(Level.INFO, "PSMA_CSPWTCS0014", e);
406:                    return false;
407:                }
408:            }
409:
410:        }
w__w_w___._j_a___va___2_s.co__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.