public List<Role> getRoleByJob(Job job) { List<Role> roleList = new LinkedList<Role>(); for (Job_Role job_Role : job_RoleDao.getByColumn("job", job)) { roleList.add(job_Role.getRole()); } return roleList; }
public void disTributeRole(List<TreeNode> treeList, Job job) { job_RoleDao.deleteByColumn("job", job); for (TreeNode node : treeList) { if (node.isSelected()) { Job_Role job_Role = new Job_Role(); job_Role.setJob(job); job_Role.setRole((Role) node.getData()); job_RoleDao.create(job_Role); } } }
public List<TreeNode> getRoleTreeByJob(Job job) { List<Job_Role> job_RoleList = job_RoleDao.getByColumn("job", job); List<Role> roleList = roleDao.findAll(); List<TreeNode> treeList = new LinkedList<TreeNode>(); for (Role role : roleList) { TreeNode treeNode = new TreeNode(); treeNode.setData(role); treeList.add(treeNode); for (Job_Role job_Role : job_RoleList) { if (job_Role.getRole().equalWithByPrimary(role)) { treeNode.setSelected(true); job_RoleList.remove(job_Role); break; } } } return treeList; }