Skip to content

Commit

Permalink
Merge pull request #9 from JanardhanBS-SyncByte/develop-java21_backup
Browse files Browse the repository at this point in the history
Fixed circular dependency
  • Loading branch information
aihamh authored Jun 12, 2024
2 parents 22b0423 + eb1329f commit 7eb8a32
Show file tree
Hide file tree
Showing 25 changed files with 612 additions and 484 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public class PreRegistrationApplication {
public static void main(String[] args) {
SpringApplication.run(PreRegistrationApplication.class, args);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
import io.mosip.preregistration.application.service.LoginService;
import io.mosip.preregistration.core.config.LoggerConfiguration;

import static io.mosip.preregistration.application.constant.PreRegLoginConstant.LOGGER_SESSIONID;
import static io.mosip.preregistration.application.constant.PreRegLoginConstant.LOGGER_IDTYPE;
import static io.mosip.preregistration.application.constant.PreRegLoginConstant.LOGGER_ID;

@Configuration
public class ApplicationEventListerner {

Expand All @@ -27,15 +31,14 @@ public class ApplicationEventListerner {

@EventListener(ApplicationStartedEvent.class)
public void applicationStartedEvent() {
log.info("sessionId", "idType", "id", "In applicationStartedEvent method of ApplicationEventListerner");
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID, "In applicationStartedEvent method of ApplicationEventListerner");
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In applicationStartedEvent method of ApplicationEventListerner login service setupLoginService method called");
demographicService.setup();
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In applicationStartedEvent method of ApplicationEventListerner demographic Service setup() method is called");
documentService.setup();
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In applicationStartedEvent method of ApplicationEventListerner documentService setup() method is called");
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package io.mosip.preregistration.application.constant;

public class PreRegLoginConstant {
private PreRegLoginConstant() {
throw new IllegalStateException("PreRegLoginConstant class");
}

public static final String LOGGER_SESSIONID = "PRE-REGISTRATION";
public static final String LOGGER_IDTYPE = "APPLICATION SERVICE";
public static final String LOGGER_ID = "";

public static final String OTP_SMS_TEMPLATE = "pre.reg.login.otp.sms.template";
public static final String OTP_SUBJECT_TEMPLATE = "pre.reg.login.otp.mail.subject.template";
public static final String OTP_CONTENT_TEMPLATE = "pre.reg.login.otp.mail.content.template";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;

import static io.mosip.preregistration.application.constant.PreRegLoginConstant.LOGGER_SESSIONID;
import static io.mosip.preregistration.application.constant.PreRegLoginConstant.LOGGER_IDTYPE;
import static io.mosip.preregistration.application.constant.PreRegLoginConstant.LOGGER_ID;

/**
* This class provides different API's to perform operations on
* pre-registration.
Expand Down Expand Up @@ -115,7 +119,7 @@ public void initBinder(WebDataBinder binder) {
public ResponseEntity<MainResponseDTO<DemographicCreateResponseDTO>> addPreRegDemographicData(
@Validated @RequestBody(required = true) MainRequestDTO<DemographicRequestDTO> jsonObject,
@ApiParam(hidden = true) Errors errors) {
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In pre-registration controller for add preregistration with json object" + jsonObject);
requestValidator.validateId(CREATE, jsonObject.getId(), errors);
DataValidationUtil.validate(errors, CREATE);
Expand Down Expand Up @@ -145,7 +149,7 @@ public ResponseEntity<MainResponseDTO<DemographicUpdateResponseDTO>> updatePreRe
@Validated @RequestBody(required = true) MainRequestDTO<DemographicRequestDTO> jsonObject,
@ApiParam(hidden = true) Errors errors) {
String userId = preRegistrationService.authUserDetails().getUserId();
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In pre-registration controller for Update preregistration with json object" + jsonObject);
requestValidator.validateId(UPDATE, jsonObject.getId(), errors);
DataValidationUtil.validate(errors, UPDATE);
Expand All @@ -170,7 +174,7 @@ public ResponseEntity<MainResponseDTO<DemographicUpdateResponseDTO>> updatePreRe
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) })
public ResponseEntity<MainResponseDTO<DemographicResponseDTO>> getPreRegDemographicData(
@PathVariable("preRegistrationId") String preRegistraionId) {
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In pre-registration controller for fetching all demographic data with preregistrationId"
+ preRegistraionId);
return ResponseEntity.status(HttpStatus.OK).body(preRegistrationService.getDemographicData(preRegistraionId));
Expand Down Expand Up @@ -198,7 +202,7 @@ public ResponseEntity<MainResponseDTO<String>> updatePreRegApplicationStatus(
@PathVariable("preRegistrationId") String preRegId,
@RequestParam(value = "statusCode", required = true) String status) {
String userId = preRegistrationService.authUserDetails().getUserId();
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In pre-registration controller for fetching all demographic data with preRegId " + preRegId
+ " and status " + status);
return ResponseEntity.status(HttpStatus.OK)
Expand All @@ -225,7 +229,7 @@ public ResponseEntity<MainResponseDTO<String>> updatePreRegApplicationStatus(
public ResponseEntity<MainResponseDTO<DemographicMetadataDTO>> getAllPreRegApplications(HttpServletRequest res,
@RequestParam(value = "pageIndex", required = false) String pageIdx) {
String userId = preRegistrationService.authUserDetails().getUserId();
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In pre-registration controller for fetching all applications with userId ");
return ResponseEntity.status(HttpStatus.OK)
.body(preRegistrationService.getAllApplicationDetails(userId, pageIdx));
Expand All @@ -250,7 +254,7 @@ public ResponseEntity<MainResponseDTO<DemographicMetadataDTO>> getAllPreRegAppli
public ResponseEntity<MainResponseDTO<PreRegistartionStatusDTO>> getPreRegApplicationStatus(
@PathVariable("preRegistrationId") String preId) {
String userId = preRegistrationService.authUserDetails().getUserId();
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In pre-registration controller for fetching all applicationStatus with preId " + preId);
return ResponseEntity.status(HttpStatus.OK).body(preRegistrationService.getApplicationStatus(preId, userId));
}
Expand All @@ -274,7 +278,7 @@ public ResponseEntity<MainResponseDTO<PreRegistartionStatusDTO>> getPreRegApplic
public ResponseEntity<MainResponseDTO<DeletePreRegistartionDTO>> deletePreRegApplication(
@PathVariable("preRegistrationId") String preId) {
String userId = preRegistrationService.authUserDetails().getUserId();
log.info("sessionId", "idType", "id",
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
"In pre-registration controller for deletion of individual with preId " + preId);

return ResponseEntity.status(HttpStatus.OK).body(preRegistrationService.deleteIndividual(preId, userId));
Expand Down Expand Up @@ -309,9 +313,8 @@ public ResponseEntity<MainResponseDTO<Map<String, String>>> getUpdatedDateTimeBy
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) })
public ResponseEntity<MainResponseDTO<?>> getPreRegDemographicAndDocumentData(
@PathVariable("preregistrationId") String preregistrationId) {
log.info("In demographic controller to getFullPreRegApplication {}", preregistrationId);
log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID, "In demographic controller to getFullPreRegApplication " + preregistrationId);
return ResponseEntity.status(HttpStatus.OK)
.body(preRegistrationService.getPregistrationInfo(preregistrationId));
}

}
Loading

0 comments on commit 7eb8a32

Please sign in to comment.