public boolean hasVacancy(Course course, Role role) { List<PersonRoleCourse> results = prcRepository.findCurso(course, role); int registereds = results.size(); if (results.isEmpty() || registereds < course.getStudents()) { return true; } else { return false; } }
public boolean isRegistered(User user, Course course) { List<PersonRoleCourse> results = prcRepository.findRegistered(user, course); // System.out.println(resultados.get(0).getCurso().getNome()+" :: // "+resultados.get(0).getPessoa().getNome()); if (results.isEmpty()) { return false; } else { return true; } }
public PersonRoleCourse insertPersonRoleCourse(PersonRoleCourse prc) { return prcRepository.makePersistent(prc); }
public void deletePersonRoleCourse(PersonRoleCourse prc) { prcRepository.makeTransient(prc); }
public PersonRoleCourse searchPersonRoleCourse(Person person, Course course) { return prcRepository.searchPersonRoleCourse(person, course); }
public PersonRoleCourse updatePersonRoleCourse(PersonRoleCourse prc) { System.out.println("SQL QUERY PRA UPDATE PRC: "); return prcRepository.makePersistentU(prc); }
public List<User> listUsersByCourse(Course course, Role role) { return prcRepository.listUsersByCourse(course, role); }
public int countUsersByCourse(Course course, Role role) { List<PersonRoleCourse> results = prcRepository.findCurso(course, role); return results.size(); }