View Javadoc
1   /*
2    * Copyright (c) 2002-2022, City of 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.portal.web.mailinglist;
35  
36  import java.util.ArrayList;
37  import java.util.Collection;
38  import java.util.Collections;
39  import java.util.HashMap;
40  import java.util.List;
41  import java.util.Map;
42  
43  import javax.servlet.http.HttpServletRequest;
44  
45  import org.apache.commons.lang3.StringUtils;
46  
47  import fr.paris.lutece.portal.business.mailinglist.MailingList;
48  import fr.paris.lutece.portal.business.mailinglist.MailingListFilter;
49  import fr.paris.lutece.portal.business.mailinglist.MailingListHome;
50  import fr.paris.lutece.portal.business.mailinglist.MailingListUsersFilter;
51  import fr.paris.lutece.portal.business.mailinglist.Recipient;
52  import fr.paris.lutece.portal.business.rbac.RBACRoleHome;
53  import fr.paris.lutece.portal.service.admin.AccessDeniedException;
54  import fr.paris.lutece.portal.service.mailinglist.AdminMailingListService;
55  import fr.paris.lutece.portal.service.mailinglist.MailingListRemovalListenerService;
56  import fr.paris.lutece.portal.service.message.AdminMessage;
57  import fr.paris.lutece.portal.service.message.AdminMessageService;
58  import fr.paris.lutece.portal.service.security.SecurityTokenService;
59  import fr.paris.lutece.portal.service.template.AppTemplateService;
60  import fr.paris.lutece.portal.service.util.AppLogService;
61  import fr.paris.lutece.portal.service.util.AppPathService;
62  import fr.paris.lutece.portal.service.util.AppPropertiesService;
63  import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupService;
64  import fr.paris.lutece.portal.web.admin.AdminFeaturesPageJspBean;
65  import fr.paris.lutece.portal.web.constants.Messages;
66  import fr.paris.lutece.portal.web.constants.Parameters;
67  import fr.paris.lutece.portal.web.util.LocalizedPaginator;
68  import fr.paris.lutece.util.ReferenceList;
69  import fr.paris.lutece.util.html.AbstractPaginator;
70  import fr.paris.lutece.util.html.HtmlTemplate;
71  import fr.paris.lutece.util.http.SecurityUtil;
72  import fr.paris.lutece.util.sort.AttributeComparator;
73  import fr.paris.lutece.util.url.UrlItem;
74  
75  /**
76   * Mailing ListJspBean
77   */
78  public class MailingListJspBean extends AdminFeaturesPageJspBean
79  {
80      private static final long serialVersionUID = -1589153949244582338L;
81  
82      // Rights
83      public static final String RIGHT_MANAGE_MAILINGLISTS = "CORE_MAILINGLISTS_MANAGEMENT";
84  
85      // Templates
86      private static final String TEMPLATE_MANAGE_MAILINGLISTS = "admin/mailinglist/manage_mailinglists.html";
87      private static final String TEMPLATE_CREATE_MAILINGLIST = "admin/mailinglist/create_mailinglist.html";
88      private static final String TEMPLATE_MODIFY_MAILINGLIST = "admin/mailinglist/modify_mailinglist.html";
89      private static final String TEMPLATE_ADD_USERS = "admin/mailinglist/add_users.html";
90      private static final String TEMPLATE_VIEW_USERS = "admin/mailinglist/view_users.html";
91  
92      // Bookmarks
93      private static final String MARK_MAILINGLISTS_LIST = "mailinglists_list";
94      private static final String MARK_WORKGROUPS_LIST = "workgroups_list";
95      private static final String MARK_WORKGROUP_SELECTED = "selected_workgroup";
96      private static final String MARK_ROLES_LIST = "roles_list";
97      private static final String MARK_RECIPIENTS_LIST = "recipients_list";
98      private static final String MARK_MAILINGLIST = "mailinglist";
99      private static final String MARK_MAILINGLIST_FILTER = "mailinglistFilter";
100     private static final String MARK_PAGINATOR = "paginator";
101     private static final String MARK_NB_ITEMS_PER_PAGE = "nb_items_per_page";
102 
103     // Properties
104     private static final String PROPERTY_CREATE_MAILINGLIST_PAGETITLE = "portal.mailinglist.create_mailinglist.pageTitle";
105     private static final String PROPERTY_MODIFY_MAILINGLIST_PAGETITLE = "portal.mailinglist.modify_mailinglist.pageTitle";
106     private static final String PROPERTY_VIEW_USERS_PAGETITLE = "portal.mailinglist.view_users.pageTitle";
107     private static final String PROPERTY_ADD_USERS_PAGETITLE = "portal.mailinglist.add_users.pageTitle";
108     private static final String PROPERTY_MAILINGLIST_PER_PAGE = "paginator.mailinglist.itemsPerPage";
109     private static final String MESSAGE_CONFIRM_REMOVE = "portal.mailinglist.message.confirmRemoveMailingList";
110     private static final String MESSAGE_CANNOT_REMOVE = "portal.mailinglist.message.cannotRemoveMailingList";
111     private static final String MESSAGE_FILTER_ALREADY_EXISTS = "portal.mailinglist.message.filterAlreadyExists";
112 
113     // Parameters
114     private static final String PARAMETER_WORKGROUP = "workgroup";
115     private static final String PARAMETER_ROLE = "role";
116     private static final String PARAMETER_MAILINGLIST_ID = "id_mailinglist";
117     private static final String PARAMETER_NAME = "name";
118     private static final String PARAMETER_DESCRIPTION = "description";
119     private static final String PARAMETER_SESSION = "session";
120 
121     // JSP
122     private static final String JSP_MODIFY_MAILINGLIST = "ModifyMailingList.jsp";
123     private static final String JSP_URL_REMOVE_MAILINGLIST = "jsp/admin/mailinglist/DoRemoveMailingList.jsp";
124     private static final String JSP_URL_MANAGE_MAILINGLISTS = "jsp/admin/mailinglist/ManageMailingLists.jsp";
125     private MailingListFilter _mailingListFilter;
126     private int _nItemsPerPage;
127     private String _strCurrentPageIndex;
128 
129     /**
130      * Get the mailinglists management page. This page provides the list of all existing mailinglists.
131      * 
132      * @param request
133      *            the http request
134      * @return the html code for the mailinglist management page
135      */
136     public String getManageMailinglists( HttpServletRequest request )
137     {
138         Map<String, Object> model = new HashMap<>( );
139 
140         // Build filter
141         if ( StringUtils.isBlank( request.getParameter( PARAMETER_SESSION ) ) )
142         {
143             _mailingListFilter = new MailingListFilter( );
144             populate( _mailingListFilter, request );
145         }
146 
147         List<MailingList> listMailinglists = AdminMailingListService.getUserMailingListsByFilter( getUser( ), _mailingListFilter );
148 
149         // SORT
150         String strSortedAttributeName = request.getParameter( Parameters.SORTED_ATTRIBUTE_NAME );
151         String strAscSort = request.getParameter( Parameters.SORTED_ASC );
152         boolean bIsAscSort = true;
153 
154         if ( StringUtils.isBlank( strSortedAttributeName ) )
155         {
156             strSortedAttributeName = PARAMETER_NAME;
157         }
158 
159         if ( StringUtils.isNotBlank( strAscSort ) )
160         {
161             bIsAscSort = Boolean.parseBoolean( strAscSort );
162         }
163 
164         Collections.sort( listMailinglists, new AttributeComparator( strSortedAttributeName, bIsAscSort ) );
165 
166         // Paginator
167         _strCurrentPageIndex = AbstractPaginator.getPageIndex( request, AbstractPaginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex );
168         int defaultItemsPerPage = AppPropertiesService.getPropertyInt( PROPERTY_MAILINGLIST_PER_PAGE, 50 );
169         _nItemsPerPage = AbstractPaginator.getItemsPerPage( request, AbstractPaginator.PARAMETER_ITEMS_PER_PAGE, _nItemsPerPage, defaultItemsPerPage );
170 
171         UrlItem/url/UrlItem.html#UrlItem">UrlItem url = new UrlItem( AppPathService.getBaseUrl( request ) + JSP_URL_MANAGE_MAILINGLISTS );
172         url.addParameter( Parameters.SORTED_ATTRIBUTE_NAME, strSortedAttributeName );
173         url.addParameter( Parameters.SORTED_ASC, Boolean.toString( bIsAscSort ) );
174         url.addParameter( PARAMETER_SESSION, PARAMETER_SESSION );
175 
176         LocalizedPaginator<MailingList> paginator = new LocalizedPaginator<>( listMailinglists, _nItemsPerPage, url.getUrl( ),
177                 AbstractPaginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex, request.getLocale( ) );
178 
179         model.put( MARK_MAILINGLISTS_LIST, paginator.getPageItems( ) );
180         model.put( MARK_PAGINATOR, paginator );
181         model.put( MARK_NB_ITEMS_PER_PAGE, Integer.toString( paginator.getItemsPerPage( ) ) );
182         model.put( MARK_MAILINGLIST_FILTER, _mailingListFilter );
183 
184         HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_MANAGE_MAILINGLISTS, getLocale( ), model );
185 
186         return getAdminPage( template.getHtml( ) );
187     }
188 
189     /**
190      * Get the mailinglist create page.
191      * 
192      * @param request
193      *            the http request
194      * @return the html code for the mailinglist create page
195      */
196     public String getCreateMailinglist( HttpServletRequest request )
197     {
198         setPageTitleProperty( PROPERTY_CREATE_MAILINGLIST_PAGETITLE );
199 
200         ReferenceList listWorkgroups = AdminWorkgroupService.getUserWorkgroups( getUser( ), getLocale( ) );
201 
202         HashMap<String, Object> model = new HashMap<>( );
203         model.put( MARK_WORKGROUPS_LIST, listWorkgroups );
204 
205         // LUTECE-890 : the first workgroup will be selected by default
206         if ( !listWorkgroups.isEmpty( ) )
207         {
208             model.put( MARK_WORKGROUP_SELECTED, listWorkgroups.get( 0 ).getCode( ) );
209         }
210 
211         model.put( SecurityTokenService.MARK_TOKEN, SecurityTokenService.getInstance( ).getToken( request, TEMPLATE_CREATE_MAILINGLIST ) );
212         HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_CREATE_MAILINGLIST, getLocale( ), model );
213 
214         return getAdminPage( template.getHtml( ) );
215     }
216 
217     /**
218      * Process the data capture form for create a mailing list
219      *
220      * @param request
221      *            The HTTP Request
222      * @return The Jsp URL of the process result
223      * @throws AccessDeniedException
224      *             If the security token is invalid
225      */
226     public String doCreateMailingList( HttpServletRequest request ) throws AccessDeniedException
227     {
228         MailingListmailinglist/MailingList.html#MailingList">MailingList mailinglist = new MailingList( );
229         String strErrors = processFormData( request, mailinglist );
230 
231         if ( strErrors != null )
232         {
233             return AdminMessageService.getMessageUrl( request, strErrors, AdminMessage.TYPE_STOP );
234         }
235         if ( !SecurityTokenService.getInstance( ).validate( request, TEMPLATE_CREATE_MAILINGLIST ) )
236         {
237             throw new AccessDeniedException( ERROR_INVALID_TOKEN );
238         }
239 
240         MailingListHome.create( mailinglist );
241 
242         // Forward to modify page to enter users filters
243         UrlItemrlItem.html#UrlItem">UrlItem urlModify = new UrlItem( JSP_MODIFY_MAILINGLIST );
244         urlModify.addParameter( PARAMETER_MAILINGLIST_ID, mailinglist.getId( ) );
245 
246         return urlModify.getUrl( );
247     }
248 
249     /**
250      * Get the mailinglist modify page.
251      * 
252      * @param request
253      *            the http request
254      * @return the html code for the mailinglist modify page
255      */
256     public String getModifyMailinglist( HttpServletRequest request )
257     {
258         setPageTitleProperty( PROPERTY_MODIFY_MAILINGLIST_PAGETITLE );
259 
260         ReferenceList listWorkgroups = AdminWorkgroupService.getUserWorkgroups( getUser( ), getLocale( ) );
261 
262         String strMailingListId = request.getParameter( PARAMETER_MAILINGLIST_ID );
263 
264         if ( !StringUtils.isNumeric( strMailingListId ) )
265         {
266             AppLogService.error( " {} is not a valid mailing list id.", ( ) -> SecurityUtil.logForgingProtect( strMailingListId ) );
267 
268             return getManageMailinglists( request );
269         }
270 
271         int nMailingListId = Integer.parseInt( strMailingListId );
272         MailingList mailinglist = MailingListHome.findByPrimaryKey( nMailingListId );
273 
274         if ( mailinglist == null )
275         {
276             AppLogService.error( "{} is not a valid mailing list id.", ( ) -> SecurityUtil.logForgingProtect( strMailingListId ) );
277 
278             return getManageMailinglists( request );
279         }
280 
281         Map<String, Object> model = new HashMap<>( );
282         model.put( MARK_WORKGROUPS_LIST, listWorkgroups );
283         model.put( MARK_MAILINGLIST, mailinglist );
284         model.put( SecurityTokenService.MARK_TOKEN, SecurityTokenService.getInstance( ).getToken( request, TEMPLATE_MODIFY_MAILINGLIST ) );
285 
286         HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_MODIFY_MAILINGLIST, getLocale( ), model );
287 
288         return getAdminPage( template.getHtml( ) );
289     }
290 
291     /**
292      * Process the data capture form for modify a mailing list
293      *
294      * @param request
295      *            The HTTP Request
296      * @return The Jsp URL of the process result
297      * @throws AccessDeniedException
298      *             if the security token is invalid
299      */
300     public String doModifyMailingList( HttpServletRequest request ) throws AccessDeniedException
301     {
302         String strId = request.getParameter( PARAMETER_MAILINGLIST_ID );
303         int nId = Integer.parseInt( strId );
304         MailingList mailinglist = MailingListHome.findByPrimaryKey( nId );
305 
306         String strErrors = processFormData( request, mailinglist );
307 
308         if ( strErrors != null )
309         {
310             return AdminMessageService.getMessageUrl( request, strErrors, AdminMessage.TYPE_STOP );
311         }
312         if ( !SecurityTokenService.getInstance( ).validate( request, TEMPLATE_MODIFY_MAILINGLIST ) )
313         {
314             throw new AccessDeniedException( ERROR_INVALID_TOKEN );
315         }
316 
317         MailingListHome.update( mailinglist );
318 
319         return getHomeUrl( request );
320     }
321 
322     /**
323      * Returns the page of confirmation for deleting a mailinglist
324      *
325      * @param request
326      *            The Http Request
327      * @return the confirmation url
328      */
329     public String getConfirmRemoveMailingList( HttpServletRequest request )
330     {
331         String strId = request.getParameter( PARAMETER_MAILINGLIST_ID );
332 
333         ArrayList<String> listErrors = new ArrayList<>( );
334 
335         if ( !MailingListRemovalListenerService.getService( ).checkForRemoval( strId, listErrors, getLocale( ) ) )
336         {
337             String strCause = AdminMessageService.getFormattedList( listErrors, getLocale( ) );
338             Object [ ] args = {
339                     strCause
340             };
341             return AdminMessageService.getMessageUrl( request, MESSAGE_CANNOT_REMOVE, args, AdminMessage.TYPE_STOP );
342         }
343         String strUrlRemove = JSP_URL_REMOVE_MAILINGLIST;
344         Map<String, String> parameters = new HashMap<>( );
345         parameters.put( PARAMETER_MAILINGLIST_ID, strId );
346         parameters.put( SecurityTokenService.PARAMETER_TOKEN, SecurityTokenService.getInstance( ).getToken( request, JSP_URL_REMOVE_MAILINGLIST ) );
347         return AdminMessageService.getMessageUrl( request, MESSAGE_CONFIRM_REMOVE, strUrlRemove, AdminMessage.TYPE_CONFIRMATION, parameters );
348 
349     }
350 
351     /**
352      * Process the data capture form for modify a mailing list
353      *
354      * @param request
355      *            The HTTP Request
356      * @return The Jsp URL of the process result
357      * @throws AccessDeniedException
358      *             if the security token is invalid
359      */
360     public String doRemoveMailingList( HttpServletRequest request ) throws AccessDeniedException
361     {
362         if ( !SecurityTokenService.getInstance( ).validate( request, JSP_URL_REMOVE_MAILINGLIST ) )
363         {
364             throw new AccessDeniedException( ERROR_INVALID_TOKEN );
365         }
366         String strId = request.getParameter( PARAMETER_MAILINGLIST_ID );
367         int nId = Integer.parseInt( strId );
368 
369         MailingListHome.remove( nId );
370 
371         return getHomeUrl( request );
372     }
373 
374     /**
375      * Get the view users page.
376      * 
377      * @param request
378      *            the http request
379      * @return the html code for the mailinglist modify page
380      */
381     public String getViewUsers( HttpServletRequest request )
382     {
383         setPageTitleProperty( PROPERTY_VIEW_USERS_PAGETITLE );
384 
385         HashMap<String, Object> model = new HashMap<>( );
386         Collection<Recipient> listRecipients;
387         String strId = request.getParameter( PARAMETER_MAILINGLIST_ID );
388 
389         if ( strId != null )
390         {
391             int nIdMailingList = Integer.parseInt( strId );
392             listRecipients = AdminMailingListService.getRecipients( nIdMailingList );
393         }
394         else
395         {
396             String strWorkgroup = request.getParameter( PARAMETER_WORKGROUP );
397             String strRole = request.getParameter( PARAMETER_ROLE );
398             listRecipients = AdminMailingListService.getRecipients( strWorkgroup, strRole );
399         }
400 
401         model.put( MARK_RECIPIENTS_LIST, listRecipients );
402 
403         HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_VIEW_USERS, getLocale( ), model );
404 
405         return getAdminPage( template.getHtml( ) );
406     }
407 
408     /**
409      * Get the add users page.
410      * 
411      * @param request
412      *            the http request
413      * @return the html code for the mailinglist modify page
414      */
415     public String getAddUsers( HttpServletRequest request )
416     {
417         setPageTitleProperty( PROPERTY_ADD_USERS_PAGETITLE );
418 
419         String strId = request.getParameter( PARAMETER_MAILINGLIST_ID );
420         int nId = Integer.parseInt( strId );
421         MailingList mailinglist = MailingListHome.findByPrimaryKey( nId );
422 
423         if ( mailinglist == null )
424         {
425             return getManageMailinglists( request );
426         }
427 
428         ReferenceList listWorkgroups = AdminWorkgroupService.getUserWorkgroups( getUser( ), getLocale( ) );
429         ReferenceList listRoles = RBACRoleHome.getRolesList( );
430         listRoles.addItem( AdminMailingListService.ALL_ROLES, AdminMailingListService.ALL_ROLES );
431 
432         Map<String, Object> model = new HashMap<>( );
433         model.put( MARK_WORKGROUPS_LIST, listWorkgroups );
434         model.put( MARK_ROLES_LIST, listRoles );
435         model.put( MARK_MAILINGLIST, mailinglist );
436         model.put( SecurityTokenService.MARK_TOKEN, SecurityTokenService.getInstance( ).getToken( request, TEMPLATE_ADD_USERS ) );
437 
438         HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_ADD_USERS, getLocale( ), model );
439 
440         return getAdminPage( template.getHtml( ) );
441     }
442 
443     /**
444      * Process the data capture form for adding users filters
445      *
446      * @param request
447      *            The HTTP Request
448      * @return The Jsp URL of the process result
449      * @throws AccessDeniedException
450      *             if the security token is invalid
451      */
452     public String doAddUsers( HttpServletRequest request ) throws AccessDeniedException
453     {
454         String strId = request.getParameter( PARAMETER_MAILINGLIST_ID );
455         String strWorkgroup = request.getParameter( PARAMETER_WORKGROUP );
456         String strRole = request.getParameter( PARAMETER_ROLE );
457 
458         int nId = Integer.parseInt( strId );
459         MailingListUsersFilterglist/MailingListUsersFilter.html#MailingListUsersFilter">MailingListUsersFilter filter = new MailingListUsersFilter( );
460         filter.setWorkgroup( strWorkgroup );
461         filter.setRole( strRole );
462 
463         if ( !AdminMailingListService.checkFilter( filter, nId ) )
464         {
465             if ( !SecurityTokenService.getInstance( ).validate( request, TEMPLATE_ADD_USERS ) )
466             {
467                 throw new AccessDeniedException( ERROR_INVALID_TOKEN );
468             }
469             MailingListHome.addFilterToMailingList( filter, nId );
470 
471             // Forward to modify page to enter users filters
472             UrlItemrlItem.html#UrlItem">UrlItem urlModify = new UrlItem( JSP_MODIFY_MAILINGLIST );
473             urlModify.addParameter( PARAMETER_MAILINGLIST_ID, nId );
474 
475             return urlModify.getUrl( );
476         }
477 
478         return AdminMessageService.getMessageUrl( request, MESSAGE_FILTER_ALREADY_EXISTS, AdminMessage.TYPE_STOP );
479     }
480 
481     /**
482      * Process the data capture form to remove users filters
483      *
484      * @param request
485      *            The HTTP Request
486      * @return The Jsp URL of the process result
487      * @throws AccessDeniedException
488      *             if the security token is invalid
489      */
490     public String doDeleteFilter( HttpServletRequest request ) throws AccessDeniedException
491     {
492         if ( !SecurityTokenService.getInstance( ).validate( request, TEMPLATE_MODIFY_MAILINGLIST ) )
493         {
494             throw new AccessDeniedException( ERROR_INVALID_TOKEN );
495         }
496 
497         String strId = request.getParameter( PARAMETER_MAILINGLIST_ID );
498         String strWorkgroup = request.getParameter( PARAMETER_WORKGROUP );
499         String strRole = request.getParameter( PARAMETER_ROLE );
500 
501         int nId = Integer.parseInt( strId );
502         MailingListUsersFilterglist/MailingListUsersFilter.html#MailingListUsersFilter">MailingListUsersFilter filter = new MailingListUsersFilter( );
503         filter.setWorkgroup( strWorkgroup );
504         filter.setRole( strRole );
505         MailingListHome.deleteFilterToMailingList( filter, nId );
506 
507         // Forward to modify page to enter users filters
508         UrlItemrlItem.html#UrlItem">UrlItem urlModify = new UrlItem( JSP_MODIFY_MAILINGLIST );
509         urlModify.addParameter( PARAMETER_MAILINGLIST_ID, nId );
510 
511         return urlModify.getUrl( );
512     }
513 
514     /**
515      * Process Form Data
516      * 
517      * @param request
518      *            The HTTP request
519      * @param mailinglist
520      *            The mailing list
521      * @return An Error message or null if no error
522      */
523     private String processFormData( HttpServletRequest request, MailingList mailinglist )
524     {
525         String strErrors = null;
526         String strName = request.getParameter( PARAMETER_NAME );
527         String strDescription = request.getParameter( PARAMETER_DESCRIPTION );
528         String strWorkgroup = request.getParameter( PARAMETER_WORKGROUP );
529 
530         if ( ( strName == null ) || ( strName.equals( "" ) ) || ( strDescription == null ) || ( strDescription.equals( "" ) ) )
531         {
532             return Messages.MANDATORY_FIELDS;
533         }
534 
535         mailinglist.setName( strName );
536         mailinglist.setDescription( strDescription );
537         mailinglist.setWorkgroup( strWorkgroup );
538 
539         return strErrors;
540     }
541 }