View Javadoc
1   /*
2    * Copyright (c) 2002-2014, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.calendar.service;
35  
36  import java.io.Serializable;
37  
38  import fr.paris.lutece.plugins.calendar.business.Agenda;
39  import fr.paris.lutece.portal.service.resource.Resource;
40  import fr.paris.lutece.portal.service.role.RoleRemovalListenerService;
41  import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource;
42  import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupService;
43  import fr.paris.lutece.portal.service.workgroup.WorkgroupRemovalListenerService;
44  
45  
46  /**
47   *  This class describes an agenda resource
48   */
49  public class AgendaResource implements Serializable, Resource, AdminWorkgroupResource
50  {
51  	private static final long serialVersionUID = 5430301763071821176L;
52  	private static AgendaResourceWorkgroupRemovalListener _listenerWorkgroup;
53      private static AgendaResourceRoleRemovalListener _listenerRole;
54  
55      // Variables declarations
56      private String _strId;
57      private String _strName;
58      private String _strEventImage;
59      private String _strEventPrefix;
60      private String _strLoaderClassName;
61      private String _strLoaderParameter;
62      private String _strRole;
63      private String _strRoleManager;
64      private Agenda _agenda;
65      private String _strAdminWorkgroup;
66      private String _strResourceType;
67      private boolean _bNotify;
68      private int _nPeriodValidity;
69  
70      /**
71       * Initialize the Agenda
72       */
73      public static void init(  )
74      {
75          // Create removal listeners and register them
76          if ( _listenerWorkgroup == null )
77          {
78              _listenerWorkgroup = new AgendaResourceWorkgroupRemovalListener(  );
79              WorkgroupRemovalListenerService.getService(  ).registerListener( _listenerWorkgroup );
80          }
81  
82          if ( _listenerRole == null )
83          {
84              _listenerRole = new AgendaResourceRoleRemovalListener(  );
85              RoleRemovalListenerService.getService(  ).registerListener( _listenerRole );
86          }
87      }
88  
89      /**
90       * Returns the Id
91       *
92       * @return The Id
93       */
94      public String getId(  )
95      {
96          return _strId;
97      }
98  
99      /**
100      * Sets the Id
101      *
102      * @param strId The Id
103      */
104     public void setId( String strId )
105     {
106         _strId = strId;
107     }
108 
109     /**
110      * Returns the Name
111      *
112      * @return The Name
113      */
114     public String getName(  )
115     {
116         return _strName;
117     }
118 
119     /**
120      * Sets the Name
121      *
122      * @param strName The Name
123      */
124     public void setName( String strName )
125     {
126         _strName = strName;
127     }
128 
129     /**
130      * Returns the Resource Type
131      *
132      * @return The Resource Type
133      */
134     public String getResourceType(  )
135     {
136         return _strResourceType;
137     }
138 
139     /**
140      * Sets the Resource Type
141      *
142      * @param strResourceType The Resource Type
143      */
144     public void setResourceType( String strResourceType )
145     {
146         _strResourceType = strResourceType;
147     }
148 
149     /**
150      * Returns the EventImage
151      *
152      * @return The EventImage
153      */
154     public String getEventImage(  )
155     {
156         return _strEventImage;
157     }
158 
159     /**
160      * Sets the EventImage
161      *
162      * @param strEventImage The EventImage
163      */
164     public void setEventImage( String strEventImage )
165     {
166         _strEventImage = strEventImage;
167     }
168 
169     /**
170      * Returns the EventPrefix
171      *
172      * @return The EventPrefix
173      */
174     public String getEventPrefix(  )
175     {
176         return _strEventPrefix;
177     }
178 
179     /**
180      * Sets the EventPrefix
181      *
182      * @param strEventPrefix The EventPrefix
183      */
184     public void setEventPrefix( String strEventPrefix )
185     {
186         _strEventPrefix = strEventPrefix;
187     }
188 
189     /**
190      * Returns the LoaderClassName
191      *
192      * @return The LoaderClassName
193      */
194     public String getLoaderClassName(  )
195     {
196         return _strLoaderClassName;
197     }
198 
199     /**
200      * Sets the LoaderClassName
201      *
202      * @param strLoaderClassName The LoaderClassName
203      */
204     public void setLoaderClassName( String strLoaderClassName )
205     {
206         _strLoaderClassName = strLoaderClassName;
207     }
208 
209     /**
210      * Returns the LoaderParameter
211      *
212      * @return The LoaderParameter
213      */
214     public String getLoaderParameter(  )
215     {
216         return _strLoaderParameter;
217     }
218 
219     /**
220      * Sets the LoaderParameter
221      *
222      * @param strLoaderParameter The LoaderParameter
223      */
224     public void setLoaderParameter( String strLoaderParameter )
225     {
226         _strLoaderParameter = strLoaderParameter;
227     }
228 
229     /**
230      * Returns the Role
231      *
232      * @return The Role
233      */
234     public String getRole(  )
235     {
236         return _strRole;
237     }
238 
239     /**
240      * Sets the Role
241      *
242      * @param strRole The Role
243      */
244     public void setRole( String strRole )
245     {
246         _strRole = strRole;
247     }
248 
249     /**
250     * Returns the  Manager Role
251     *
252     * @return The ManagerRole
253     */
254     public String getRoleManager(  )
255     {
256         return _strRoleManager;
257     }
258 
259     /**
260      * Sets the Manager Role
261      * @param strRoleManager The role of the manager of the agenda
262      */
263     public void setRoleManager( String strRoleManager )
264     {
265         _strRoleManager = strRoleManager;
266     }
267 
268     /**
269      * Returns the Agenda
270      *
271      * @return The Agenda
272      */
273     public Agenda getAgenda(  )
274     {
275         return _agenda;
276     }
277 
278     /**
279      * Sets the Agenda
280      * @param agenda The Agenda
281      */
282     public void setAgenda( Agenda agenda )
283     {
284         _agenda = agenda;
285     }
286 
287     /**
288      * Returns the workgroup
289      * @return The workgroup
290      */
291     public String getWorkgroup(  )
292     {
293         return _strAdminWorkgroup;
294     }
295 
296     /**
297      * Sets the workgroup
298      * @param strAdminWorkgroup The string representation of the admin workgroup
299      */
300     public void setWorkgroup( String strAdminWorkgroup )
301     {
302         _strAdminWorkgroup = AdminWorkgroupService.normalizeWorkgroupKey( strAdminWorkgroup );
303     }
304     
305     /**
306      * Returns the _bNotify
307      * @return The _bNotify
308      */
309     public boolean isNotify(  )
310     {
311         return _bNotify;
312     }
313 
314     /**
315      * Sets the _bNotify
316      * @param notify the _bNotification to set
317      */
318     public void setNotify( Boolean notify )
319     {
320     	_bNotify = notify;
321     }
322     
323     /**
324      * Returns the period validity of mail notification
325      * @return The period validity of mail notification
326      */
327     public int getPeriodValidity(  )
328     {
329         return _nPeriodValidity;
330     }
331 
332     /**
333      * Sets the the period validity of mail notification
334      * @param nPeriodValidity The int period validity of mail notification
335      */
336     public void setPeriodValidity( int nPeriodValidity )
337     {
338     	_nPeriodValidity = nPeriodValidity;
339     }
340 }