public void approveAssistantRequest(UserRequest request, Person evaluator) { AcademicController ac = new AcademicController(); Role role = ac.searchRoleByConstant(Constants.MONITOR); PersonRoleCourse prc = this.searchPersonRoleCourse(request.getPerson(), request.getCourse()); if (prc != null) { this.deletePersonRoleCourse(prc); } PersonRoleCourse prcc = new PersonRoleCourse(); prcc.setCourse(request.getCourse()); prcc.setPerson(request.getPerson()); prcc.setRole(role); prcc.setDate(new Date()); this.updatePersonRoleCourse(prcc); }
public void requestAssistance(UserRequest userRequest) throws RequestException { List<UserRequest> results = searchRequestByUserID(userRequest.getCourse().getId(), userRequest.getPerson().getId()); for (UserRequest request : results) { if (request.getStatus().equalsIgnoreCase("ag")) { throw new RequestException("errors.request.waiting"); } if (request.getStatus().equalsIgnoreCase("ap")) { throw new RequestException("errors.request.approved"); } } userRequest.setStatus("ag"); insertUserRequest(userRequest); }