View Javadoc
1   /*******************************************************************************
2    *   Gisgraphy Project 
3    * 
4    *   This library is free software; you can redistribute it and/or
5    *   modify it under the terms of the GNU Lesser General Public
6    *   License as published by the Free Software Foundation; either
7    *   version 2.1 of the License, or (at your option) any later version.
8    * 
9    *   This library is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   *   Lesser General Public License for more details.
13   * 
14   *   You should have received a copy of the GNU Lesser General Public
15   *   License along with this library; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
17   * 
18   *  Copyright 2008  Gisgraphy project 
19   *  David Masclet <davidmasclet@gisgraphy.com>
20   *  
21   *  
22   *******************************************************************************/
23  package com.gisgraphy.service.impl;
24  
25  import java.util.List;
26  
27  import com.gisgraphy.dao.RoleDao;
28  import com.gisgraphy.model.Role;
29  import com.gisgraphy.service.RoleManager;
30  
31  /**
32   * Implementation of RoleManager interface.
33   * 
34   * @author <a href="mailto:dan@getrolling.com">Dan Kibler</a>
35   */
36  @SuppressWarnings("unchecked")
37  public class RoleManagerImpl extends UniversalManagerImpl implements
38  	RoleManager {
39      private RoleDao dao;
40  
41      public void setRoleDao(RoleDao dao) {
42  	this.dao = dao;
43      }
44  
45      /**
46       * {@inheritDoc}
47       */
48      public List<Role> getRoles(Role role) {
49  	return dao.getAll();
50      }
51  
52      /**
53       * {@inheritDoc}
54       */
55      public Role getRole(String rolename) {
56  	return dao.getRoleByName(rolename);
57      }
58  
59      /**
60       * {@inheritDoc}
61       */
62      public Role saveRole(Role role) {
63  	return dao.save(role);
64      }
65  
66      /**
67       * {@inheritDoc}
68       */
69      public void removeRole(String rolename) {
70  	dao.removeRole(rolename);
71      }
72  }