KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > business > calendar > CalendarBean


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: CalendarBean.java,v $
31  * Revision 1.3 2005/04/10 20:09:40 colinmacleod
32  * Added new themes.
33  * Changed id type to String.
34  * Changed i tag to em and b tag to strong.
35  * Improved PicoContainerFactory with NanoContainer scripts.
36  *
37  * Revision 1.2 2005/04/09 17:19:16 colinmacleod
38  * Changed copyright text to GPL v2 explicitly.
39  *
40  * Revision 1.1.1.1 2005/03/10 17:47:42 colinmacleod
41  * Restructured ivata op around Hibernate/PicoContainer.
42  * Renamed ivata groupware.
43  *
44  * Revision 1.8 2004/11/12 18:17:26 colinmacleod
45  * Ordered imports.
46  *
47  * Revision 1.7 2004/11/12 16:08:08 colinmacleod
48  * Removed dependencies on SSLEXT.
49  * Moved Persistence classes to ivata masks.
50  *
51  * Revision 1.6 2004/07/13 19:42:12 colinmacleod
52  * Moved project to POJOs from EJBs.
53  * Applied PicoContainer to services layer (replacing session EJBs).
54  * Applied Hibernate to persistence layer (replacing entity EJBs).
55  *
56  * Revision 1.5 2004/03/27 10:31:25 colinmacleod
57  * Split off business logic from remote facades to POJOs.
58  *
59  * Revision 1.4 2004/03/21 21:16:21 colinmacleod
60  * Shortened name to ivata op.
61  *
62  * Revision 1.3 2004/02/10 19:57:22 colinmacleod
63  * Changed email address.
64  *
65  * Revision 1.2 2004/02/01 22:07:29 colinmacleod
66  * Added full names to author tags
67  *
68  * Revision 1.1.1.1 2004/01/27 20:58:19 colinmacleod
69  * Moved ivata openportal to SourceForge..
70  *
71  * Revision 1.7 2004/01/19 21:13:14 colin
72  * Removed minutes for ivata groupware v0.9
73  *
74  * Revision 1.6 2003/12/08 15:52:45 jano
75  * fixing calendar functionaality
76  *
77  * Revision 1.5 2003/11/03 11:28:48 jano
78  * commiting calendar,
79  * tryinjg to fix deploying problem
80  *
81  * Revision 1.4 2003/10/28 13:10:23 jano
82  * commiting calendar,
83  * still fixing compile and building openGroupware project
84  *
85  * Revision 1.3 2003/10/15 13:58:58 jano
86  * converting to XDoclet
87  *
88  * Revision 1.2 2003/10/15 13:57:23 colin
89  * fixing for XDoclet
90  *
91  * Revision 1.5 2003/05/02 10:28:48 peter
92  * added locale to validation
93  *
94  * Revision 1.4 2003/03/13 17:09:14 peter
95  * fixed: day events finder is timeZone aware
96  *
97  * Revision 1.3 2003/03/03 16:42:07 colin
98  * now sets user name and modified by as appropriate
99  *
100  * Revision 1.2 2003/02/26 17:11:45 peter
101  * fixed the paths for resourcBundles in validation methods
102  *
103  * Revision 1.1 2003/02/25 08:09:10 colin
104  * moved to business
105  *
106  * Revision 1.25 2003/02/20 20:24:29 colin
107  * improved validation by adding ValidationField and ValidationException
108  *
109  * Revision 1.24 2003/02/13 08:45:42 colin
110  * conversion to Struts/popups
111  *
112  * Revision 1.23 2003/02/05 14:50:42 colin
113  * added validate method
114  *
115  * Revision 1.22 2003/02/04 17:43:46 colin
116  * copyright notice
117  *
118  * Revision 1.21 2002/09/25 15:33:10 jano
119  * it's not nesesery to remove event when you are removing meeting
120  *
121  * Revision 1.20 2002/09/25 08:25:36 jano
122  * fixing when event finishing before starting
123  *
124  * Revision 1.19 2002/09/11 11:05:58 jano
125  * new method findMeetingByPrimaryKey
126  *
127  * Revision 1.18 2002/09/10 15:00:48 jano
128  * add new method findMetingsWithoutMinutes
129  *
130  * Revision 1.17 2002/09/10 08:19:45 jano
131  * amendMeeting was fixed
132  *
133  * Revision 1.16 2002/08/29 15:54:00 jano
134  * removeMeeting working
135  *
136  * Revision 1.15 2002/08/29 14:53:23 jano
137  * *** empty log message ***
138  *
139  * Revision 1.14 2002/08/29 14:46:40 jano
140  * new methods amendMeeting removeMeeting
141  *
142  * Revision 1.13 2002/08/16 14:58:08 jano
143  * add mehod findMeetingByEventId
144  *
145  * Revision 1.12 2002/08/14 09:24:38 jano
146  * *** empty log message ***
147  *
148  * Revision 1.11 2002/08/07 16:18:40 jano
149  * *** empty log message ***
150  *
151  * Revision 1.10 2002/08/01 06:36:58 jano
152  * add method findEventByPrimaryKey to calendarBean
153  *
154  * Revision 1.9 2002/07/26 06:53:48 jano
155  * problem with GregorianCalendra.roll method so I change to SET method
156  *
157  * Revision 1.8 2002/07/22 12:59:30 jano
158  * change DATE to GregorianCalendar in EventDO
159  *
160  * Revision 1.7 2002/07/11 13:10:09 jano
161  * commiting all calendar files for sure
162  *
163  * Revision 1.6 2002/07/04 14:57:21 jano
164  * testing watch on/cvs edit
165  *
166  * Revision 1.5 2002/07/04 14:56:21 jano
167  * testing watch on
168  *
169  * Revision 1.4 2002/07/04 14:49:19 jano
170  * test with cvs edit
171  *
172  * Revision 1.3 2002/07/04 12:07:31 jano
173  * findEventForDay was added to calendar Bean
174  *
175  * Revision 1.2 2002/07/03 15:26:53 jano
176  * doing on calendar and calendar.event bean
177  * -----------------------------------------------------------------------------
178  */

