From 7da8f0a64a177307b13d301690254ee6fb3ccca6 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Mon, 10 Jun 2024 17:36:05 +0530 Subject: [PATCH 1/2] [Java21] Signed-off-by: JanardhanBS-SyncByte --- pre-registration/pom.xml | 173 ++++++++++-------- .../pom.xml | 47 ++--- .../application/config/LoginConfig.java | 34 +--- .../controller/ApplicationController.java | 18 +- .../controller/AppointmentController.java | 84 ++++----- .../controller/DemographicController.java | 142 ++++++-------- .../controller/DocumentController.java | 113 ++++++------ .../controller/GenerateQRcodeController.java | 57 +++--- .../controller/LoginController.java | 99 +++++----- .../controller/LostUINController.java | 6 +- .../controller/NotificationController.java | 50 +++-- .../controller/ProxyMasterdataController.java | 37 ++-- .../controller/TransliterationController.java | 56 +++--- .../controller/UISpecificationController.java | 37 ++-- .../UpdateRegistrationController.java | 7 +- .../test/config/TestSecurityConfig.java | 1 - .../pre-registration-batchjob/pom.xml | 20 +- .../batchjob/audit/BatchjobConfig.java | 11 +- .../pre-registration-captcha-service/pom.xml | 33 ++-- .../captcha/config/SwaggerConfig.java | 53 ++---- .../captcha/controller/CaptchaController.java | 11 +- .../pre-registration-core/pom.xml | 48 +---- .../core/config/TemplateConfiguration.java | 2 +- .../pre-registration-datasync-service/pom.xml | 31 +--- .../datasync/config/DataSyncConfig.java | 48 ++--- .../datasync/DataSyncApplicationTest.java | 2 +- .../datasync/test/config/TestConfig.java | 22 +-- .../controller/DataSyncControllerTest.java | 10 +- .../test/service/DataSyncServiceTest.java | 5 +- .../service/util/DataSyncServiceUtilTest.java | 2 +- 30 files changed, 534 insertions(+), 725 deletions(-) diff --git a/pre-registration/pom.xml b/pre-registration/pom.xml index b8be5da89c9..5744cb99868 100644 --- a/pre-registration/pom.xml +++ b/pre-registration/pom.xml @@ -13,73 +13,36 @@ Parent project of MOSIP Pre-Registration https://github.com/mosip/pre-registration - - - MPL 2.0 - https://www.mozilla.org/en-US/MPL/2.0/ - - - - scm:git:git://github.com/mosip/pre-registration.git - scm:git:ssh://github.com:mosip/pre-registration.git - https://github.com/mosip/pre-registration - HEAD - - - - - Mosip - mosip.emailnotifier@gmail.com - io.mosip - https://github.com/mosip/pre-registration - - - - - - ossrh - CentralRepository - https://oss.sonatype.org/content/repositories/snapshots - default - - true - - - - central - MavenCentral - default - https://repo1.maven.org/maven2 - - false - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - 1.2.1-java21-SNAPSHOT - 1.2.1-java21-SNAPSHOT UTF-8 - 21 - 21 - 3.8.0 + UTF-8 + 21 + + + ${java.version} + ${java.version} + 3.11.0 + 3.0.2 + 3.1.0 + 3.2.0 + 2.3 + 0.8.11 + 3.1.1 + 3.3.1 + 3.2.3 3.0.2 3.1.0 - 2.22.0 - 0.8.11 + 3.3.0 + 3.1.2 + 3.2.5 + 1.6.7 3.7.0.1746 - 3.2.0 + + 3.0.1 + 0.2 + + + 2.5.0 5.0.4.RELEASE @@ -91,9 +54,6 @@ 2.0.1.Final 2.9.5 - - 2.9.2 - 2.5.0 5.1.46 @@ -111,7 +71,6 @@ 2.2 4.3 - 4.12 1.1.6 @@ -124,11 +83,13 @@ 1.1.1 + 3.1.4 20080701 0.7.4 1.2 63.1 + 1.4.2 **/code/**, @@ -154,10 +115,12 @@ **/dto/**,**/entity/**,**/config/** - 3.0.2 - 3.1.0 - + + 1.2.1-java21-SNAPSHOT + 1.2.1-java21-SNAPSHOT + 1.2.1-java21-SNAPSHOT + pre-registration-core pre-registration-application-service @@ -165,19 +128,20 @@ pre-registration-batchjob pre-registration-captcha-service + io.mosip.kernel kernel-bom - 1.2.1-java21-SNAPSHOT + ${kernel.bom.version} pom import org.projectlombok lombok - 1.18.30 + ${lombok.version} provided @@ -303,7 +267,7 @@ org.jacoco jacoco-maven-plugin - ${maven.jacoco.version} + ${jacoco.maven.plugin.version} @@ -322,7 +286,7 @@ org.apache.maven.plugins maven-javadoc-plugin - ${maven.javadoc.version} + ${maven.javadoc.plugin.version} attach-javadocs @@ -338,7 +302,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.7 + ${nexus.staging.maven.plugin.version} true ossrh @@ -350,7 +314,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + ${maven.source.plugin.version} attach-sources @@ -364,7 +328,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + ${maven.gpg.plugin.version} sign-artifacts @@ -419,7 +383,7 @@ pl.project13.maven git-commit-id-plugin - 3.0.1 + ${git.commit.id.plugin.version} get-the-git-infos @@ -439,7 +403,6 @@ full ${project.basedir}/.git - @@ -475,4 +438,58 @@ + + + + ossrh + CentralRepository + https://oss.sonatype.org/content/repositories/snapshots + default + + true + + + + central + MavenCentral + default + https://repo1.maven.org/maven2 + + false + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + MPL 2.0 + https://www.mozilla.org/en-US/MPL/2.0/ + + + + scm:git:git://github.com/mosip/pre-registration.git + scm:git:ssh://github.com:mosip/pre-registration.git + https://github.com/mosip/pre-registration + HEAD + + + + + Mosip + mosip.emailnotifier@gmail.com + io.mosip + https://github.com/mosip/pre-registration + + diff --git a/pre-registration/pre-registration-application-service/pom.xml b/pre-registration/pre-registration-application-service/pom.xml index 75019afbd11..5da3d5a524c 100644 --- a/pre-registration/pre-registration-application-service/pom.xml +++ b/pre-registration/pre-registration-application-service/pom.xml @@ -12,39 +12,29 @@ pre-registration-application-service Pre-Registration Application Service Project Maven project of MOSIP Pre-Registration Service - 1.2.1-java21-SNAPSHOT + - UTF-8 - 1.2.1-java21-SNAPSHOT + + 2.1 + 3.10.8 + + 1.2.1-java21-SNAPSHOT 1.2.1-java21-SNAPSHOT 1.2.1-java21-SNAPSHOT 1.2.1-java21-SNAPSHOT + 1.2.1-java21-SNAPSHOT 1.2.1-java21-SNAPSHOT - 1.4.2 - - - - io.mosip.kernel - kernel-bom - 1.2.1-java21-SNAPSHOT - pom - import - - - io.jsonwebtoken jjwt - 0.6.0 org.hamcrest hamcrest - 2.1 test @@ -54,7 +44,6 @@ org.springframework.cloud spring-cloud-starter-config - ${spring-cloud-config.version} org.springframework.boot @@ -63,7 +52,6 @@ org.ehcache ehcache - 3.10.8 org.springframework.boot @@ -73,7 +61,7 @@ io.mosip.preregistration pre-registration-core - 1.2.1-java21-SNAPSHOT + ${pre.registration.core.version} io.mosip.kernel @@ -118,22 +106,18 @@ org.apache.httpcomponents httpclient - ${apache.httpclient.version} org.json json - ${org.json.version} io.micrometer micrometer-core - ${io.micrometer.prometheus.version} io.micrometer micrometer-registry-prometheus - ${io.micrometer.prometheus.version} org.springframework.boot @@ -155,7 +139,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + ${maven.compiler.version} -parameters @@ -183,7 +167,7 @@ org.springframework.boot spring-boot-maven-plugin - ${spring.boot.version} + ${spring.boot.maven.plugin.version} ZIP true @@ -211,12 +195,12 @@ io.mosip.kernel kernel-ref-idobjectvalidator - 1.2.1-java21-SNAPSHOT + ${kernel.idobjectvalidator.version} io.mosip.kernel kernel-transliteration-icu4j - 1.2.1-java21-SNAPSHOT + ${kernel.transliteration.icu4j.version} org.junit.vintage @@ -225,7 +209,6 @@ junit junit - ${junit.version} test @@ -234,7 +217,7 @@ org.springframework.boot spring-boot-maven-plugin - ${spring.boot.version} + ${spring.boot.maven.plugin.version} true ZIP @@ -271,7 +254,7 @@ org.springdoc springdoc-openapi-maven-plugin - 0.2 + ${springdoc.openapi.maven.plugin} integration-test @@ -292,4 +275,4 @@ - + \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/config/LoginConfig.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/config/LoginConfig.java index 43aa7ca8d5c..acca7446bfb 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/config/LoginConfig.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/config/LoginConfig.java @@ -1,8 +1,5 @@ package io.mosip.preregistration.application.config; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springdoc.core.GroupedOpenApi; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -15,36 +12,17 @@ @Configuration public class LoginConfig { - - private static final Logger logger = LoggerFactory.getLogger(LoginConfig.class); - - @Autowired - private OpenApiProperties openApiProperties; - @Bean - public OpenAPI openApi() { - OpenAPI api = new OpenAPI() - .components(new Components()) - .info(new Info() - .title(openApiProperties.getInfo().getTitle()) + public OpenAPI openApi(@Autowired OpenApiProperties openApiProperties) { + OpenAPI api = new OpenAPI().components(new Components()) + .info(new Info().title(openApiProperties.getInfo().getTitle()) .version(openApiProperties.getInfo().getVersion()) .description(openApiProperties.getInfo().getDescription()) - .license(new License() - .name(openApiProperties.getInfo().getLicense().getName()) + .license(new License().name(openApiProperties.getInfo().getLicense().getName()) .url(openApiProperties.getInfo().getLicense().getUrl()))); - openApiProperties.getService().getServers().forEach(server -> { - api.addServersItem(new Server().description(server.getDescription()).url(server.getUrl())); - }); - logger.info("swagger open api bean is ready"); + openApiProperties.getService().getServers().forEach( + server -> api.addServersItem(new Server().description(server.getDescription()).url(server.getUrl()))); return api; } - - @Bean - public GroupedOpenApi groupedOpenApi() { - return GroupedOpenApi.builder().group(openApiProperties.getGroup().getName()) - .pathsToMatch(openApiProperties.getGroup().getPaths().stream().toArray(String[]::new)) - .build(); - } - } \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/ApplicationController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/ApplicationController.java index d606f4f1895..c1e9e0d6513 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/ApplicationController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/ApplicationController.java @@ -83,21 +83,20 @@ public ResponseEntity> getApplication( @PathVariable("applicationId") String applicationId) { return ResponseEntity.status(HttpStatus.OK).body(applicationService.getApplicationInfo(applicationId)); } - + @PreAuthorize("hasAnyRole(@authorizedRoles.getGetapplicationsstatus())") @GetMapping(path = "/applications/status/{applicationId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "getApplicationStatus", description = "Fetch the status of a application", tags = "application-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "All applications status fetched successfully"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> getApplicationStatus( @PathVariable("applicationId") String applicationId) { return ResponseEntity.status(HttpStatus.OK).body(applicationService.getApplicationStatus(applicationId)); } - @PreAuthorize("hasAnyRole(@authorizedRoles.getGetappointmentregistrationcenterid())") @GetMapping(path = "/applications/bookings/{regCenterId}") @Operation(summary = "getBookingsForRegCenter", description = "Fetch all bookings for regCenterId on the given appointmentDate", tags = "application-controller") @@ -106,7 +105,8 @@ public ResponseEntity> getApplicationStatus( @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity>> getBookingsForRegCenter( - @PathVariable("regCenterId") String regCenterId, @RequestParam("appointmentDate") String appointmentFromDate, + @PathVariable("regCenterId") String regCenterId, + @RequestParam("appointmentDate") String appointmentFromDate, @RequestParam(required = false) String appointmentToDate) { return ResponseEntity.status(HttpStatus.OK) .body(applicationService.getBookingsForRegCenter(regCenterId, appointmentFromDate, appointmentToDate)); @@ -119,12 +119,12 @@ public ResponseEntity>> getBo @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) - public ResponseEntity> getAllApplications(@RequestParam(required = false) String type) { + public ResponseEntity> getAllApplications( + @RequestParam(required = false) String type) { if (type != null) { return ResponseEntity.status(HttpStatus.OK) .body(applicationService.getAllApplicationsForUserForBookingType(type)); } return ResponseEntity.status(HttpStatus.OK).body(applicationService.getAllApplicationsForUser()); } - -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/AppointmentController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/AppointmentController.java index fc567da3f66..f2381e0e659 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/AppointmentController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/AppointmentController.java @@ -30,13 +30,13 @@ import io.mosip.preregistration.core.common.dto.MainRequestDTO; import io.mosip.preregistration.core.common.dto.MainResponseDTO; import io.mosip.preregistration.core.config.LoggerConfiguration; +import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import springfox.documentation.annotations.ApiIgnore; @RestController @Tag(name = "appointment-controller", description = "Appointment Controller") @@ -52,9 +52,9 @@ public class AppointmentController { @Operation(summary = "Fetch availability Data", description = "Fetch availability Data", tags = "appointment-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Availablity details fetched successfully"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> getAvailability( @PathVariable("registrationCenterId") String registrationCenterId) { log.info("fetch availablity for regID: {}", registrationCenterId); @@ -64,17 +64,15 @@ public ResponseEntity> getAvailability( @PreAuthorize("hasAnyRole(@authorizedRoles.getPostappointmentpregid())") @PostMapping(path = "/applications/appointment/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "Booking Appointment", description = "Booking Appointment", tags = "appointment-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Appointment Booked Successfully"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Appointment Booked Successfully"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> bookAppoinment( @PathVariable("preRegistrationId") String preRegistrationId, @Validated @RequestBody(required = true) MainRequestDTO bookingDTO, - @ApiIgnore Errors errors, - @RequestHeader(value = "User-Agent") String userAgent) { + @ApiParam(hidden = true) Errors errors, @RequestHeader(value = "User-Agent") String userAgent) { log.info("Book an appointment for preRegId: {}", preRegistrationId); return ResponseEntity.status(HttpStatus.OK) .body(appointmentService.makeAppointment(bookingDTO, preRegistrationId, userAgent)); @@ -85,41 +83,37 @@ public ResponseEntity> bookAppoinment( @Operation(summary = "Fetch Appointment details", description = "Fetch Appointment details", tags = "appointment-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Appointment details fetched Successfully"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> getAppointments( @PathVariable("preRegistrationId") String preRegistrationId) { log.info("To fetch appointment details for preRegID: {}", preRegistrationId); return ResponseEntity.status(HttpStatus.OK).body(appointmentService.getAppointmentDetails(preRegistrationId)); - } @PreAuthorize("hasAnyRole(@authorizedRoles.getCancelappointmentpreregid())") @PutMapping(path = "/applications/appointment/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "Cancel an booked appointment", description = "Cancel an booked appointment", tags = "appointment-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Appointment cancelled successfully"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Appointment cancelled successfully"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> cancelBook( @PathVariable("preRegistrationId") String preRegistrationId) { log.info("Cancel the appointment for preRegId :{} ", preRegistrationId); return ResponseEntity.status(HttpStatus.OK).body(appointmentService.cancelAppointment(preRegistrationId)); } - + @PreAuthorize("hasAnyRole(@authorizedRoles.getCancelappointmentpreregid())") @PutMapping(path = "/internal/applications/appointment/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE) - @Operation(summary = "Cancel an booked appointment. Used internally by batch job", description = "Cancel an booked appointment. Used internally by batch job,", - tags = "appointment-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Appointment cancelled successfully"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @Operation(summary = "Cancel an booked appointment. Used internally by batch job", description = "Cancel an booked appointment. Used internally by batch job,", tags = "appointment-controller") + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Appointment cancelled successfully"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> internalCancelBook( @PathVariable("preRegistrationId") String preRegistrationId) { log.info("Cancel the appointment for preRegId called internally :{} ", preRegistrationId); @@ -129,31 +123,29 @@ public ResponseEntity> internalCancelB @PreAuthorize("hasAnyRole(@authorizedRoles.getDeleteappointmentpreregid())") @DeleteMapping(path = "/applications/appointment", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "Discard Booking", description = "CDiscard Booking", tags = "appointment-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Deletion of Booking is successfully"), + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Deletion of Booking is successfully"), @ApiResponse(responseCode = "204", description = "No Content"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - }) + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), }) public ResponseEntity> discardIndividual( @RequestParam(value = "preRegistrationId") String preId) { log.info("Delete booking with preId: {}", preId); - return ResponseEntity.status(HttpStatus.OK).body(appointmentService.deleteBookingAndUpdateApplicationStatus(preId)); + return ResponseEntity.status(HttpStatus.OK) + .body(appointmentService.deleteBookingAndUpdateApplicationStatus(preId)); } @PreAuthorize("hasAnyRole(@authorizedRoles.getPostappointmentmulti())") @PostMapping(path = "/applications/appointment", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "Booking Appointment", description = "Booking Appointment", tags = "appointment-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Appointment Booked Successfully"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Appointment Booked Successfully"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> bookMultiAppoinment( @Validated @RequestBody(required = true) MainRequestDTO bookingRequest, @RequestHeader(value = "User-Agent") String userAgent) { - return ResponseEntity.status(HttpStatus.OK).body(appointmentService.makeMultiAppointment(bookingRequest, userAgent)); + return ResponseEntity.status(HttpStatus.OK) + .body(appointmentService.makeMultiAppointment(bookingRequest, userAgent)); } - -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/DemographicController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/DemographicController.java index c74cf22e929..b2a76adb82c 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/DemographicController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/DemographicController.java @@ -6,8 +6,6 @@ import java.util.Map; -import jakarta.servlet.http.HttpServletRequest; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -33,7 +31,6 @@ import io.mosip.preregistration.application.dto.DemographicMetadataDTO; import io.mosip.preregistration.application.dto.DemographicRequestDTO; import io.mosip.preregistration.application.dto.DemographicUpdateResponseDTO; -import io.mosip.preregistration.application.dto.SchemaResponseDto; import io.mosip.preregistration.application.service.DemographicServiceIntf; import io.mosip.preregistration.core.common.dto.DemographicResponseDTO; import io.mosip.preregistration.core.common.dto.MainRequestDTO; @@ -43,13 +40,14 @@ import io.mosip.preregistration.core.config.LoggerConfiguration; import io.mosip.preregistration.core.util.DataValidationUtil; import io.mosip.preregistration.core.util.RequestValidator; +import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import springfox.documentation.annotations.ApiIgnore; +import jakarta.servlet.http.HttpServletRequest; /** * This class provides different API's to perform operations on @@ -87,8 +85,7 @@ public class DemographicController { /** * Inits the binder. * - * @param binder - * the binder + * @param binder the binder */ @InitBinder public void initBinder(WebDataBinder binder) { @@ -101,26 +98,23 @@ public void initBinder(WebDataBinder binder) { * This Post API is use to create a pre-registation application for * registration. * - * @param jsonObject - * the json object - * @param errors - * Errors + * @param jsonObject the json object + * @param errors Errors * @return List of response dto containing pre-id and group-id */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getPostapplications())") @PostMapping(path = "/applications/prereg", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "addPreRegDemographicData", description = "Add demographic data for a new preregistration application", tags = "demographic-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Pre-Registration successfully Created"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Pre-Registration successfully Created"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> addPreRegDemographicData( @Validated @RequestBody(required = true) MainRequestDTO jsonObject, - @ApiIgnore Errors errors) { + @ApiParam(hidden = true) Errors errors) { log.info("sessionId", "idType", "id", "In pre-registration controller for add preregistration with json object" + jsonObject); requestValidator.validateId(CREATE, jsonObject.getId(), errors); @@ -131,29 +125,25 @@ public ResponseEntity> addPreRegDe /** * This Put API use to update a pre-registation application. * - * @param preRegistrationId - * preRegistrationId - * @param jsonObject - * The json object - * @param errors - * Errors + * @param preRegistrationId preRegistrationId + * @param jsonObject The json object + * @param errors Errors * @return List of response dto containing pre-id and group-id */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getPutapplications())") @PutMapping(path = "/applications/prereg/{preRegistrationId}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "updatePreRegDemographicData", description = "Update demographic data for a new preregistration application", tags = "demographic-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Demographic data successfully Updated"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Demographic data successfully Updated"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> updatePreRegDemographicData( @PathVariable("preRegistrationId") String preRegistrationId, @Validated @RequestBody(required = true) MainRequestDTO jsonObject, - @ApiIgnore Errors errors) { + @ApiParam(hidden = true) Errors errors) { String userId = preRegistrationService.authUserDetails().getUserId(); log.info("sessionId", "idType", "id", "In pre-registration controller for Update preregistration with json object" + jsonObject); @@ -166,20 +156,18 @@ public ResponseEntity> updatePreRe /** * Get API to fetch all the Pre-registration data for a pre-id. * - * @param preRegistraionId - * the pre reg id + * @param preRegistraionId the pre reg id * @return the application data for a pre-id */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN','PRE_REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN','PRE_REGISTRATION_ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getGetapplications())") @GetMapping(path = "/applications/prereg/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "getPreRegDemographicData", description = "Get demographic data for a new preregistration application", tags = "demographic-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Demographic data successfully retrieved"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Demographic data successfully retrieved"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> getPreRegDemographicData( @PathVariable("preRegistrationId") String preRegistraionId) { log.info("sessionId", "idType", "id", @@ -191,23 +179,21 @@ public ResponseEntity> getPreRegDemograp /** * Put API to update the status of the application. * - * @param preRegId - * the pre reg id - * @param status - * the status + * @param preRegId the pre reg id + * @param status the status * @return the updation status of application for a pre-id */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getPutapplicationsstatus())") @PutMapping(path = "/applications/prereg/status/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "updatePreRegApplicationStatus", description = "Update Pre-Registartion status", tags = "demographic-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Pre-Registration Status successfully updated"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> updatePreRegApplicationStatus( @PathVariable("preRegistrationId") String preRegId, @RequestParam(value = "statusCode", required = true) String status) { @@ -228,15 +214,14 @@ public ResponseEntity> updatePreRegApplicationStatus( * @return List of applications created by User */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getGetapplicationsall())") @GetMapping(path = "/applications/prereg", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "getAllPreRegApplications", description = "Fetch all the prereg applications created by user", tags = "demographic-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "All applications fetched successfully"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "All applications fetched successfully"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> getAllPreRegApplications(HttpServletRequest res, @RequestParam(value = "pageIndex", required = false) String pageIdx) { String userId = preRegistrationService.authUserDetails().getUserId(); @@ -249,20 +234,19 @@ public ResponseEntity> getAllPreRegAppli /** * Get API to fetch the status of a application. * - * @param preId - * the pre id + * @param preId the pre id * @return status of application */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getGetapplicationsstatus())") @GetMapping(path = "/applications/prereg/status/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "getPreRegApplicationStatus", description = "Fetch the status of a application", tags = "demographic-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "All applications status fetched successfully"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> getPreRegApplicationStatus( @PathVariable("preRegistrationId") String preId) { String userId = preRegistrationService.authUserDetails().getUserId(); @@ -275,21 +259,18 @@ public ResponseEntity> getPreRegApplic * Delete API to delete the Individual applicant and documents associated with * the PreId. * - * @param preId - * the pre id + * @param preId the pre id * @return the deletion status of application for a pre-id */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getDeleteapplications())") @DeleteMapping(path = "/applications/prereg/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "deletePreRegApplication", description = "Discard prereg application", tags = "demographic-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Deletion of individual is successfully"), + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Deletion of individual is successfully"), @ApiResponse(responseCode = "204", description = "No Content"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - }) + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), }) public ResponseEntity> deletePreRegApplication( @PathVariable("preRegistrationId") String preId) { String userId = preRegistrationService.authUserDetails().getUserId(); @@ -299,28 +280,25 @@ public ResponseEntity> deletePreRegApp return ResponseEntity.status(HttpStatus.OK).body(preRegistrationService.deleteIndividual(preId, userId)); } - - //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN','REGISTRATION_PROCESSOR')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ADMIN','REGISTRATION_PROCESSOR')") @PreAuthorize("hasAnyRole(@authorizedRoles.getPostapplicationsupdatedtime())") @PostMapping(path = "/applications/prereg/updatedTime", produces = MediaType.APPLICATION_JSON_VALUE) - @Operation(summary = "getUpdatedDateTimeByPreIds", description = "Get Updated Date Time for List of Pre-Registration Id", - tags = "demographic-controller") + @Operation(summary = "getUpdatedDateTimeByPreIds", description = "Get Updated Date Time for List of Pre-Registration Id", tags = "demographic-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Updated Date Time successfully fetched for list of pre-registration ids"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity>> getUpdatedDateTimeByPreIds( @Validated @RequestBody MainRequestDTO mainRequestDTO, - @ApiIgnore Errors errors) { + @ApiParam(hidden = true) Errors errors) { requestValidator.validateId(UPDATEDTIME, mainRequestDTO.getId(), errors); DataValidationUtil.validate(errors, UPDATEDTIME); return ResponseEntity.status(HttpStatus.OK) .body(preRegistrationService.getUpdatedDateTimeForPreIds(mainRequestDTO.getRequest())); } - - + @PreAuthorize("hasAnyRole(@authorizedRoles.getGetapplicationsinfo())") @GetMapping(path = "/applications/prereg/info/{preregistrationId}") @Operation(summary = "getPreRegDemographicAndDocumentData", description = "Retrive Application demographic and document info for given prid", tags = "application-controller") @@ -332,8 +310,8 @@ public ResponseEntity>> getUpdatedDateTimeBy public ResponseEntity> getPreRegDemographicAndDocumentData( @PathVariable("preregistrationId") String preregistrationId) { log.info("In demographic controller to getFullPreRegApplication {}", preregistrationId); - return ResponseEntity.status(HttpStatus.OK).body(preRegistrationService.getPregistrationInfo(preregistrationId)); + return ResponseEntity.status(HttpStatus.OK) + .body(preRegistrationService.getPregistrationInfo(preregistrationId)); } - } diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/DocumentController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/DocumentController.java index 38c42ac71f2..5f3edc9f229 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/DocumentController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/DocumentController.java @@ -4,6 +4,22 @@ */ package io.mosip.preregistration.application.controller; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + import io.mosip.kernel.core.logger.spi.Logger; import io.mosip.preregistration.application.dto.DocumentResponseDTO; import io.mosip.preregistration.application.service.DocumentServiceIntf; @@ -18,14 +34,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - import jakarta.validation.Valid; /** @@ -60,16 +68,15 @@ public class DocumentController { * @return response in a format specified in API document * */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL')") @PreAuthorize("hasAnyRole(@authorizedRoles.getPostdocumentspreregistrationid())") @PostMapping(path = "/documents/{preRegistrationId}", consumes = { "multipart/form-data" }) @Operation(summary = "fileUpload", description = "Document Upload", tags = "document-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Document uploaded successfully"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Document uploaded successfully"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> fileUpload( @PathVariable(value = "preRegistrationId") String preRegistrationId, @RequestPart(value = "Document request", required = true) String reqDto, @@ -95,16 +102,15 @@ public ResponseEntity> fileUpload( * * @return response in a format specified in API document */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL')") @PreAuthorize("hasAnyRole(@authorizedRoles.getPutdocumentspreregistrationid())") @PutMapping(path = "/documents/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "copyDocument", description = "Copy uploaded document", tags = "document-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Document successfully copied"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Document successfully copied"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> copyDocument( @Valid @PathVariable(required = true, value = "preRegistrationId") String preRegistrationId, @Valid @RequestParam(required = true) String catCode, @@ -123,15 +129,15 @@ public ResponseEntity> copyDocument( * @param pre_registration_id pass preRegistrationId * @return response in a format specified in API document */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ + // ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getGetdocumentspreregistrationid())") @GetMapping(path = "/documents/preregistration/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "getDocumentforDocId", description = "Get All Document for Pre-Registration Id", tags = "document-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Documents reterived successfully"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Documents reterived successfully"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> getAllDocumentforPreid( @Valid @PathVariable(required = true) String preRegistrationId) { log.info("sessionId", "idType", "id", @@ -148,15 +154,15 @@ public ResponseEntity> getAllDocumentforPreid * @param preRegistrationId pass preRegistrationId as request param * @return response in a format specified in API document */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ + // ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getGetdocumentsdocumentid())") @GetMapping(path = "/documents/{documentId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "getDocumentforDocId", description = "Get All Document for Document Id", tags = "document-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Documents reterived successfully"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Documents reterived successfully"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> getDocumentforDocId( @Valid @PathVariable(required = true) String documentId, @Valid @RequestParam(required = true, value = "preRegistrationId") String preRegistrationId) { @@ -176,16 +182,14 @@ public ResponseEntity> getDocumentforDocId( * @return response in a format specified in API document */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL')") @PreAuthorize("hasAnyRole(@authorizedRoles.getDeletedocumentsdocumentid())") @DeleteMapping(path = "/documents/{documentId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "deleteDocument", description = "Delete document by document Id", tags = "document-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Document successfully deleted"), - @ApiResponse(responseCode = "204", description = "No Content" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - }) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Document successfully deleted"), + @ApiResponse(responseCode = "204", description = "No Content", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), }) public ResponseEntity> deleteDocument( @Valid @PathVariable(required = true) String documentId, @Valid @RequestParam(required = true, value = "preRegistrationId") String preRegistrationId) { @@ -193,7 +197,6 @@ public ResponseEntity> deleteDocument "In deleteDocument method of document controller to delete the document for documentId " + documentId); return ResponseEntity.status(HttpStatus.OK) .body(documentUploadService.deleteDocument(documentId, preRegistrationId)); - } /** @@ -203,16 +206,14 @@ public ResponseEntity> deleteDocument * @return response in a format specified in API document */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL')") @PreAuthorize("hasAnyRole(@authorizedRoles.getDeletedocumentspreregistrationid())") @DeleteMapping(path = "/documents/preregistration/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "deleteAllByPreId", description = "Delete all documents by pre-registration Id", tags = "document-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Documents successfully deleted"), - @ApiResponse(responseCode = "204", description = "No Content" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - }) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Documents successfully deleted"), + @ApiResponse(responseCode = "204", description = "No Content", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), }) public ResponseEntity> deleteAllByPreId( @Valid @PathVariable(required = true) String preRegistrationId) { log.info("sessionId", "idType", "id", @@ -221,16 +222,17 @@ public ResponseEntity> deleteAllByPre return ResponseEntity.status(HttpStatus.OK).body(documentUploadService.deleteAllByPreId(preRegistrationId)); } - //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ + // ADMIN')") @PreAuthorize("hasAnyRole(@authorizedRoles.getPutdocumentsdocumentid())") @PutMapping(path = "/documents/document/{documentId}", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "updateDocRefId", description = "update document reference Id", tags = "document-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Document Reference Id successfully updated"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> updateDocRefId( @Valid @PathVariable(required = true) String documentId, @Valid @RequestParam(required = true, value = "preRegistrationId") String preRegistrationId, @@ -240,6 +242,5 @@ public ResponseEntity> updateDocRefId( + "preregistrationId " + preRegistrationId + "DocRefId " + refNumebr); return ResponseEntity.status(HttpStatus.OK) .body(documentUploadService.updateDocRefId(documentId, preRegistrationId, refNumebr)); - } -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/GenerateQRcodeController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/GenerateQRcodeController.java index 259bb19ae5c..32add8bc81b 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/GenerateQRcodeController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/GenerateQRcodeController.java @@ -1,10 +1,5 @@ package io.mosip.preregistration.application.controller; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -20,19 +15,25 @@ import org.springframework.web.bind.annotation.RestController; import io.mosip.kernel.core.logger.spi.Logger; +import io.mosip.preregistration.application.dto.QRCodeResponseDTO; +import io.mosip.preregistration.application.service.GenerateQRcodeService; import io.mosip.preregistration.core.common.dto.MainRequestDTO; import io.mosip.preregistration.core.common.dto.MainResponseDTO; import io.mosip.preregistration.core.config.LoggerConfiguration; import io.mosip.preregistration.core.util.DataValidationUtil; import io.mosip.preregistration.core.util.RequestValidator; +import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import io.mosip.preregistration.application.dto.QRCodeResponseDTO; -import io.mosip.preregistration.application.service.GenerateQRcodeService; -import springfox.documentation.annotations.ApiIgnore; /** - * This class provides API's to generate the QR code operations on + * This class provides API's to generate the QR code operations on * pre-registration. + * * @author Sanober Noor * @since 1.0.0 */ @@ -42,13 +43,13 @@ public class GenerateQRcodeController { private Logger log = LoggerConfiguration.logConfig(GenerateQRcodeController.class); - + @Autowired private RequestValidator requestValidator; - + /** The Constant for GET UPDATED DATE TIME application. */ private static final String QRCODE = "pre-registration.qrcode.generate"; - + /** * Inits the binder. * @@ -58,30 +59,30 @@ public class GenerateQRcodeController { public void initBinder(WebDataBinder binder) { binder.addValidators(requestValidator); } - + @Autowired private GenerateQRcodeService service; - + /** - * @param data pass the data for generating qr code - * @param errors + * @param data pass the data for generating qr code + * @param errors * @return QRCodeResponseDTO the response entity */ - //@PreAuthorize("hasAnyRole('INDIVIDUAL')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL')") @PreAuthorize("hasAnyRole(@authorizedRoles.getPostqrcodegenerate())") - @PostMapping(path="/generate" ,consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - @Operation(summary = "Generate QR Code", description = "Generate QR Code", tags = "generate-q-rcode-controller") + @PostMapping(path = "/generate", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) + @Operation(summary = "Generate QR Code", description = "Generate QR Code", tags = "generate-q-rcode-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) - public ResponseEntity> generateQRCode(@Validated @RequestBody MainRequestDTO data,@ApiIgnore Errors errors) { + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) + public ResponseEntity> generateQRCode( + @Validated @RequestBody MainRequestDTO data, @ApiParam(hidden = true) Errors errors) { log.info("sessionId", "idType", "id", "In generateQRCode controller for generateQRCode generation with request " + data); requestValidator.validateId(QRCODE, data.getId(), errors); - DataValidationUtil.validate(errors,QRCODE); - return new ResponseEntity<>(service.generateQRCode(data),HttpStatus.OK); - + DataValidationUtil.validate(errors, QRCODE); + return new ResponseEntity<>(service.generateQRCode(data), HttpStatus.OK); } -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java index f5b9fdcefc8..c2cdb1501af 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java @@ -3,11 +3,6 @@ import java.util.Map; import java.util.Objects; -import jakarta.servlet.http.Cookie; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.validation.Valid; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; @@ -41,13 +36,17 @@ import io.mosip.preregistration.core.config.LoggerConfiguration; import io.mosip.preregistration.core.util.DataValidationUtil; import io.mosip.preregistration.core.util.RequestValidator; +import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import springfox.documentation.annotations.ApiIgnore; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; /** * This class provides different api to perform operation for login @@ -57,7 +56,7 @@ * */ @RestController -@RequestMapping("/login") +@RequestMapping("/login") @Tag(name = "login-controller", description = "Login Controller") public class LoginController { @@ -73,7 +72,7 @@ public class LoginController { @Value("${mosip.preregistration.sendotp.allowapi:false}") private boolean allowSendOtpApi; - + @Value("${preregistration.cookie.contextpath}") private String cookieContextPath; @@ -109,15 +108,15 @@ public void initBinder(WebDataBinder binder) { @Deprecated(since = "1.2.0", forRemoval = true) @PostMapping(value = "/sendOtp", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "sendOTP", description = "Send Otp to UserId", tags = "login-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) @ResponseStatus(value = HttpStatus.OK) public ResponseEntity> sendOTP( - @Validated @RequestBody MainRequestDTO userOtpRequest, @ApiIgnore Errors errors) { + @Validated @RequestBody MainRequestDTO userOtpRequest, + @ApiParam(hidden = true) Errors errors) { loginValidator.validateId(SENDOTP, userOtpRequest.getId(), errors); DataValidationUtil.validate(errors, SENDOTP); @@ -138,15 +137,15 @@ public ResponseEntity> sendOTP( */ @PostMapping(value = "/sendOtp/langcode", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "sendOTPWithLangCode", description = "Send Otp to UserId", tags = "login-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) @ResponseStatus(value = HttpStatus.OK) public ResponseEntity> sendOTPWithLangCode( - @Validated @RequestBody MainRequestDTO userOtpRequest, @ApiIgnore Errors errors) { + @Validated @RequestBody MainRequestDTO userOtpRequest, + @ApiParam(hidden = true) Errors errors) { loginValidator.validateId(SENDOTP, userOtpRequest.getId(), errors); DataValidationUtil.validate(errors, SENDOTP); @@ -170,14 +169,13 @@ public ResponseEntity> sendOTPWithLangCode( */ @PostMapping(value = "/validateOtp", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "validateWithUserIdOtp", description = "Validate UserId and Otp", tags = "login-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> validateWithUserIdOtp( - @Validated @RequestBody MainRequestDTO userIdOtpRequest, @ApiIgnore Errors errors, + @Validated @RequestBody MainRequestDTO userIdOtpRequest, @ApiParam(hidden = true) Errors errors, HttpServletResponse res, HttpServletRequest req) { log.debug("User ID: {}", userIdOtpRequest.getRequest().getUserId()); @@ -191,7 +189,7 @@ public ResponseEntity> validateWithUserIdOtp( responseCookie.setHttpOnly(true); responseCookie.setSecure(true); responseCookie.setPath(cookieContextPath); - res.addCookie(responseCookie); + res.addCookie(responseCookie); } return ResponseEntity.status(HttpStatus.OK).body(responseBody); } @@ -204,12 +202,11 @@ public ResponseEntity> validateWithUserIdOtp( */ @PostMapping(value = "/invalidateToken", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "invalidateToken", description = "Invalidate the token", tags = "login-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) @ResponseStatus(value = HttpStatus.OK) public ResponseEntity> invalidateToken(HttpServletRequest req, HttpServletResponse res) { @@ -220,7 +217,6 @@ public ResponseEntity> invalidateToken(HttpServletReques responseCookie.setPath(cookieContextPath); res.addCookie(responseCookie); return ResponseEntity.status(HttpStatus.OK).body(loginService.invalidateToken(req.getHeader("Cookie"))); - } /** @@ -233,28 +229,24 @@ public ResponseEntity> invalidateToken(HttpServletReques @Operation(summary = "configParams", description = "Get global and Pre-Registration config data", tags = "login-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "global and Pre-Registration config data successfully retrieved"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity>> configParams() { - return new ResponseEntity<>(loginService.getConfig(), HttpStatus.OK); - } - @PostMapping(path = "/sendOtpWithCaptcha", produces = MediaType.APPLICATION_JSON_VALUE) @Operation(summary = "sendOtpWithCaptcha", description = "sendOtpWithCaptcha", tags = "login-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> sendOtpWithCaptcha( @Validated @Valid @RequestBody MainRequestDTO sendOtpRequestWithCaptcha, - HttpServletResponse res, @ApiIgnore Errors errors) { + HttpServletResponse res, @ApiParam(hidden = true) Errors errors) { MainResponseDTO response = loginService.validateCaptchaAndSendOtp(sendOtpRequestWithCaptcha); if (Objects.isNull(response.getErrors())) { @@ -264,10 +256,9 @@ public ResponseEntity> sendOtpWithCaptcha( resCookie.setHttpOnly(true); resCookie.setSecure(true); resCookie.setPath(cookieContextPath); - + res.addCookie(resCookie); } return new ResponseEntity<>(response, HttpStatus.OK); } - -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LostUINController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LostUINController.java index b992ed5908e..7977e151f16 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LostUINController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LostUINController.java @@ -26,13 +26,13 @@ import io.mosip.preregistration.core.config.LoggerConfiguration; import io.mosip.preregistration.core.util.DataValidationUtil; import io.mosip.preregistration.core.util.RequestValidator; +import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import springfox.documentation.annotations.ApiIgnore; @RestController @Tag(name = "lost-uin-controller", description = "Lost UIN Controller") @@ -77,7 +77,7 @@ public void initBinder(WebDataBinder binder) { @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> addLostUinApplication( @Validated @RequestBody(required = true) MainRequestDTO jsonObject, - @ApiIgnore Errors errors) { + @ApiParam(hidden = true) Errors errors) { log.info("sessionId", "idType", "id", "In pre-registration LostUINController for createNewApplication with json object" + jsonObject); requestValidator.validateId(LOST_UIN_CREATE_ID, jsonObject.getId(), errors); @@ -107,4 +107,4 @@ public ResponseEntity> deleteLostUinApplic return ResponseEntity.status(HttpStatus.OK).body(applicationService.deleteLostOrUpdateApplication(applicationId, BookingTypeCodes.LOST_FORGOTTEN_UIN.toString())); } -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/NotificationController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/NotificationController.java index ce714f04cb4..464b97020c6 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/NotificationController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/NotificationController.java @@ -51,15 +51,14 @@ public class NotificationController { * @return the response entity. */ @PreAuthorize("hasAnyRole(@authorizedRoles.getPostnotificationnotify())") - //@PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN')") @PostMapping(path = "/notification/notify", consumes = { "multipart/form-data" }) - @Operation(summary = "sendNotification", description = "Trigger notification", tags = "notification-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @Operation(summary = "sendNotification", description = "Trigger notification", tags = "notification-controller") + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> sendNotification( @RequestPart(value = "NotificationRequestDTO", required = true) String jsonbObject, @RequestPart(value = "langCode", required = true) String langCode, @@ -80,15 +79,14 @@ public ResponseEntity> sendNotification * @return the response entity. */ @PreAuthorize("hasAnyRole(@authorizedRoles.getPostnotification())") - //@PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN')") @PostMapping(path = "/notification", consumes = { "multipart/form-data" }) - @Operation(summary = "sendNotifications", description = "Trigger notification", tags = "notification-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @Operation(summary = "sendNotifications", description = "Trigger notification", tags = "notification-controller") + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> sendNotifications( @RequestPart(value = "NotificationRequestDTO", required = true) String jsonbObject, @RequestPart(value = "langCode", required = false) String langCode, @@ -99,7 +97,7 @@ public ResponseEntity> sendNotification return new ResponseEntity<>(notificationService.sendNotification(jsonbObject, langCode, file, true), HttpStatus.OK); } - + /** * Api to Trigger notification service. * @@ -109,21 +107,21 @@ public ResponseEntity> sendNotification * @return the response entity. */ @PreAuthorize("hasAnyRole(@authorizedRoles.getPostnotification())") - //@PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN')") + // @PreAuthorize("hasAnyRole('INDIVIDUAL','PRE_REGISTRATION_ADMIN')") @PostMapping(path = "/internal/notification", consumes = { "multipart/form-data" }) - @Operation(summary = "sendNotificationsInternal", description = "Trigger notification by internal batch job", tags = "notification-controller") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @Operation(summary = "sendNotificationsInternal", description = "Trigger notification by internal batch job", tags = "notification-controller") + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> sendNotificationsInternal( @RequestPart(value = "NotificationRequestDTO", required = true) String jsonbObject, @RequestPart(value = "langCode", required = false) String langCode, @RequestPart(value = "attachment", required = false) MultipartFile file, HttpServletRequest res) { log.info("sessionId", "idType", "id", - "In notification controller for sendNotificationsInternal() with request notification dto " + jsonbObject); + "In notification controller for sendNotificationsInternal() with request notification dto " + + jsonbObject); log.debug("sessionId", "idType", "id", res.getHeader("Cookie")); return new ResponseEntity<>(notificationService.sendNotification(jsonbObject, langCode, file, false), HttpStatus.OK); diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/ProxyMasterdataController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/ProxyMasterdataController.java index 6dbb494a542..abea0926a30 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/ProxyMasterdataController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/ProxyMasterdataController.java @@ -1,12 +1,5 @@ package io.mosip.preregistration.application.controller; -import jakarta.servlet.http.HttpServletRequest; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -18,7 +11,13 @@ import io.mosip.kernel.core.logger.spi.Logger; import io.mosip.preregistration.core.config.LoggerConfiguration; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletRequest; @RestController @RequestMapping("/proxy") @@ -31,30 +30,28 @@ public class ProxyMasterdataController { private io.mosip.preregistration.application.service.ProxyMasterDataService service; @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = { RequestMethod.GET }) - @Operation(summary = "GET Master data proxy", description = "Master data proxy", tags = "proxy-masterdata-controller") + @Operation(summary = "GET Master data proxy", description = "Master data proxy", tags = "proxy-masterdata-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity masterDataGetProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { log.info("sessionId", "idType", "id", "In masterDataGetProxyController method with request url: " + request.getRequestURI()); return ResponseEntity.status(HttpStatus.OK).body(service.getMasterDataResponse(body, request)); } - - @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = { - RequestMethod.POST }) - @Operation(summary = "POST Master data proxy", description = "Master data proxy", tags = "proxy-masterdata-controller") + + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = { RequestMethod.POST }) + @Operation(summary = "POST Master data proxy", description = "Master data proxy", tags = "proxy-masterdata-controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity masterDataPostProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { log.info("sessionId", "idType", "id", "In masterDataPostProxyController method with request url" + request.getRequestURI()); return ResponseEntity.status(HttpStatus.OK).body(service.getMasterDataResponse(body, request)); } - -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/TransliterationController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/TransliterationController.java index 484b8b55658..edfab3775dc 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/TransliterationController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/TransliterationController.java @@ -4,6 +4,20 @@ */ package io.mosip.preregistration.application.controller; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.Errors; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + import io.mosip.preregistration.application.dto.TransliterationRequestDTO; import io.mosip.preregistration.application.dto.TransliterationResponseDTO; import io.mosip.preregistration.application.service.TransliterationService; @@ -11,26 +25,17 @@ import io.mosip.preregistration.core.common.dto.MainResponseDTO; import io.mosip.preregistration.core.util.DataValidationUtil; import io.mosip.preregistration.core.util.RequestValidator; +import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.Errors; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; /** - * This class provides different API's to perform operations on - * Transliteration Application + * This class provides different API's to perform operations on Transliteration + * Application * * @author Kishan Rathore * @since 1.0.0 @@ -44,13 +49,13 @@ public class TransliterationController { /** Autowired reference for {@link #transliterationService}. */ @Autowired private TransliterationService transliterationService; - + @Autowired private RequestValidator requestValidator; - + /** The Constant for GET UPDATED DATE TIME application. */ private static final String TRANS = "pre-registration.transliteration.transliterate"; - + /** * Inits the binder. * @@ -65,20 +70,21 @@ public void initBinder(WebDataBinder binder) { * Post API to transliterate from transliteration application. * * @param requestDTO - * @return responseDto with transliterated toFieldValue. + * @return responseDto with transliterated toFieldValue. */ @PreAuthorize("hasAnyRole(@authorizedRoles.getPosttransliterationtransliterate())") - @PostMapping(path = "/transliterate", consumes = MediaType.APPLICATION_JSON_VALUE,produces = MediaType.APPLICATION_JSON_VALUE) - @Operation(summary = "Get Pre-Registartion-Translitration data", description = "Get Pre-Registartion-Translitration data", tags = "Transliteration Controller") + @PostMapping(path = "/transliterate", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) + @Operation(summary = "Get Pre-Registartion-Translitration data", description = "Get Pre-Registartion-Translitration data", tags = "Transliteration Controller") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Given key is translitrated successfully"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> translitrator( - @Validated @RequestBody(required = true) MainRequestDTO requestDTO, @ApiIgnore Errors errors) { + @Validated @RequestBody(required = true) MainRequestDTO requestDTO, + @ApiParam(hidden = true) Errors errors) { requestValidator.validateId(TRANS, requestDTO.getId(), errors); - DataValidationUtil.validate(errors,TRANS); + DataValidationUtil.validate(errors, TRANS); return ResponseEntity.status(HttpStatus.OK).body(transliterationService.translitratorService(requestDTO)); } -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/UISpecificationController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/UISpecificationController.java index 1f7ae0a9fee..50f3191d62e 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/UISpecificationController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/UISpecificationController.java @@ -1,9 +1,5 @@ package io.mosip.preregistration.application.controller; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -20,6 +16,10 @@ import io.mosip.preregistration.core.config.LoggerConfiguration; import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; @RestController @@ -33,12 +33,12 @@ public class UISpecificationController { @PreAuthorize("hasAnyRole(@authorizedRoles.getGetuispeclatest())") @GetMapping("/uispec/latest") - @Operation(summary = "Service to fetch latest published ui specification", description = "Service to fetch latest published ui specification", tags = { "UISpecification Controller" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @Operation(summary = "Service to fetch latest published ui specification", description = "Service to fetch latest published ui specification", tags = { + "UISpecification Controller" }) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> getLatestPublishedSchema( @RequestParam(name = "version", defaultValue = "0", required = false) @ApiParam(value = "version", defaultValue = "0") double version, @RequestParam(name = "identitySchemaVersion", defaultValue = "0", required = false) @ApiParam(value = "version", defaultValue = "0") double identitySchemaVersion) { @@ -47,19 +47,18 @@ public ResponseEntity> getLatestPublishedSche return ResponseEntity.status(HttpStatus.OK).body(uiSpecService.getLatestUISpec(version, identitySchemaVersion)); } - @PreAuthorize("hasAnyRole(@authorizedRoles.getGetuispecall())" ) + @PreAuthorize("hasAnyRole(@authorizedRoles.getGetuispecall())") @GetMapping("/uispec/all") - @Operation(summary = "Service to fetch all published ui specification", description = "Service to fetch all published ui specification", tags = { "UISpecification Controller" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @Operation(summary = "Service to fetch all published ui specification", description = "Service to fetch all published ui specification", tags = { + "UISpecification Controller" }) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity>> getAllPublishedSchema( @RequestParam(name = "pageNumber", defaultValue = "0") @ApiParam(value = "page number", defaultValue = "0") int pageNumber, @RequestParam(name = "pageSize", defaultValue = "10") @ApiParam(value = "page size", defaultValue = "10") int pageSize) { log.info("In UISpecification Controller to getAllPublishedSchema"); return ResponseEntity.status(HttpStatus.OK).body(uiSpecService.getAllUISpec(pageNumber, pageSize)); } - -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/UpdateRegistrationController.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/UpdateRegistrationController.java index da3f987d1a3..3480e24e3b5 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/UpdateRegistrationController.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/UpdateRegistrationController.java @@ -26,13 +26,13 @@ import io.mosip.preregistration.core.config.LoggerConfiguration; import io.mosip.preregistration.core.util.DataValidationUtil; import io.mosip.preregistration.core.util.RequestValidator; +import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import springfox.documentation.annotations.ApiIgnore; @RestController @Tag(name = "update-registration-controller", description = "Update Registration Controller") @@ -78,7 +78,7 @@ public void initBinder(WebDataBinder binder) { @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity> addUpdateRegistration( @Validated @RequestBody(required = true) MainRequestDTO jsonObject, - @ApiIgnore Errors errors) { + @ApiParam(hidden = true) Errors errors) { log.info("sessionId", "idType", "id", "In pre-registration UpdateRegistrationController for createNewApplication with json object" + jsonObject); @@ -110,5 +110,4 @@ public ResponseEntity> deleteUpdateRegistr return ResponseEntity.status(HttpStatus.OK).body(applicationService.deleteLostOrUpdateApplication(applicationId, BookingTypeCodes.UPDATE_REGISTRATION.toString())); } - -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/config/TestSecurityConfig.java b/pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/config/TestSecurityConfig.java index 40233ba5bd2..a1c47cd64bc 100644 --- a/pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/config/TestSecurityConfig.java +++ b/pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/config/TestSecurityConfig.java @@ -81,5 +81,4 @@ public UserDetailsService userDetailsService() { users.add(new User("test", "mosip", Arrays.asList(new SimpleGrantedAuthority("ROLE_TEST")))); return new InMemoryUserDetailsManager(users); } - } diff --git a/pre-registration/pre-registration-batchjob/pom.xml b/pre-registration/pre-registration-batchjob/pom.xml index adf7aeeab77..df12dc3bdb8 100644 --- a/pre-registration/pre-registration-batchjob/pom.xml +++ b/pre-registration/pre-registration-batchjob/pom.xml @@ -10,29 +10,14 @@ 1.2.1-java21-SNAPSHOT - 1.2.1-java21-SNAPSHOT pre-registration-batchjob pre-registration-batchjob http://maven.apache.org - UTF-8 - 1.4.2 - - - - io.mosip.kernel - kernel-bom - 1.2.1-java21-SNAPSHOT - pom - import - - - - org.springframework.boot @@ -88,7 +73,6 @@ junit junit - ${junit.version} test @@ -102,7 +86,7 @@ org.springframework.boot spring-boot-maven-plugin - ${spring.boot.version} + ${spring.boot.maven.plugin.version} true ZIP @@ -118,4 +102,4 @@ - + \ No newline at end of file diff --git a/pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/audit/BatchjobConfig.java b/pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/audit/BatchjobConfig.java index a87bf4933ae..7e217e87251 100644 --- a/pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/audit/BatchjobConfig.java +++ b/pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/audit/BatchjobConfig.java @@ -12,8 +12,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - /** * This class is used for Swagger configuration, also to configure Host and * Port. @@ -25,13 +23,12 @@ * */ @Configuration -@EnableSwagger2 @ConfigurationProperties("mosip.preregistration.batchjob") public class BatchjobConfig { - + /** The id. */ private Map id; - + /** * Sets the id. * @@ -40,7 +37,6 @@ public class BatchjobConfig { public void setId(Map id) { this.id = id; } - /** * Id. @@ -51,5 +47,4 @@ public void setId(Map id) { public Map ic() { return Collections.unmodifiableMap(id); } - -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-captcha-service/pom.xml b/pre-registration/pre-registration-captcha-service/pom.xml index 3f4cdb9ecdb..f840332e454 100644 --- a/pre-registration/pre-registration-captcha-service/pom.xml +++ b/pre-registration/pre-registration-captcha-service/pom.xml @@ -13,26 +13,16 @@ pre-registration-captcha-service A pre-registration service to generate and validate captcha - 1.2.1-java21-SNAPSHOT - 21 - 3.0.2 - 1.4.2 + 1.2.1-java21-SNAPSHOT + 1.2.1-java21-SNAPSHOT + 1.2.1-java21-SNAPSHOT + 1.2.1-java21-SNAPSHOT + - - - - io.mosip.kernel - kernel-bom - 1.2.1-java21-SNAPSHOT - pom - import - - - org.projectlombok @@ -97,7 +87,7 @@ org.springframework.boot spring-boot-maven-plugin - ${spring.boot.version} + ${spring.boot.maven.plugin.version} true @@ -123,12 +113,12 @@ io.mosip.kernel kernel-ref-idobjectvalidator - 1.2.1-java21-SNAPSHOT + ${kernel.idobjectvalidator.version} io.mosip.kernel kernel-transliteration-icu4j - 1.2.1-java21-SNAPSHOT + ${kernel.transliteration.icu4j.version} org.junit.vintage @@ -137,7 +127,6 @@ junit junit - ${junit.version} test @@ -146,7 +135,7 @@ org.springframework.boot spring-boot-maven-plugin - ${spring.boot.version} + ${spring.boot.maven.plugin.version} true ZIP @@ -183,7 +172,7 @@ org.springdoc springdoc-openapi-maven-plugin - 0.2 + ${springdoc.openapi.maven.plugin} integration-test @@ -204,4 +193,4 @@ - + \ No newline at end of file diff --git a/pre-registration/pre-registration-captcha-service/src/main/java/io/mosip/preregistration/captcha/config/SwaggerConfig.java b/pre-registration/pre-registration-captcha-service/src/main/java/io/mosip/preregistration/captcha/config/SwaggerConfig.java index 0ccc51e1328..950b3b35769 100644 --- a/pre-registration/pre-registration-captcha-service/src/main/java/io/mosip/preregistration/captcha/config/SwaggerConfig.java +++ b/pre-registration/pre-registration-captcha-service/src/main/java/io/mosip/preregistration/captcha/config/SwaggerConfig.java @@ -1,17 +1,14 @@ package io.mosip.preregistration.captcha.config; -import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.info.License; -import io.swagger.v3.oas.models.servers.Server; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.util.Collections; +import java.util.Map; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; import org.apache.hc.client5.http.impl.classic.HttpClients; import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springdoc.core.GroupedOpenApi; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -20,11 +17,11 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; -import java.security.KeyManagementException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.util.Collections; -import java.util.Map; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.servers.Server; @Configuration @ConfigurationProperties("mosip.preregistration.captcha") @@ -81,35 +78,17 @@ public RestTemplate restTemplateBean() throws KeyManagementException, NoSuchAlgo return new RestTemplate(requestFactory); } - private static final Logger logger = LoggerFactory.getLogger(SwaggerConfig.class); - - @Autowired - private OpenApiProperties openApiProperties; - @Bean - public OpenAPI openApi() { - OpenAPI api = new OpenAPI() - .components(new Components()) - .info(new Info() - .title(openApiProperties.getInfo().getTitle()) + public OpenAPI openApi(@Autowired OpenApiProperties openApiProperties) { + OpenAPI api = new OpenAPI().components(new Components()) + .info(new Info().title(openApiProperties.getInfo().getTitle()) .version(openApiProperties.getInfo().getVersion()) .description(openApiProperties.getInfo().getDescription()) - .license(new License() - .name(openApiProperties.getInfo().getLicense().getName()) + .license(new License().name(openApiProperties.getInfo().getLicense().getName()) .url(openApiProperties.getInfo().getLicense().getUrl()))); - openApiProperties.getService().getServers().forEach(server -> { - api.addServersItem(new Server().description(server.getDescription()).url(server.getUrl())); - }); - logger.info("swagger open api bean is ready"); + openApiProperties.getService().getServers().forEach( + server -> api.addServersItem(new Server().description(server.getDescription()).url(server.getUrl()))); return api; } - - @Bean - public GroupedOpenApi groupedOpenApi() { - return GroupedOpenApi.builder().group(openApiProperties.getGroup().getName()) - .pathsToMatch(openApiProperties.getGroup().getPaths().stream().toArray(String[]::new)) - .build(); - } - } diff --git a/pre-registration/pre-registration-captcha-service/src/main/java/io/mosip/preregistration/captcha/controller/CaptchaController.java b/pre-registration/pre-registration-captcha-service/src/main/java/io/mosip/preregistration/captcha/controller/CaptchaController.java index 44b45c4fc63..1c598f682a6 100644 --- a/pre-registration/pre-registration-captcha-service/src/main/java/io/mosip/preregistration/captcha/controller/CaptchaController.java +++ b/pre-registration/pre-registration-captcha-service/src/main/java/io/mosip/preregistration/captcha/controller/CaptchaController.java @@ -1,7 +1,5 @@ package io.mosip.preregistration.captcha.controller; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -21,11 +19,13 @@ import io.mosip.preregistration.core.config.LoggerConfiguration; import io.mosip.preregistration.core.util.DataValidationUtil; import io.mosip.preregistration.core.util.RequestValidator; +import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import springfox.documentation.annotations.ApiIgnore; @RestController @Tag(name = "captcha-controller", description = "Captcha Controller") @@ -54,12 +54,11 @@ public void initBinder(WebDataBinder binder) { @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) }) public ResponseEntity validateCaptcha(@Validated @RequestBody MainRequestDTO captchaRequest, - @ApiIgnore Errors errors) { + @ApiParam(hidden = true) Errors errors) { log.info("sessionId", "idType", "id", "In pre-registration captcha controller to validate the recaptcha token" + captchaRequest); requestValidator.validateId(VALIDATE, captchaRequest.getId(), errors); DataValidationUtil.validate(errors, VALIDATE); return new ResponseEntity<>(this.captchaService.validateCaptcha(captchaRequest.getRequest()), HttpStatus.OK); } - -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-core/pom.xml b/pre-registration/pre-registration-core/pom.xml index 194e953ffcf..d3a52b243c0 100644 --- a/pre-registration/pre-registration-core/pom.xml +++ b/pre-registration/pre-registration-core/pom.xml @@ -9,40 +9,22 @@ pre-registration-parent 1.2.1-java21-SNAPSHOT - 1.2.1-java21-SNAPSHOT - pre-registration-core - pre-registration-core Maven project of MOSIP Pre-Registration Service - 1.2.1-java21-SNAPSHOT - UTF-8 + 1.2.1-java21-SNAPSHOT 1.2.1-java21-SNAPSHOT 1.2.1-java21-SNAPSHOT - - - - - io.mosip.kernel - kernel-bom - 1.2.1-java21-SNAPSHOT - pom - import - - - - org.springframework.boot spring-boot-starter-web - ${spring.boot.version} com.fasterxml.jackson.datatype @@ -53,13 +35,11 @@ org.apache.httpcomponents httpclient - ${apache.httpclient.version} junit junit test - ${junit.version} io.mosip.kernel @@ -100,32 +80,15 @@ org.postgresql postgresql - ${postgresql.version} org.springdoc - springdoc-openapi-ui - - - org.springframework - spring-webmvc - - - - - io.springfox - springfox-swagger2 - ${swagger.version} - - - io.springfox - springfox-swagger-ui - ${swagger.version} + springdoc-openapi-starter-webmvc-ui + ${springdoc.openapi.starter.webmvc.ui.version} com.h2database h2 - ${h2.version} test @@ -136,17 +99,14 @@ org.springframework.boot spring-boot-starter-actuator - ${spring.boot.version} com.googlecode.json-simple json-simple - ${jsonsimple.version} org.apache.commons commons-collections4 - ${commons-collections4.version} org.junit.vintage @@ -161,4 +121,4 @@ spring-boot-starter-data-jpa - + \ No newline at end of file diff --git a/pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/config/TemplateConfiguration.java b/pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/config/TemplateConfiguration.java index 405098f3062..ad6368aa1a2 100644 --- a/pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/config/TemplateConfiguration.java +++ b/pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/config/TemplateConfiguration.java @@ -25,4 +25,4 @@ public class TemplateConfiguration { public TemplateManager templateManager(TemplateManagerBuilder templateManagerBuilder) { return templateManagerBuilder.build(); } -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-datasync-service/pom.xml b/pre-registration/pre-registration-datasync-service/pom.xml index a69356b712f..e14aa7eaf13 100644 --- a/pre-registration/pre-registration-datasync-service/pom.xml +++ b/pre-registration/pre-registration-datasync-service/pom.xml @@ -10,31 +10,17 @@ 1.2.1-java21-SNAPSHOT - pre-registration-datasync-service pre-registration-datasync-service - 1.2.1-java21-SNAPSHOT - UTF-8 - UTF-8 - 21 + 1.2.1-java21-SNAPSHOT 1.2.1-java21-SNAPSHOT - 1.4.2 + 1.2.1-java21-SNAPSHOT + 1.2.1-java21-SNAPSHOT - - - - io.mosip.kernel - kernel-bom - 1.2.1-java21-SNAPSHOT - pom - import - - - org.springframework.boot @@ -47,7 +33,6 @@ org.springframework.cloud spring-cloud-starter-config - ${spring-cloud-config.version} com.h2database @@ -115,7 +100,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring.boot.version} true ZIP @@ -143,12 +127,12 @@ io.mosip.kernel kernel-ref-idobjectvalidator - 1.2.1-java21-SNAPSHOT + ${kernel.ref.idobjectvalidator.version} io.mosip.kernel kernel-transliteration-icu4j - 1.2.1-java21-SNAPSHOT + ${kernel.transliteration.icu4j.version} org.junit.vintage @@ -157,7 +141,6 @@ junit junit - ${junit.version} test @@ -203,7 +186,7 @@ org.springdoc springdoc-openapi-maven-plugin - 0.2 + ${springdoc.openapi.maven.plugin} integration-test @@ -224,4 +207,4 @@ - + \ No newline at end of file diff --git a/pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/config/DataSyncConfig.java b/pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/config/DataSyncConfig.java index 2c4bab69f47..3ae4a8c7112 100644 --- a/pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/config/DataSyncConfig.java +++ b/pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/config/DataSyncConfig.java @@ -1,23 +1,23 @@ package io.mosip.preregistration.datasync.config; -import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.info.License; -import io.swagger.v3.oas.models.servers.Server; +import java.util.Collections; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springdoc.core.GroupedOpenApi; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.servers.Server; /** * Config for Data sync @@ -77,33 +77,17 @@ private Set protocols() { return protocols; } - @Autowired - private OpenApiProperties openApiProperties; - @Bean - public OpenAPI openApi() { - OpenAPI api = new OpenAPI() - .components(new Components()) - .info(new Info() - .title(openApiProperties.getInfo().getTitle()) + public OpenAPI openApi(@Autowired OpenApiProperties openApiProperties) { + OpenAPI api = new OpenAPI().components(new Components()) + .info(new Info().title(openApiProperties.getInfo().getTitle()) .version(openApiProperties.getInfo().getVersion()) .description(openApiProperties.getInfo().getDescription()) - .license(new License() - .name(openApiProperties.getInfo().getLicense().getName()) + .license(new License().name(openApiProperties.getInfo().getLicense().getName()) .url(openApiProperties.getInfo().getLicense().getUrl()))); - openApiProperties.getService().getServers().forEach(server -> { - api.addServersItem(new Server().description(server.getDescription()).url(server.getUrl())); - }); - logger.info("swagger open api bean is ready"); + openApiProperties.getService().getServers().forEach( + server -> api.addServersItem(new Server().description(server.getDescription()).url(server.getUrl()))); return api; } - - @Bean - public GroupedOpenApi groupedOpenApi() { - return GroupedOpenApi.builder().group(openApiProperties.getGroup().getName()) - .pathsToMatch(openApiProperties.getGroup().getPaths().stream().toArray(String[]::new)) - .build(); - } - } diff --git a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/DataSyncApplicationTest.java b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/DataSyncApplicationTest.java index 56f447f2aaf..86887b2f8ea 100644 --- a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/DataSyncApplicationTest.java +++ b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/DataSyncApplicationTest.java @@ -14,7 +14,7 @@ * */ @ComponentScan(basePackages = { "io.mosip.preregistration.core.*,io.mosip.preregistration.document.*" - + ",io.mosip.preregistration.datasync.*, io.mosip.kernel.core.*" + + ",io.mosip.preregistration.datasync.*, io.mosip.kernel.core.*,io.mosip.kernel.templatemanager.velocity.*" + ",io.mosip.kernel.emailnotifier.*,io.mosip.kernel.smsnotifier.*,io.mosip.kernel.cryotomanager.*" + ",io.mosip.kernel.auditmanger.*,io.mosip.kernel.idgenerator.*" }) @EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class }) diff --git a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/config/TestConfig.java b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/config/TestConfig.java index 0ec609e6956..88d6a1cfa72 100644 --- a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/config/TestConfig.java +++ b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/config/TestConfig.java @@ -23,19 +23,19 @@ public class TestConfig { @Bean public RestTemplate selfTokenRestTemplate() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException { - - TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; + TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; - SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom() - .loadTrustMaterial(null, acceptingTrustStrategy).build(); + SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy) + .build(); - SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); + SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); - HttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create().setSSLSocketFactory(csf).build(); - CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build(); - HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); + HttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create() + .setSSLSocketFactory(csf).build(); + CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build(); + HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); - requestFactory.setHttpClient(httpClient); - return new RestTemplate(requestFactory); + requestFactory.setHttpClient(httpClient); + return new RestTemplate(requestFactory); } -} +} \ No newline at end of file diff --git a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/controller/DataSyncControllerTest.java b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/controller/DataSyncControllerTest.java index 3a7dfc79268..138e7b3c85f 100644 --- a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/controller/DataSyncControllerTest.java +++ b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/controller/DataSyncControllerTest.java @@ -34,19 +34,15 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithUserDetails; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestContext; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.RequestBuilder; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.web.context.WebApplicationContext; import io.mosip.kernel.clientcrypto.service.spi.ClientCryptoManagerService; import io.mosip.kernel.core.signatureutil.model.SignatureResponse; import io.mosip.preregistration.core.common.dto.MainRequestDTO; import io.mosip.preregistration.core.common.dto.MainResponseDTO; -import io.mosip.preregistration.core.config.TemplateConfiguration; import io.mosip.preregistration.core.util.RequestValidator; import io.mosip.preregistration.datasync.DataSyncApplicationTest; import io.mosip.preregistration.datasync.dto.DataSyncRequestDTO; @@ -56,15 +52,18 @@ import io.mosip.preregistration.datasync.dto.ReverseDatasyncReponseDTO; import io.mosip.preregistration.datasync.errorcodes.ErrorMessages; import io.mosip.preregistration.datasync.service.DataSyncService; -import io.mosip.preregistration.datasync.test.config.TestConfig; @ComponentScan(basePackages = { "io.mosip.preregistration.core.*,io.mosip.preregistration.document.*" + ",io.mosip.preregistration.datasync.*, io.mosip.kernel.core.*" + ",io.mosip.kernel.emailnotifier.*,io.mosip.kernel.smsnotifier.*,io.mosip.kernel.cryotomanager.*" + ",io.mosip.kernel.auditmanger.*,io.mosip.kernel.idgenerator.*" }) +/* @SpringBootTest(classes = { DataSyncApplicationTest.class }) @RunWith(SpringRunner.class) @ContextConfiguration(classes = {TestConfig.class, TestContext.class, TemplateConfiguration.class, WebApplicationContext.class}) +@AutoConfigureMockMvc*/ +@SpringBootTest(classes = { DataSyncApplicationTest.class }) +@RunWith(SpringRunner.class) @AutoConfigureMockMvc public class DataSyncControllerTest { @@ -158,7 +157,6 @@ public void successRetrievePreidsTest() throws Exception { RequestBuilder requestBuilder = MockMvcRequestBuilders.get("/sync/{preRegistrationId}", "97285429827016") .contentType(MediaType.APPLICATION_JSON); mockMvc.perform(requestBuilder).andExpect(status().isOk()); - } @WithUserDetails("reg-officer") diff --git a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/DataSyncServiceTest.java b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/DataSyncServiceTest.java index a8aae69d102..f04c1e8afea 100644 --- a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/DataSyncServiceTest.java +++ b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/DataSyncServiceTest.java @@ -52,7 +52,6 @@ import io.mosip.preregistration.core.common.dto.MainRequestDTO; import io.mosip.preregistration.core.common.dto.MainResponseDTO; import io.mosip.preregistration.core.common.dto.SlotTimeDto; -import io.mosip.preregistration.core.config.TemplateConfiguration; import io.mosip.preregistration.core.exception.InvalidRequestParameterException; import io.mosip.preregistration.core.util.AuditLogUtil; import io.mosip.preregistration.datasync.DataSyncApplicationTest; @@ -76,10 +75,10 @@ @ComponentScan(basePackages = { "io.mosip.preregistration.core.*,io.mosip.preregistration.document.*" + ",io.mosip.preregistration.datasync.*, io.mosip.kernel.core.*" + ",io.mosip.kernel.emailnotifier.*,io.mosip.kernel.smsnotifier.*,io.mosip.kernel.cryotomanager.*" - + ",io.mosip.kernel.auditmanger.*,io.mosip.kernel.idgenerator.*,io.mosip.kernel.templatemanager.*" }) + + ",io.mosip.kernel.auditmanger.*,io.mosip.kernel.idgenerator.*" }) @RunWith(SpringRunner.class) @SpringBootTest(classes = { DataSyncApplicationTest.class }) -@ContextConfiguration(classes = {TestConfig.class, TestContext.class, TemplateConfiguration.class, WebApplicationContext.class}) +@ContextConfiguration(classes = {TestConfig.class, TestContext.class, /*TemplateConfiguration.class, */ WebApplicationContext.class}) public class DataSyncServiceTest { @Mock diff --git a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/util/DataSyncServiceUtilTest.java b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/util/DataSyncServiceUtilTest.java index 1bfed1ab2ef..47285e38ea6 100644 --- a/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/util/DataSyncServiceUtilTest.java +++ b/pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/util/DataSyncServiceUtilTest.java @@ -82,7 +82,7 @@ @SpringBootTest(classes = { DataSyncApplicationTest.class }) @TestPropertySource("classpath:application.properties") @ComponentScan(basePackages = { "io.mosip.preregistration.core.*,io.mosip.preregistration.document.*" - + ",io.mosip.preregistration.datasync.*, io.mosip.kernel.core.*" + + ",io.mosip.preregistration.datasync.repository.*,io.mosip.preregistration.datasync.entity.*,io.mosip.kernel.core.*" + ",io.mosip.kernel.emailnotifier.*,io.mosip.kernel.smsnotifier.*,io.mosip.kernel.cryotomanager.*" + ",io.mosip.kernel.auditmanger.*,io.mosip.kernel.idgenerator.*" }) @ContextConfiguration(classes = { TestConfig.class, TestContext.class, WebApplicationContext.class, From adeca0f9b2f669415b1c8871e653a89fff77c76a Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Mon, 10 Jun 2024 17:38:01 +0530 Subject: [PATCH 2/2] [Java21] Signed-off-by: JanardhanBS-SyncByte --- .../io/mosip/preregistration/application/config/Config.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/config/Config.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/config/Config.java index 7d461a0bd1a..9d244ab3584 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/config/Config.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/config/Config.java @@ -69,5 +69,4 @@ public RestTemplate restTemplateConfig() requestFactory.setHttpClient(httpClientBuilder.build()); return new RestTemplate(requestFactory); } - -} +} \ No newline at end of file