diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java index 069a8553b7..921bf7167b 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java @@ -147,6 +147,7 @@ public MainResponseDTO getAppointmentDetails(String preR } private void userValidation(String applicationId) { + this.applicationIdValidation(applicationId); String authUserId = authUserDetails().getUserId(); List list = listAuth(authUserDetails().getAuthorities()); if (list.contains("ROLE_INDIVIDUAL")) { @@ -155,7 +156,7 @@ private void userValidation(String applicationId) { + " and userID " + authUserId); ApplicationEntity applicationEntity = null; try { - applicationEntity = applicationRepostiory.findByApplicationId(applicationId); + applicationEntity = applicationRepostiory.findById(applicationId).orElseThrow(); } catch (Exception ex) { log.error(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID, "Invaid applicationId/Not Record Found for the ID : " + applicationId); @@ -169,6 +170,15 @@ private void userValidation(String applicationId) { } } + private void applicationIdValidation(String applicationId) { + if (applicationId == null || applicationId.trim().isEmpty()) { + throw new AppointmentExecption( + ApplicationErrorCodes.PRG_APP_013.getCode(), + "preRegistrationId cannot be empty." + ); + } + } + /** * This method is used to get the list of authorization role *