179 package com.ivata.groupware.business.calendar;
180
181
182 import java.util.Collection JavaDoc;
183
184 import javax.ejb.CreateException JavaDoc;
185 import javax.ejb.RemoveException JavaDoc;
186 import javax.ejb.SessionBean JavaDoc;
187 import javax.ejb.SessionContext JavaDoc;
188
189 import org.picocontainer.PicoContainer;
190
191 import com.ivata.groupware.admin.security.server.SecuritySession;
192 import com.ivata.groupware.business.calendar.event.EventDO;
193 import com.ivata.groupware.business.calendar.event.meeting.MeetingDO;
194 import com.ivata.groupware.container.PicoContainerFactory;
195 import com.ivata.mask.util.SystemException;
196 import com.ivata.mask.validation.ValidationErrors;
197
198
199 /**
200  * @author Jan Boros <janboros@sourceforge.net>
201  *
202  * To change the template for this generated type comment go to
203  * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
204  */

205 /**
206  * <p>Calendar facade to enter, retrieve and delete events and meetings.</p>
207  *
208  * @since 2002-07-03
209  * @author Jan Boros <janboros@sourceforge.net>
210  * @version $Revision: 1.3 $
211  *
212  * @ejb.bean
213  * name="Calendar"
214  * display-name="Calendar"
215  * type="Stateless"
216  * view-type="remote"
217  * jndi-name="CalendarRemote"
218  *
219  * @ejb.transaction
220  * type = "Required"
221  *
222  * @ejb.home
223  * generate="false"
224  * remote-class="com.ivata.groupware.business.calendar.CalendarRemoteHome"
225  *
226  * @ejb.interface
227  * remote-class="com.ivata.groupware.business.calendar.CalendarRemote"
228  */

