@PreAuthorize("hasRole('ROLE_PERSON_CASELOAD_READ') and hasRole('ROLE_BULK_SEARCH_EXPORT')")
  @RequestMapping(value = "/caseload", method = RequestMethod.GET)
  public @ResponseBody void myCaseload(
      HttpServletResponse response,
      final @RequestParam(required = false) UUID programStatusId,
      final @RequestParam(required = false) ObjectStatus status,
      final @RequestParam(required = false) Integer start,
      final @RequestParam(required = false) Integer limit,
      final @RequestParam(required = false) String sort,
      final @RequestParam(required = false) String sortDirection)
      throws ObjectNotFoundException, ValidationException, IOException {

    ProgramStatus programStatus = null;
    if (null != programStatusId) {
      programStatus = programStatusService.get(programStatusId);
    }

    response.setHeader("Content-Disposition", "attachment; filename=" + buildFileName("caseload_"));
    response.setContentType("text/csv");

    CaseloadCsvWriterHelper csvWriterHelper = new CaseloadCsvWriterHelper(response.getWriter());
    service.exportableCaseLoadFor(
        csvWriterHelper,
        programStatus,
        securityService.currentUser().getPerson(),
        buildSortAndPage(limit, start, sort, sortDirection));
  }
  @PreAuthorize("hasRole('ROLE_PERSON_SEARCH_READ') and hasRole('ROLE_CUSTOM_BULK_SEARCH_EXPORT')")
  @RequestMapping(value = "/customizableSearch", method = RequestMethod.GET)
  public @ResponseBody void customizableSearch(
      HttpServletResponse response,
      final @RequestParam(required = false) String schoolId,
      final @RequestParam(required = false) String firstName,
      final @RequestParam(required = false) String lastName,
      final @RequestParam(required = false) String programStatus,
      final @RequestParam(required = false) String coachId,
      final @RequestParam(required = false) String declaredMajor,
      final @RequestParam(required = false) BigDecimal hoursEarnedMin,
      final @RequestParam(required = false) BigDecimal hoursEarnedMax,
      final @RequestParam(required = false) BigDecimal gpaEarnedMin,
      final @RequestParam(required = false) BigDecimal gpaEarnedMax,
      final @RequestParam(required = false) BigDecimal localGpaMin,
      final @RequestParam(required = false) BigDecimal localGpaMax,
      final @RequestParam(required = false) BigDecimal programGpaMin,
      final @RequestParam(required = false) BigDecimal programGpaMax,
      final @RequestParam(required = false) Boolean currentlyRegistered,
      final @RequestParam(required = false) String earlyAlertResponseLate,
      final @RequestParam(required = false) String sapStatusCode,
      final @RequestParam(required = false) String specialServiceGroup,
      final @RequestParam(required = false) String planStatus,
      final @RequestParam(required = false) String planExists,
      final @RequestParam(required = false) Boolean myCaseload,
      final @RequestParam(required = false) Boolean myPlans,
      final @RequestParam(required = false) Boolean myWatchList,
      final @RequestParam(required = false) @DateTimeFormat(
              pattern = DateOnlyFormatting.DEFAULT_DATE_PATTERN) Date birthDate,
      final @RequestParam(required = false) String actualStartTerm,
      final @RequestParam(required = false) String personTableType,
      final @RequestParam(required = false) Integer start,
      final @RequestParam(required = false) Integer limit,
      final @RequestParam(required = false) String sort,
      final @RequestParam(required = false) String sortDirection,
      final @RequestParam(required = false) List customOptions,
      final HttpServletRequest request)
      throws ObjectNotFoundException, IOException {

    response.setHeader(
        "Content-Disposition", "attachment; filename=" + buildFileName("customsearch_"));
    response.setContentType("text/csv");

    SortingAndPaging sortAndPage = buildSortAndPage(limit, start, sort, sortDirection);
    PersonSearchRequest form =
        personSearchRequestFactory.from(
            schoolId,
            firstName,
            lastName,
            programStatus,
            specialServiceGroup,
            coachId,
            declaredMajor,
            hoursEarnedMin,
            hoursEarnedMax,
            gpaEarnedMin,
            gpaEarnedMax,
            localGpaMin,
            localGpaMax,
            programGpaMin,
            programGpaMax,
            currentlyRegistered,
            earlyAlertResponseLate,
            sapStatusCode,
            planStatus,
            planExists,
            myCaseload,
            myPlans,
            myWatchList,
            birthDate,
            actualStartTerm,
            personTableType,
            sortAndPage);

    service.exportDirectoryPersonSearchCustomizable(
        response.getWriter(), form, cleanCustomOptionsAndMapToMaster(customOptions));
  }