Commit 05bb994c authored by Pratik Shrivastava's avatar Pratik Shrivastava

feat: add method to validate form data fields

parent 11a162fa
......@@ -280,5 +280,38 @@ public class AdmissionFormDAOController {
workbook.write(out);
return out.toByteArray();
}
public void validateAdmissionFormDataForAdminSubmit(AdmissionFormData formData) {
if (formData.getSchool() == null || formData.getSchool().isEmpty()) {
throw new IllegalArgumentException("School is missing");
}
if (formData.getCategory() == null || formData.getCategory().isEmpty()) {
throw new IllegalArgumentException("Category is missing");
}
if (formData.getFullName() == null || formData.getFullName().isEmpty()) {
throw new IllegalArgumentException("Full Name is missing");
}
if (formData.getAdmissionClass() == null || formData.getAdmissionClass().isEmpty()) {
throw new IllegalArgumentException("Admission Class is missing");
}
if (formData.getDateOfBirth() == null || formData.getDateOfBirth().isEmpty()) {
throw new IllegalArgumentException("Date of Birth is missing");
}
if (formData.getFatherName() == null || formData.getFatherName().isEmpty()) {
throw new IllegalArgumentException("Father's Name is missing");
}
if (formData.getFatherEmail() == null || formData.getFatherEmail().isEmpty()) {
throw new IllegalArgumentException("Father's Email is missing");
}
if (formData.getFatherMobile() == null || formData.getFatherMobile().isEmpty()) {
throw new IllegalArgumentException("Father's Mobile is missing");
}
if (formData.getCorrespondenceAddress() == null || formData.getCorrespondenceAddress().isEmpty()) {
throw new IllegalArgumentException("Correspondence Address is missing");
}
if (formData.getHomeAddress() == null || formData.getHomeAddress().isEmpty()) {
throw new IllegalArgumentException("Home Address is missing");
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment