applicant-facing/src/main/java/com/girlsdayout/applicationform/MainController.java
@PostMapping(path="application/submit")
    public String addNewApplicant (@RequestParam String lName, @RequestParam String fName,
                                        @RequestParam String address, @RequestParam String city,
                                        @RequestParam String state, @RequestParam String zipCode,
                                        @RequestParam String phoneNumber, @RequestParam String dateOfBirth,
                                        @RequestParam String ethnicity,
                                        @RequestParam String allergies, @RequestParam String medications,
                                        @RequestParam String parentsCollege, @RequestParam String militaryRelatives,
                                        @RequestParam String fallSchool, @RequestParam String risingGradeLevel,
                                        @RequestParam String collegeOfInterest, @RequestParam String shirtSize,
                                        @RequestParam String parentFName, @RequestParam String parentLName,
                                        @RequestParam String parentEMail, @RequestParam String parentAddress,
                                        @RequestParam String parentCity, @RequestParam String parentState,
                                        @RequestParam String parentZipCode, @RequestParam String parentMobilePhone,
                                        @RequestParam String parentWorkPhone,
                                        @RequestParam String otherParentFName, @RequestParam String otherParentLName,
                                        @RequestParam String contactName, @RequestParam String relationship,
                                        @RequestParam String contactAddress, @RequestParam String contactCity,
                                        @RequestParam String contactState, @RequestParam String contactZipCode,
                                        @RequestParam String contactMobilePhone, @RequestParam String contactWorkPhone) {

        //creates new applicant object
        Applicant a = new Applicant();

        //setting all of the applicant's variables
        a.setfName(fName);
        a.setlName(lName);
        a.setAddress(address);
        a.setCity(city);
        a.setState(state);
        a.setZipCode(zipCode);
        a.setPhoneNumber(phoneNumber);
        a.setDateOfBirth(dateOfBirth);
        a.setAge();
        a.setEthnicity(ethnicity);
        a.setAllergies(allergies);
        a.setMedications(medications);
        a.setParentsCollege(parentsCollege);
        a.setMilitaryRelatives(militaryRelatives);
        a.setFallSchool(fallSchool);
        a.setRisingGradeLevel(risingGradeLevel);
        a.setCollegeOfInterest(collegeOfInterest);
        a.setShirtSize(shirtSize);
        a.setRecordId();
        a.setWaiverStatus();
        a.setAppStatus();

        //setting all the parent's variables
        a.setParentFName(parentFName);
        a.setParentLName(parentLName);
        a.setParentEMail(parentEMail);
        a.setParentAddress(parentAddress);
        a.setParentCity(parentCity);
        a.setParentState(parentState);
        a.setParentZipCode(parentZipCode);
        a.setParentMobilePhone(parentMobilePhone);
        a.setParentWorkPhone(parentWorkPhone);
        a.setOtherParentFName(otherParentFName);
        a.setOtherParentLName(otherParentLName);

        //setting all the emergency contact variables
        a.setContactName(contactName);
        a.setRelationship(relationship);
        a.setContactAddress(contactAddress);
        a.setContactCity(contactCity);
        a.setContactState(contactState);
        a.setContactZipCode(contactZipCode);
        a.setContactMobilePhone(contactMobilePhone);
        a.setContactWorkPhone(contactWorkPhone);

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

        //try-catch that sends confirmation e-mail to applicant after application data is sent to the db
        try {
            notificationService.sendNotification(a);
        }catch(MessagingException e){
            logger.info("error sending: " + e.getMessage());
            return "There was an error sending the confirmation e-mail";
        }

        //the return statement redirects to the application/submit/recordID page.
        return "redirect:/application/submit/" + a.getRecordId();

    }
//method that gets all information from user input and saves it to the database
method that gets all information from user input and saves it to the database
method that gets all information from user input and saves it to the database
@PostMapping(path="application/submit")
    public String addNewApplicant (@RequestParam String lName, @RequestParam String fName,
                                        @RequestParam String address, @RequestParam String city,
                                        @RequestParam String state, @RequestParam String zipCode,
                                        @RequestParam String phoneNumber, @RequestParam String dateOfBirth,
                                        @RequestParam String ethnicity,
                                        @RequestParam String allergies, @RequestParam String medications,
                                        @RequestParam String parentsCollege, @RequestParam String militaryRelatives,
                                        @RequestParam String fallSchool, @RequestParam String risingGradeLevel,
                                        @RequestParam String collegeOfInterest, @RequestParam String shirtSize,
                                        @RequestParam String parentFName, @RequestParam String parentLName,
                                        @RequestParam String parentEMail, @RequestParam String parentAddress,
                                        @RequestParam String parentCity, @RequestParam String parentState,
                                        @RequestParam String parentZipCode, @RequestParam String parentMobilePhone,
                                        @RequestParam String parentWorkPhone,
                                        @RequestParam String otherParentFName, @RequestParam String otherParentLName,
                                        @RequestParam String contactName, @RequestParam String relationship,
                                        @RequestParam String contactAddress, @RequestParam String contactCity,
                                        @RequestParam String contactState, @RequestParam String contactZipCode,
                                        @RequestParam String contactMobilePhone, @RequestParam String contactWorkPhone) {
        Applicant a = new Applicant();
        a.setfName(fName);
        a.setlName(lName);
        a.setAddress(address);
        a.setCity(city);
        a.setState(state);
        a.setZipCode(zipCode);
        a.setPhoneNumber(phoneNumber);
        a.setDateOfBirth(dateOfBirth);
        a.setAge();
        a.setEthnicity(ethnicity);
        a.setAllergies(allergies);
        a.setMedications(medications);
        a.setParentsCollege(parentsCollege);
        a.setMilitaryRelatives(militaryRelatives);
        a.setFallSchool(fallSchool);
        a.setRisingGradeLevel(risingGradeLevel);
        a.setCollegeOfInterest(collegeOfInterest);
        a.setShirtSize(shirtSize);
        a.setRecordId();
        a.setWaiverStatus();
        a.setAppStatus();
        a.setParentFName(parentFName);
        a.setParentLName(parentLName);
        a.setParentEMail(parentEMail);
        a.setParentAddress(parentAddress);
        a.setParentCity(parentCity);
        a.setParentState(parentState);
        a.setParentZipCode(parentZipCode);
        a.setParentMobilePhone(parentMobilePhone);
        a.setParentWorkPhone(parentWorkPhone);
        a.setOtherParentFName(otherParentFName);
        a.setOtherParentLName(otherParentLName);
        a.setContactName(contactName);
        a.setRelationship(relationship);
        a.setContactAddress(contactAddress);
        a.setContactCity(contactCity);
        a.setContactState(contactState);
        a.setContactZipCode(contactZipCode);
        a.setContactMobilePhone(contactMobilePhone);
        a.setContactWorkPhone(contactWorkPhone);
        applicantRepository.save(a);
        try {
            notificationService.sendNotification(a);
        }catch(MessagingException e){
            logger.info("error sending: " + e.getMessage());
            return "There was an error sending the confirmation e-mail";
        }
        return "redirect:/application/submit/" + a.getRecordId();
    }
