PageRenderTime 16ms CodeModel.GetById 12ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/web/DRCP/src/com/bluesky/drcp/persistence/dao/hibernate/RoleDaoImpl.java

http://drcp.googlecode.com/
Java | 43 lines | 30 code | 13 blank | 0 comment | 0 complexity | 472553164ce59733a28ea2907a9703c9 MD5 | raw file
 1package com.bluesky.drcp.persistence.dao.hibernate;
 2
 3import java.util.List;
 4
 5import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
 6
 7import com.bluesky.drcp.business.Role;
 8import com.bluesky.drcp.persistence.dao.RoleDao;
 9
10public class RoleDaoImpl extends HibernateDaoSupport implements RoleDao {
11
12	public boolean isAuthorized(String id, String entryId) {
13		Object[] p = new Object[] { id, entryId };
14		List list = getHibernateTemplate().find(
15				"from FunctionAuthorization where roleId=? and entryId=?", p);
16
17		return (!list.isEmpty());
18
19	}
20
21	public void delete(String id) {
22		Role role = (Role)getHibernateTemplate().get(Role.class, id);
23		getHibernateTemplate().delete(role);
24	}
25
26	public Role get(String id) {
27		return (Role)getHibernateTemplate().get(Role.class, id);
28	}
29
30	public List getAll() {
31		return getHibernateTemplate().find("from Role");		
32	}
33
34	public String save(Role role) {
35		getHibernateTemplate().save(role);	
36		return role.getId();
37	}
38
39	public void update(Role role) {
40		getHibernateTemplate().update(role);		
41	}
42	
43}