コード例 #1
0
  @RequestMapping(value = "/transcript/full", method = RequestMethod.GET)
  @PreAuthorize(Permission.SECURITY_PERSON_READ)
  public @ResponseBody ExternalStudentRecordsTO loadFullStudentRecords(final @PathVariable UUID id)
      throws ObjectNotFoundException {
    String schoolId = getStudentId(id);

    final ExternalStudentRecords record = new ExternalStudentRecords();

    record.setPrograms(
        externalStudentAcademicProgramService.getAcademicProgramsBySchoolId(schoolId));
    record.setGPA(externalStudentTranscriptService.getRecordsBySchoolId(schoolId));
    record.setFinancialAid(
        externalStudentFinancialAidService.getStudentFinancialAidBySchoolId(schoolId));
    record.setTerms(externalStudentTranscriptCourseService.getTranscriptsBySchoolId(schoolId));
    record.setFinancialAidAcceptedTerms(
        externalStudentFinancialAidAwardTermService.getStudentFinancialAidAwardsBySchoolId(
            schoolId));
    record.setFinancialAidFiles(
        externalStudentFinancialAidFileService.getStudentFinancialAidFilesBySchoolId(schoolId));
    record.setNonCourseEntities(
        externalStudentTranscriptNonCourseEntityService.getNonCourseTranscriptsBySchoolId(
            schoolId));
    ExternalStudentRecordsTO recordTO =
        new ExternalStudentRecordsTO(record, getBalancedOwed(id, schoolId));

    // update the course faculty names
    updateFactultyNames(recordTO);

    return recordTO;
  }
コード例 #2
0
  @RequestMapping(value = "/transcript/currentcourses", method = RequestMethod.GET)
  @PreAuthorize(Permission.SECURITY_PERSON_READ)
  public @ResponseBody List<ExternalStudentTranscriptCourseTO> loadCurrentCourses(
      final @PathVariable UUID id) throws ObjectNotFoundException {
    String schoolId = getStudentId(id);

    Term currentTerm;
    try {
      currentTerm = termService.getCurrentTerm();
    } catch (ObjectNotFoundException e) {
      currentTerm = new Term();
      LOGGER.error(
          "CURRENT TERM NOT SET, org.jasig.ssp.web.api.external.ExternalStudentRecordsController.loadCurrentCourses(UUID) is being called but will not function properly");
    }
    List<ExternalStudentTranscriptCourseTO> courses =
        externalStudentTranscriptCourseFactory.asTOList(
            externalStudentTranscriptCourseService.getTranscriptsBySchoolIdAndTermCode(
                schoolId, currentTerm.getCode()));
    Collection<EnrollmentStatus> mappings = statusCodeMappings();

    String defaultStatusCode = getDefaultStatusCode(mappings);

    for (ExternalStudentTranscriptCourseTO course : courses) {
      try {
        Person person =
            !StringUtils.isNotBlank(course.getFacultySchoolId())
                ? null
                : personService.getInternalOrExternalPersonBySchoolId(
                    course.getFacultySchoolId(),
                    false); // TODO: getInternalOrExternalPersonBySchoolId is slow refactor?
        if (person != null) {
          course.setFacultyName(person.getFullName());
        }
      } catch (ObjectNotFoundException e) {
        course.setFacultyName("None Listed");
        LOGGER.debug(
            "FACULTY SCHOOL ID WAS NOT RESOLVED WHILE LOADING TRANSCRIPT RECORD.  Factulty School_id: "
                + course.getFacultySchoolId()
                + " Student ID: "
                + course.getSchoolId()
                + " Course: "
                + course.getFormattedCourse());
      }

      if (StringUtils.isBlank(course.getStatusCode())) {
        course.setStatusCode(defaultStatusCode);
      } else if (mappings != null && !mappings.isEmpty()) {
        for (EnrollmentStatus enrollmentStatus : mappings) {
          if (enrollmentStatus.getCode().equals(course.getStatusCode())) {
            course.setStatusCode(enrollmentStatus.getName());
          }
        }
      }
    }
    return courses;
  }