diff --git a/health-services/referralmanagement/src/main/java/org/egov/referralmanagement/Constants.java b/health-services/referralmanagement/src/main/java/org/egov/referralmanagement/Constants.java index a2d9a0dad47..7bd29b61cc1 100644 --- a/health-services/referralmanagement/src/main/java/org/egov/referralmanagement/Constants.java +++ b/health-services/referralmanagement/src/main/java/org/egov/referralmanagement/Constants.java @@ -12,4 +12,6 @@ public interface Constants { String GET_ID = "getId"; String STAFF = "STAFF"; String FACILITY = "FACILITY"; + + String INVALID_RECIPIENT_TYPE = "Invalid Recipient Type"; } diff --git a/health-services/referralmanagement/src/main/java/org/egov/referralmanagement/validator/RmRecipientIdValidator.java b/health-services/referralmanagement/src/main/java/org/egov/referralmanagement/validator/RmRecipientIdValidator.java index 26d6094fcfd..c853663a974 100644 --- a/health-services/referralmanagement/src/main/java/org/egov/referralmanagement/validator/RmRecipientIdValidator.java +++ b/health-services/referralmanagement/src/main/java/org/egov/referralmanagement/validator/RmRecipientIdValidator.java @@ -10,6 +10,7 @@ import org.egov.common.validator.Validator; import org.egov.referralmanagement.service.FacilityService; import org.egov.referralmanagement.util.ValidatorUtil; +import org.egov.tracer.model.CustomException; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -24,6 +25,7 @@ import static org.egov.common.utils.CommonUtils.populateErrorDetails; import static org.egov.common.utils.ValidatorUtils.getErrorForNonExistentEntity; import static org.egov.referralmanagement.Constants.FACILITY; +import static org.egov.referralmanagement.Constants.INVALID_RECIPIENT_TYPE; import static org.egov.referralmanagement.Constants.STAFF; /** @@ -63,6 +65,9 @@ public Map> validate(ReferralBulkRequest request) { break; case FACILITY: addIgnoreNull(facilityIdList, referral.getRecipientId()); + break; + default: + throw new CustomException(INVALID_RECIPIENT_TYPE, "Exception : The Recipient Type is invalid."); } });