/** * Using the Student UUID passed, return the ExternalStudentRecordsLiteTO in its current state, * creating it if necessary. * * @param id Student identifier Any errors will throw this generic exception. * @return Service response with success value, in the JSON format. * @throws ObjectNotFoundException, IOException If any reference data could not be loaded. */ @RequestMapping(value = "/test/details", method = RequestMethod.GET) @PreAuthorize(Permission.SECURITY_PERSON_READ) public String getTestProviderDetails( final @PathVariable UUID id, final @RequestParam(required = true) String testCode, final @RequestParam(required = false) String subTestCode, HttpServletResponse httpServletResponse) throws ObjectNotFoundException, IOException { Person person = personService.get(id); String url = (String) externalStudentTestService.getTestDetails(testCode, subTestCode, person); return "redirect:" + url; }
@RequestMapping(value = "/studentactivity", method = RequestMethod.GET) @PreAuthorize(Permission.SECURITY_PERSON_READ) public @ResponseBody List<RecentActivityTO> loadRecentStudentActivity(final @PathVariable UUID id) throws ObjectNotFoundException { List<RecentActivityTO> recentActivities = new ArrayList<RecentActivityTO>(); Person person = personService.get(id); SortingAndPaging sAndP = SortingAndPaging.createForSingleSortWithPaging( ObjectStatus.ACTIVE, 0, 1000, "createdDate", "DESC", "createdDate"); PagingWrapper<EarlyAlert> earlyAlerts = earlyAlertService.getAllForPerson(person, sAndP); SspUser currentUser = securityService.currentUser(); List<EarlyAlertTO> earlyAlertTOs = earlyAlertTOFactory.asTOList(earlyAlerts.getRows()); PagingWrapper<JournalEntry> journalEntries = journalEntryService.getAllForPerson(person, currentUser, sAndP); List<JournalEntryTO> journalEntriesTOs = journalEntryTOFactory.asTOList(journalEntries.getRows()); PagingWrapper<Task> actions = taskService.getAllForPerson(person, currentUser, sAndP); List<TaskTO> actionsTOs = taskTOFactory.asTOList(actions.getRows()); PagingWrapper<Plan> plans = planService.getAllForStudent( SortingAndPaging.createForSingleSortWithPaging( ObjectStatus.ALL, 0, 1000, null, null, null), id); List<PlanTO> planTOs = planTOFactory.asTOList(plans.getRows()); for (EarlyAlertTO earlyAlert : earlyAlertTOs) { if (earlyAlert.getClosedDate() != null) { recentActivities.add( new RecentActivityTO( earlyAlert.getClosedById(), earlyAlert.getClosedByName(), "Early Alert Closed", earlyAlert.getClosedDate())); } else { recentActivities.add( new RecentActivityTO( earlyAlert.getCreatedBy().getId(), getPersonLiteName(earlyAlert.getCreatedBy()), "Early Alert Created", earlyAlert.getCreatedDate())); } } for (JournalEntryTO journalEntry : journalEntriesTOs) { recentActivities.add( new RecentActivityTO( journalEntry.getCreatedBy().getId(), getPersonLiteName(journalEntry.getCreatedBy()), "Journal Entry", journalEntry.getEntryDate())); } for (TaskTO action : actionsTOs) { if (action.isCompleted()) { recentActivities.add( new RecentActivityTO( action.getModifiedBy().getId(), getPersonLiteName(action.getModifiedBy()), "Action Plan Task Created", action.getCompletedDate())); } else { recentActivities.add( new RecentActivityTO( action.getCreatedBy().getId(), getPersonLiteName(action.getCreatedBy()), "Action Plan Task Created", action.getCreatedDate())); } } for (PlanTO planTO : planTOs) { Date testDate = DateUtils.addDays(planTO.getCreatedDate(), 1); String planName = planTO.getName(); if (planTO.getModifiedDate().before(testDate)) { recentActivities.add( new RecentActivityTO( planTO.getCreatedBy().getId(), getPersonLiteName(planTO.getCreatedBy()), "Map Plan (" + planName + ") Created", planTO.getModifiedDate())); } else { recentActivities.add( new RecentActivityTO( planTO.getModifiedBy().getId(), getPersonLiteName(planTO.getModifiedBy()), "Map Plan (" + planName + ") Updated", planTO.getModifiedDate())); } } if (person.getStudentIntakeCompleteDate() != null) { recentActivities.add( new RecentActivityTO( person.getCoach().getId(), person.getCoach().getFullName(), "Student Intake Completed", person.getStudentIntakeCompleteDate())); } if (person.getStudentIntakeRequestDate() != null) { recentActivities.add( new RecentActivityTO( person.getCoach().getId(), person.getCoach().getFullName(), "Student Intake Requested", person.getStudentIntakeRequestDate())); } Collections.sort(recentActivities, RecentActivityTO.RECENT_ACTIVITY_TO_DATE_COMPARATOR); return recentActivities; }