View Javadoc

1   package org.appfuse.service.impl;
2   
3   import org.appfuse.dao.RoleDao;
4   import org.appfuse.model.Role;
5   import org.appfuse.service.RoleManager;
6   import org.springframework.beans.factory.annotation.Autowired;
7   import org.springframework.stereotype.Service;
8   
9   import java.util.List;
10  
11  /**
12   * Implementation of RoleManager interface.
13   *
14   * @author <a href="mailto:dan@getrolling.com">Dan Kibler</a>
15   */
16  @Service("roleManager")
17  public class RoleManagerImpl extends GenericManagerImpl<Role, Long> implements RoleManager {
18      RoleDao roleDao;
19  
20      @Autowired
21      public RoleManagerImpl(RoleDao roleDao) {
22          super(roleDao);
23          this.roleDao = roleDao;
24      }
25  
26      /**
27       * {@inheritDoc}
28       */
29      public List<Role> getRoles(Role role) {
30          return dao.getAll();
31      }
32  
33      /**
34       * {@inheritDoc}
35       */
36      public Role getRole(String rolename) {
37          return roleDao.getRoleByName(rolename);
38      }
39  
40      /**
41       * {@inheritDoc}
42       */
43      public Role saveRole(Role role) {
44          return dao.save(role);
45      }
46  
47      /**
48       * {@inheritDoc}
49       */
50      public void removeRole(String rolename) {
51          roleDao.removeRole(rolename);
52      }
53  }