// Decompiled by DJ v3.12.12.98 Copyright 2014 Atanas Neshkov Date: 2015-8-26 1:16:30
// Home Page: http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: AppRoleDaoImpl.java
package com.htsoft.oa.dao.system.impl;
import com.htsoft.core.dao.impl.BaseDaoImpl;
import com.htsoft.oa.dao.system.AppRoleDao;
import com.htsoft.oa.model.system.AppFunction;
import com.htsoft.oa.model.system.AppRole;
import com.htsoft.oa.model.system.FunUrl;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.HibernateTemplate;
public class AppRoleDaoImpl
extends BaseDaoImpl<AppRole>
implements AppRoleDao {
public AppRoleDaoImpl() {
super(AppRole.class);
}
public AppRole getByRoleName(String roleName) {
String hql = "from AppRole ar where ar.roleName=?";
return (AppRole)this.findUnique(hql, new Object[]{roleName});
}
public HashMap<String, Set<String>> getSecurityDataSource() {
final HashMap source = new HashMap();
this.getHibernateTemplate().execute((HibernateCallback)new HibernateCallback(){
public Object doInHibernate(Session session) throws HibernateException, SQLException {
String hql = "from AppRole";
Query query = session.createQuery(hql);
List<AppRole> roleList = query.list();
for (AppRole role : roleList) {
TreeSet<String> urlSet = new TreeSet<String>();
for (AppFunction fun : role.getFunctions()) {
Iterator<FunUrl> urlIt = fun.getFunUrls().iterator();
while (urlIt.hasNext()) {
urlSet.add(urlIt.next().getUrlPath());
}
}
source.put(role.getName(), urlSet);
}
return null;
}
});
return source;
}
}
------解决思路----------------------
abstract method GenericDao<AppRole,Long>.get(Long)