applicant-facing-gdo/src/main/java/com/girlsdayout/applicationform/controller/MainController.java
@PostMapping(path= "waiver/{id}/submit")
    public String multiUpload(@RequestParam("boschWaiver") MultipartFile boschWaiver, @RequestParam("consentWaiver") MultipartFile consentWaiver,
                              @RequestParam("cofcWaiver") MultipartFile cofcWaiver, @PathVariable("id") String id) throws IOException, MessagingException {
        //recordID = id passed in the path from post request
        String recordId = id;

        //file path of desired directory where waivers will be uploaded
        String filePath = "/Users/MatthewHunt/Documents/Trident Technical College/Spring 2020/Senior Capstone/WaiverFiles/";

        //gets applicant object that matches the record ID
        Optional<Applicant> applicant = applicantRepository.findByRecordId(recordId);
        Applicant a = applicant.get();

        //getting the file types of each file and assigning to string variables
        String boschType = boschWaiver.getContentType();
        String consentType = consentWaiver.getContentType();
        String cofcType = cofcWaiver.getContentType();

        //if all three files match an accepted file type, continue with uploading the waiver
        if ((boschType.equals("image/jpeg") || boschType.equals("image/png") || boschType.equals("image/jpg") || boschType.equals("image/svg") || boschType.equals("application/pdf"))
                & (consentType.equals("image/jpeg") || consentType.equals("image/png") || consentType.equals("image/jpg") || consentType.equals("image/svg") || consentType.equals("application/pdf"))
                & (cofcType.equals("image/jpeg") || cofcType.equals("image/png") || cofcType.equals("image/jpg") || cofcType.equals("image/svg") || cofcType.equals("application/pdf")))
        {
            //upload waiver through waiverService
            waiverService.uploadWaiver(boschWaiver, filePath , a.getRecordId(), "-BoschWaiver");
            waiverService.uploadWaiver(consentWaiver, filePath , a.getRecordId(), "-ConsentWaiver");
            waiverService.uploadWaiver(cofcWaiver, filePath , a.getRecordId(), "-CofCWaiver");

            //change app_status to Pending and inserts the file paths of the uploaded waivers to the waiver table
            a.setWaiverStatus("Submitted");
            a.setBoschWaiver(filePath + a.getRecordId() + "-BoschWaiver");
            a.setConsentWaiver(filePath + a.getRecordId() + "-ConsentWaiver");
            a.setCofcWaiver(filePath + a.getRecordId() + "-CofCWaiver");

            //sends an e-mail to the approvers that waivers were uploaded
            notificationService.emailApprovers(adminRepository.findAll(), "Waiver", a);

            //saves the changes to the applicant object
            applicantRepository.save(a);

            //returns the submitted waiver page
            return "waiversubmit.html";
        }
        /*
         * ELSE - somehow an unaccepted file type was submitted by user.
         * Not uploaded or inserted to DB. Waiver error page returned.
         */
        else{
            return "waivererror.html";
        }
    }
/*
     * method that uploads the waivers to the desired directory on the server. Method also saves path files of
     * saved waivers to the database. Also checks the content type of files uploaded, verifying that they are pdf
     * or image file. If waiver upload is successful, e-mail will be sent to approvers that new waivers were uploaded.
     */
method that uploads the waivers to the desired directory on the server. Method also saves path files of
saved waivers to the database. Also checks the content type of files uploaded, verifying that they are pdf
or image file. If waiver upload is successful, e-mail will be sent to approvers that new waivers were uploaded.
method that uploads the waivers to the desired directory on the server . Method also saves path files of saved waivers to the database . Also checks the content type of files uploaded verifying that they are pdf or image file . If waiver upload is successful e - mail will be sent to approvers that new waivers were uploaded .
@PostMapping(path= "waiver/{id}/submit")
    public String multiUpload(@RequestParam("boschWaiver") MultipartFile boschWaiver, @RequestParam("consentWaiver") MultipartFile consentWaiver,
                              @RequestParam("cofcWaiver") MultipartFile cofcWaiver, @PathVariable("id") String id) throws IOException, MessagingException {
        String recordId = id;
        String filePath = "/Users/MatthewHunt/Documents/Trident Technical College/Spring 2020/Senior Capstone/WaiverFiles/";
        Optional<Applicant> applicant = applicantRepository.findByRecordId(recordId);
        Applicant a = applicant.get();
        String boschType = boschWaiver.getContentType();
        String consentType = consentWaiver.getContentType();
        String cofcType = cofcWaiver.getContentType();
        if ((boschType.equals("image/jpeg") || boschType.equals("image/png") || boschType.equals("image/jpg") || boschType.equals("image/svg") || boschType.equals("application/pdf"))
                & (consentType.equals("image/jpeg") || consentType.equals("image/png") || consentType.equals("image/jpg") || consentType.equals("image/svg") || consentType.equals("application/pdf"))
                & (cofcType.equals("image/jpeg") || cofcType.equals("image/png") || cofcType.equals("image/jpg") || cofcType.equals("image/svg") || cofcType.equals("application/pdf")))
        {
            waiverService.uploadWaiver(boschWaiver, filePath , a.getRecordId(), "-BoschWaiver");
            waiverService.uploadWaiver(consentWaiver, filePath , a.getRecordId(), "-ConsentWaiver");
            waiverService.uploadWaiver(cofcWaiver, filePath , a.getRecordId(), "-CofCWaiver");
            a.setWaiverStatus("Submitted");
            a.setBoschWaiver(filePath + a.getRecordId() + "-BoschWaiver");
            a.setConsentWaiver(filePath + a.getRecordId() + "-ConsentWaiver");
            a.setCofcWaiver(filePath + a.getRecordId() + "-CofCWaiver");
            notificationService.emailApprovers(adminRepository.findAll(), "Waiver", a);
            applicantRepository.save(a);
            return "waiversubmit.html";
        }
        /*
         * ELSE - somehow an unaccepted file type was submitted by user.
         * Not uploaded or inserted to DB. Waiver error page returned.
         */
        else{
            return "waivererror.html";
        }
    }