229 public class CalendarBean implements SessionBean JavaDoc, Calendar {
230     /**
231      * <p>Provides the session bean with container-specific information.</p>
232      */

233     SessionContext JavaDoc sessionContext;
234
235     /** <p>method using to add NEW event</p>
236      *
237      * @param eventDO event to ADD
238      * @return added event
239      *
240      * @ejb.interface-method
241      * view-type = "remote"
242      */

243     public EventDO addEvent(final SecuritySession securitySession,
244             final EventDO eventDO)
245             throws SystemException {
246         return getCalendar().addEvent(securitySession, eventDO);
247     }
248
249     /** <p>method using to modifi event</p>
250      *
251      * @param eventDO event to AMEND
252      * @return amend event
253      *
254      * @ejb.interface-method
255      * view-type = "remote"
256      */

257     public EventDO amendEvent(final SecuritySession securitySession,
258             final EventDO eventDO)
259             throws SystemException {
260         return getCalendar().amendEvent(securitySession, eventDO);
261     }
262
263     /**
264      * <p>Called by the container to notify an entity object it has been
265      * activated.</p>
266      */

267     public void ejbActivate() {}
268
269     /**
270      * <p>Called by the container just after the bean has been created.</p>
271      *
272      * @exception CreateException if any error occurs. Never thrown by this
273      * class.
274      *
275      * @ejb.create-method
276      */

277     public void ejbCreate() throws CreateException JavaDoc {}
278
279     /**
280      * <p>Called by the container to notify the entity object it will be
281      * deactivated. Called just before deactivation.</p>
282      */

283     public void ejbPassivate() {}
284
285     /**
286      * <p>This method is called by the container when the bean is about
287      * to be removed.</p>
288      *
289      * <p>This method will be called after a client calls the <code>remove</code>
290      * method of the remote/local home interface.</p>
291      *
292      * @throws RemoveException if any error occurs. Currently never thrown by
293      * this class.
294      */

295     public void ejbRemove() {}
296
297     /**
298      * <p>find eventDO for that Id</p>
299      *
300      *
301      * @param
302      * @return Vector of events
303      *
304      * @ejb.interface-method
305      * view-type = "remote"
306      */

307     public EventDO findEventByPrimaryKey(final SecuritySession securitySession,
308             final String JavaDoc id)
309             throws SystemException {
310         return getCalendar().findEventByPrimaryKey(securitySession, id);
311     }
312
313     /**
314      * <p>this method giving Events for DAY. DAY has to be initial at clients site
315      * with DAY, MOUTH, YEAR</p>
316      *
317      * @param day evens for this DAY
318      * @return Vector of events
319      *
320      * @ejb.interface-method
321      * view-type = "remote"
322      */

323     public Collection JavaDoc findEventsForDay(final SecuritySession securitySession,
324             final java.util.Calendar JavaDoc day)
325             throws SystemException {
326         return getCalendar().findEventsForDay(securitySession, day);
327     }
328
329     /**
330      * Get the Calendar implementation.
331      */

332     private Calendar getCalendar()
333             throws SystemException {
334         PicoContainer container = PicoContainerFactory.getInstance()
335             .getGlobalContainer();
336         return (Calendar) container.getComponentInstance(Calendar.class);
337     }
338
339     /**
340      * <p>method usig to remove event</p>
341      *
342      * @param eventDO event to REMOVE
343      *
344      * @ejb.interface-method
345      * view-type = "remote"
346      */

347     public void removeEvent(final SecuritySession securitySession,
348             final EventDO event)
349             throws SystemException {
350         getCalendar().removeEvent(securitySession, event);
351     }
352
353     /**
354      * <p>Set up the context for this entity object. The session bean stores the
355      * context for later use.</p>
356      *
357      * @param sessionContext the new context which the session object should
358      * store.
359      */

360     public final void setSessionContext(final SessionContext JavaDoc sessionContext) {
361         this.sessionContext = sessionContext;
362     }
363
364     /**
365      * <p>Confirm all of the elements of the event are present and valid.</p>
366      *
367      * @param eventDO data object to check for consistency and
368      * completeness.
369      * @return a collection of validation errors if any of the
370      * mandatory fields are missing, or if fields contain invalid values.
371      *
372      * @ejb.interface-method
373      * view-type = "remote"
374      */

375     public ValidationErrors validate(final SecuritySession securitySession,
376             final EventDO eventDO)
377             throws SystemException {
378         return getCalendar().validate(securitySession, eventDO);
379     }
380
381     /**
382      * <p>Confirm all of the elements of the meeting and associated event are
383      * present and valid.</p>
384      *
385      * @param meetingDO data object to check for consistency and
386      * completeness.
387      * @param locale locale to show field errors for.
388      * @return a collection of validation errors if any of the
389      * mandatory fields are missing, or if fields contain invalid values.
390      *
391      * @ejb.interface-method
392      * view-type = "remote"
393      */

394     public ValidationErrors validate(final SecuritySession securitySession,
395             final MeetingDO meetingDO)
396             throws SystemException {
397         return getCalendar().validate(securitySession, meetingDO);
398     }
399 }
400
Popular Tags