/** 根据角色过滤权限 描述: 时间:2010-5-27 作者:童贝 参数: 返回值: 抛出异常: */ public List<TjItemKind> filterKindListByQx(Person person, List<TjItemKind> kindList) { Set<P2Role> p2rSet = person.getRoles(); Iterator<P2Role> it = p2rSet.iterator(); List<Sjqx> qxList = new ArrayList<Sjqx>(); Set<Sjqx> qxSet = new HashSet<Sjqx>(); while (it.hasNext()) { P2Role p2r = it.next(); Role role = p2r.getRole(); List<Sjqx> sjList = sjqxManager.findBy("roleid", role.getId()); qxSet.addAll(sjList); } qxList.addAll(qxSet); List<TjItemKind> removeList = new ArrayList<TjItemKind>(); for (TjItemKind tj : kindList) { boolean isExt = false; for (Sjqx sjqx : qxList) { String id = tj.getId(); if (id.equals(sjqx.getQxid())) { isExt = true; break; } } if (!isExt) { removeList.add(tj); } } kindList.removeAll(removeList); return kindList; }
/** 描述:复位状态 时间:2010-4-9 作者:童贝 参数: 返回值: 抛出异常: */ public boolean ghostState(String kid) { String hql = "from TjItemKind where kid='" + kid + "'"; List<TjItemKind> list = this.find(hql); if (list.size() > 0) { TjItemKind kind = list.get(0); kind.setDflag(new Long(1)); this.save(kind); return true; } return false; }
/** * 功能说明:判断可以操作数据维护模块 * * @author 童贝 * @version Jun 25, 2009 * @return */ public boolean findOperateState(String kid) { String hql = "from TjItemKind where kid='" + kid + "'"; List<TjItemKind> list = this.find(hql); if (list.size() > 0) { TjItemKind state = list.get(0); if (state.getDflag().intValue() == 2) { return false; } else { state.setDflag(new Long(2)); this.save(state); } } return true; }