private void populateViewFlipper() { if (mTermService != null) { mTermSessions = mTermService.getSessions(); mTermSessions.addCallback(this); if (mTermSessions.size() == 0) { mTermSessions.add(createTermSession()); } for (TermSession session : mTermSessions) { EmulatorView view = createEmulatorView(session); mViewFlipper.addView(view); } updatePrefs(); Intent intent = getIntent(); int flags = intent.getFlags(); String action = intent.getAction(); if ((flags & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0 && action != null) { if (action.equals(RemoteInterface.PRIVACT_OPEN_NEW_WINDOW)) { mViewFlipper.setDisplayedChild(mTermSessions.size() - 1); } else if (action.equals(RemoteInterface.PRIVACT_SWITCH_WINDOW)) { int target = intent.getIntExtra(RemoteInterface.PRIVEXTRA_TARGET_WINDOW, -1); if (target >= 0) { mViewFlipper.setDisplayedChild(target); } } } mViewFlipper.resumeCurrentView(); } }
@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; }