public void validateDOB(String dateOfBirth, DateTime createdAt) { if (StringUtils.isNotEmpty(dateOfBirth)) { if (!ValidationUtils.assertDateFormat(dateOfBirth)) { errors.add("Invalid date of birth %s", dateOfBirth); return; } if (!ValidationUtils.assertDateBefore(parseDateTime(dateOfBirth), createdAt)) errors.add("Invalid date of birth %s", dateOfBirth); } }
public void validateEDD(String expectedDateOfDelivery, DateTime createdAt) { if (StringUtils.isNotEmpty(expectedDateOfDelivery)) { if (!ValidationUtils.assertDateFormat(expectedDateOfDelivery)) { errors.add("Invalid expected date of delivery %s", expectedDateOfDelivery); return; } if (!ValidationUtils.assertDateBefore(createdAt, parseDateTime(expectedDateOfDelivery))) errors.add("Invalid expected date of delivery %s", expectedDateOfDelivery); } }
public void validateWeekNumber(String week) { if (StringUtils.isNotEmpty(week)) { if (!ValidationUtils.assertNumeric(week)) { errors.add("Invalid week number %s", week); } } }
public void validateExactlyOneOfEDDOrDOBIsPresent(String... args) { if (!ValidationUtils.assertExactlyOnePresent(args)) errors.add( "Invalid request. One of expected date of delivery or date of birth should be present"); }
public void validateOnlyOneOfEDDOrDOBOrWeekNumberPresent(String... args) { if (!ValidationUtils.assertNotMoreThanOnePresent(args)) errors.add( "Invalid request. Only one of expected date of delivery, date of birth and week number should be present"); }
public void validateName(String name) { if (addErrorMessageIfEmpty(name, "Missing Name")) return; if (!ValidationUtils.assertAlphanumericWithDot(name)) errors.add("Name is Invalid"); }
public void validateAge(String beneficiaryAge) { if (addErrorMessageIfEmpty(beneficiaryAge, "Missing beneficiary age")) return; if (!ValidationUtils.assertNumeric(beneficiaryAge)) errors.add("Invalid beneficiary age %s", beneficiaryAge); }