@ PostMapping ( path = "application/submit" ) public String addNewApplicant ( @ RequestParam String lName , @ RequestParam String fName , @ RequestParam String address , @ RequestParam String city , @ RequestParam String state , @ RequestParam String zipCode , @ RequestParam String phoneNumber , @ RequestParam String dateOfBirth , @ RequestParam String ethnicity , @ RequestParam String allergies , @ RequestParam String medications , @ RequestParam String parentsCollege , @ RequestParam String militaryRelatives , @ RequestParam String fallSchool , @ RequestParam String risingGradeLevel , @ RequestParam String collegeOfInterest , @ RequestParam String shirtSize , @ RequestParam String parentFName , @ RequestParam String parentLName , @ RequestParam String parentEMail , @ RequestParam String parentAddress , @ RequestParam String parentCity , @ RequestParam String parentState , @ RequestParam String parentZipCode , @ RequestParam String parentMobilePhone , @ RequestParam String parentWorkPhone , @ RequestParam String otherParentFName , @ RequestParam String otherParentLName , @ RequestParam String contactName , @ RequestParam String relationship , @ RequestParam String contactAddress , @ RequestParam String contactCity , @ RequestParam String contactState , @ RequestParam String contactZipCode , @ RequestParam String contactMobilePhone , @ RequestParam String contactWorkPhone ) { Applicant a = new Applicant ( ) ; a . setfName ( fName ) ; a . setlName ( lName ) ; a . setAddress ( address ) ; a . setCity ( city ) ; a . setState ( state ) ; a . setZipCode ( zipCode ) ; a . setPhoneNumber ( phoneNumber ) ; a . setDateOfBirth ( dateOfBirth ) ; a . setAge ( ) ; a . setEthnicity ( ethnicity ) ; a . setAllergies ( allergies ) ; a . setMedications ( medications ) ; a . setParentsCollege ( parentsCollege ) ; a . setMilitaryRelatives ( militaryRelatives ) ; a . setFallSchool ( fallSchool ) ; a . setRisingGradeLevel ( risingGradeLevel ) ; a . setCollegeOfInterest ( collegeOfInterest ) ; a . setShirtSize ( shirtSize ) ; a . setRecordId ( ) ; a . setWaiverStatus ( ) ; a . setAppStatus ( ) ; a . setParentFName ( parentFName ) ; a . setParentLName ( parentLName ) ; a . setParentEMail ( parentEMail ) ; a . setParentAddress ( parentAddress ) ; a . setParentCity ( parentCity ) ; a . setParentState ( parentState ) ; a . setParentZipCode ( parentZipCode ) ; a . setParentMobilePhone ( parentMobilePhone ) ; a . setParentWorkPhone ( parentWorkPhone ) ; a . setOtherParentFName ( otherParentFName ) ; a . setOtherParentLName ( otherParentLName ) ; a . setContactName ( contactName ) ; a . setRelationship ( relationship ) ; a . setContactAddress ( contactAddress ) ; a . setContactCity ( contactCity ) ; a . setContactState ( contactState ) ; a . setContactZipCode ( contactZipCode ) ; a . setContactMobilePhone ( contactMobilePhone ) ; a . setContactWorkPhone ( contactWorkPhone ) ; applicantRepository . save ( a ) ; try { notificationService . sendNotification ( a ) ; } catch ( MessagingException e ) { logger . info ( "error sending: " + e . getMessage ( ) ) ; return "There was an error sending the confirmation e-mail" ; } return "redirect:/application/submit/" + a . getRecordId ( ) ; }
method that gets all information from user input and saves it to the database
method that gets all information from user input and saves it to the database
//creates new applicant object //setting all of the applicant's variables //setting all the parent's variables //setting all the emergency contact variables //saves the applicant object to the database //try-catch that sends confirmation e-mail to applicant after application data is sent to the db //the return statement redirects to the application/submit/recordID page.