@ PostMapping ( path = "waiver/{id}/submit" ) public String multiUpload ( @ RequestParam ( "boschWaiver" ) MultipartFile boschWaiver , @ RequestParam ( "consentWaiver" ) MultipartFile consentWaiver , @ RequestParam ( "cofcWaiver" ) MultipartFile cofcWaiver , @ PathVariable ( "id" ) String id ) throws IOException , MessagingException { String recordId = id ; String filePath = "/Users/MatthewHunt/Documents/Trident Technical College/Spring 2020/Senior Capstone/WaiverFiles/" ; Optional < Applicant > applicant = applicantRepository . findByRecordId ( recordId ) ; Applicant a = applicant . get ( ) ; String boschType = boschWaiver . getContentType ( ) ; String consentType = consentWaiver . getContentType ( ) ; String cofcType = cofcWaiver . getContentType ( ) ; if ( ( boschType . equals ( "image/jpeg" ) || boschType . equals ( "image/png" ) || boschType . equals ( "image/jpg" ) || boschType . equals ( "image/svg" ) || boschType . equals ( "application/pdf" ) ) & ( consentType . equals ( "image/jpeg" ) || consentType . equals ( "image/png" ) || consentType . equals ( "image/jpg" ) || consentType . equals ( "image/svg" ) || consentType . equals ( "application/pdf" ) ) & ( cofcType . equals ( "image/jpeg" ) || cofcType . equals ( "image/png" ) || cofcType . equals ( "image/jpg" ) || cofcType . equals ( "image/svg" ) || cofcType . equals ( "application/pdf" ) ) ) { waiverService . uploadWaiver ( boschWaiver , filePath , a . getRecordId ( ) , "-BoschWaiver" ) ; waiverService . uploadWaiver ( consentWaiver , filePath , a . getRecordId ( ) , "-ConsentWaiver" ) ; waiverService . uploadWaiver ( cofcWaiver , filePath , a . getRecordId ( ) , "-CofCWaiver" ) ; a . setWaiverStatus ( "Submitted" ) ; a . setBoschWaiver ( filePath + a . getRecordId ( ) + "-BoschWaiver" ) ; a . setConsentWaiver ( filePath + a . getRecordId ( ) + "-ConsentWaiver" ) ; a . setCofcWaiver ( filePath + a . getRecordId ( ) + "-CofCWaiver" ) ; notificationService . emailApprovers ( adminRepository . findAll ( ) , "Waiver" , a ) ; applicantRepository . save ( a ) ; return "waiversubmit.html" ; } /*
         * ELSE - somehow an unaccepted file type was submitted by user.
         * Not uploaded or inserted to DB. Waiver error page returned.
         */ else { return "waivererror.html" ; } }
method that uploads the waivers to the desired directory on the server.
method that uploads the waivers to the desired directory on the server .
//recordID = id passed in the path from post request //file path of desired directory where waivers will be uploaded //gets applicant object that matches the record ID //getting the file types of each file and assigning to string variables //if all three files match an accepted file type, continue with uploading the waiver //upload waiver through waiverService //change app_status to Pending and inserts the file paths of the uploaded waivers to the waiver table //sends an e-mail to the approvers that waivers were uploaded //saves the changes to the applicant object //returns the submitted waiver page