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 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; }