KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > appfuse > dao > ibatis > RoleDaoiBatis


1 package org.appfuse.dao.ibatis;
2
3 import java.util.List JavaDoc;
4
5 import org.appfuse.dao.RoleDao;
6 import org.appfuse.model.Role;
7
8 /**
9  * This class interacts with iBatis's SQL Maps to save/delete and
10  * retrieve Role objects.
11  *
12  * <p>
13  * <a HREF="RoleDaoiBatis.java.htm"><i>View Source</i></a>
14  * </p>
15  *
16  * @author <a HREF="mailto:matt@raibledesigns.com">Matt Raible</a>
17  */

18 public class RoleDaoiBatis extends BaseDaoiBATIS implements RoleDao {
19
20     public List JavaDoc getRoles(Role role) {
21         return getSqlMapClientTemplate().queryForList("getRoles", null);
22     }
23     
24     public Role getRoleByName(String JavaDoc name) {
25         return (Role) getSqlMapClientTemplate().queryForObject("getRoleByName", name);
26     }
27
28     public void saveRole(final Role role) {
29         if (role.getId() == null) {
30             getSqlMapClientTemplate().update("addRole", role);
31         } else {
32             getSqlMapClientTemplate().update("updateRole", role);
33         }
34     }
35
36     public void removeRole(String JavaDoc rolename) {
37         getSqlMapClientTemplate().update("deleteRole", rolename);
38     }
39
40 }
41
Popular Tags