Source Code Cross Referenced for DbCalendarService.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » calendar » impl » 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 » ERP CRM Financial » sakai » org.sakaiproject.calendar.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/calendar/tags/sakai_2-4-1/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/DbCalendarService.java $
003:         * $Id: DbCalendarService.java 8050 2006-04-20 17:39:55Z ggolden@umich.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.calendar.impl;
021:
022:        import java.util.List;
023:
024:        import org.apache.commons.logging.Log;
025:        import org.apache.commons.logging.LogFactory;
026:        import org.sakaiproject.calendar.api.Calendar;
027:        import org.sakaiproject.calendar.api.CalendarEdit;
028:        import org.sakaiproject.calendar.api.CalendarEvent;
029:        import org.sakaiproject.calendar.api.CalendarEventEdit;
030:        import org.sakaiproject.db.api.SqlService;
031:        import org.sakaiproject.util.BaseDbDoubleStorage;
032:        import org.sakaiproject.util.StorageUser;
033:
034:        /**
035:         * <p>DbCalendarService fills out the BaseCalendarService with a database implementation.</p>
036:         * <p>The sql scripts in src/sql/chef_calendar.sql must be run on the database.</p>
037:         */
038:        public class DbCalendarService extends BaseCalendarService {
039:            /** Our logger. */
040:            private static Log M_log = LogFactory
041:                    .getLog(DbCalendarService.class);
042:
043:            /** The name of the db table holding calendar calendars. */
044:            protected String m_cTableName = "CALENDAR_CALENDAR";
045:
046:            /** The name of the db table holding calendar events. */
047:            protected String m_rTableName = "CALENDAR_EVENT";
048:
049:            /** If true, we do our locks in the remote database, otherwise we do them here. */
050:            protected boolean m_locksInDb = true;
051:
052:            protected static final String[] FIELDS = { "EVENT_START",
053:                    "EVENT_END" };
054:
055:            /*******************************************************************************
056:             * Constructors, Dependencies and their setter methods
057:             *******************************************************************************/
058:
059:            /** Dependency: SqlService */
060:            protected SqlService m_sqlService = null;
061:
062:            /**
063:             * Dependency: SqlService.
064:             * @param service The SqlService.
065:             */
066:            public void setSqlService(SqlService service) {
067:                m_sqlService = service;
068:            }
069:
070:            /**
071:             * Configuration: set the table name for the container.
072:             * @param path The table name for the container.
073:             */
074:            public void setContainerTableName(String name) {
075:                m_cTableName = name;
076:            }
077:
078:            /**
079:             * Configuration: set the table name for the resource.
080:             * @param path The table name for the resource.
081:             */
082:            public void setResourceTableName(String name) {
083:                m_rTableName = name;
084:            }
085:
086:            /**
087:             * Configuration: set the locks-in-db
088:             * @param path The storage path.
089:             */
090:            public void setLocksInDb(String value) {
091:                m_locksInDb = new Boolean(value).booleanValue();
092:            }
093:
094:            /** Configuration: to run the ddl on init or not. */
095:            protected boolean m_autoDdl = false;
096:
097:            /**
098:             * Configuration: to run the ddl on init or not.
099:             * 
100:             * @param value
101:             *        the auto ddl value.
102:             */
103:            public void setAutoDdl(String value) {
104:                m_autoDdl = new Boolean(value).booleanValue();
105:            }
106:
107:            /*******************************************************************************
108:             * Init and Destroy
109:             *******************************************************************************/
110:
111:            /**
112:             * Final initialization, once all dependencies are set.
113:             */
114:            public void init() {
115:                try {
116:                    // if we are auto-creating our schema, check and create
117:                    if (m_autoDdl) {
118:                        m_sqlService.ddl(this .getClass().getClassLoader(),
119:                                "sakai_calendar");
120:                    }
121:
122:                    super .init();
123:
124:                    M_log.info("init(): tables: " + m_cTableName + " "
125:                            + m_rTableName + " locks-in-db: " + m_locksInDb);
126:                } catch (Throwable t) {
127:                    M_log.warn("init(): ", t);
128:                }
129:            }
130:
131:            /*******************************************************************************
132:             * BaseCalendarService extensions
133:             *******************************************************************************/
134:
135:            /**
136:             * Construct a Storage object.
137:             * @return The new storage object.
138:             */
139:            protected Storage newStorage() {
140:                return new DbStorage(this );
141:
142:            } // newStorage
143:
144:            /*******************************************************************************
145:             * Storage implementation
146:             *******************************************************************************/
147:
148:            /**
149:             * Covers for the BaseDbStorage, providing Chat parameters
150:             * Note: base class containers are reference based, this service is still id based - converted here %%%
151:             */
152:            protected class DbStorage extends BaseDbDoubleStorage implements 
153:                    Storage {
154:                /**
155:                 * Construct.
156:                 * @param user The StorageUser class to call back for creation of Resource and Edit objects.
157:                 */
158:                public DbStorage(StorageUser user) {
159:                    // TODO: what about owner, draft?
160:                    super (m_cTableName, "CALENDAR_ID", m_rTableName,
161:                            "EVENT_ID", "CALENDAR_ID", "EVENT_START", /* owner, draft, pubview */
162:                            null, null, null, FIELDS, m_locksInDb, "calendar",
163:                            "event", user, m_sqlService);
164:
165:                } // DbStorage
166:
167:                /** Calendar **/
168:
169:                public boolean checkCalendar(String ref) {
170:                    return super .getContainer(ref) != null;
171:                }
172:
173:                public Calendar getCalendar(String ref) {
174:                    return (Calendar) super .getContainer(ref);
175:                }
176:
177:                public List getCalendars() {
178:                    return super .getAllContainers();
179:                }
180:
181:                public CalendarEdit putCalendar(String ref) {
182:                    return (CalendarEdit) super .putContainer(ref);
183:                }
184:
185:                public CalendarEdit editCalendar(String ref) {
186:                    return (CalendarEdit) super .editContainer(ref);
187:                }
188:
189:                public void commitCalendar(CalendarEdit edit) {
190:                    super .commitContainer(edit);
191:                }
192:
193:                public void cancelCalendar(CalendarEdit edit) {
194:                    super .cancelContainer(edit);
195:                }
196:
197:                public void removeCalendar(CalendarEdit edit) {
198:                    super .removeContainer(edit);
199:                }
200:
201:                /** Event **/
202:
203:                public boolean checkEvent(Calendar calendar, String messageId) {
204:                    return super .checkResource(calendar, messageId);
205:                }
206:
207:                public CalendarEvent getEvent(Calendar calendar, String id) {
208:                    return (CalendarEvent) super .getResource(calendar, id);
209:                }
210:
211:                public List getEvents(Calendar calendar) {
212:                    return super .getAllResources(calendar);
213:                }
214:
215:                public CalendarEventEdit putEvent(Calendar calendar, String id) {
216:                    return (CalendarEventEdit) super .putResource(calendar, id,
217:                            null);
218:                }
219:
220:                public CalendarEventEdit editEvent(Calendar calendar,
221:                        String messageId) {
222:                    return (CalendarEventEdit) super .editResource(calendar,
223:                            messageId);
224:                }
225:
226:                public void commitEvent(Calendar calendar,
227:                        CalendarEventEdit edit) {
228:                    super .commitResource(calendar, edit);
229:                }
230:
231:                public void cancelEvent(Calendar calendar,
232:                        CalendarEventEdit edit) {
233:                    super .cancelResource(calendar, edit);
234:                }
235:
236:                public void removeEvent(Calendar calendar,
237:                        CalendarEventEdit edit) {
238:                    super .removeResource(calendar, edit);
239:                }
240:
241:            } // DbStorage
242:
243:        } // DbCachedCalendarService
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.