コード例 #1
0
 // Faculty names are not added to the external courses by default
 // this method should fix ssp-3041 - Scody
 private void updateFactultyNames(ExternalStudentRecordsTO recordTO) {
   List<ExternalStudentTranscriptCourseTO> courses = recordTO.getTerms();
   if (courses != null) {
     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.  Faculty School_id: "
                 + course.getFacultySchoolId()
                 + " Student ID: "
                 + course.getSchoolId()
                 + " Course: "
                 + course.getFormattedCourse());
       }
     }
   }
 }
コード例 #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;
  }