/** * readUsers * * @return List */ public List<User> readUsers() { List<User> list = new ArrayList<User>(); Element element; User user; NodeList users = OrganizationElementFactory.getListUsers(this.getUsersElement()); for (int i = 0; i < users.getLength(); i++) { element = (Element) users.item(i); user = factory.elementToUser(element); list.add(user); } return list; }
/** * readRoles * * @return List */ public List<Role> readRoles() { List<Role> list = new ArrayList<Role>(); Element element; Role role; NodeList roles = OrganizationElementFactory.getListRoles(this.getRolesElement()); for (int i = 0; i < roles.getLength(); i++) { element = (Element) roles.item(i); role = factory.elementToRole(element); list.add(role); } return list; }
/** * readAssignedRoles * * @param anUser User * @return List */ public List<Role> readAssignedRoles(User anUser) { List<Role> list = new ArrayList<Role>(); Element userElement = this.getUserElement(anUser); Element element; Role role; NodeList roles = OrganizationElementFactory.getListRoles(userElement); for (int i = 0; i < roles.getLength(); i++) { element = (Element) roles.item(i); role = new Role(factory.elementToBase(element).getId()); list.add(role); } return list; }