@Checked("RolePredicates.MASTER_DEGREE_ADMINISTRATIVE_OFFICE_PREDICATE") @Service public static List run( InfoStudent infoStudent, Specialization specialization, StudentCurricularPlanState state) throws Exception { List infoStudentCurricularPlanList = new ArrayList(); Registration registration = Registration.readStudentByNumberAndDegreeType( infoStudent.getNumber(), infoStudent.getDegreeType()); if (registration == null) { return null; } List studentCurricularPlanList = registration.getStudentCurricularPlansBySpecialization(specialization); if (studentCurricularPlanList == null || studentCurricularPlanList.isEmpty()) { return null; } for (Iterator iter = studentCurricularPlanList.iterator(); iter.hasNext(); ) { StudentCurricularPlan studentCurricularPlan = (StudentCurricularPlan) iter.next(); if (studentCurricularPlan != null && studentCurricularPlan.getIdInternal() != null) { infoStudentCurricularPlanList.add( InfoStudentCurricularPlan.newInfoFromDomain(studentCurricularPlan)); } } return infoStudentCurricularPlanList; }
private static void checkOldStudentNumber(Integer studentNumber, Person person) throws ExistingServiceException { if (studentNumber != null) { Registration existingStudent = Registration.readStudentByNumberAndDegreeType(studentNumber, DegreeType.MASTER_DEGREE); if (existingStudent != null && !existingStudent.getPerson().equals(person)) { throw new ExistingServiceException(); } } }