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


001:        /**
002:         * Copyright 2002 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         *
013:         */package com.sun.portal.app.sharedevents.models;
014:
015:        import java.util.*;
016:        import java.util.logging.*;
017:
018:        import com.sun.comclient.calendar.*;
019:        import com.sun.portal.app.sharedevents.util.AppUtils;
020:        import com.sun.portal.app.sharedevents.util.SharedConstants;
021:        import com.sun.portal.log.common.PortalLogger;
022:
023:        /**
024:         * EventsListModel class provides an interface to a set of events. This
025:         * model is useful for event management and processing a set of events.
026:         * <br>
027:         * The EventsListModel provides all means of access machanisms such as 
028:         * fetch a set of events, load the fetched events or given events and
029:         * manage events such as update or delete a bunch of events.
030:         * <p>
031:         * It provides following execute contexts for event lists 
032:         * <br><code>LOAD_EVENT_CONTEXT</code></b> -- fetches set of events
033:         * <p>
034:         * <p>
035:         * @author Sai
036:         * <p>
037:         */
038:        public class EventsListModel {
039:            private transient ArrayList _events = null;
040:            private transient ArrayList _calids = null;
041:            private transient DateTime _start = null;
042:            private transient DateTime _end = null;
043:            private transient boolean _searchMode = false;
044:            private transient DateTime _selectedDate = null;
045:            private transient String viewCtx = null;
046:            private transient String searchText = null;
047:
048:            private CalendarBaseModel cbm = null;
049:            private HashMap calids = null;
050:
051:            //// Definitions, fields and data structures for set of tasks
052:
053:            private String CLASS_NAME = "EventsListModel";
054:
055:            private static Logger logger = PortalLogger
056:                    .getLogger(EventsListModel.class);
057:
058:            public EventsListModel() {
059:                logger.entering(CLASS_NAME, "EventsListModel()");
060:                logger.exiting(CLASS_NAME, "EventsListModel()");
061:            }
062:
063:            public EventsListModel(String name) {
064:                logger.entering(CLASS_NAME, "EventsListModel(" + name + ")");
065:                logger.exiting(CLASS_NAME, "EventsListModel(" + name + ")");
066:            }
067:
068:            /** 
069:             * Gets the events that are being used in next load context.
070:             * <p>
071:             * @return List of events that are being used in next load context
072:             * <p>
073:             */
074:            public ArrayList getEvents() {
075:                return this ._events;
076:            }
077:
078:            /** 
079:             * Sets the events to be loaded in next load context.
080:             * <p>
081:             * @param events List of events to be loaded in next load context
082:             * <p>
083:             */
084:            public void setEvents(ArrayList events) {
085:                this ._events = events;
086:            }
087:
088:            /*
089:             * Can be used by the caller to set the start Date & Time
090:             */
091:            public void setContextStartDt(DateTime dt) {
092:                _start = dt;
093:            }
094:
095:            /*
096:             * Can be used by the caller to set the end Date & Time
097:             */
098:            public void setContextEndDt(DateTime dt) {
099:                _end = dt;
100:            }
101:
102:            public void setViewContext(String viewContext) {
103:                viewCtx = viewContext;
104:            }
105:
106:            public void setSearchMode(boolean value) {
107:                _searchMode = value;
108:            }
109:
110:            public void setSearchFilter(String value) {
111:                searchText = value;
112:            }
113:
114:            ////// Model contexts
115:
116:            /**
117:             * Provides support for event list execute operations.
118:             * <p>
119:             * Following are the suppported event list execute contexts.
120:             * <br><code>LOAD_EVENT_CONTEXT</code></b> -- Use this context to load a set of events 
121:             * <p>
122:             * In case if context passed is 'null' then the default event list execute
123:             * context executed is LOAD_EVENT_CONTEXT.
124:             * <p>
125:             */
126:            public void execute(String context) throws Exception {
127:
128:                String opName = null;
129:
130:                if (null != context) {
131:                    opName = context;
132:                } else {
133:                    opName = SharedConstants.LOAD_EVENTS_CONTEXT;
134:                }
135:
136:                if (opName.equals(SharedConstants.LOAD_EVENTS_CONTEXT)) {
137:                    try {
138:                        fetchEvents();
139:                    } catch (Exception e1) {
140:                        throw e1;
141:                    }
142:                } else {
143:
144:                    throw new Exception("Invalid Execution context");
145:                }
146:
147:            }
148:
149:            private void fetchEvents() throws Exception {
150:                logger.entering(CLASS_NAME, "fetchEvents()");
151:
152:                // Reset the event Data
153:                _events = null;
154:
155:                cbm = getCalendarBaseModel();
156:
157:                try {
158:
159:                    if (null == viewCtx) {
160:                        viewCtx = SharedConstants.VIEW_CTX_DAY;
161:                    }
162:
163:                    cbm.removeAllCalids();
164:
165:                    String calid = null;
166:                    try {
167:                        calid = AppUtils.getTargetCalendarId();
168:                    } catch (Exception e1) {
169:                        logger.log(Level.SEVERE,
170:                                "Failed to obtain Calendar ID: "
171:                                        + e1.getMessage());
172:                        throw e1;
173:                    }
174:
175:                    cbm.addCalid(calid);
176:
177:                    if (_searchMode) {
178:
179:                        if (logger.isLoggable(Level.FINE)) {
180:                            logger.log(Level.FINE,
181:                                    "In searchMode: Searching the events....");
182:                        }
183:
184:                        // Set the filter if exists
185:                        if ((null != searchText)
186:                                && (false == searchText.trim().equals(""))) {
187:
188:                            // Searching for events using search_string in entire events data using filter (ALL=*str*)
189:
190:                            String filter = "ALL=" + searchText;
191:                            cbm.setComponentSearchFilter(filter);
192:                            cbm.setComponentSearchOption(0);
193:
194:                            if (logger.isLoggable(Level.FINE)) {
195:                                logger.log(Level.FINE, "Filter set to: "
196:                                        + filter);
197:                            }
198:
199:                        }
200:
201:                        cbm.execute(SharedConstants.SEARCH_EVENTS_CONTEXT);
202:                        _events = cbm.getAllEvents();
203:
204:                    } else {
205:
206:                        // Set start and end dates if and only if it is non-search mode.
207:                        cbm.setStartTime(_start);
208:                        cbm.setEndTime(_end);
209:
210:                        if (logger.isLoggable(Level.FINE)) {
211:                            logger.log(Level.FINE, "Fetching the events ....");
212:                            logger.log(Level.FINE, "viewCtx: " + viewCtx);
213:                            logger.log(Level.FINE, "start: "
214:                                    + _start.toISOString());
215:                            logger
216:                                    .log(Level.FINE, "end: "
217:                                            + _end.toISOString());
218:                        }
219:
220:                        String ctx = SharedConstants.FETCH_EVENTS_CONTEXT;
221:
222:                        cbm.execute(ctx);
223:                        _events = cbm.getAllEvents();
224:
225:                    }
226:                } catch (Exception e2) {
227:                    logger.log(Level.SEVERE,
228:                            "Exception while fetching events: " + e2);
229:                    throw e2;
230:                }
231:
232:                logger.exiting(CLASS_NAME, "fetchEvents()");
233:
234:            }
235:
236:            private CalendarBaseModel getCalendarBaseModel() {
237:                return new CalendarBaseModel("eventsListModel");
238:
239:            }
240:
241:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.