Source Code Cross Referenced for EventBackingBean.java in  » Portal » Open-Portal » com » sun » portal » app » sharedevents » faces » 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.app.sharedevents.faces 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * EventBackingBean.java
0003:         *
0004:         * Created on April 18, 2005, 2:57 PM
0005:         */
0006:
0007:        package com.sun.portal.app.sharedevents.faces;
0008:
0009:        import com.sun.comclient.calendar.DateTime;
0010:        import com.sun.comclient.calendar.RecurrencePattern;
0011:        import com.sun.comclient.calendar.VEvent;
0012:        import com.sun.portal.app.sharedevents.util.SharedConstants;
0013:        import java.beans.*;
0014:        import java.io.Serializable;
0015:        import javax.faces.context.FacesContext;
0016:        import com.sun.portal.app.sharedevents.models.EventModel;
0017:        import com.sun.portal.app.sharedevents.util.AppUtils;
0018:        import com.sun.portal.app.sharedevents.util.CalUserHelper;
0019:        import com.sun.portal.log.common.PortalLogger;
0020:        import com.sun.web.ui.model.Option;
0021:        import java.util.Date;
0022:        import java.util.Map;
0023:        import java.util.ResourceBundle;
0024:        import java.util.TimeZone;
0025:        import java.util.logging.Level;
0026:        import java.util.logging.Logger;
0027:        import javax.faces.context.ExternalContext;
0028:
0029:        /**
0030:         * @author SaiSatish Vedam
0031:         */
0032:        public class EventBackingBean extends Object implements  Serializable {
0033:
0034:            private static final long serialVersionUID = 1L;
0035:
0036:            public static final String PROP_SAMPLE_PROPERTY = "sampleProperty";
0037:
0038:            private String sampleProperty;
0039:
0040:            private PropertyChangeSupport propertySupport;
0041:
0042:            private String CLASS_NAME = "EventBackingBean";
0043:
0044:            private boolean fetchFailed = false;
0045:            private boolean loadDefaults = true;
0046:            private boolean editMode = false;
0047:            private boolean modifyAllInstances = false;
0048:            private boolean isRecurring = false;
0049:            private boolean renderEvent = true;
0050:
0051:            private String pageTitle = null;
0052:
0053:            private String selectedType = "0";
0054:            private String startDateStr = null;
0055:            private String title = null;
0056:            private String location = null;
0057:            private String desc = null;
0058:            private String startHour = null;
0059:            private String startMin = null;
0060:            private String endHour = null;
0061:            private String endMin = null;
0062:            private String repeatInterval = null;
0063:            private String uid = null;
0064:            private String rid = null;
0065:
0066:            private String oldStartDate = null;
0067:            private String oldStartHour = null;
0068:            private String oldStartMin = null;
0069:            private String oldEndHour = null;
0070:            private String oldEndMin = null;
0071:            private String oldRepeatInterval = null;
0072:            private String oldEventTitle = null;
0073:            private String oldEventLocation = null;
0074:            private String oldEventDesc = null;
0075:            //private String eventUIDRID = null;
0076:
0077:            private ResourceBundle bundle = null;
0078:            private EventModel model = null;
0079:            private VEvent event = null;
0080:            private FacesContext context = null;
0081:            private ExternalContext extContext = null;
0082:            private Date startDate = null;
0083:            private static Option[] hourOptions = null;
0084:            private static Option[] minOptions = null;
0085:            private static Option[] recurrenceOptions = null;
0086:
0087:            private EventAlert alert = null;
0088:
0089:            private static Logger logger = PortalLogger
0090:                    .getLogger(EventBackingBean.class);
0091:
0092:            public EventBackingBean() {
0093:
0094:                logger.entering(CLASS_NAME, "EventBackingBean()");
0095:
0096:                extContext = FacesContext.getCurrentInstance()
0097:                        .getExternalContext();
0098:
0099:                bundle = getResourceBundle();
0100:
0101:                Map requestMap = extContext.getRequestParameterMap();
0102:
0103:                //Check if it needs to display the serach result.
0104:                AppUtils.hasSearchResultsInURL();
0105:
0106:                // Need to check if this is in edit/new event mode.
0107:                // Edit mode would contain the UID, RID as parameters
0108:                String reqUid = null;
0109:                String reqRid = null;
0110:                if (requestMap != null) {
0111:
0112:                    reqUid = (String) requestMap
0113:                            .get(SharedConstants.URL_CURR_EVENT_UID);
0114:
0115:                    if (reqUid != null && reqUid.length() > 0) {
0116:                        uid = reqUid;
0117:                        setAttributeInSession(
0118:                                SharedConstants.SESSION_CURR_EVENT_UID, uid);
0119:                        logger.log(Level.FINE, "UID from request: " + uid);
0120:                        this 
0121:                                .removeAttributeFromSession(SharedConstants.SESSION_CURR_EVENT_RID);
0122:                        reqRid = (String) requestMap
0123:                                .get(SharedConstants.URL_CURR_EVENT_RID);
0124:                        if (reqRid != null && reqRid.length() > 0
0125:                                && !reqRid.equalsIgnoreCase("null")) {
0126:                            rid = reqRid;
0127:                            setAttributeInSession(
0128:                                    SharedConstants.SESSION_CURR_EVENT_RID, rid);
0129:                            logger.log(Level.FINE, "RID from request: " + rid);
0130:                        } else {
0131:                            reqRid = null;
0132:                            //logger.log(Level.FINE, "The event is not recurring");
0133:                        }
0134:                    }
0135:                }
0136:
0137:                // See if the UID & RID are stored in session. These would have been stored 
0138:                // when they were found in request params.
0139:                // We need to do this because a page refresh (in portlet env) would not contain the
0140:                // request params but we still need to maintain the state
0141:
0142:                if (uid == null) {
0143:                    uid = (String) getSessionAttribute(SharedConstants.SESSION_CURR_EVENT_UID);
0144:                    //retrive the rid, only if uid is retrived from session.
0145:                    rid = (String) getSessionAttribute(SharedConstants.SESSION_CURR_EVENT_RID);
0146:
0147:                }
0148:
0149:                logger.fine(CLASS_NAME + ".EventBackingBean() UID=" + uid);
0150:                logger.fine(CLASS_NAME + ".EventBackingBean() RID=" + rid);
0151:                if (uid != null) {
0152:                    loadDefaults = false;
0153:                    setEditMode(true);
0154:                    retrieveEvent();
0155:                    if (!fetchFailed) {
0156:                        loadEventData();
0157:                    }
0158:                } else {
0159:                    model = getEventModel();
0160:                }
0161:
0162:                EventsUserSessionBackingBean userSessionBean = (EventsUserSessionBackingBean) AppUtils
0163:                        .getBean(EventsUserSessionBackingBean.BEAN_NAME);
0164:                alert = userSessionBean.getEventAlert();
0165:
0166:                logger.exiting(CLASS_NAME, "EventBackingBean()");
0167:
0168:            }
0169:
0170:            public String getPageTitle() {
0171:
0172:                if (getEditMode()) {
0173:                    pageTitle = bundle.getString("editEventPageTitle");
0174:                } else {
0175:                    pageTitle = bundle.getString("createEventPageTitle");
0176:                }
0177:                return pageTitle;
0178:            }
0179:
0180:            public void setPageTitle(String value) {
0181:                pageTitle = value;
0182:            }
0183:
0184:            public boolean getShowAlert() {
0185:
0186:                return alert.getShowAlert();
0187:            }
0188:
0189:            public void setShowAlert(boolean showAlert) {
0190:                alert.setShowAlert(showAlert);
0191:            }
0192:
0193:            public String getAlertType() {
0194:                return alert.getAlertType();
0195:            }
0196:
0197:            public void setAlertType(String value) {
0198:                alert.setAlertType(value);
0199:            }
0200:
0201:            public String getMessageSummary() {
0202:                return alert.getMessageSummary();
0203:            }
0204:
0205:            public void setMessageSummary(String s) {
0206:                alert.setMessageSummary(s);
0207:            }
0208:
0209:            public String getMessageDetail() {
0210:                return alert.getMessageDetail();
0211:            }
0212:
0213:            public void setMessageDetail(String s) {
0214:                alert.setmessageDetail(s);
0215:            }
0216:
0217:            public Date getStartDate() {
0218:                return startDate;
0219:            }
0220:
0221:            /*
0222:            public String getStartDate() {
0223:                return startDate;
0224:            }
0225:             */
0226:
0227:            public void setStartDate(Date s) {
0228:                startDate = s;
0229:            }
0230:
0231:            /*
0232:            public void setStartDate(String s) {
0233:                startDate = s;
0234:            }
0235:             */
0236:
0237:            public String getEventTitle() {
0238:
0239:                return title;
0240:            }
0241:
0242:            public void setEventTitle(String value) {
0243:                title = value;
0244:            }
0245:
0246:            public String getEventLocation() {
0247:
0248:                return location;
0249:            }
0250:
0251:            public void setEventLocation(String value) {
0252:
0253:                location = value;
0254:            }
0255:
0256:            public String getEventDesc() {
0257:                return desc;
0258:            }
0259:
0260:            public void setEventDesc(String value) {
0261:                desc = value;
0262:            }
0263:
0264:            public String getStartHour() {
0265:
0266:                if (startHour != null) {
0267:                    return startHour;
0268:                }
0269:
0270:                startHour = model.getStartHourField();
0271:                return startHour;
0272:            }
0273:
0274:            public void setStartHour(String sh) {
0275:                startHour = sh;
0276:            }
0277:
0278:            public String getStartMin() {
0279:                if (startMin != null) {
0280:                    return startMin;
0281:                }
0282:                startMin = model.getStartMinField();
0283:                return startMin;
0284:            }
0285:
0286:            public void setStartMin(String sm) {
0287:                startMin = sm;
0288:            }
0289:
0290:            public String getEndHour() {
0291:                if (endHour != null) {
0292:                    return endHour;
0293:                }
0294:                endHour = model.getEndHourField();
0295:                return endHour;
0296:            }
0297:
0298:            public void setEndHour(String eh) {
0299:                endHour = eh;
0300:
0301:            }
0302:
0303:            public String getEndMin() {
0304:                if (endMin != null) {
0305:                    return endMin;
0306:                }
0307:                endMin = model.getEndMinField();
0308:                return endMin;
0309:            }
0310:
0311:            public void setEndMin(String em) {
0312:                endMin = em;
0313:            }
0314:
0315:            public String getRepeatInterval() {
0316:
0317:                if (repeatInterval != null) {
0318:                    return repeatInterval;
0319:                }
0320:                repeatInterval = model.getRepeatIntervalField();
0321:                return repeatInterval;
0322:
0323:            }
0324:
0325:            public void setRepeatInterval(String repeatInterval) {
0326:                this .repeatInterval = repeatInterval;
0327:            }
0328:
0329:            public EventModel getEventModel() {
0330:
0331:                logger.entering(CLASS_NAME, "getEventModel()");
0332:
0333:                EventModel model = new EventModel();
0334:
0335:                if (!loadDefaults) {
0336:                    return model;
0337:                }
0338:
0339:                try {
0340:                    model.retrieve(SharedConstants.LOAD_EVENT_DEFAULTS_CONTEXT);
0341:                } catch (Exception e1) {
0342:                    logger.log(Level.WARNING,
0343:                            "Failed load default values for event: "
0344:                                    + e1.getMessage());
0345:                }
0346:
0347:                logger.exiting(CLASS_NAME, "getEventModel()");
0348:                return model;
0349:            }
0350:
0351:            public String handleNavigation() {
0352:                logger.entering(CLASS_NAME, "handleNavigation()");
0353:                alert.setShowAlert(false);
0354:
0355:                logger.exiting(CLASS_NAME, "handleNavigation()");
0356:
0357:                return "eventPage";
0358:
0359:            }
0360:
0361:            /*
0362:             * Handles creation/Modifying an event.
0363:             * Returns "success" if the operation is success-ful so that JSF 
0364:             * Navigation map can re-direct to the defined 
0365:             * view (in faces-config.xml)
0366:             *
0367:             */
0368:
0369:            public String handleSave() {
0370:                logger.entering(CLASS_NAME, "handleSave()");
0371:                this .setShowAlert(false);
0372:                boolean modifyEvent = false;
0373:                String execContext = null;
0374:
0375:                // Inform the parent page (i.e events listing) to refresh the data after
0376:                // this operation
0377:                setAttributeInSession(SharedConstants.SESSION_REFRESH_DATA,
0378:                        "true");
0379:
0380:                if (logger.isLoggable(Level.FINE)) {
0381:                    //logger.log(Level.FINE, "startDate: " + startDate);    
0382:                    logger.log(Level.FINE, "startHour: " + startHour);
0383:                    logger.log(Level.FINE, "startMin: " + startMin);
0384:                    logger.log(Level.FINE, "endHour: " + endHour);
0385:                    logger.log(Level.FINE, "endMin: " + endMin);
0386:                    logger.log(Level.FINE, "repeatInterval: " + repeatInterval);
0387:                    logger.log(Level.FINE, "title: " + title);
0388:                    logger.log(Level.FINE, "location: " + location);
0389:                    logger.log(Level.FINE, "desc: " + desc);
0390:
0391:                }
0392:
0393:                // Determine if this is in Edit mode or New Event Mode.
0394:                // If this was invoked from Edit mode, we would have the event UID
0395:
0396:                if (uid != null && uid.length() > 0) {
0397:                    logger.log(Level.FINE, "Modifying the event with UID: "
0398:                            + uid);
0399:                    modifyEvent = true;
0400:                }
0401:
0402:                boolean startDateChanged = false;
0403:                boolean startHourChanged = false;
0404:                boolean startMinChanged = false;
0405:                boolean endHourChanged = false;
0406:                boolean endMinChanged = false;
0407:                boolean recurrenceChanged = false;
0408:                boolean titleChanged = false;
0409:                boolean locationChanged = false;
0410:                boolean descChanged = false;
0411:
0412:                // Determine if there was change in any of the event data
0413:                // There is no point in sending the event-modification request to the
0414:                // calendar server is nothing was changed.
0415:
0416:                if (modifyEvent) {
0417:
0418:                    execContext = SharedConstants.MODIFY_EVENT_CONTEXT;
0419:
0420:                    startDateChanged = isStartDateChanged();
0421:                    startHourChanged = isStartHourChanged();
0422:                    startMinChanged = isStartMinChanged();
0423:                    endHourChanged = isEndHourChanged();
0424:                    endMinChanged = isEndMinChanged();
0425:                    recurrenceChanged = isRecurrenceChanged();
0426:                    titleChanged = isTitleChanged();
0427:                    locationChanged = isLocationChanged();
0428:                    descChanged = isDescChanged();
0429:
0430:                }
0431:
0432:                EventModel model = new EventModel();
0433:
0434:                if (modifyEvent) {
0435:                    if (startDateChanged || startHourChanged || startMinChanged
0436:                            || endMinChanged || endHourChanged
0437:                            || recurrenceChanged || titleChanged
0438:                            || locationChanged || descChanged) {
0439:
0440:                        if (startDateChanged || startHourChanged
0441:                                || startMinChanged || endHourChanged
0442:                                || endMinChanged) {
0443:                            model.setStartDate(startDate);
0444:                            model.setStartHourField(startHour);
0445:                            model.setStartMinField(startMin);
0446:                            model.setEndHourField(endHour);
0447:                            model.setEndMinField(endMin);
0448:                        }
0449:
0450:                        model.setEventUID(uid);
0451:                        model.setEventRID(rid);
0452:
0453:                        // Modying THIS_INSTANCE or THIS_AND_ALL ?
0454:
0455:                        if (logger.isLoggable(Level.FINE)) {
0456:                            logger.log(Level.FINE, "Modify All Instances? "
0457:                                    + modifyAllInstances);
0458:                        }
0459:
0460:                        if (getModifyAllInstances()) {
0461:                            model
0462:                                    .setRecurrenceModifier(RecurrencePattern.THIS_AND_ALL);
0463:                        } else {
0464:                            model
0465:                                    .setRecurrenceModifier(RecurrencePattern.THIS_INSTANCE);
0466:                        }
0467:
0468:                        if (recurrenceChanged) {
0469:                            model.setRecurrenceChanged(true);
0470:                            model.setRepeatIntervalField(repeatInterval);
0471:
0472:                        }
0473:
0474:                        if (titleChanged) {
0475:                            model.setTitleField(title);
0476:                        }
0477:
0478:                        if (locationChanged) {
0479:                            model.setLocationField(location);
0480:                        }
0481:                        if (descChanged) {
0482:                            model.setDescField(desc);
0483:                        }
0484:
0485:                    } else {
0486:                        if (logger.isLoggable(Level.FINE)) {
0487:                            logger.log(Level.FINE,
0488:                                    "No Modifications done to the event!");
0489:                        }
0490:
0491:                        logger.exiting(CLASS_NAME, "handleSave()");
0492:                        removeAttributeFromSession(SharedConstants.SESSION_CURR_EVENT_UID);
0493:                        removeAttributeFromSession(SharedConstants.SESSION_CURR_EVENT_RID);
0494:                        removeAttributeFromSession(SharedConstants.SESSION_COMMUNITY_EVENT_SEARCH);
0495:
0496:                        return "success";
0497:                    }
0498:                }
0499:
0500:                if (!modifyEvent) {
0501:
0502:                    execContext = SharedConstants.ADD_EVENT_CONTEXT;
0503:
0504:                    //model.setStartDateF(startDate);
0505:                    model.setStartDate(startDate);
0506:                    model.setStartHourField(startHour);
0507:                    model.setStartMinField(startMin);
0508:                    model.setEndHourField(endHour);
0509:                    model.setEndMinField(endMin);
0510:                    model.setRepeatIntervalField(repeatInterval);
0511:                    model.setTitleField(title);
0512:                    model.setLocationField(location);
0513:                    model.setDescField(desc);
0514:                }
0515:
0516:                boolean insertFailed = false;
0517:
0518:                String msgDetailBundleKey = null;
0519:                // Do the insert context to create the new event
0520:                try {
0521:
0522:                    model.insert(execContext);
0523:
0524:                } catch (Exception e1) {
0525:                    msgDetailBundleKey = e1.getMessage();
0526:                    if (modifyEvent) {
0527:                        logger.log(Level.SEVERE, "Event Modification Failed: "
0528:                                + e1.getMessage());
0529:                        //msgDetailBundleKey = "eventModifyFailMsgDetail";
0530:                    } else {
0531:                        logger.log(Level.SEVERE, "Event Creation Failed: "
0532:                                + e1.getMessage());
0533:                        //msgDetailBundleKey = "eventCreateFailMsgDetail";
0534:                    }
0535:                    this .setMessageDetail(e1.getMessage());
0536:                    insertFailed = true;
0537:                }
0538:
0539:                // Get the appropriate error/info message based on the bundle key obtained
0540:
0541:                if (msgDetailBundleKey != null
0542:                        && msgDetailBundleKey.length() > 0) {
0543:                    String detail = bundle.getString(msgDetailBundleKey);
0544:                    if (detail == null || detail.length() == 0) {
0545:                        detail = bundle.getString("unknownErrorMsgDetail");
0546:                    }
0547:                    this .setMessageDetail(detail);
0548:
0549:                }
0550:
0551:                if (insertFailed) {
0552:                    this .setShowAlert(true);
0553:                    alert.setAlertType(EventAlert.ALERT_TYPE_ERROR);
0554:                    String summary = bundle.getString("eventCreateFailSummary");
0555:                    if (modifyEvent) {
0556:                        summary = bundle.getString("eventModifyFailSummary");
0557:                    }
0558:                    this .setMessageSummary(summary);
0559:
0560:                    // Return the string that is mapped in the Navigation rules 
0561:                    // (faces-config.xml) so the the control is transferred accordingly
0562:                    logger.exiting(CLASS_NAME, "handleSave()");
0563:                    return "failure";
0564:                } else {
0565:
0566:                    removeAttributeFromSession(SharedConstants.SESSION_CURR_EVENT_UID);
0567:                    removeAttributeFromSession(SharedConstants.SESSION_CURR_EVENT_RID);
0568:                    removeAttributeFromSession(SharedConstants.SESSION_COMMUNITY_EVENT_SEARCH);
0569:
0570:                    // Return the string that is mapped in the Navigation rules 
0571:                    // (faces-config.xml) so the the control is transferred accordingly
0572:                    alert.setShowAlert(false);
0573:                    logger.exiting(CLASS_NAME, "handleSave()");
0574:                    return "success";
0575:                }
0576:
0577:            }
0578:
0579:            public String handleDelete() {
0580:                logger.entering(CLASS_NAME, "handleDelete()");
0581:
0582:                boolean insertFailed = false;
0583:
0584:                // Inform the parent page (i.e events listing) to refresh the data after
0585:                // this operation
0586:                setAttributeInSession(SharedConstants.SESSION_REFRESH_DATA,
0587:                        "true");
0588:
0589:                EventModel model = getEventModel();
0590:
0591:                if (uid != null && uid.length() > 0) {
0592:                    model.setEventUID(uid);
0593:
0594:                } else {
0595:                    this .setShowAlert(true);
0596:                    this .setAlertType(EventAlert.ALERT_TYPE_ERROR);
0597:
0598:                    this .setMessageSummary(bundle
0599:                            .getString("eventDeleteFailSummary"));
0600:                    this .setMessageDetail(bundle
0601:                            .getString("eventDeleteFailMsgDetail"));
0602:                    logger.log(Level.SEVERE,
0603:                            "No UID specified for the event to delete!");
0604:                    logger.exiting(CLASS_NAME, "handleDelete()");
0605:                    return "failure";
0606:                }
0607:
0608:                if (getModifyAllInstances()) {
0609:                    model.setRecurrenceModifier(RecurrencePattern.THIS_AND_ALL);
0610:                } else {
0611:                    model
0612:                            .setRecurrenceModifier(RecurrencePattern.THIS_INSTANCE);
0613:                }
0614:
0615:                if (getIsRecurring()) {
0616:                    if (logger.isLoggable(Level.FINE)) {
0617:                        logger.log(Level.FINE, "Event is recurring. RID: "
0618:                                + rid);
0619:                    }
0620:                    if (rid != null && rid.length() > 0) {
0621:                        model.setEventRID(rid);
0622:                    }
0623:
0624:                } else {
0625:                    if (logger.isLoggable(Level.FINE)) {
0626:                        logger.log(Level.FINE, "Event is not recurring");
0627:                    }
0628:
0629:                }
0630:
0631:                try {
0632:                    model.insert(SharedConstants.DELETE_EVENT_CONTEXT);
0633:                } catch (Exception e) {
0634:                    logger.log(Level.SEVERE, "Failed to delete event: "
0635:                            + e.getMessage());
0636:                    insertFailed = true;
0637:                }
0638:
0639:                if (insertFailed) {
0640:                    setShowAlert(true);
0641:                    this .setAlertType(EventAlert.ALERT_TYPE_ERROR);
0642:
0643:                    this .setMessageSummary(bundle
0644:                            .getString("eventDeleteFailSummary"));
0645:                    this .setMessageDetail(bundle.getString("eventFailDetail"));
0646:                    logger.log(Level.SEVERE,
0647:                            "No UID specified for the event to delete!");
0648:                    logger.exiting(CLASS_NAME, "handleDelete()");
0649:                    return "failure";
0650:                }
0651:
0652:                removeAttributeFromSession(SharedConstants.SESSION_CURR_EVENT_UID);
0653:                removeAttributeFromSession(SharedConstants.SESSION_CURR_EVENT_RID);
0654:                removeAttributeFromSession(SharedConstants.SESSION_COMMUNITY_EVENT_SEARCH);
0655:                alert.setShowAlert(false);
0656:
0657:                logger.exiting(CLASS_NAME, "handleDelete()");
0658:
0659:                return "success";
0660:
0661:            }
0662:
0663:            public String handleCancel() {
0664:                logger.entering(CLASS_NAME, "handleCancel()");
0665:                removeAttributeFromSession(SharedConstants.SESSION_CURR_EVENT_UID);
0666:                removeAttributeFromSession(SharedConstants.SESSION_CURR_EVENT_RID);
0667:                removeAttributeFromSession(SharedConstants.SESSION_COMMUNITY_EVENT_SEARCH);
0668:                alert.setShowAlert(false);
0669:                logger.exiting(CLASS_NAME, "handleCancel()");
0670:                // This would be mapped appropriately 
0671:                return "cancelEvent";
0672:
0673:            }
0674:
0675:            private void retrieveEvent() {
0676:                logger.entering(CLASS_NAME, "retrieveEvent()");
0677:
0678:                if (uid != null && uid.length() > 0) {
0679:
0680:                } else {
0681:                    renderEvent = false;
0682:                    setShowAlert(true);
0683:                    setAlertType(EventAlert.ALERT_TYPE_ERROR);
0684:                    setMessageSummary(bundle
0685:                            .getString("eventRetrieveFailSummary"));
0686:                    setMessageDetail(bundle.getString("eventFailDetail"));
0687:
0688:                }
0689:
0690:                StringBuffer uidRid = new StringBuffer(uid);
0691:
0692:                EventModel model = new EventModel();
0693:                model.setEventUID(uid);
0694:                if (rid != null && rid.length() > 0) {
0695:                    model.setEventRID(rid);
0696:                }
0697:
0698:                try {
0699:                    model.retrieve(SharedConstants.LOAD_EVENT_CONTEXT);
0700:                } catch (Exception e1) {
0701:                    fetchFailed = true;
0702:                }
0703:
0704:                event = model.getCurrentEvent();
0705:                if (fetchFailed) {
0706:                    renderEvent = false;
0707:                    setShowAlert(true);
0708:                    setAlertType(EventAlert.ALERT_TYPE_ERROR);
0709:
0710:                    setMessageSummary(bundle
0711:                            .getString("eventRetrieveFailSummary"));
0712:                    setMessageDetail(bundle.getString("eventFailDetail"));
0713:                    return;
0714:                }
0715:                logger.fine("Retrived Event=" + event.toString());
0716:                logger.exiting(CLASS_NAME, "retrieveEvent()");
0717:
0718:            }
0719:
0720:            private void loadEventData() {
0721:                loadEventStartDateTime();
0722:
0723:                loadEventEndTime();
0724:
0725:                loadEventRepeatInterval();
0726:
0727:                loadEventTitle();
0728:                loadEventLocation();
0729:                loadEventDescription();
0730:
0731:            }
0732:
0733:            private void loadEventStartDateTime() {
0734:                DateTime dt = null;
0735:                DateTime userDt = null;
0736:
0737:                if (event == null) {
0738:                    return;
0739:                }
0740:
0741:                String tzStr = CalUserHelper.getUserTimeZone();
0742:                TimeZone tz = TimeZone.getTimeZone(tzStr);
0743:
0744:                try {
0745:                    dt = event.getStartTime();
0746:                    if (dt != null) {
0747:                        userDt = new DateTime(dt.toISOString(), tz);
0748:                    }
0749:                } catch (Exception e) {
0750:                    logger.log(Level.WARNING, "loadEventStartDateTime()"
0751:                            + " Failed to obtain DateTime for user: "
0752:                            + e.getMessage());
0753:                    userDt = null;
0754:                }
0755:
0756:                String dtFormat = CalUserHelper.getUserDateFormat();
0757:                //startDate = AppUtils.getDisplayableDate(userDt, dtFormat, "/");
0758:
0759:                // Get the Date object required for Calendar UI element
0760:                startDate = userDt.getTime();
0761:
0762:                oldStartDate = AppUtils.getDisplayableDate(userDt, dtFormat,
0763:                        "/");
0764:
0765:                if (logger.isLoggable(Level.FINE)) {
0766:                    logger.log(Level.FINE, "startDate as per user's TZ: "
0767:                            + startDate);
0768:                }
0769:
0770:                startHour = AppUtils.getHoursValue(userDt,
0771:                        SharedConstants.DEFAULT_TIME_FORMAT);
0772:                oldStartHour = startHour;
0773:
0774:                startMin = AppUtils.getMinutesValue(userDt,
0775:                        SharedConstants.DEFAULT_TIME_FORMAT);
0776:                oldStartMin = startMin;
0777:
0778:            }
0779:
0780:            private void loadEventEndTime() {
0781:                DateTime dt = null;
0782:                DateTime userDt = null;
0783:
0784:                if (event == null) {
0785:                    return;
0786:                }
0787:
0788:                String tzStr = CalUserHelper.getUserTimeZone();
0789:                TimeZone tz = TimeZone.getTimeZone(tzStr);
0790:
0791:                try {
0792:                    dt = event.getEndTime();
0793:                    if (dt != null) {
0794:                        userDt = new DateTime(dt.toISOString(), tz);
0795:                    }
0796:                } catch (Exception e) {
0797:
0798:                    userDt = null;
0799:                }
0800:
0801:                endHour = AppUtils.getHoursValue(userDt,
0802:                        SharedConstants.DEFAULT_TIME_FORMAT);
0803:                oldEndHour = endHour;
0804:
0805:                endMin = AppUtils.getMinutesValue(userDt,
0806:                        SharedConstants.DEFAULT_TIME_FORMAT);
0807:                oldEndMin = endMin;
0808:
0809:            }
0810:
0811:            private void loadEventTitle() {
0812:                if (event == null) {
0813:                    return;
0814:                }
0815:                try {
0816:                    title = event.getSummary();
0817:                } catch (Exception e) {
0818:
0819:                }
0820:                oldEventTitle = title;
0821:            }
0822:
0823:            private void loadEventLocation() {
0824:                if (event == null) {
0825:                    return;
0826:                }
0827:                try {
0828:                    location = event.getLocation();
0829:                } catch (Exception e) {
0830:
0831:                }
0832:                oldEventLocation = location;
0833:
0834:            }
0835:
0836:            private void loadEventDescription() {
0837:                if (event == null) {
0838:                    return;
0839:                }
0840:                try {
0841:                    desc = event.getDescription();
0842:                } catch (Exception e) {
0843:
0844:                }
0845:                oldEventDesc = desc;
0846:
0847:            }
0848:
0849:            private void loadEventRepeatInterval() {
0850:                if (event == null) {
0851:                    return;
0852:                }
0853:
0854:                try {
0855:                    if (event.isRecurring()) {
0856:                        isRecurring = true;
0857:                    }
0858:                } catch (Exception e) {
0859:
0860:                }
0861:                loadRecurrencePattern();
0862:
0863:            }
0864:
0865:            private void loadRecurrencePattern() {
0866:                if (event == null) {
0867:                    return;
0868:                }
0869:                RecurrencePattern[] rPats = null;
0870:                try {
0871:                    if (event.isRecurring()) {
0872:                        rPats = event.getRecurrenceRules();
0873:                    }
0874:                } catch (Exception e1) {
0875:                    logger.log(Level.WARNING,
0876:                            "Failed to obtain recurrence pattern");
0877:                    rPats = null;
0878:                }
0879:                String freq = null;
0880:                String byday = null;
0881:                if (rPats != null && rPats.length > 0) {
0882:                    freq = rPats[0].getFrequency();
0883:                    byday = rPats[0].getByDay();
0884:                    if (logger.isLoggable(Level.FINE)) {
0885:                        logger.log(Level.FINE, "Event Frequency: " + freq);
0886:                        logger.log(Level.FINE, "Event BYDAY: " + byday);
0887:                    }
0888:                }
0889:
0890:                if (freq != null) {
0891:                    if (freq
0892:                            .equalsIgnoreCase(SharedConstants.EVENT_RECURRENCE_HOURLY)) {
0893:                        repeatInterval = SharedConstants.EVENT_RECURRENCE_HOURLY;
0894:                        oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_HOURLY;
0895:                    } else if (freq
0896:                            .equalsIgnoreCase(SharedConstants.EVENT_RECURRENCE_DAILY)) {
0897:                        repeatInterval = SharedConstants.EVENT_RECURRENCE_DAILY;
0898:                        oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_DAILY;
0899:                    } else if (freq
0900:                            .equalsIgnoreCase(SharedConstants.EVENT_RECURRENCE_MONTHLY)) {
0901:                        repeatInterval = SharedConstants.EVENT_RECURRENCE_MONTHLY;
0902:                        oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_MONTHLY;
0903:                    } else if (freq
0904:                            .equalsIgnoreCase(SharedConstants.EVENT_RECURRENCE_WEEKLY)) {
0905:
0906:                        if (byday != null) {
0907:
0908:                            if (byday
0909:                                    .equalsIgnoreCase(SharedConstants.EVENT_RECURRENCE_BYDAY_MWF)) {
0910:                                repeatInterval = SharedConstants.EVENT_RECURRENCE_MWF;
0911:                                oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_MWF;
0912:                            } else if (byday
0913:                                    .equalsIgnoreCase(SharedConstants.EVENT_RECURRENCE_BYDAY_TT)) {
0914:                                repeatInterval = SharedConstants.EVENT_RECURRENCE_TT;
0915:                                oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_TT;
0916:                            } else if (byday
0917:                                    .equalsIgnoreCase(SharedConstants.EVENT_RECURRENCE_BYDAY_SS)) {
0918:                                repeatInterval = SharedConstants.EVENT_RECURRENCE_SS;
0919:                                oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_SS;
0920:                            } else if (byday
0921:                                    .equalsIgnoreCase(SharedConstants.EVENT_RECURRENCE_BYDAY_MTWTF)) {
0922:                                repeatInterval = SharedConstants.EVENT_RECURRENCE_MTWTF;
0923:                                oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_MTWTF;
0924:                            } else {
0925:                                repeatInterval = SharedConstants.EVENT_RECURRENCE_WEEKLY;
0926:                                oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_WEEKLY;
0927:                            }
0928:                        } else {
0929:                            repeatInterval = SharedConstants.EVENT_RECURRENCE_WEEKLY;
0930:                            oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_WEEKLY;
0931:                        }
0932:                    }
0933:                } else {
0934:                    repeatInterval = SharedConstants.EVENT_RECURRENCE_ONETIME;
0935:                    oldRepeatInterval = SharedConstants.EVENT_RECURRENCE_ONETIME;
0936:                }
0937:
0938:                if (logger.isLoggable(Level.FINE)) {
0939:                    logger
0940:                            .log(Level.FINE, "Repeat Interval: "
0941:                                    + repeatInterval);
0942:                }
0943:
0944:            }
0945:
0946:            public boolean getEditMode() {
0947:                return editMode;
0948:            }
0949:
0950:            public void setEditMode(boolean editMode) {
0951:                this .editMode = editMode;
0952:            }
0953:
0954:            public boolean getModifyAllInstances() {
0955:                logger.entering(CLASS_NAME, "getModifyAllInstances()");
0956:                logger.entering(CLASS_NAME, "getModifyAllInstances()");
0957:                return modifyAllInstances;
0958:
0959:            }
0960:
0961:            public void setModifyAllInstances(boolean modifyAllInstances) {
0962:                logger.entering(CLASS_NAME, "setModifyAllInstances()");
0963:                this .modifyAllInstances = modifyAllInstances;
0964:                if (logger.isLoggable(Level.FINE)) {
0965:                    logger.log(Level.FINE, "Modify All Instances? "
0966:                            + modifyAllInstances);
0967:                }
0968:                logger.entering(CLASS_NAME, "setModifyAllInstances()");
0969:            }
0970:
0971:            public String getOldStartDate() {
0972:                return oldStartDate;
0973:            }
0974:
0975:            public void setOldStartDate(String oldStartDate) {
0976:                this .oldStartDate = oldStartDate;
0977:            }
0978:
0979:            public String getOldStartHour() {
0980:                return oldStartHour;
0981:            }
0982:
0983:            public void setOldStartHour(String oldStartHour) {
0984:                this .oldStartHour = oldStartHour;
0985:            }
0986:
0987:            public String getOldStartMin() {
0988:                return oldStartMin;
0989:            }
0990:
0991:            public void setOldStartMin(String oldStartMin) {
0992:                this .oldStartMin = oldStartMin;
0993:            }
0994:
0995:            public String getOldEndHour() {
0996:                return oldEndHour;
0997:            }
0998:
0999:            public void setOldEndHour(String oldEndHour) {
1000:                this .oldEndHour = oldEndHour;
1001:            }
1002:
1003:            public String getOldEndMin() {
1004:                return oldEndMin;
1005:            }
1006:
1007:            public void setOldEndMin(String oldEndMin) {
1008:                this .oldEndMin = oldEndMin;
1009:            }
1010:
1011:            public String getOldRepeatInterval() {
1012:                return oldRepeatInterval;
1013:            }
1014:
1015:            public void setOldRepeatInterval(String oldRepeatInterval) {
1016:                this .oldRepeatInterval = oldRepeatInterval;
1017:            }
1018:
1019:            public String getOldEventTitle() {
1020:                return oldEventTitle;
1021:            }
1022:
1023:            public void setOldEventTitle(String oldEventTitle) {
1024:                this .oldEventTitle = oldEventTitle;
1025:            }
1026:
1027:            public String getOldEventLocation() {
1028:                return oldEventLocation;
1029:            }
1030:
1031:            public void setOldEventLocation(String oldEventLocation) {
1032:                this .oldEventLocation = oldEventLocation;
1033:            }
1034:
1035:            public String getOldEventDesc() {
1036:                return oldEventDesc;
1037:            }
1038:
1039:            public void setOldEventDesc(String oldEventDesc) {
1040:                this .oldEventDesc = oldEventDesc;
1041:            }
1042:
1043:            public String getEventUID() {
1044:                return uid;
1045:            }
1046:
1047:            public void setEventUID(String eventUID) {
1048:                logger.entering(CLASS_NAME, "setEventUID()");
1049:                uid = eventUID;
1050:                logger.exiting(CLASS_NAME, "setEventUID()");
1051:            }
1052:
1053:            public String getEventRID() {
1054:                return rid;
1055:            }
1056:
1057:            public void setEventRID(String eventRID) {
1058:                rid = eventRID;
1059:            }
1060:
1061:            public boolean getIsRecurring() {
1062:                return isRecurring;
1063:            }
1064:
1065:            public void setIsRecurring(boolean isRecurring) {
1066:                this .isRecurring = isRecurring;
1067:            }
1068:
1069:            private boolean isStartDateChanged() {
1070:
1071:                boolean change = false;
1072:
1073:                String tzStr = CalUserHelper.getUserTimeZone();
1074:                TimeZone tz = TimeZone.getTimeZone(tzStr);
1075:
1076:                String dtFormat = CalUserHelper.getUserDateFormat();
1077:                //startDate = AppUtils.getDisplayableDate(userDt, dtFormat, "/");
1078:
1079:                if (startDate != null) {
1080:                    DateTime userDt = null;
1081:                    try {
1082:                        userDt = new DateTime(tz);
1083:                    } catch (Exception e1) {
1084:                        logger.log(Level.SEVERE, "Failed to Obtain start date");
1085:                        return false;
1086:                    }
1087:                    userDt.setTime(startDate);
1088:                    String startDtStr = AppUtils.getDisplayableDate(userDt,
1089:                            dtFormat, "/");
1090:                    logger.log(Level.FINE, "startDate: " + startDtStr);
1091:
1092:                    if (oldStartDate != null) {
1093:
1094:                        if (oldStartDate.equalsIgnoreCase(startDateStr)) {
1095:                            change = false;
1096:                        } else {
1097:                            change = true;
1098:                        }
1099:                    } else {
1100:                        change = true;
1101:                    }
1102:
1103:                } else {
1104:                    if (oldStartDate != null && oldStartDate.length() > 0) {
1105:                        change = true;
1106:                    } else {
1107:                        change = false;
1108:                    }
1109:                }
1110:
1111:                return change;
1112:            }
1113:
1114:            private boolean isStartHourChanged() {
1115:
1116:                boolean change = false;
1117:
1118:                if (startHour != null && startHour.length() > 0) {
1119:                    if (oldStartHour != null) {
1120:                        if (oldStartHour.equalsIgnoreCase(startHour)) {
1121:                            change = false;
1122:                        } else {
1123:                            change = true;
1124:                        }
1125:                    } else {
1126:                        change = true;
1127:                    }
1128:
1129:                } else {
1130:                    if (oldStartHour != null && oldStartHour.length() > 0) {
1131:                        change = true;
1132:                    } else {
1133:                        change = false;
1134:                    }
1135:                }
1136:
1137:                return change;
1138:            }
1139:
1140:            private boolean isStartMinChanged() {
1141:
1142:                boolean change = false;
1143:
1144:                if (startMin != null && startMin.length() > 0) {
1145:                    if (oldStartMin != null) {
1146:                        if (oldStartMin.equalsIgnoreCase(startMin)) {
1147:                            change = false;
1148:                        } else {
1149:                            change = true;
1150:                        }
1151:                    } else {
1152:                        change = true;
1153:                    }
1154:
1155:                } else {
1156:                    if (oldStartMin != null && oldStartMin.length() > 0) {
1157:                        change = true;
1158:                    } else {
1159:                        change = false;
1160:                    }
1161:                }
1162:
1163:                return change;
1164:            }
1165:
1166:            private boolean isEndMinChanged() {
1167:
1168:                boolean change = false;
1169:
1170:                if (endMin != null && endMin.length() > 0) {
1171:                    if (oldEndMin != null) {
1172:                        if (oldEndMin.equalsIgnoreCase(endMin)) {
1173:                            change = false;
1174:                        } else {
1175:                            change = true;
1176:                        }
1177:                    } else {
1178:                        change = true;
1179:                    }
1180:
1181:                } else {
1182:                    if (oldEndMin != null && oldEndMin.length() > 0) {
1183:                        change = true;
1184:                    } else {
1185:                        change = false;
1186:                    }
1187:                }
1188:
1189:                return change;
1190:            }
1191:
1192:            private boolean isEndHourChanged() {
1193:
1194:                boolean change = false;
1195:
1196:                if (endHour != null && endHour.length() > 0) {
1197:                    if (oldEndHour != null) {
1198:                        if (oldEndHour.equalsIgnoreCase(endHour)) {
1199:                            change = false;
1200:                        } else {
1201:                            change = true;
1202:                        }
1203:                    } else {
1204:                        change = true;
1205:                    }
1206:
1207:                } else {
1208:                    if (oldEndHour != null && oldEndHour.length() > 0) {
1209:                        change = true;
1210:                    } else {
1211:                        change = false;
1212:                    }
1213:                }
1214:
1215:                return change;
1216:            }
1217:
1218:            private boolean isRecurrenceChanged() {
1219:
1220:                boolean change = false;
1221:
1222:                if (repeatInterval != null && repeatInterval.length() > 0) {
1223:                    if (oldRepeatInterval != null) {
1224:                        if (oldRepeatInterval.equalsIgnoreCase(repeatInterval)) {
1225:                            change = false;
1226:                        } else {
1227:                            change = true;
1228:                        }
1229:                    } else {
1230:                        change = true;
1231:                    }
1232:
1233:                } else {
1234:                    if (oldRepeatInterval != null
1235:                            && oldRepeatInterval.length() > 0) {
1236:                        change = true;
1237:                    } else {
1238:                        change = false;
1239:                    }
1240:                }
1241:
1242:                return change;
1243:            }
1244:
1245:            private boolean isTitleChanged() {
1246:
1247:                boolean change = false;
1248:
1249:                if (title != null && title.length() > 0) {
1250:                    if (oldEventTitle != null) {
1251:                        if (oldEventTitle.equalsIgnoreCase(title)) {
1252:                            change = false;
1253:                        } else {
1254:                            change = true;
1255:                        }
1256:                    } else {
1257:                        change = true;
1258:                    }
1259:
1260:                } else {
1261:                    if (oldEventTitle != null && oldEventTitle.length() > 0) {
1262:                        change = true;
1263:                    } else {
1264:                        change = false;
1265:                    }
1266:                }
1267:
1268:                return change;
1269:            }
1270:
1271:            private boolean isLocationChanged() {
1272:
1273:                boolean change = false;
1274:
1275:                if (location != null && location.length() > 0) {
1276:                    if (oldEventLocation != null) {
1277:                        if (oldEventLocation.equalsIgnoreCase(location)) {
1278:                            change = false;
1279:                        } else {
1280:                            change = true;
1281:                        }
1282:                    } else {
1283:                        change = true;
1284:                    }
1285:
1286:                } else {
1287:                    if (oldEventLocation != null
1288:                            && oldEventLocation.length() > 0) {
1289:                        change = true;
1290:                    } else {
1291:                        change = false;
1292:                    }
1293:                }
1294:
1295:                return change;
1296:            }
1297:
1298:            private boolean isDescChanged() {
1299:
1300:                boolean change = false;
1301:
1302:                if (desc != null && desc.length() > 0) {
1303:                    if (oldEventDesc != null) {
1304:                        if (oldEventDesc.equalsIgnoreCase(desc)) {
1305:                            change = false;
1306:                        } else {
1307:                            change = true;
1308:                        }
1309:                    } else {
1310:                        change = true;
1311:                    }
1312:
1313:                } else {
1314:                    if (oldEventDesc != null && oldEventDesc.length() > 0) {
1315:                        change = true;
1316:                    } else {
1317:                        change = false;
1318:                    }
1319:                }
1320:
1321:                return change;
1322:            }
1323:
1324:            public boolean isRenderEvent() {
1325:                return renderEvent;
1326:            }
1327:
1328:            public void setRenderEvent(boolean renderEvent) {
1329:                this .renderEvent = renderEvent;
1330:            }
1331:
1332:            private ResourceBundle getResourceBundle() {
1333:                return AppUtils.getResourceBundle();
1334:            }
1335:
1336:            public Option[] getHourOptions() {
1337:                hourOptions = new Option[SharedConstants.hoursIn24HourFormatNames.length];
1338:                for (int i = 0; i < SharedConstants.hoursIn24HourFormatNames.length; i++) {
1339:                    String dispOption = bundle
1340:                            .getString(SharedConstants.hoursIn24HourFormatNames[i]
1341:                                    + "HoursLabel");
1342:                    if (dispOption != null) {
1343:                        hourOptions[i] = new Option(
1344:                                SharedConstants.hoursIn24HourFormatNames[i],
1345:                                dispOption);
1346:                    }
1347:
1348:                }
1349:                return hourOptions;
1350:            }
1351:
1352:            public void setHourOptions(Option[] aHourOptions) {
1353:                hourOptions = aHourOptions;
1354:            }
1355:
1356:            public Option[] getMinOptions() {
1357:                minOptions = new Option[SharedConstants.minutesIn24HourFormatValues.length];
1358:                for (int i = 0; i < SharedConstants.minutesIn24HourFormatValues.length; i++) {
1359:                    String dispOption = bundle
1360:                            .getString(SharedConstants.minutesIn24HourFormatValues[i]
1361:                                    + "MinutesLabel");
1362:                    if (dispOption != null) {
1363:                        minOptions[i] = new Option(
1364:                                SharedConstants.minutesIn24HourFormatValues[i],
1365:                                SharedConstants.minutesIn24HourFormatValues[i]);
1366:                    }
1367:                }
1368:
1369:                return minOptions;
1370:            }
1371:
1372:            public void setMinOptions(Option[] aMinOptions) {
1373:                minOptions = aMinOptions;
1374:            }
1375:
1376:            public Option[] getRecurrenceOptions() {
1377:
1378:                recurrenceOptions = new Option[SharedConstants.repeatIntervalVal.length];
1379:                for (int i = 0; i < SharedConstants.repeatIntervalVal.length; i++) {
1380:                    String dispOption = bundle.getString("repeatInterval"
1381:                            + SharedConstants.repeatIntervalVal[i] + "Label");
1382:                    if (dispOption != null) {
1383:                        recurrenceOptions[i] = new Option(
1384:                                SharedConstants.repeatIntervalVal[i],
1385:                                dispOption);
1386:                    }
1387:                }
1388:                return recurrenceOptions;
1389:            }
1390:
1391:            public void setRecurrenceOptions(Option[] aRecurrenceOptions) {
1392:                recurrenceOptions = aRecurrenceOptions;
1393:            }
1394:
1395:            private void removeAttributeFromSession(String attr) {
1396:                extContext = FacesContext.getCurrentInstance()
1397:                        .getExternalContext();
1398:                extContext.getSessionMap().remove(attr);
1399:
1400:            }
1401:
1402:            private void setAttributeInSession(String attr, String value) {
1403:                extContext = FacesContext.getCurrentInstance()
1404:                        .getExternalContext();
1405:                if (attr != null && value != null) {
1406:                    extContext.getSessionMap().put(attr, value);
1407:                }
1408:            }
1409:
1410:            private Object getSessionAttribute(String attr) {
1411:                extContext = FacesContext.getCurrentInstance()
1412:                        .getExternalContext();
1413:                return extContext.getSessionMap().get(attr);
1414:            }
1415:
1416:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.