/** * 给角色授权 * * @param roleId * @param TreeService rights * @return */ public void impowerRole(String roleId, TreeService rights) { // TODO Auto-generated method stub SysRole sr = (SysRole) dao.loadEntity(SysRole.class, roleId); Set s = sr.getSysRightRoles(); Iterator i = s.iterator(); while (i.hasNext()) { SysRightRole srr = (SysRightRole) i.next(); dao.removeEntity(srr); } dao.flush(); // String rootName = rights.getRoot().getId(); Map registry = rights.getRegistry(); Iterator iterator = registry.keySet().iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); ViewTreeControlNode node = (ViewTreeControlNode) registry.get(key); String nodeType = node.getType(); if (nodeType == null) nodeType = ""; // 是角色图标 类型是leaf_right_% if (SysStaticParameter.RICON.equalsIgnoreCase(node.getTmpIcon()) && nodeType.indexOf("leaf_right") != -1) { SysRightRole dbsrr = new SysRightRole(); dbsrr.setId(ks.getNext("SYS_RIGHT_ROLE")); dbsrr.setSysRole(sr); SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, node.getId()); dbsrr.setSysLeafRight(slr); dao.saveEntity(dbsrr); } } }
public void deleteRoleRights(String roleId, String treeId) { Object[] o = dao.findEntity(searchHelp.searchRightRole(roleId, treeId)); for (int i = 0; i < o.length; i++) { SysRightRole srr = (SysRightRole) o[i]; dao.removeEntity(srr); } dao.flush(); }
/** * 删除树及其子节点 * * @param TreeControlNodeService node 带删除节点 * @return * @throws */ public void deleteDict(String id) { SysLeafRight slr = (SysLeafRight) dao.loadEntity(SysLeafRight.class, id); dao.removeEntity(slr); }
public void delete(IBaseDTO dto) { // TODO Auto-generated method stub OperInquiryCard inquiryCard = (OperInquiryCard) dao.loadEntity(OperInquiryCard.class, dto.get("id").toString()); dao.removeEntity(inquiryCard); }