- * {@link #openApi()} registers an Authorize apiKey named
- * {@code Authorization} (header), same pattern as commons kernel-auth-service.
- *
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-@Configuration
-@ConfigurationProperties("mosip.preregistration.booking")
-public class BookingConfig {
-
- /** The id. */
- private Map id;
-
- /**
- * Sets the id.
- *
- * @param id the id
- */
- public void setId(Map id) {
- this.id = id;
- }
-
-
- /**
- * Id.
- *
- * @return the map
- */
- @Bean
- public Map ic() {
- return Collections.unmodifiableMap(id);
- }
-
- /**
- * Reference for ${application.env.local:false} from property file.
- */
- @Value("${application.env.local:false}")
- private Boolean localEnv;
-
- /**
- * Reference for ${swagger.base-url:#{null}} from property file.
- */
- @Value("${swagger.base-url:#{null}}")
- private String swaggerBaseUrl;
-
- /**
- * Reference for ${server.port:9095} from property file.
- */
- @Value("${server.port:9095}")
- private int serverPort;
-
- /**
- * To define Protocol
- */
- String proto = "http";
- /**
- * To define Host
- */
- String host = "localhost";
- /**
- * To define port
- */
- int port = -1;
- String hostWithPort = "localhost:9095";
-
- /**
- * @return set or protocols
- */
- private Set protocols() {
- Set protocols = new HashSet<>();
- protocols.add(proto);
- return protocols;
- }
-
- private static final Logger logger = LoggerFactory.getLogger(BookingConfig.class);
-
- /**
- * Scheme name shown by Swagger UI as Authorize (IDA-style Authorization apiKey).
- */
- public static final String AUTHORIZATION_SCHEME = "Authorization";
-
- @Autowired
- private OpenApiProperties openApiProperties;
-
- @Bean
- public OpenAPI openApi() {
- OpenAPI api = new OpenAPI()
- .components(new Components().addSecuritySchemes(AUTHORIZATION_SCHEME, authorizationApiKey()))
- .addSecurityItem(new SecurityRequirement().addList(AUTHORIZATION_SCHEME))
- .info(new Info()
- .title(openApiProperties.getInfo().getTitle())
- .version(openApiProperties.getInfo().getVersion())
- .description(openApiProperties.getInfo().getDescription())
- .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");
- return api;
- }
-
- /**
- * Header apiKey named {@code Authorization} so Swagger UI shows Authorize
- * with Name / In / Value (same as commons kernel-auth-service).
- *
- * @return the security scheme
- */
- private static SecurityScheme authorizationApiKey() {
- return new SecurityScheme().type(SecurityScheme.Type.APIKEY).in(SecurityScheme.In.HEADER)
- .name(AUTHORIZATION_SCHEME);
- }
-
- @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-booking-service/src/main/java/io/mosip/preregistration/booking/config/OpenApiProperties.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/config/OpenApiProperties.java
deleted file mode 100644
index 963ff70ad5f..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/config/OpenApiProperties.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package io.mosip.preregistration.booking.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-import java.util.List;
-
-/**
- * Binds {@code openapi.*} properties used by {@link BookingConfig} for Springdoc.
- */
-@Configuration
-@ConfigurationProperties(prefix = "openapi")
-@Data
-public class OpenApiProperties {
- /** API title, description, version, and license. */
- private InfoProperty info;
- /** Published server URLs for the OpenAPI document. */
- private Service service;
- /** Swagger UI group name and path filters. */
- private Group group;
-}
-
-/** OpenAPI info block bound from {@code openapi.info.*}. */
-@Data
-class InfoProperty {
- /** Display title in Swagger UI. */
- private String title;
- /** Longer description of the API. */
- private String description;
- /** Document version string. */
- private String version;
- /** License name and URL. */
- private LicenseProperty license;
-}
-
-/** License fields bound from {@code openapi.info.license.*}. */
-@Data
-class LicenseProperty {
- /** License display name (for example Mosip). */
- private String name;
- /** License document URL. */
- private String url;
-}
-
-/** Server list bound from {@code openapi.service.*}. */
-@Data
-class Service {
- /** OpenAPI servers (Try-it-out base URLs). */
- private List servers;
-}
-
-/** A single OpenAPI server URL and description. */
-@Data
-class Server {
- /** Human-readable server label. */
- private String description;
- /** Absolute or relative base URL. */
- private String url;
-}
-
-/** Path group bound from {@code openapi.group.*}. */
-@Data
-class Group {
- /** Springdoc group name. */
- private String name;
- /** Ant-style paths included in this group. */
- private List paths;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/controller/BookingController.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/controller/BookingController.java
deleted file mode 100644
index e3b6b5193db..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/controller/BookingController.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.controller;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
-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.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.InitBinder;
-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.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import io.mosip.kernel.core.exception.ParseException;
-import io.mosip.kernel.core.logger.spi.Logger;
-import io.mosip.preregistration.booking.dto.AvailabilityDto;
-import io.mosip.preregistration.booking.dto.BookingDataByRegIdDto;
-import io.mosip.preregistration.booking.dto.BookingRequestDTO;
-import io.mosip.preregistration.booking.dto.BookingStatus;
-import io.mosip.preregistration.booking.dto.BookingStatusDTO;
-import io.mosip.preregistration.booking.dto.MultiBookingRequest;
-import io.mosip.preregistration.booking.service.BookingServiceIntf;
-import io.mosip.preregistration.core.common.dto.BookingRegistrationDTO;
-import io.mosip.preregistration.core.common.dto.CancelBookingResponseDTO;
-import io.mosip.preregistration.core.common.dto.DeleteBookingDTO;
-import io.mosip.preregistration.core.common.dto.MainRequestDTO;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import io.mosip.preregistration.core.common.dto.PreRegIdsByRegCenterIdResponseDTO;
-import io.mosip.preregistration.core.config.LoggerConfiguration;
-import io.mosip.preregistration.core.util.DataValidationUtil;
-import io.mosip.preregistration.core.util.RequestValidator;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-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.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-
-/**
- * This class provides different API's to perform operations on Booking
- * Application
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-@RestController
-@RequestMapping("/")
-@Tag(name = "booking-controller", description = "Booking Controller")
-@SecurityRequirement(name = "Authorization")
-public class BookingController {
-
- /** Autowired reference for {@link #bookingService}. */
- @Autowired
- private BookingServiceIntf bookingService;
-
- /** Validates MOSIP request ids on POST/PUT bodies. */
- @Autowired
- private RequestValidator requestValidator;
-
- /** MOSIP request-id constant for booking APIs. */
- private static final String BOOKING = "book";
-
-
- /**
- * Inits the binder.
- *
- * @param binder the binder
- */
- @InitBinder
- public void initBinder(WebDataBinder binder) {
- binder.addValidators(requestValidator);
- }
-
-
- private Logger log = LoggerConfiguration.logConfig(BookingController.class);
-
-
- /**
- * Get API to get availability details.
- *
- * @param registration_center_id
- * @return MainResponseDTO
- */
- //@PreAuthorize("hasAnyRole('INDIVIDUAL')")
- @PreAuthorize("hasAnyRole(@authorizedRoles.getGetappointmentavailability())")
- @GetMapping(path = "/appointment/availability/{registrationCenterId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Fetch availability Data", description = "Fetch availability Data", tags = "booking-controller")
- @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Availability 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))) })
- public ResponseEntity> getAvailability(
- @PathVariable("registrationCenterId") String registrationCenterId) {
- log.info("sessionId", "idType", "id",
- "In getAvailability method of Booking controller to fetch the availability for regID: "
- + registrationCenterId);
- return ResponseEntity.status(HttpStatus.OK).body(bookingService.getAvailability(registrationCenterId));
- }
-
- /**
- * Post API to book the appointment.
- *
- * @param MainListRequestDTO
- * @return MainResponseDTO
- * @throws ParseException
- * @throws java.text.ParseException
- */
- //@PreAuthorize("hasAnyRole('INDIVIDUAL')")
- @PreAuthorize("hasAnyRole(@authorizedRoles.getPostappointmentpreregistrationid())")
- @PostMapping(path = "/appointment/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Booking Appointment", description = "Booking Appointment", tags = "booking-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))) })
- public ResponseEntity> bookAppoinment(
- @PathVariable("preRegistrationId") String preRegistrationId,
- @Validated @RequestBody(required = true) MainRequestDTO bookingDTO, @Parameter(hidden = true) Errors errors ) {
- log.info("sessionId", "idType", "id",
- "In bookAppoinment method of Booking controller to book an appointment for object: " + bookingDTO);
- requestValidator.validateId(BOOKING, bookingDTO.getId(), errors);
- DataValidationUtil.validate(errors,BOOKING);
- return ResponseEntity.status(HttpStatus.OK).body(bookingService.bookAppointment(bookingDTO, preRegistrationId));
- }
-
- /**
- * Post API to book the appointment.
- *
- * @param MainListRequestDTO
- * @return MainResponseDTO
- * @throws ParseException
- * @throws java.text.ParseException
- */
- //@PreAuthorize("hasAnyRole('INDIVIDUAL')")
- @PreAuthorize("hasAnyRole(@authorizedRoles.getPostappointment())")
- @PostMapping(path = "/appointment", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Booking Appointment", description = "Booking Appointment", tags = "booking-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))) })
- public ResponseEntity> bookMultiAppoinment(
- @Validated @RequestBody(required = true) MainRequestDTO bookingRequest, @Parameter(hidden = true) Errors errors) {
- log.info("sessionId", "idType", "id",
- "In bookAppoinment method of Booking controller to book an appointment for object: " + bookingRequest);
- requestValidator.validateId(BOOKING, bookingRequest.getId(), errors);
- DataValidationUtil.validate(errors,BOOKING);
- return ResponseEntity.status(HttpStatus.OK).body(bookingService.bookMultiAppointment(bookingRequest));
- }
-
- /**
- * Get API to get the booked appointment details.
- *
- * @param MainListRequestDTO
- * @return MainResponseDTO
- * @throws ParseException
- * @throws java.text.ParseException
- */
-
- //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ ADMIN','PRE_REGISTRATION_ADMIN')")
- @PreAuthorize("hasAnyRole(@authorizedRoles.getGetappointmentpreregistrationid())")
- @GetMapping(path = "/appointment/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Fetch Appointment details", description = "Fetch Appointment details", tags = "booking-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))) })
- public ResponseEntity> getAppointments(
- @PathVariable("preRegistrationId") String preRegistrationId) {
- log.info("sessionId", "idType", "id",
- "In appointmentDetails method of Booking controller to fetch appointment details for preRegID: "
- + preRegistrationId);
- return ResponseEntity.status(HttpStatus.OK).body(bookingService.getAppointmentDetails(preRegistrationId));
-
- }
-
- /**
- * Put API to cancel the appointment.
- *
- * @param MainListRequestDTO
- * @return MainResponseDTO
- * @throws ParseException
- * @throws java.text.ParseException
- */
- //@PreAuthorize("hasAnyRole('INDIVIDUAL')")
- @PreAuthorize("hasAnyRole(@authorizedRoles.getPutappointmentpreregistrationid())")
- @PutMapping(path = "/appointment/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Cancel an booked appointment", description = "Cancel an booked appointment", tags = "booking-controller")
- @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Appointment canceled 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("sessionId", "idType", "id",
- "In cancelBook method of Booking controller to cancel the appointment for object: " + preRegistrationId);
- return ResponseEntity.status(HttpStatus.OK)
- .body(bookingService.cancelAppointment(preRegistrationId));
- }
-
- /**
- * Put API to cancel the appointment for Pre-registration batch job.
- *
- * @param MainListRequestDTO
- * @return MainResponseDTO
- * @throws ParseException
- * @throws java.text.ParseException
- */
- //@PreAuthorize("hasAnyRole('PRE_REGISTRATION_ADMIN','REGISTRATION_SUPERVISOR')")
- @PreAuthorize("hasAnyRole(@authorizedRoles.getPutbatchappointmentpreregistrationid())")
- @PutMapping(path = "/batch/appointment/{preRegistrationId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Cancel an booked appointment", description = "Cancel an booked appointment", tags = "booking-controller")
- @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Appointment canceled 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> cancelAppointmentBatch(
- @PathVariable("preRegistrationId") String preRegistrationId) {
- log.info("sessionId", "idType", "id",
- "In cancelAppointmentBatch method of Booking controller to cancel the appointment for object: " + preRegistrationId+" triggered by batch job");
- return ResponseEntity.status(HttpStatus.OK)
- .body(bookingService.cancelAppointmentBatch(preRegistrationId));
- }
-
- /**
- * Delete API to delete the Individual booking associated with the PreId.
- *
- * @param preId
- * the pre id
- * @return the deletion status of booking for a pre-id
- */
- //@PreAuthorize("hasAnyRole('INDIVIDUAL')")
- @PreAuthorize("hasAnyRole(@authorizedRoles.getDeleteappointment())")
- @DeleteMapping(path = "/appointment", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Discard Booking", description = "Discard Booking", tags = "booking-controller")
- @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Deletion of Booking is successfully"),
- @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(hidden = true))),
- @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))),
- })
- public ResponseEntity> discardIndividual(
- @RequestParam(value = "preRegistrationId") String preId) {
- log.info("sessionId", "idType", "id", "In Booking controller for deletion of booking with preId " + preId);
-
- return ResponseEntity.status(HttpStatus.OK).body(bookingService.deleteBooking(preId));
- }
-
- /**
- * Get API to fetch all the booked pre-ids within from-date and to-date range.
- *
- * @param fromDate
- * the from date
- * @param toDate
- * the to date
- * @return the booked pre-ids for date range
- */
- //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ ADMIN')")
- @PreAuthorize("hasAnyRole(@authorizedRoles.getGetappointmentpreregistrationidregistrationcenterid())")
- @GetMapping(path = "/appointment/preRegistrationId/{registrationCenterId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Get Pre-Registartion ids By Booked Date Time And Registration center id",
- description = "Get Pre-Registartion ids By Booked Date Time And Registration center id", tags = "booking-controller")
- @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Booked 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> getBookedDataByDate(
- @RequestParam(value = "from_date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd") String fromDate,
- @RequestParam(value = "to_date") @DateTimeFormat(pattern = "yyyy-MM-dd") String toDate,
- @PathVariable("registrationCenterId") String regCenterId) {
- log.info("sessionId", "idType", "id",
- "In booking controller for fetching all booked preids " + fromDate + " to " + toDate);
- return ResponseEntity.status(HttpStatus.OK)
- .body(bookingService.getBookedPreRegistrationByDate(fromDate, toDate, regCenterId));
- }
-
-
- /**
- * Get API to fetch all the booked pre-ids within from-date and to-date range.
- *
- * @param fromDate
- * the from date
- * @param toDate
- * the to date
- * @return the booked pre-ids for date range
- */
- //@PreAuthorize("hasAnyRole('INDIVIDUAL','REGISTRATION_OFFICER','REGISTRATION_SUPERVISOR','REGISTRATION_ ADMIN')")
- @PreAuthorize("hasAnyRole(@authorizedRoles.getGetappointmentregistrationcenterid())")
- @GetMapping(path = "/appointment/registrationCenterId/{registrationCenterId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Get Pre-Registartion ids By Booked Date Time And Registration center id",
- description = "Get Pre-Registartion ids By Booked Date Time And Registration center id", tags = "booking-controller")
- @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Booked 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> getBookedDataByRegId(
- @RequestParam(value = "from_date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd") String fromDate,
- @RequestParam(value = "to_date") @DateTimeFormat(pattern = "yyyy-MM-dd") String toDate,
- @PathVariable("registrationCenterId") String regCenterId) {
- log.info("sessionId", "idType", "id",
- "In booking controller for fetching all booked preids " + fromDate + " to " + toDate);
- return ResponseEntity.status(HttpStatus.OK)
- .body(bookingService.getBookedPreRegistrations(fromDate, toDate, regCenterId));
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/AvailabilityDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/AvailabilityDto.java
deleted file mode 100644
index d0b91e8f9d9..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/AvailabilityDto.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.util.List;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Availability calendar for one registration centre.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-public class AvailabilityDto {
-
- /** Registration centre id. */
- private String regCenterId;
-
- /** Per-day slots (including holidays). */
- private List centerDetails;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/AvailabilityReqDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/AvailabilityReqDto.java
deleted file mode 100644
index 2ef79fefc19..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/AvailabilityReqDto.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Request body used to fetch availability for one centre.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-public class AvailabilityReqDto {
- /** Registration centre whose slots are requested. */
- private String registrationCenterId;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingDataByRegIdDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingDataByRegIdDto.java
deleted file mode 100644
index d2f50f803cd..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingDataByRegIdDto.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.time.LocalDate;
-import java.util.Map;
-
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Booked pre-ids grouped by appointment date for one registration centre.
- */
-@Data
-@Getter
-@Setter
-public class BookingDataByRegIdDto {
-
- /** Registration centre id. */
- private String registrationCenterId;
-
- /** pre-id → (date → slot). */
- private Map> idsWithAppointmentDate;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingRequestDTO.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingRequestDTO.java
deleted file mode 100644
index 5d8c5a76062..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingRequestDTO.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Getter;
-import lombok.Setter;
-
-
-/**
- * Appointment request: centre, date, and from/to slot.
- *
- * @author Kishan Rathore
- * @since 1.0.0
- */
-@Getter
-@Setter
-public class BookingRequestDTO implements Serializable{
- /**
- *
- */
- /** Serialization version. */
- private static final long serialVersionUID = 3339740008361919496L;
- /**
- * registration Center Id
- */
- @JsonProperty("registration_center_id")
- @ApiModelProperty(value = "Registration Center ID", position = 1)
- private String registrationCenterId;
- /**
- * booked Date Time
- */
- @JsonProperty("appointment_date")
- @ApiModelProperty(value = "Appointment Date", position = 2)
- private String regDate;
- /**
- * booked from Time Slot
- */
- @JsonProperty("time_slot_from")
- @ApiModelProperty(value = "From Time Slot", position = 3)
- private String slotFromTime;
- /**
- * booked to Time Slot
- */
- @JsonProperty("time_slot_to")
- @ApiModelProperty(value = "To Time Slot", position = 4)
- private String slotToTime;
-
-}
\ No newline at end of file
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingStatus.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingStatus.java
deleted file mode 100644
index 97b799ececd..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingStatus.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.util.List;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Multi-appointment response: one status per requested pre-id.
- */
-@Getter
-@Setter
-public class BookingStatus {
-
- /** Per-pre-id booking outcomes. */
- List bookingStatusResponse;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingStatusDTO.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingStatusDTO.java
deleted file mode 100644
index be5370dac91..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/BookingStatusDTO.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Single booking outcome message.
- */
-@Getter
-@Setter
-public class BookingStatusDTO {
-
- /** Human-readable booking result. */
- private String bookingMessage;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/CancelBookingDTO.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/CancelBookingDTO.java
deleted file mode 100644
index e9068a7133b..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/CancelBookingDTO.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class CancelBookingDTO implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * registration Center Id
- */
- @JsonProperty("registration_center_id")
- @ApiModelProperty(value = "Registration Center ID", position = 2)
- private String registrationCenterId;
- /**
- * booked Date Time
- */
- @JsonProperty("appointment_date")
- @ApiModelProperty(value = "Appointment Date", position = 3)
- private String regDate;
- /**
- * booked Time Slot
- */
- @JsonProperty("time_slot_from")
- @ApiModelProperty(value = "From Time Slot", position = 4)
- private String slotFromTime;
-
- /**
- * booked to Time Slot
- */
- @JsonProperty("time_slot_to")
- @ApiModelProperty(value = "To Time Slot", position = 5)
- private String slotToTime;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/DateTimeDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/DateTimeDto.java
deleted file mode 100644
index 8c785767d9b..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/DateTimeDto.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.util.List;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * One calendar day of slot availability for a centre.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-public class DateTimeDto {
-
- /** Calendar date (ISO local date string). */
- private String date;
-
- /** {@code true} when the centre is closed for a holiday. */
- private boolean isHoliday;
-
- /** Bookable slots on {@link #date}. */
- private List timeSlots;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/DemographicBookingRightJoin.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/DemographicBookingRightJoin.java
deleted file mode 100644
index 42b2d6ded5e..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/DemographicBookingRightJoin.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.time.LocalTime;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * Join projection of demographic status and booked slot.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@AllArgsConstructor
-public class DemographicBookingRightJoin implements Serializable {
-
- /**
- *
- */
- /** Serialization version. */
- private static final long serialVersionUID = -6964396778095509912L;
-
- /** Status of the preid */
- private String statusCode;
-
- /** Registration center id. */
- private String registrationCenterId;
-
- /** Slot from time. */
- private LocalTime slotFromTime;
-
- /** Slot to time. */
- private LocalTime slotToTime;
-
- /** Appointment date. */
- private LocalDate regDate;
-
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/HolidayDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/HolidayDto.java
deleted file mode 100644
index f30fbf37ad5..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/HolidayDto.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.util.List;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Holiday row returned with registration-centre masterdata.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-public class HolidayDto {
- /** Holiday identifier. */
- private String holidayId;
- /** Calendar date of the holiday. */
- private String holidayDate;
- /**
- * Holiday day is day of week as integer value, week start from Monday , Monday is 1 and Sunday is 7
- */
- private String holidayDay;
- /**
- * Holiday month is month of the year as integer value.
- */
- private String holidayMonth;
- /** Four-digit year. */
- private String holidayYear;
- /** Display name of the holiday. */
- private String holidayName;
- /** Language of {@link #holidayName}. */
- private String languageCode;
- /** Whether the holiday is currently active. */
- private Boolean isActive;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/MultiBookingRequest.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/MultiBookingRequest.java
deleted file mode 100644
index 5b7e2e2e46f..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/MultiBookingRequest.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.util.List;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Wrapper for several appointment requests in one API call.
- *
- * @author Kishan Rathore
- * @since 1.0.0
- */
-@Getter
-@Setter
-public class MultiBookingRequest {
-
- /** Individual booking rows. */
- List bookingRequest;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/MultiBookingRequestDTO.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/MultiBookingRequestDTO.java
deleted file mode 100644
index 1d5e4534e72..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/MultiBookingRequestDTO.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import io.mosip.preregistration.core.common.dto.BookingRegistrationDTO;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * One row of a multi-booking request (pre-id plus slot).
- *
- * @author Kishan Rathore
- * @since 1.0.0
- */
-@Getter
-@Setter
-public class MultiBookingRequestDTO implements Serializable{
-
- /**
- *
- */
- /** Serialization version. */
- private static final long serialVersionUID = -4081838636811604986L;
- /**
- * pre-Registration Id
- */
- @ApiModelProperty(value = "Pre-Registration ID", position = 1)
- private String preRegistrationId;
- /**
- * registration Center Id
- */
- @JsonProperty("registration_center_id")
- @ApiModelProperty(value = "Registration Center ID", position = 1)
- private String registrationCenterId;
- /**
- * booked Date Time
- */
- @JsonProperty("appointment_date")
- @ApiModelProperty(value = "Appointment Date", position = 2)
- private String regDate;
- /**
- * booked from Time Slot
- */
- @JsonProperty("time_slot_from")
- @ApiModelProperty(value = "From Time Slot", position = 3)
- private String slotFromTime;
- /**
- * booked to Time Slot
- */
- @JsonProperty("time_slot_to")
- @ApiModelProperty(value = "To Time Slot", position = 4)
- private String slotToTime;
-
-}
\ No newline at end of file
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/RegistrationCenterDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/RegistrationCenterDto.java
deleted file mode 100644
index 012e16d5ebd..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/RegistrationCenterDto.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.time.LocalTime;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Registration-centre masterdata used to generate appointment slots.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-public class RegistrationCenterDto {
-
- /** Centre identifier. */
- private String id;
-
- /** Display name. */
- private String name;
-
- /** Centre type code from masterdata. */
- private String centerTypeCode;
-
- /** Address line 1. */
- private String addressLine1;
-
- /** Address line 2. */
- private String addressLine2;
-
- /** Address line 3. */
- private String addressLine3;
-
- /** Latitude. */
- private String latitude;
-
- /** Longitude. */
- private String longitude;
-
- /** Location hierarchy code. */
- private String locationCode;
-
- /** Holiday location code used to load holidays. */
- private String holidayLocationCode;
-
- /** Contact phone. */
- private String contactPhone;
-
- /** Number of stations at the centre. */
- private Short numberOfStations;
-
- /** Working-hours description. */
- private String workingHours;
-
- /** Language of textual fields. */
- private String langCode;
-
- /** Number of kiosks. */
- private Short numberOfKiosks;
-
- /** Processing time per kiosk (slot length). */
- private LocalTime perKioskProcessTime;
-
- /** Centre opening time. */
- private LocalTime centerStartTime;
-
- /** Centre closing time. */
- private LocalTime centerEndTime;
-
- /** IANA or MOSIP time zone id. */
- private String timeZone;
-
- /** Contact person name. */
- private String contactPerson;
-
- /** Lunch break start. */
- private LocalTime lunchStartTime;
-
- /** Lunch break end. */
- private LocalTime lunchEndTime;
-
- /** Whether the centre is active. */
- private Boolean isActive;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/RegistrationCenterHolidayDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/RegistrationCenterHolidayDto.java
deleted file mode 100644
index e7e94762274..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/RegistrationCenterHolidayDto.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.util.List;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Masterdata payload: one centre plus its holidays.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-public class RegistrationCenterHolidayDto {
- /** Centre metadata used to generate slots. */
- private RegistrationCenterDto registrationCenter;
- /** Holidays for that centre. */
- private List holidays;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/RegistrationCenterResponseDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/RegistrationCenterResponseDto.java
deleted file mode 100644
index 62d57558746..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/RegistrationCenterResponseDto.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.util.List;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Masterdata list wrapper for registration centres.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-public class RegistrationCenterResponseDto {
- /** Centres returned by masterdata. */
- private List registrationCenters;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/SlotDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/SlotDto.java
deleted file mode 100644
index 38e7489d53d..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/SlotDto.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.time.LocalTime;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * A bookable time window and remaining capacity.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-public class SlotDto {
-
- /** Slot start (inclusive). */
- private LocalTime fromTime;
-
- /** Slot end (exclusive or inclusive per MOSIP config). */
- private LocalTime toTime;
-
- /** Remaining appointments that can still be booked in this slot. */
- private int availability;
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/SlotTimeDto.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/SlotTimeDto.java
deleted file mode 100644
index cab008af172..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/dto/SlotTimeDto.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package io.mosip.preregistration.booking.dto;
-
-import java.time.LocalTime;
-
-import lombok.Data;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Slot start/end used in booked-pre-id query responses.
- */
-@Data
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-public class SlotTimeDto {
-
- /** Slot start. */
- private LocalTime fromTime;
-
- /** Slot end. */
- private LocalTime toTime;
-
- /**
- * @param fromTime slot start
- * @param toTime slot end
- */
- public SlotTimeDto(LocalTime fromTime, LocalTime toTime) {
- this.fromTime = fromTime;
- this.toTime = toTime;
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailabilityPK.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailabilityPK.java
deleted file mode 100644
index 609d103bb30..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailabilityPK.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.entity;
-
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.time.LocalTime;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * This entity class defines the database table details for Booking application.
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-@Embeddable
-@Getter
-@Setter
-public class AvailabilityPK implements Serializable{
-
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = -4022968783477038513L;
-
- /** Registration_Center_Id. */
- @Column(name = "regcntr_id")
- private String regcntrId;
-
- /** Availability_Date. */
- @Column(name = "availability_date")
- private LocalDate regDate;
-
- /**Slot_From_Time. */
- @Column(name = "slot_from_time")
- private LocalTime fromTime;
-
-
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailibityEntity.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailibityEntity.java
deleted file mode 100644
index 1b620d6aaff..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailibityEntity.java
+++ /dev/null
@@ -1,98 +0,0 @@
-
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.entity;
-
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-
-import jakarta.persistence.AttributeOverride;
-import jakarta.persistence.AttributeOverrides;
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.IdClass;
-import jakarta.persistence.NamedQuery;
-import jakarta.persistence.Table;
-
-import org.springframework.stereotype.Component;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * This entity class defines the database table details for Booking application.
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-@Component
-@Entity
-@Table(name = "reg_available_slot", schema = "prereg")
-@Getter
-@Setter
-@NoArgsConstructor
-@ToString
-@IdClass(AvailabilityPK.class)
-@NamedQuery(name = "AvailibityEntity.findDate", query = "SELECT DISTINCT regDate FROM AvailibityEntity where regcntrId=:regcntrId and regDate>=:fromDate and regDate<=:toDate order by regDate ASC")
-public class AvailibityEntity implements Serializable {
-
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 1L;
-
- /** Registration center Id. */
- @Id
- @AttributeOverrides({ @AttributeOverride(name = "regcntrId", column = @Column(name = "regcntr_id")),
- @AttributeOverride(name = "regDate", column = @Column(name = "availability_date")),
- @AttributeOverride(name = "fromTime", column = @Column(name = "slot_from_time")) })
-
- private String regcntrId;
-
- /** Registration date. */
- private LocalDate regDate;
-
- /** From date. */
- private LocalTime fromTime;
-
- /** Slot to time. */
- @Column(name = "slot_to_time")
- private LocalTime toTime;
-
- /** Available Kiosks. */
- @Column(name = "available_kiosks")
- private int availableKiosks;
-
- /** Created by. */
- @Column(name = "cr_by")
- private String crBy;
-
- /** Created date time. */
- @Column(name = "cr_dtimes")
- private LocalDateTime crDate;
-
- /** Updated by. */
- @Column(name = "upd_by")
- private String upBy;
-
- /** Updated date time. */
- @Column(name = "upd_dtimes")
- private LocalDateTime updDate;
-
- /** Is deleted. */
- @Column(name = "is_deleted")
- private boolean isDeleted;
-
- /** Delete date time. */
- @Column(name = "del_dtimes")
- private LocalDateTime delTime;
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/errorcodes/ErrorCodes.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/errorcodes/ErrorCodes.java
deleted file mode 100644
index 36347da3796..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/errorcodes/ErrorCodes.java
+++ /dev/null
@@ -1,75 +0,0 @@
-
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.errorcodes;
-
-/**
- * This Enum provides the constant variables to define Error codes.
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-public enum ErrorCodes {
- PRG_BOOK_RCI_001("PRG_BOOK_RCI_001"), // Appointment cannot be booked
- PRG_BOOK_RCI_002("PRG_BOOK_RCI_002"), // availability not thr for selected time
- PRG_BOOK_RCI_003("PRG_BOOK_RCI_003"), // User has not been selected any time slot
- PRG_BOOK_RCI_004("PRG_BOOK_RCI_004"), // Appointment time slot is already booked
- PRG_BOOK_RCI_005("PRG_BOOK_RCI_005"), // Appointment booking failed
- PRG_BOOK_RCI_006("PRG_BOOK_RCI_006"), // Pre id not found
- PRG_BOOK_RCI_007("PRG_BOOK_RCI_007"), // reg center id not found
- PRG_BOOK_RCI_008("PRG_BOOK_RCI_008"), // date is not selected
- PRG_BOOK_RCI_010("PRG_BOOK_RCI_010"), // Booking Table not accessible
- PRG_BOOK_RCI_011("PRG_BOOK_RCI_011"), // status code updation failed
- PRG_BOOK_RCI_012("PRG_BOOK_RCI_012"), // get status code failed
- PRG_BOOK_RCI_014("PRG_BOOK_RCI_014"), // no slots available for that date
- PRG_BOOK_RCI_015("PRG_BOOK_RCI_015"), // No time slots are assigned to that registration center
- PRG_BOOK_RCI_013("PRG_BOOK_RCI_013"), // Booking data not found
- PRG_BOOK_RCI_016("PRG_BOOK_RCI_016"), // availability table is not accessable
- PRG_BOOK_RCI_017("PRG_BOOK_RCI_017"), // Appointment time slot is already canceled.
- PRG_BOOK_RCI_018("PRG_BOOK_RCI_018"), // Appointment can not be canceled.
- PRG_BOOK_RCI_019("PRG_BOOK_RCI_019"), // Cancel Appointmenct failed
- PRG_BOOK_RCI_020("PRG_BOOK_RCI_020"), // Master service not available
- PRG_BOOK_RCI_021("PRG_BOOK_RCI_021"), // Rebooking failed
- PRG_BOOK_RCI_022("PRG_BOOK_RCI_022"), // Invalid request parameter
- PRG_BOOK_RCI_023("PRG_BOOK_RCI_023"), // DOCUMENTS_NOT_FOUND_EXCEPTION
- PRG_BOOK_RCI_024("PRG_BOOK_RCI_024"), // AVAILABILITY_UPDATE_FAILED
- PRG_BOOK_RCI_025("PRG_BOOK_RCI_025"), // HTTP_CLIENT_EXCEPTION
- PRG_BOOK_RCI_026("PRG_BOOK_RCI_026"), // Booking status cannot be done altered before.
- PRG_BOOK_RCI_027("PRG_BOOK_RCI_027"), // Delete Booking not allowed
- PRG_BOOK_RCI_028("PRG_BOOK_RCI_028"), // FAILED_TO_DELETE_THE_PRE_REGISTRATION_RECORD
- PRG_BOOK_RCI_029("PRG_BOOK_RCI_029"), // APPONIMENT_CANNOT_BE_CANCELED
- PRG_BOOK_RCI_030("PRG_BOOK_RCI_030"),
- PRG_BOOK_RCI_031("PRG_BOOK_RCI_031"), // Invalid Booking Date Time
- PRG_BOOK_RCI_032("PRG_BOOK_RCI_032"),// BOOKING_NOT_FOUND_FOR_THE_DATE_RANGE
- PRG_PAM_APP_005("PRG_PAM_APP_005"), // failed to update in demographic entity
- PRG_BOOK_RCI_033("PRG_BOOK_RCI_033"),// notification failed exception
- PRG_BOOK_RCI_034("PRG_BOOK_RCI_034"),
- PRG_BOOK_RCI_035("PRG_BOOK_RCI_035"),// reg center id not found
- PRG_BOOK_RCI_036("PRG_BOOK_RCI_036"); //Appointmnet cannot be booked for incomplete application
-
-
- /**
- * @param code
- */
- private ErrorCodes(String code) {
- this.code = code;
- }
-
- /**
- * Code
- */
- private final String code;
-
- /**
- * @return the code
- */
- public String getCode() {
- return code;
- }
-
-}
\ No newline at end of file
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/errorcodes/ErrorMessages.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/errorcodes/ErrorMessages.java
deleted file mode 100644
index 219e21d5a5c..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/errorcodes/ErrorMessages.java
+++ /dev/null
@@ -1,199 +0,0 @@
-
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.errorcodes;
-
-/**
- * This Enum provides the constant variables to define Error Messages.
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-/**
- * @author M1043008
- *
- */
-public enum ErrorMessages {
- /**
- * ErrorMessage for PRG_BOOK_RCI_001
- */
- BOOKING_TABLE_NOT_ACCESSIBLE("Booking table not found"),
- /**
- * ErrorMessage for PRG_BOOK_RCI_002
- */
- REGISTRATION_TABLE_NOT_ACCESSIBLE("Registration table to accessible"),
- /**
- * ErrorMessage for PRG_BOOK_RCI_003
- */
- USER_HAS_NOT_SELECTED_TIME_SLOT("User has not selected time slot"),
- /**
- * ErrorMessage for PRG_BOOK_RCI_004
- */
- APPOINTMENT_TIME_SLOT_IS_ALREADY_BOOKED("Appointment time slot is already booked"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- PREREGISTRATION_ID_NOT_ENTERED("Preregistration id not entered"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- REGISTRATION_CENTER_ID_NOT_ENTERED("Registration center id not entered"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- BOOKING_DATE_TIME_NOT_SELECTED("Booking date time not selected"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- INVALID_ID("Invalid id"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- INVALID_VERSION("Invalid version"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- APPOINTMENT_CANNOT_BE_BOOKED("Appointment cannot be booked"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- AVAILABILITY_NOT_FOUND_FOR_THE_SELECTED_TIME(
- "Appointment booking/re-booking cannot be done as the requested slot is not available. Please select another slot or try again later"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- APPOINTMENT_BOOKING_FAILED("Appointment booking/re-booking cannot be done"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- TABLE_NOT_FOUND_EXCEPTION("Table not found exception"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- DEMOGRAPHIC_STATUS_UPDATION_FAILED("Demographic status updation failed"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- NO_TIME_SLOTS_ASSIGNED_TO_THAT_REG_CENTER("No available slots found for specified registration center"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- DEMOGRAPHIC_GET_STATUS_FAILED("Demographic get status failed"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- AVAILABILITY_TABLE_NOT_ACCESSABLE("Availablity table not accessible"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- BOOKING_DATA_NOT_FOUND("Booking data not found"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- APPOINTMENT_CANNOT_BE_CANCELED("Appointment cannot be canceled"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- APPOINTMENT_TIME_SLOT_IS_ALREADY_CANCELED("Appointment time slot is already canceled"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- APPOINTMENT_CANCEL_FAILED("Appointment cancel failed"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- APPOINTMENT_REBOOKING_FAILED("Appointment rebooking failed"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- MASTER_DATA_NOT_FOUND("Master data not found"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- HOLIDAY_MASTER_DATA_NOT_FOUND("Holiday master data not found"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- INVALID_REQUEST_PARAMETER("Invalid request parameter"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- DOCUMENTS_NOT_FOUND_EXCEPTION("Documents not found exception"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- DEMOGRAPHIC_SERVICE_CALL_FAILED("Demographic service call failed"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- AVAILABILITY_UPDATE_FAILED("Availablity update failed"),
- /**
- * ErrorMessage for PRG_TRL_APP_001
- */
- HTTP_CLIENT_EXCEPTION("Http client exception"),
- /**
- * ErrorMessage for PRG_TRL_APP_026
- */
- BOOKING_CANNOT_BE_DONE("Appointment re-booking cannot be done within"),
-
- /**
- * ErrorMessage for PRG_TRL_APP_027
- */
- DELETE_BOOKING_NOT_ALLOWED("Delete booking not allowed"),
- /**
- * ErrorMessage for PRG_TRL_APP_028
- */
- FAILED_TO_DELETE_THE_PRE_REGISTRATION_RECORD("Failed to delete the pre registration record"),
- /**
- * ErrorMessage for PRG_TRL_APP_029
- */
- APPONIMENT_CANNOT_BE_CANCELED("Appointment cannot be canceled"),
- /**
- * ErrorMessage for PRG_TRL_APP_030
- */
- CANNOT_GET_DETAILS_FOR("Cannot get details for"),
- /**
- * ErrorMessage for PRG_BOOK_RCI_032
- */
- RECORD_NOT_FOUND_FOR_DATE_RANGE_AND_REG_CENTER_ID("Record not found for date range and reg center id"),
-
- /*
- * ErrorMessage for PRG_BOOK_RCI_031
- */
- INVALID_BOOKING_DATE_TIME("Invalid Booking Date Time"),
-
- UNABLE_TO_FETCH_THE_PRE_REGISTRATION("Unable to fetch the pre-registration id"),
-
- NOTIFICATION_CALL_FAILED("Notification service call failed"),
-
- JSON_PROCESSING_EXCEPTION("Json processing exception"),
-
- REG_CENTER_ID_NOT_FOUND("Registration center id not found"),
-
- APPOINTMENT_CANNOT_BE_BOOKED_FOR_INCOMPLETE_APPLICATION("Appointment cannot be booked for incomplete application"),
-
- APPOINTMENT_CANNOT_BE_BOOKED_FOR_PREFETCHED_APPLICATION("Appointment cannot be booked for prefetched application"),
-
- CANCEL_BOOKING_CANNOT_BE_DONE("Appointment cancelling cannot be done within");
- /**
- * @param code
- */
- private ErrorMessages(String message) {
- this.message = message;
- }
-
- private final String message;
-
- /**
- * @return message
- */
- public String getMessage() {
- return message;
- }
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentAlreadyCanceledException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentAlreadyCanceledException.java
deleted file mode 100644
index ed03e97a040..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentAlreadyCanceledException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author Jagadishwari
- * @since 1.0.0
- */
-
-@Getter
-public class AppointmentAlreadyCanceledException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = 5135952690225019228L;
- private MainResponseDTO> mainResponseDTO;
-
- public AppointmentAlreadyCanceledException(String msg) {
- super("", msg);
- }
-
- public AppointmentAlreadyCanceledException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public AppointmentAlreadyCanceledException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public AppointmentAlreadyCanceledException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public AppointmentAlreadyCanceledException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public AppointmentAlreadyCanceledException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentBookingFailedException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentBookingFailedException.java
deleted file mode 100644
index 40d09d262f9..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentBookingFailedException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class AppointmentBookingFailedException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = 5135952690225019228L;
- private MainResponseDTO> mainResponseDTO;
-
- public AppointmentBookingFailedException(String msg) {
- super("", msg);
- }
-
- public AppointmentBookingFailedException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public AppointmentBookingFailedException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public AppointmentBookingFailedException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public AppointmentBookingFailedException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public AppointmentBookingFailedException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentCannotBeBookedException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentCannotBeBookedException.java
deleted file mode 100644
index 5cbf94b75fd..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentCannotBeBookedException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class AppointmentCannotBeBookedException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = 5135952690225019228L;
- private MainResponseDTO> mainResponseDTO;
-
- public AppointmentCannotBeBookedException(String msg) {
- super("", msg);
- }
-
- public AppointmentCannotBeBookedException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public AppointmentCannotBeBookedException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public AppointmentCannotBeBookedException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public AppointmentCannotBeBookedException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public AppointmentCannotBeBookedException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentCannotBeCanceledException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentCannotBeCanceledException.java
deleted file mode 100644
index 30e648329e9..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentCannotBeCanceledException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class AppointmentCannotBeCanceledException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = 5135952690225019228L;
- private MainResponseDTO> mainResponseDTO;
-
- public AppointmentCannotBeCanceledException(String msg) {
- super("", msg);
- }
-
- public AppointmentCannotBeCanceledException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public AppointmentCannotBeCanceledException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public AppointmentCannotBeCanceledException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public AppointmentCannotBeCanceledException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public AppointmentCannotBeCanceledException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentReBookingFailedException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentReBookingFailedException.java
deleted file mode 100644
index b8d7f3e5fb0..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AppointmentReBookingFailedException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class AppointmentReBookingFailedException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = 5135952690225019228L;
- private MainResponseDTO> mainResponseDTO;
-
- public AppointmentReBookingFailedException(String msg) {
- super("", msg);
- }
-
- public AppointmentReBookingFailedException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public AppointmentReBookingFailedException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public AppointmentReBookingFailedException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public AppointmentReBookingFailedException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public AppointmentReBookingFailedException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AvailabilityTableNotAccessableException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AvailabilityTableNotAccessableException.java
deleted file mode 100644
index ae484c258ba..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AvailabilityTableNotAccessableException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * Thrown when the availability table cannot be read.
- */
-@Getter
-public class AvailabilityTableNotAccessableException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = 5135952690225019228L;
- /** MOSIP envelope copied onto the error response. */
- private MainResponseDTO> mainResponseDTO;
-
- public AvailabilityTableNotAccessableException(String msg) {
- super("", msg);
- }
-
- public AvailabilityTableNotAccessableException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public AvailabilityTableNotAccessableException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public AvailabilityTableNotAccessableException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public AvailabilityTableNotAccessableException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public AvailabilityTableNotAccessableException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AvailabilityUpdationFailedException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AvailabilityUpdationFailedException.java
deleted file mode 100644
index 16c157691a4..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AvailabilityUpdationFailedException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * Thrown when incrementing/decrementing slot availability fails.
- */
-@Getter
-public class AvailabilityUpdationFailedException extends BaseUncheckedException{
-
-
- /**
- *
- */
- private static final long serialVersionUID = -8740121632422570371L;
- /** MOSIP envelope copied onto the error response. */
- private MainResponseDTO> mainResponseDTO;
-
- public AvailabilityUpdationFailedException(String msg) {
- super("", msg);
- }
-
- public AvailabilityUpdationFailedException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public AvailabilityUpdationFailedException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public AvailabilityUpdationFailedException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public AvailabilityUpdationFailedException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public AvailabilityUpdationFailedException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AvailablityNotFoundException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AvailablityNotFoundException.java
deleted file mode 100644
index 29dc958e398..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/AvailablityNotFoundException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class AvailablityNotFoundException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = 5135952690225019228L;
- private MainResponseDTO> mainResponseDTO;
-
- public AvailablityNotFoundException(String msg) {
- super("", msg);
- }
-
- public AvailablityNotFoundException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public AvailablityNotFoundException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public AvailablityNotFoundException(String errorCode, String errorMessage,MainResponseDTO> respone) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=respone;
- }
-
- public AvailablityNotFoundException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public AvailablityNotFoundException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingDataNotFoundException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingDataNotFoundException.java
deleted file mode 100644
index eda11b4b93c..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingDataNotFoundException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class BookingDataNotFoundException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = 5135952690225019228L;
- private MainResponseDTO> mainResponseDTO;
-
- public BookingDataNotFoundException(String msg) {
- super("", msg);
- }
-
- public BookingDataNotFoundException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public BookingDataNotFoundException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public BookingDataNotFoundException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public BookingDataNotFoundException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public BookingDataNotFoundException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingDateNotSeletectedException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingDateNotSeletectedException.java
deleted file mode 100644
index 3dc67b754b8..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingDateNotSeletectedException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-@Getter
-public class BookingDateNotSeletectedException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = -8090038321393006576L;
- private MainResponseDTO> mainResponseDTO;
-
- public BookingDateNotSeletectedException(String msg) {
- super("", msg);
- }
-
- public BookingDateNotSeletectedException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public BookingDateNotSeletectedException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public BookingDateNotSeletectedException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public BookingDateNotSeletectedException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public BookingDateNotSeletectedException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingPreIdNotFoundException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingPreIdNotFoundException.java
deleted file mode 100644
index b7484558931..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingPreIdNotFoundException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class BookingPreIdNotFoundException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = -8090038321393006576L;
- private MainResponseDTO> mainResponseDTO;
-
- public BookingPreIdNotFoundException(String msg) {
- super("", msg);
- }
-
- public BookingPreIdNotFoundException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public BookingPreIdNotFoundException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public BookingPreIdNotFoundException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public BookingPreIdNotFoundException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public BookingPreIdNotFoundException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingRegistrationCenterIdNotFoundException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingRegistrationCenterIdNotFoundException.java
deleted file mode 100644
index 1496857a17c..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingRegistrationCenterIdNotFoundException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class BookingRegistrationCenterIdNotFoundException extends BaseUncheckedException {
-
- private static final long serialVersionUID = -5462747645675773416L;
- private MainResponseDTO> mainResponseDTO;
-
- public BookingRegistrationCenterIdNotFoundException(String msg) {
- super("", msg);
- }
-
- public BookingRegistrationCenterIdNotFoundException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public BookingRegistrationCenterIdNotFoundException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public BookingRegistrationCenterIdNotFoundException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public BookingRegistrationCenterIdNotFoundException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public BookingRegistrationCenterIdNotFoundException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingTimeSlotAlreadyBooked.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingTimeSlotAlreadyBooked.java
deleted file mode 100644
index df01548142c..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingTimeSlotAlreadyBooked.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class BookingTimeSlotAlreadyBooked extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = -7620811373366498697L;
- private MainResponseDTO> mainResponseDTO;
-
- public BookingTimeSlotAlreadyBooked(String msg) {
- super("", msg);
- }
-
- public BookingTimeSlotAlreadyBooked(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public BookingTimeSlotAlreadyBooked(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public BookingTimeSlotAlreadyBooked(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public BookingTimeSlotAlreadyBooked(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public BookingTimeSlotAlreadyBooked() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingTimeSlotNotSeletectedException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingTimeSlotNotSeletectedException.java
deleted file mode 100644
index ff677b7b6c3..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/BookingTimeSlotNotSeletectedException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class BookingTimeSlotNotSeletectedException extends BaseUncheckedException {
-
- private static final long serialVersionUID = -4543476272744645661L;
- private MainResponseDTO> mainResponseDTO;
-
- public BookingTimeSlotNotSeletectedException(String msg) {
- super("", msg);
- }
-
- public BookingTimeSlotNotSeletectedException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public BookingTimeSlotNotSeletectedException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public BookingTimeSlotNotSeletectedException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public BookingTimeSlotNotSeletectedException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public BookingTimeSlotNotSeletectedException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/CancelAppointmentFailedException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/CancelAppointmentFailedException.java
deleted file mode 100644
index 79bc6f0bbe0..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/CancelAppointmentFailedException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class CancelAppointmentFailedException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = 5135952690225019228L;
- private MainResponseDTO> mainResponseDTO;
-
- public CancelAppointmentFailedException(String msg) {
- super("", msg);
- }
-
- public CancelAppointmentFailedException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public CancelAppointmentFailedException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public CancelAppointmentFailedException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public CancelAppointmentFailedException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public CancelAppointmentFailedException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/DemographicGetStatusException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/DemographicGetStatusException.java
deleted file mode 100644
index d2d99652861..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/DemographicGetStatusException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class DemographicGetStatusException extends BaseUncheckedException {
-
- private static final long serialVersionUID = 1L;
- private MainResponseDTO> mainResponseDTO;
-
- public DemographicGetStatusException(String msg) {
- super("", msg);
- }
-
- public DemographicGetStatusException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public DemographicGetStatusException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public DemographicGetStatusException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public DemographicGetStatusException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public DemographicGetStatusException() {
- super();
- }
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/DemographicStatusUpdationException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/DemographicStatusUpdationException.java
deleted file mode 100644
index 4f00c30188d..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/DemographicStatusUpdationException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class DemographicStatusUpdationException extends BaseUncheckedException {
-
- private static final long serialVersionUID = 1L;
- private MainResponseDTO> mainResponseDTO;
-
- public DemographicStatusUpdationException(String msg) {
- super("", msg);
- }
-
- public DemographicStatusUpdationException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public DemographicStatusUpdationException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public DemographicStatusUpdationException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public DemographicStatusUpdationException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public DemographicStatusUpdationException() {
- super();
- }
-
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/DocumentNotFoundException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/DocumentNotFoundException.java
deleted file mode 100644
index b7db5849f8a..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/DocumentNotFoundException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class DocumentNotFoundException extends BaseUncheckedException {
-
- private static final long serialVersionUID = 1L;
- private MainResponseDTO> mainResponseDTO;
-
- public DocumentNotFoundException(String msg) {
- super("", msg);
- }
-
- public DocumentNotFoundException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public DocumentNotFoundException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public DocumentNotFoundException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public DocumentNotFoundException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public DocumentNotFoundException() {
- super();
- }
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/InvalidDateTimeFormatException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/InvalidDateTimeFormatException.java
deleted file mode 100644
index 96c6dcf4337..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/InvalidDateTimeFormatException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * @author M1046129
- *
- */
-
-@Getter
-public class InvalidDateTimeFormatException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = -2782261618399872549L;
- private MainResponseDTO> mainResponseDTO;
-
- public InvalidDateTimeFormatException(String msg) {
- super("", msg);
- }
-
- public InvalidDateTimeFormatException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public InvalidDateTimeFormatException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public InvalidDateTimeFormatException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public InvalidDateTimeFormatException(String errorCode, String errorMessage, Throwable rootCause,MainResponseDTO> response) {
- super(errorCode, errorMessage, rootCause);
- this.mainResponseDTO=response;
- }
-
- public InvalidDateTimeFormatException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/JsonException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/JsonException.java
deleted file mode 100644
index f62b62af72f..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/JsonException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * Thrown when booking JSON cannot be parsed.
- */
-@Getter
-public class JsonException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = -2782261618399872549L;
- /** MOSIP envelope copied onto the error response. */
- private MainResponseDTO> mainResponseDTO;
-
- public JsonException(String msg) {
- super("", msg);
- }
-
- public JsonException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public JsonException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public JsonException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public JsonException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public JsonException() {
- super();
- }
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/OperationNotAllowedException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/OperationNotAllowedException.java
deleted file mode 100644
index cd223a8290d..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/OperationNotAllowedException.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * This class defines the OperationNotAllowedException
- *
- * @author Rajath KR
- * @since 1.0.0
- *
- */
-
-@Getter
-public class OperationNotAllowedException extends BaseUncheckedException {
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 1L;
- private MainResponseDTO> mainResponseDTO;
-
- /**
- * @param errorMessage pass the error message
- */
- public OperationNotAllowedException(String errorMessage) {
- super("", errorMessage);
- }
-
- /**
- * @param errorCode pass the error code
- * @param errorMessage pass the error message
- */
- public OperationNotAllowedException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public OperationNotAllowedException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- /**
- * @param errorMessage pass the error message
- * @param rootCause pass the cause
- */
- public OperationNotAllowedException(String errorMessage, Throwable rootCause) {
- super("", errorMessage, rootCause);
- }
-
- /**
- * @param errorCode pass the error code
- * @param errorMessage pass the error message
- * @param rootCause pass the cause
- */
- public OperationNotAllowedException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/RecordNotFoundException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/RecordNotFoundException.java
deleted file mode 100644
index 00eb1c42085..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/RecordNotFoundException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-
-@Getter
-public class RecordNotFoundException extends BaseUncheckedException {
-
- /**
- *
- */
- private static final long serialVersionUID = -2782261618399872549L;
- private MainResponseDTO> mainResponseDTO;
-
- public RecordNotFoundException(String msg) {
- super("", msg);
- }
-
- public RecordNotFoundException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public RecordNotFoundException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public RecordNotFoundException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public RecordNotFoundException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public RecordNotFoundException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/TimeSpanException.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/TimeSpanException.java
deleted file mode 100644
index 9159874c6f3..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/TimeSpanException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package io.mosip.preregistration.booking.exception;
-
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import lombok.Getter;
-
-/**
- * Thrown when an appointment is requested outside the allowed time span.
- */
-@Getter
-public class TimeSpanException extends BaseUncheckedException{
-
- /**
- *
- */
- private static final long serialVersionUID = -5676105896729083192L;
- /** MOSIP envelope copied onto the error response. */
- private MainResponseDTO> mainResponseDTO;
-
- /**
- * @param msg error text
- */
- public TimeSpanException(String msg) {
- super("", msg);
- }
-
- public TimeSpanException(String msg, Throwable cause) {
- super("", msg, cause);
- }
-
- public TimeSpanException(String errorCode, String errorMessage) {
- super(errorCode, errorMessage, null);
- }
-
- public TimeSpanException(String errorCode, String errorMessage,MainResponseDTO> response) {
- super(errorCode, errorMessage, null);
- this.mainResponseDTO=response;
- }
-
- public TimeSpanException(String errorCode, String errorMessage, Throwable rootCause) {
- super(errorCode, errorMessage, rootCause);
- }
-
- public TimeSpanException() {
- super();
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionCatcher.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionCatcher.java
deleted file mode 100644
index a02a120eea9..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionCatcher.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.exception.util;
-
-import java.time.DateTimeException;
-import java.time.format.DateTimeParseException;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-
-import io.mosip.kernel.core.dataaccess.exception.DataAccessLayerException;
-import io.mosip.kernel.core.exception.BaseCheckedException;
-import io.mosip.kernel.core.exception.BaseUncheckedException;
-import io.mosip.kernel.core.exception.ParseException;
-import io.mosip.preregistration.booking.errorcodes.ErrorCodes;
-import io.mosip.preregistration.booking.errorcodes.ErrorMessages;
-import io.mosip.preregistration.booking.exception.AppointmentAlreadyCanceledException;
-import io.mosip.preregistration.booking.exception.AppointmentBookingFailedException;
-import io.mosip.preregistration.booking.exception.AppointmentCannotBeBookedException;
-import io.mosip.preregistration.booking.exception.AppointmentCannotBeCanceledException;
-import io.mosip.preregistration.booking.exception.AppointmentReBookingFailedException;
-import io.mosip.preregistration.booking.exception.AvailablityNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingDataNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingDateNotSeletectedException;
-import io.mosip.preregistration.booking.exception.BookingPreIdNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingRegistrationCenterIdNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingTimeSlotAlreadyBooked;
-import io.mosip.preregistration.booking.exception.BookingTimeSlotNotSeletectedException;
-import io.mosip.preregistration.booking.exception.CancelAppointmentFailedException;
-import io.mosip.preregistration.booking.exception.DemographicGetStatusException;
-import io.mosip.preregistration.booking.exception.DemographicStatusUpdationException;
-import io.mosip.preregistration.booking.exception.DocumentNotFoundException;
-import io.mosip.preregistration.booking.exception.InvalidDateTimeFormatException;
-import io.mosip.preregistration.booking.exception.JsonException;
-import io.mosip.preregistration.booking.exception.OperationNotAllowedException;
-import io.mosip.preregistration.booking.exception.RecordNotFoundException;
-import io.mosip.preregistration.booking.exception.TimeSpanException;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import io.mosip.preregistration.core.exception.AppointmentBookException;
-import io.mosip.preregistration.core.exception.AppointmentCancelException;
-import io.mosip.preregistration.core.exception.AppointmentReBookException;
-import io.mosip.preregistration.core.exception.InvalidRequestException;
-import io.mosip.preregistration.core.exception.InvalidRequestParameterException;
-import io.mosip.preregistration.core.exception.NotificationException;
-import io.mosip.preregistration.core.exception.PreRegistrationException;
-import io.mosip.preregistration.core.exception.RecordFailedToDeleteException;
-import io.mosip.preregistration.core.exception.RestCallException;
-import io.mosip.preregistration.core.exception.TableNotAccessibleException;
-
-/**
- * This class is used to catch the exceptions that occur while Booking
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-public class BookingExceptionCatcher {
-
- /**
- * Method to handle the respective exceptions
- *
- * @param ex
- * pass the exception
- */
- public void handle(Exception ex, MainResponseDTO> mainResponseDTO) {
- if (ex instanceof RecordNotFoundException) {
- throw new RecordNotFoundException(((RecordNotFoundException) ex).getErrorCode(),
- ((RecordNotFoundException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof InvalidRequestParameterException) {
- throw new InvalidRequestParameterException(((InvalidRequestParameterException) ex).getErrorCode(),
- ((InvalidRequestParameterException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof DateTimeException || ex instanceof java.time.format.DateTimeParseException
- || ex instanceof InvalidDateTimeFormatException || ex instanceof java.text.ParseException) {
- throw new InvalidDateTimeFormatException(
- ((InvalidDateTimeFormatException)ex).getErrorCode(),
- ((InvalidDateTimeFormatException)ex).getErrorText(),
- mainResponseDTO);
- } else if (ex instanceof ParseException) {
- throw new ParseException(io.mosip.preregistration.core.errorcodes.ErrorCodes.PRG_CORE_REQ_019.toString(),
- io.mosip.preregistration.core.errorcodes.ErrorMessages.INVALID_DATE_TIME_FORMAT.getMessage());
- } else if (ex instanceof DocumentNotFoundException) {
- throw new DocumentNotFoundException(((DocumentNotFoundException) ex).getErrorCode(),
- ((DocumentNotFoundException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof DataAccessLayerException) {
-
- throw new TableNotAccessibleException(((DataAccessLayerException) ex).getErrorCode(),
- ((DataAccessLayerException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof BookingDataNotFoundException) {
- throw new BookingDataNotFoundException(((BookingDataNotFoundException) ex).getErrorCode(),
- ((BookingDataNotFoundException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof AppointmentBookingFailedException) {
- throw new AppointmentBookingFailedException(((AppointmentBookingFailedException) ex).getErrorCode(),
- ((AppointmentBookingFailedException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof BookingTimeSlotAlreadyBooked) {
- throw new BookingTimeSlotAlreadyBooked(((BookingTimeSlotAlreadyBooked) ex).getErrorCode(),
- ((BookingTimeSlotAlreadyBooked) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof AppointmentReBookingFailedException) {
- throw new AppointmentReBookingFailedException(((AppointmentReBookingFailedException) ex).getErrorCode(),
- ((AppointmentReBookingFailedException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof BookingPreIdNotFoundException) {
- throw new BookingPreIdNotFoundException(((BookingPreIdNotFoundException) ex).getErrorCode(),
- ((BookingPreIdNotFoundException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof BookingRegistrationCenterIdNotFoundException) {
- throw new BookingRegistrationCenterIdNotFoundException(
- ((BookingRegistrationCenterIdNotFoundException) ex).getErrorCode(),
- ((BookingRegistrationCenterIdNotFoundException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof BookingTimeSlotNotSeletectedException) {
- throw new BookingTimeSlotNotSeletectedException(((BookingTimeSlotNotSeletectedException) ex).getErrorCode(),
- ((BookingTimeSlotNotSeletectedException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof BookingDateNotSeletectedException) {
- throw new BookingDateNotSeletectedException(((BookingDateNotSeletectedException) ex).getErrorCode(),
- ((BookingDateNotSeletectedException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof AppointmentCannotBeBookedException) {
- throw new AppointmentCannotBeBookedException(((AppointmentCannotBeBookedException) ex).getErrorCode(),
- ((AppointmentCannotBeBookedException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof CancelAppointmentFailedException) {
- throw new CancelAppointmentFailedException(((CancelAppointmentFailedException) ex).getErrorCode(),
- ((CancelAppointmentFailedException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof AvailablityNotFoundException) {
- throw new AvailablityNotFoundException(((AvailablityNotFoundException) ex).getErrorCode(),
- ((AvailablityNotFoundException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof AppointmentAlreadyCanceledException) {
- throw new AppointmentAlreadyCanceledException(((AppointmentAlreadyCanceledException) ex).getErrorCode(),
- ((AppointmentAlreadyCanceledException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof AppointmentCannotBeCanceledException) {
- throw new AppointmentCannotBeCanceledException(((AppointmentCannotBeCanceledException) ex).getErrorCode(),
- ((AppointmentCannotBeCanceledException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof DemographicGetStatusException) {
- throw new DemographicGetStatusException(((DemographicGetStatusException) ex).getErrorCode(),
- ((DemographicGetStatusException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof AppointmentBookException) {
- throw new AppointmentBookException(((AppointmentBookException) ex).getErrorCode(),
- ((AppointmentBookException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof AppointmentCancelException) {
- throw new AppointmentCancelException(((AppointmentCancelException) ex).getErrorCode(),
- ((AppointmentCancelException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof AppointmentReBookException) {
- throw new AppointmentReBookException(((AppointmentReBookException) ex).getErrorCode(),
- ((AppointmentReBookException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof TimeSpanException) {
- throw new TimeSpanException(((TimeSpanException) ex).getErrorCode(),
- ((TimeSpanException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof RecordFailedToDeleteException) {
- throw new RecordFailedToDeleteException(((RecordFailedToDeleteException) ex).getErrorCode(),
- ((RecordFailedToDeleteException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof OperationNotAllowedException) {
- throw new OperationNotAllowedException(((OperationNotAllowedException) ex).getErrorCode(),
- ((OperationNotAllowedException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof DemographicStatusUpdationException) {
- throw new DemographicStatusUpdationException(((DemographicStatusUpdationException) ex).getErrorCode(),
- ((DemographicStatusUpdationException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof DateTimeParseException) {
- throw new InvalidDateTimeFormatException(ErrorCodes.PRG_BOOK_RCI_031.getCode(),
- ErrorMessages.INVALID_BOOKING_DATE_TIME.getMessage(), mainResponseDTO);
- } else if (ex instanceof TableNotAccessibleException) {
- throw new TableNotAccessibleException(((TableNotAccessibleException) ex).getErrorCode(),
- ((TableNotAccessibleException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof RestCallException) {
- throw new RestCallException(((RestCallException) ex).getErrorCode(),
- ((RestCallException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof NotificationException) {
- throw new NotificationException(((NotificationException) ex).getValidationErrorList(), mainResponseDTO);
- } else if (ex instanceof JsonProcessingException) {
- throw new JsonException(ErrorCodes.PRG_BOOK_RCI_034.getCode(),
- ErrorMessages.JSON_PROCESSING_EXCEPTION.getMessage(), mainResponseDTO);
- } else if (ex instanceof InvalidRequestException) {
- throw new InvalidRequestException(((InvalidRequestException) ex).getErrorCode(),
- ((InvalidRequestException) ex).getErrorText(), mainResponseDTO);
- } else {
- if (ex instanceof BaseUncheckedException) {
- throw new PreRegistrationException(((BaseUncheckedException) ex).getErrorCode(),
- ((BaseUncheckedException) ex).getErrorText(), mainResponseDTO);
- } else if (ex instanceof BaseCheckedException) {
- throw new PreRegistrationException(((BaseCheckedException) ex).getErrorCode(),
- ((BaseCheckedException) ex).getErrorText(), mainResponseDTO);
- }
- }
-
- }
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionHandler.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionHandler.java
deleted file mode 100644
index d1e09cb15eb..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionHandler.java
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.exception.util;
-
-import java.io.IOException;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import jakarta.annotation.Resource;
-import jakarta.servlet.http.HttpServletRequest;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.env.Environment;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.converter.HttpMessageNotReadableException;
-import org.springframework.security.access.AccessDeniedException;
-import org.springframework.validation.FieldError;
-import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-import org.springframework.web.context.request.WebRequest;
-import org.springframework.web.util.ContentCachingRequestWrapper;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-
-import io.mosip.kernel.core.exception.ParseException;
-import io.mosip.kernel.core.exception.ServiceError;
-import io.mosip.kernel.core.util.DateUtils2;
-import io.mosip.kernel.core.util.EmptyCheckUtils;
-import io.mosip.preregistration.booking.exception.AppointmentAlreadyCanceledException;
-import io.mosip.preregistration.booking.exception.AppointmentBookingFailedException;
-import io.mosip.preregistration.booking.exception.AppointmentCannotBeBookedException;
-import io.mosip.preregistration.booking.exception.AppointmentCannotBeCanceledException;
-import io.mosip.preregistration.booking.exception.AppointmentReBookingFailedException;
-import io.mosip.preregistration.booking.exception.AvailabilityTableNotAccessableException;
-import io.mosip.preregistration.booking.exception.AvailablityNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingDataNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingDateNotSeletectedException;
-import io.mosip.preregistration.booking.exception.BookingPreIdNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingRegistrationCenterIdNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingTimeSlotAlreadyBooked;
-import io.mosip.preregistration.booking.exception.BookingTimeSlotNotSeletectedException;
-import io.mosip.preregistration.booking.exception.CancelAppointmentFailedException;
-import io.mosip.preregistration.booking.exception.DemographicGetStatusException;
-import io.mosip.preregistration.booking.exception.DemographicStatusUpdationException;
-import io.mosip.preregistration.booking.exception.DocumentNotFoundException;
-import io.mosip.preregistration.booking.exception.InvalidDateTimeFormatException;
-import io.mosip.preregistration.booking.exception.JsonException;
-import io.mosip.preregistration.booking.exception.OperationNotAllowedException;
-import io.mosip.preregistration.booking.exception.RecordNotFoundException;
-import io.mosip.preregistration.booking.exception.TimeSpanException;
-import io.mosip.preregistration.core.common.dto.ExceptionJSONInfoDTO;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import io.mosip.preregistration.core.common.dto.ResponseWrapper;
-import io.mosip.preregistration.core.exception.InvalidRequestException;
-import io.mosip.preregistration.core.exception.InvalidRequestParameterException;
-import io.mosip.preregistration.core.exception.MasterDataNotAvailableException;
-import io.mosip.preregistration.core.exception.NotificationException;
-import io.mosip.preregistration.core.exception.PreRegistrationException;
-import io.mosip.preregistration.core.exception.RecordFailedToDeleteException;
-import io.mosip.preregistration.core.exception.RestCallException;
-import io.mosip.preregistration.core.exception.TableNotAccessibleException;
-import io.mosip.preregistration.core.util.GenericUtil;
-
-/**
- * Exception Handler for Booking application.
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @since 1.0.0
- *
- */
-@RestControllerAdvice
-public class BookingExceptionHandler {
-
- /** The Environment. */
- @Autowired
- protected Environment env;
-
- /** The id. */
- @Resource
- protected Map id;
-
- @Value("${mosip.utc-datetime-pattern}")
- private String utcDateTimePattern;
-
- @Value("${version}")
- String versionUrl;
-
- @Value("${mosip.preregistration.booking.exception.id}")
- String idUrl;
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(DemographicStatusUpdationException.class)
- public ResponseEntity> updateStatusException(final DemographicStatusUpdationException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(AvailabilityTableNotAccessableException.class)
- public ResponseEntity> availabilityTableNotAccessableException(
- final AvailabilityTableNotAccessableException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(DemographicGetStatusException.class)
- public ResponseEntity> getStatusException(final DemographicGetStatusException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(MasterDataNotAvailableException.class)
- public ResponseEntity> masterDataNotAvailableException(final MasterDataNotAvailableException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(RestCallException.class)
- public ResponseEntity> databaseerror(final RestCallException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(BookingTimeSlotNotSeletectedException.class)
- public ResponseEntity> timeSlotNotSelected(final BookingTimeSlotNotSeletectedException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(AppointmentCannotBeBookedException.class)
- public ResponseEntity> timeSlotNotSelected(final AppointmentCannotBeBookedException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
-
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(BookingPreIdNotFoundException.class)
- public ResponseEntity> preIdNotFound(final BookingPreIdNotFoundException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(BookingRegistrationCenterIdNotFoundException.class)
- public ResponseEntity> regCenterNotFound(final BookingRegistrationCenterIdNotFoundException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(InvalidDateTimeFormatException.class)
- public ResponseEntity> invalidDateTimeException(final InvalidDateTimeFormatException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(BookingTimeSlotAlreadyBooked.class)
- public ResponseEntity> timeSlotAlreadyBooked(final BookingTimeSlotAlreadyBooked e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(BookingDateNotSeletectedException.class)
- public ResponseEntity> bookingDateNotSelected(final BookingDateNotSeletectedException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(InvalidRequestParameterException.class)
- public ResponseEntity> bookingDateNotSelected(final InvalidRequestParameterException e) {
- MainResponseDTO> errorRes = e.getMainResponseDto();
- errorRes.setId(id.get(e.getOperation()));
- errorRes.setVersion(env.getProperty("version"));
- errorRes.setErrors(e.getExptionList());
- errorRes.setResponsetime(GenericUtil.getCurrentResponseTime());
- return new ResponseEntity<>(errorRes, HttpStatus.OK);
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(BookingDataNotFoundException.class)
- public ResponseEntity> bookingDataNotFound(final BookingDataNotFoundException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(RecordNotFoundException.class)
- public ResponseEntity> recordNotFound(final RecordNotFoundException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(AppointmentAlreadyCanceledException.class)
- public ResponseEntity> appointmentAlreadyCanceledException(
- final AppointmentAlreadyCanceledException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
- @ExceptionHandler(AppointmentCannotBeCanceledException.class)
- public ResponseEntity> appointmentCanNotCanceledException(
- final AppointmentCannotBeCanceledException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
-
- @ExceptionHandler(CancelAppointmentFailedException.class)
- public ResponseEntity> appointmentCancelFailedException(
- final CancelAppointmentFailedException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
-
- @ExceptionHandler(AppointmentReBookingFailedException.class)
- public ResponseEntity> appointmentReBookingFailedException(
- final AppointmentReBookingFailedException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
-
- @ExceptionHandler(DocumentNotFoundException.class)
- public ResponseEntity> documentNotFound(final DocumentNotFoundException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
-
- @ExceptionHandler(AvailablityNotFoundException.class)
- public ResponseEntity> availablityNotFound(final AvailablityNotFoundException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
-
- @ExceptionHandler(TableNotAccessibleException.class)
-
- public ResponseEntity> tablenotAccessible(final TableNotAccessibleException e) {
- return GenericUtil.errorResponse(e, e.getMainResposneDTO());
- }
-
- /**
- * @param e
- * @param request
- * @return error response
- */
-
- @ExceptionHandler(AppointmentBookingFailedException.class)
- public ResponseEntity> appointmentBookingFailed(final AppointmentBookingFailedException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
- }
-
- @ExceptionHandler(TimeSpanException.class)
- public ResponseEntity> timeSpanException(final TimeSpanException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
-
- }
-
- @ExceptionHandler(RecordFailedToDeleteException.class)
- public ResponseEntity> recordFailedToDeleteException(final RecordFailedToDeleteException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
-
- }
-
- @ExceptionHandler(OperationNotAllowedException.class)
- public ResponseEntity> operationNotAllowedException(final OperationNotAllowedException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
-
- }
-
- @ExceptionHandler(JsonException.class)
- public ResponseEntity> jsonException(final JsonException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDTO());
-
- }
-
- @ExceptionHandler(ParseException.class)
- public ResponseEntity> parseException(final ParseException e) {
- ExceptionJSONInfoDTO errorDetails = new ExceptionJSONInfoDTO(e.getErrorCode(), e.getErrorText());
- MainResponseDTO> errorRes = new MainResponseDTO<>();
- List errorList = new ArrayList<>();
- errorList.add(errorDetails);
- errorRes.setErrors(errorList);
- errorRes.setId(idUrl);
- errorRes.setVersion(versionUrl);
- errorRes.setResponsetime(DateUtils2.formatDate(new Date(), utcDateTimePattern));
-
- return new ResponseEntity<>(errorRes, HttpStatus.OK);
-
- }
-
- @ExceptionHandler(MethodArgumentNotValidException.class)
- public ResponseEntity> methodArgumentNotValidException(
- final HttpServletRequest httpServletRequest, final MethodArgumentNotValidException e) throws IOException {
- ResponseWrapper errorResponse = setErrors(httpServletRequest);
- final List fieldErrors = e.getBindingResult().getFieldErrors();
- fieldErrors.forEach(x -> {
- ServiceError error = new ServiceError(
- io.mosip.preregistration.core.errorcodes.ErrorCodes.PRG_CORE_REQ_015.getCode(),
- x.getField() + ": " + x.getDefaultMessage());
- errorResponse.getErrors().add(error);
- });
- return new ResponseEntity<>(errorResponse, HttpStatus.OK);
- }
-
- @ExceptionHandler(HttpMessageNotReadableException.class)
- public ResponseEntity> onHttpMessageNotReadable(
- final HttpServletRequest httpServletRequest, final HttpMessageNotReadableException e) throws IOException {
- ResponseWrapper errorResponse = setErrors(httpServletRequest);
- ServiceError error = new ServiceError(
- io.mosip.preregistration.core.errorcodes.ErrorCodes.PRG_CORE_REQ_015.getCode(), e.getMessage());
- errorResponse.getErrors().add(error);
- return new ResponseEntity<>(errorResponse, HttpStatus.OK);
- }
-
- @ExceptionHandler(value = { Exception.class, RuntimeException.class })
- public ResponseEntity> defaultErrorHandler(
- final HttpServletRequest httpServletRequest, Exception e) throws IOException {
- ResponseWrapper errorResponse = setErrors(httpServletRequest);
- ServiceError error = new ServiceError(
- io.mosip.preregistration.core.errorcodes.ErrorCodes.PRG_CORE_REQ_016.getCode(), e.getMessage());
- errorResponse.getErrors().add(error);
- return new ResponseEntity<>(errorResponse, HttpStatus.INTERNAL_SERVER_ERROR);
- }
-
- @ExceptionHandler(value = AccessDeniedException.class)
- public ResponseEntity> AccessDeniedExceptionHandler(final AccessDeniedException e) {
- MainResponseDTO> errorRes = new MainResponseDTO<>();
- List errorList = new ArrayList<>();
- ExceptionJSONInfoDTO errorDetails = new ExceptionJSONInfoDTO("KER-401", "Authentication Failed");
- errorList.add(errorDetails);
- errorRes.setErrors(errorList);
- errorRes.setResponsetime(DateUtils2.formatDate(new Date(), utcDateTimePattern));
- return new ResponseEntity<>(errorRes, HttpStatus.UNAUTHORIZED);
- }
-
- @Autowired
- private ObjectMapper objectMapper;
-
- private ResponseWrapper setErrors(HttpServletRequest httpServletRequest) throws IOException {
- ResponseWrapper responseWrapper = new ResponseWrapper<>();
- responseWrapper.setResponsetime(LocalDateTime.now(ZoneId.of("UTC")));
- String requestBody = null;
- if (httpServletRequest instanceof ContentCachingRequestWrapper) {
- requestBody = new String(((ContentCachingRequestWrapper) httpServletRequest).getContentAsByteArray());
- }
- if (EmptyCheckUtils.isNullEmpty(requestBody)) {
- return responseWrapper;
- }
- objectMapper.registerModule(new JavaTimeModule());
- JsonNode reqNode = objectMapper.readTree(requestBody);
- responseWrapper.setId(reqNode.path("id").asText());
- responseWrapper.setVersion(reqNode.path("version").asText());
- return responseWrapper;
- }
-
- @ExceptionHandler(NotificationException.class)
- public ResponseEntity> authServiceException(final NotificationException e, WebRequest request) {
- List errorList = new ArrayList<>();
- e.getValidationErrorList().stream().forEach(serviceError -> errorList
- .add(new ExceptionJSONInfoDTO(serviceError.getErrorCode(), serviceError.getMessage())));
- MainResponseDTO> errorRes = e.getMainResponseDTO();
- errorRes.setErrors(errorList);
- errorRes.setResponsetime(GenericUtil.getCurrentResponseTime());
- return new ResponseEntity<>(errorRes, HttpStatus.OK);
- }
-
- @ExceptionHandler(PreRegistrationException.class)
- public ResponseEntity> commonException(final PreRegistrationException e) {
- return GenericUtil.errorResponse(e, e.getMainresponseDTO());
- }
-
- /**
- *
- * @param e
- * @return
- */
- @ExceptionHandler(InvalidRequestException.class)
- public ResponseEntity> invalidRequestException(final InvalidRequestException e) {
- return GenericUtil.errorResponse(e, e.getMainResponseDto());
- }
-
-}
\ No newline at end of file
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/BookingAvailabilityRepository.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/BookingAvailabilityRepository.java
deleted file mode 100644
index c3227ab9666..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/BookingAvailabilityRepository.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.repository;
-
-import java.time.LocalDate;
-import java.time.LocalTime;
-import java.util.List;
-
-import jakarta.transaction.Transactional;
-import jakarta.persistence.LockModeType;
-
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.jpa.repository.Lock;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository;
-import io.mosip.preregistration.booking.entity.AvailibityEntity;
-
-/**
- * This repository interface is used to define the JPA methods for Booking application.
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-@Repository("bookingAvailabilityRepository")
-@Transactional
-public interface BookingAvailabilityRepository extends BaseRepository {
-
-
- /**
- * @param Registration center id
- * @param Registration date
- * @return List AvailibityEntity based registration id and registration date.
- */
- public List findByRegcntrIdAndRegDateOrderByFromTimeAsc(String regcntrId, LocalDate regDate);
-
- /**
- * @param regcntrId
- * @param fromDate
- * @param toDate
- * @return List of LocalDate based on date
- */
- public List findDate(@Param("regcntrId") String regcntrId, @Param("fromDate") LocalDate fromDate,
- @Param("toDate") LocalDate toDate);
-
- /**
- * @param slot_from_time
- * @param slot_to_time
- * @param reg_date
- * @param regcntr_id
- * @return Availability entity
- */
- @Deprecated(forRemoval = true)
- public AvailibityEntity findByFromTimeAndToTimeAndRegDateAndRegcntrId(
- @Param("slot_from_time") LocalTime slotFromTime, @Param("slot_to_time") LocalTime slotToTime,
- @Param("availability_date") LocalDate regDate, @Param("regcntr_id") String regcntrd);
-
- /**
- * @param reg_date
- * @param regcntr_id
- * @param slot_from_time
- * @param slot_to_time
- * @return Availability entity
- */
- public AvailibityEntity findByRegDateAndRegcntrIdAndFromTimeAndToTime(
- @Param("availability_date") LocalDate regDate,
- @Param("regcntr_id") String regcntrd,
- @Param("slot_from_time") LocalTime slotFromTime, @Param("slot_to_time") LocalTime slotToTime );
-
-
- /**
- * @param reg_date
- * @param regcntr_id
- * @param slot_from_time
- * @param slot_to_time
- * @return Availability entity
- * This API performs a database lock. Use it with care.
- */
- @Lock(LockModeType.PESSIMISTIC_WRITE)
- public AvailibityEntity findFirstByRegDateAndRegcntrIdAndFromTimeAndToTime(
- @Param("availability_date") LocalDate regDate,
- @Param("regcntr_id") String regcntrd,
- @Param("slot_from_time") LocalTime slotFromTime, @Param("slot_to_time") LocalTime slotToTime );
-
-
- /**
- *
- * @param regDate
- * @return list of available date
- */
- @Query("SELECT DISTINCT e.regDate FROM AvailibityEntity e WHERE e.regDate>= ?1")
- public List findAvaialableDate(LocalDate regDate);
-
- public List findByRegcntrId(String regCenterId);
-
- /**
- *
- * @param regDate
- * @return list of available date
- */
- @Query("SELECT DISTINCT e.regcntrId FROM AvailibityEntity e WHERE e.regDate>= ?1")
- public List findAvaialableRegCenter(LocalDate regDate);
-
- /**
- *
- * @param regDate
- * @param regcntrId
- * @return list of available date
- */
- @Query("SELECT DISTINCT e.regDate FROM AvailibityEntity e WHERE e.regDate>= ?1 and e.regcntrId=?2")
- public List findAvaialableDate(LocalDate regDate, String regcntrId);
-
-
- /**
- *
- * @param regDate
- * @param regcntrId
- * @return list of AvailibityEntity
- */
- @Query("SELECT DISTINCT e FROM AvailibityEntity e WHERE e.regDate= ?1 and e.regcntrId=?2")
- public List findAvaialableSlots(LocalDate regDate, String regcntrId);
-
-
- /**
- *
- * @param regDate
- * @param regcntrId
- * @return deleted number of slots
- */
- public int deleteByRegcntrIdAndRegDate( String regcntrId ,LocalDate regDate);
-
- /**
- *
- * @param regDate
- * @return list of regcntrId
- */
- public int deleteByRegcntrIdAndRegDateGreaterThanEqual(String regcntrId, LocalDate regDate);
-
- /**
- * @param Registration center id
- * @param Registration startDate
- * @param Registration endDate
- * @return List AvailibityEntity based registration id and registration date.
- */
- public List findByRegcntrIdAndRegDateGreaterThanEqualAndRegDateLessThanEqualOrderByFromTimeAsc(String regcntrId, LocalDate starteDate,LocalDate endDate);
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/DemographicRepository.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/DemographicRepository.java
deleted file mode 100644
index 9a08d1965da..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/DemographicRepository.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package io.mosip.preregistration.booking.repository;
-
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository;
-import io.mosip.preregistration.core.common.entity.DemographicEntity;
-
-/**
- * @author Kishan Rathore
- * @since 1.0.0
- *
- */
-@Repository("demographicRepository")
-public interface DemographicRepository extends BaseRepository {
-
- /**
- * @param preRegId
- * pass preRegId
- * @return preregistration date for a pre-id
- */
- public DemographicEntity findBypreRegistrationId(@Param("preRegId") String preRegId);
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/RegistrationBookingRepository.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/RegistrationBookingRepository.java
deleted file mode 100644
index b13acdd690a..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/RegistrationBookingRepository.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.repository;
-
-import java.time.LocalDate;
-import java.util.List;
-
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-import io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository;
-import io.mosip.preregistration.core.common.entity.RegistrationBookingEntity;
-
-/**
- * This repository interface is used to define the JPA methods for Booking
- * application.
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-@Repository("registrationBookingRepository")
-@Transactional
-public interface RegistrationBookingRepository extends BaseRepository {
-
- public static final String preIdQuery = "SELECT u FROM RegistrationBookingEntity u WHERE u.preregistrationId = ?1";
- public static final String deletePreIdQuery = "delete from RegistrationBookingEntity u where u.preregistrationId = ?1";
- public static final String getPreIdQuery = "select u from RegistrationBookingEntity u where u.registrationCenterId=?3 and u.regDate between ?1 and ?2";
-
- @Query(preIdQuery)
- RegistrationBookingEntity getDemographicEntityPreRegistrationId(@Param("preRegId") String preRegId);
-
- /**
- * @param registrationCenterId
- * @param statusCode
- * @return List RegistrationBookingEntity based on Registration center id and
- * status code
- */
- public List findByRegistrationCenterId(@Param("regcntr_id") String registrationCenterId);
-
- @Query(preIdQuery)
- public List findByDemographicEntityPreRegistrationId(String preId);
-
- @Transactional
- @Modifying
- @Query(deletePreIdQuery)
- public int deleteByDemographicEntityPreRegistrationId(String preregistrationId);
-
- /**
- * @param start
- * pass startTime
- * @param end
- * pass endTime
- * @return list of booked preregistration data between start and end date
- */
- @Query(getPreIdQuery)
- public List findByRegDateBetweenAndRegistrationCenterId(LocalDate start, LocalDate end,
- String regCenterId);
-
- public List findByRegistrationCenterIdAndRegDate(String registrationCenterId,
- LocalDate regDate);
-
- @Query("SELECT e FROM RegistrationBookingEntity e WHERE e.registrationCenterId= ?1 and e.regDate>=?2")
- public List findByRegId(String registrationCenterId, LocalDate regDate);
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/impl/BookingDAO.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/impl/BookingDAO.java
deleted file mode 100644
index c28217554a5..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/impl/BookingDAO.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.repository.impl;
-
-import java.time.LocalDate;
-import java.time.LocalTime;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Component;
-
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import io.mosip.kernel.core.dataaccess.exception.DataAccessLayerException;
-import io.mosip.preregistration.booking.dto.SlotTimeDto;
-import io.mosip.preregistration.booking.entity.AvailibityEntity;
-import io.mosip.preregistration.booking.errorcodes.ErrorCodes;
-import io.mosip.preregistration.booking.errorcodes.ErrorMessages;
-import io.mosip.preregistration.booking.exception.AvailabilityUpdationFailedException;
-import io.mosip.preregistration.booking.exception.AvailablityNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingDataNotFoundException;
-import io.mosip.preregistration.booking.exception.RecordNotFoundException;
-import io.mosip.preregistration.booking.repository.BookingAvailabilityRepository;
-import io.mosip.preregistration.booking.repository.DemographicRepository;
-import io.mosip.preregistration.booking.repository.RegistrationBookingRepository;
-import io.mosip.preregistration.core.common.entity.RegistrationBookingEntity;
-import io.mosip.preregistration.core.exception.InvalidRequestParameterException;
-import io.mosip.preregistration.core.exception.RecordFailedToDeleteException;
-import io.mosip.preregistration.core.exception.TableNotAccessibleException;
-
-/**
- * This repository class is used to implement the JPA methods for Booking
- * application.
- *
- * @author Kishan Rathore
- * @since 1.0.0
- *
- */
-@Component
-public class BookingDAO {
-
- /** Autowired reference for {@link #bookingRepository}. */
- @Autowired
- @Qualifier("bookingAvailabilityRepository")
- private BookingAvailabilityRepository bookingAvailabilityRepository;
-
- /** Autowired reference for {@link #registrationBookingRepository}. */
- @Autowired
- @Qualifier("registrationBookingRepository")
- private RegistrationBookingRepository registrationBookingRepository;
-
- @Autowired
- @Qualifier("demographicRepository")
- private DemographicRepository demographicRepository;
-
- /**
- * @param Registration center id
- * @param Registration date
- * @return List AvailibityEntity based registration id and registration date.
- */
- public List availability(String regcntrId, LocalDate regDate) {
- List availabilityList = null;
- try {
- availabilityList = bookingAvailabilityRepository.findByRegcntrIdAndRegDateOrderByFromTimeAsc(regcntrId,
- regDate);
- } catch (DataAccessLayerException e) {
- throw new AvailablityNotFoundException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return availabilityList;
-
- }
-
- /**
- * @param regcntrId
- * @param fromDate
- * @param toDate
- * @return List of Local date
- */
- public List findDate(String regcntrId, LocalDate fromDate, LocalDate toDate) {
- List localDatList = null;
- try {
- localDatList = bookingAvailabilityRepository.findDate(regcntrId, fromDate, toDate);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return localDatList;
- }
-
- /**
- * @param slotFromTime
- * @param slotToTime
- * @param regDate
- * @param regcntrd
- * @return Availibity Entity based on FromTime, ToTime, RegDate and RegcntrId.
- */
- @Deprecated(forRemoval = true)
- public AvailibityEntity findByFromTimeAndToTimeAndRegDateAndRegcntrId(LocalTime slotFromTime, LocalTime slotToTime,
- LocalDate regDate, String regcntrd) {
- AvailibityEntity entity = null;
- try {
- entity = bookingAvailabilityRepository.findByFromTimeAndToTimeAndRegDateAndRegcntrId(slotFromTime,
- slotToTime, regDate, regcntrd);
- if (entity == null) {
-
- throw new AvailablityNotFoundException(ErrorCodes.PRG_BOOK_RCI_002.getCode(),
- ErrorMessages.AVAILABILITY_NOT_FOUND_FOR_THE_SELECTED_TIME.getMessage());
- }
-
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return entity;
- }
-
- /**
- * @param regDate
- * @param regcntrd
- * @param slotFromTime
- * @param slotToTime
- * @return Availibity Entity based on FromTime, ToTime, RegDate and RegcntrId.
- */
- public AvailibityEntity findByRegDateAndRegcntrIdAndFromTimeAndToTime(LocalDate regDate, String regcntrd,
- LocalTime slotFromTime, LocalTime slotToTime) {
- AvailibityEntity entity = null;
- try {
- entity = bookingAvailabilityRepository.findByRegDateAndRegcntrIdAndFromTimeAndToTime(regDate, regcntrd,
- slotFromTime, slotToTime);
- if (entity == null) {
-
- throw new AvailablityNotFoundException(ErrorCodes.PRG_BOOK_RCI_002.getCode(),
- ErrorMessages.AVAILABILITY_NOT_FOUND_FOR_THE_SELECTED_TIME.getMessage());
- }
-
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return entity;
- }
-
- /**
- * @param slotFromTime
- * @param slotToTime
- * @param regDate
- * @param regcntrd
- * @return Availibity Entity based on FromTime, ToTime, RegDate and RegcntrId.
- */
- @Transactional(propagation = Propagation.MANDATORY)
- public AvailibityEntity findFirstByRegDateAndRegcntrIdAndFromTimeAndToTime(LocalDate regDate, String regcntrd,
- LocalTime slotFromTime, LocalTime slotToTime) {
- AvailibityEntity entity = null;
- try {
- entity = bookingAvailabilityRepository.findFirstByRegDateAndRegcntrIdAndFromTimeAndToTime(regDate, regcntrd,
- slotFromTime, slotToTime);
- if (entity == null) {
-
- throw new AvailablityNotFoundException(ErrorCodes.PRG_BOOK_RCI_002.getCode(),
- ErrorMessages.AVAILABILITY_NOT_FOUND_FOR_THE_SELECTED_TIME.getMessage());
- }
-
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return entity;
- }
-
- /**
- * This method find entity for status other then CANCEL.
- *
- * @param preregistrationId
- * @param statusCode
- * @return RegistrationBookingEntity based on Pre registration id and status
- * code.
- */
- public RegistrationBookingEntity findByPreRegistrationId(String preregistrationId) {
- RegistrationBookingEntity entity = null;
- try {
- entity = registrationBookingRepository.getDemographicEntityPreRegistrationId(preregistrationId);
- if (entity == null) {
- throw new BookingDataNotFoundException(ErrorCodes.PRG_BOOK_RCI_013.getCode(),
- ErrorMessages.BOOKING_DATA_NOT_FOUND.getMessage());
- }
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.BOOKING_TABLE_NOT_ACCESSIBLE.getMessage());
- }
- return entity;
- }
-
- /**
- * @param availibityEntity
- * @return AvailibityEntity
- */
- public AvailibityEntity updateAvailibityEntity(AvailibityEntity availibityEntity) {
- AvailibityEntity entity = null;
- try {
- entity = bookingAvailabilityRepository.update(availibityEntity);
- if (entity == null) {
- throw new AvailabilityUpdationFailedException(ErrorCodes.PRG_BOOK_RCI_024.getCode(),
- ErrorMessages.AVAILABILITY_UPDATE_FAILED.getMessage());
- }
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return entity;
- }
-
- /**
- * @param bookingEntity
- * @return RegistrationBookingEntity
- */
- public RegistrationBookingEntity saveRegistrationEntityForBooking(RegistrationBookingEntity bookingEntity) {
- RegistrationBookingEntity entity = null;
- try {
- entity = registrationBookingRepository.save(bookingEntity);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.BOOKING_TABLE_NOT_ACCESSIBLE.getMessage());
- }
- return entity;
- }
-
- /**
- * @param regcntrId
- * @param regDate
- * @return List of AvailibityEntity
- */
- public List findByRegcntrIdAndRegDateOrderByFromTimeAsc(String regcntrId, LocalDate regDate) {
-
- List entityList = null;
- try {
- entityList = bookingAvailabilityRepository.findByRegcntrIdAndRegDateOrderByFromTimeAsc(regcntrId, regDate);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return entityList;
- }
-
- public List findByPreregistrationId(String preId) {
- List entityList = null;
- try {
- entityList = registrationBookingRepository.findByDemographicEntityPreRegistrationId(preId);
- if (entityList.isEmpty()) {
- throw new BookingDataNotFoundException(ErrorCodes.PRG_BOOK_RCI_013.getCode(),
- ErrorMessages.BOOKING_DATA_NOT_FOUND.getMessage());
- }
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.BOOKING_TABLE_NOT_ACCESSIBLE.getMessage());
- }
- return entityList;
-
- }
-
- public int deleteByPreRegistrationId(String preId) {
- int count = registrationBookingRepository.deleteByDemographicEntityPreRegistrationId(preId);
- if (count == 0) {
- throw new RecordFailedToDeleteException(ErrorCodes.PRG_BOOK_RCI_028.getCode(),
- ErrorMessages.FAILED_TO_DELETE_THE_PRE_REGISTRATION_RECORD.getMessage());
- }
- return count;
- }
-
- /**
- * @param fromLocaldate
- * @param toLocaldate
- * @return
- */
- public List findByBookingDateBetweenAndRegCenterId(LocalDate fromLocaldate, LocalDate toLocaldate,
- String regCenterId, Map> idsWithSlotTime) {
- List listOfPreIds = new ArrayList<>();
- try {
- if (regCenterId != null && !regCenterId.isEmpty()) {
- List entities = registrationBookingRepository
- .findByRegDateBetweenAndRegistrationCenterId(fromLocaldate, toLocaldate, regCenterId);
- if (entities != null && !entities.isEmpty()) {
- for (RegistrationBookingEntity entity : entities) {
- Map appointmentDate = new HashMap();
- appointmentDate.put(entity.getRegDate(),
- new SlotTimeDto(entity.getSlotFromTime(), entity.getSlotToTime()));
- idsWithSlotTime.put(entity.getPreregistrationId(), appointmentDate);
- listOfPreIds.add(entity.getPreregistrationId());
- }
- } else {
- throw new BookingDataNotFoundException(ErrorCodes.PRG_BOOK_RCI_032.getCode(),
- ErrorMessages.RECORD_NOT_FOUND_FOR_DATE_RANGE_AND_REG_CENTER_ID.getMessage());
- }
- } else {
- throw new InvalidRequestParameterException(ErrorCodes.PRG_BOOK_RCI_007.getCode(),
- ErrorMessages.REGISTRATION_CENTER_ID_NOT_ENTERED.getMessage(), null);
- }
- } catch (DataAccessLayerException e) {
- throw new BookingDataNotFoundException(ErrorCodes.PRG_BOOK_RCI_032.getCode(),
- ErrorMessages.RECORD_NOT_FOUND_FOR_DATE_RANGE_AND_REG_CENTER_ID.getMessage());
- }
- return listOfPreIds;
- }
-
- public boolean findRegistrationCenterId(String regCenterId) {
- List entityList = null;
- try {
- entityList = bookingAvailabilityRepository.findByRegcntrId(regCenterId);
- if (entityList == null || entityList.isEmpty()) {
- throw new RecordNotFoundException(ErrorCodes.PRG_BOOK_RCI_015.getCode(),
- ErrorMessages.NO_TIME_SLOTS_ASSIGNED_TO_THAT_REG_CENTER.getMessage());
- }
- return true;
-
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
-
- }
-
- /**
- *
- * @param regDate
- * @return list of regCenter
- */
- public List findRegCenter(LocalDate regDate) {
- List regCenterList = null;
- try {
- regCenterList = bookingAvailabilityRepository.findAvaialableRegCenter(regDate);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return regCenterList;
- }
-
- /**
- *
- * @param regDate
- * @param regID
- * @return list of date
- */
- public List findDistinctDate(LocalDate regDate, String regID) {
- List localDatList = null;
- try {
- localDatList = bookingAvailabilityRepository.findAvaialableDate(regDate, regID);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return localDatList;
- }
-
- /**
- *
- * @param regDate
- * @param regID
- * @return list of AvailibityEntity
- */
- public List findSlots(LocalDate regDate, String regID) {
- List localDatList = null;
- try {
- localDatList = bookingAvailabilityRepository.findAvaialableSlots(regDate, regID);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return localDatList;
- }
-
- /**
- *
- * @param regId
- * @param regDate
- * @return number of deleted items
- */
- public int deleteSlots(String regId, LocalDate regDate) {
- int deletedSlots = 0;
- try {
- deletedSlots = bookingAvailabilityRepository.deleteByRegcntrIdAndRegDate(regId, regDate);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return deletedSlots;
- }
-
- /**
- *
- * @param regId
- * @param regDate
- * @return list of RegistrationBookingEntity
- */
- public List findAllPreIds(String regId, LocalDate regDate) {
- List registrationBookingEntityList = null;
- try {
- registrationBookingEntityList = registrationBookingRepository.findByRegistrationCenterIdAndRegDate(regId,
- regDate);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return registrationBookingEntityList;
- }
-
- /**
- *
- * @param regId
- * @param date
- * @return list of RegistrationBookingEntity
- */
- public List findAllPreIdsByregID(String regId, LocalDate date) {
- List registrationBookingEntityList = null;
- try {
- registrationBookingEntityList = registrationBookingRepository.findByRegId(regId, date);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return registrationBookingEntityList;
- }
-
- /**
- *
- * Aparam regId
- *
- * @param regDate
- * @return number of deleted items
- */
- public int deleteAllSlotsByRegId(String regId, LocalDate regDate) {
- int deletedSlots = 0;
- try {
- deletedSlots = bookingAvailabilityRepository.deleteByRegcntrIdAndRegDateGreaterThanEqual(regId, regDate);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return deletedSlots;
- }
-
- /**
- * @param regcntrId
- * @param regDate
- * @return List of AvailibityEntity
- */
- public List findAvailability(String regcntrId, LocalDate starteDate, LocalDate endDate) {
-
- List entityList = null;
- try {
- entityList = bookingAvailabilityRepository
- .findByRegcntrIdAndRegDateGreaterThanEqualAndRegDateLessThanEqualOrderByFromTimeAsc(regcntrId,
- starteDate, endDate);
- } catch (DataAccessLayerException e) {
- throw new TableNotAccessibleException(ErrorCodes.PRG_BOOK_RCI_016.getCode(),
- ErrorMessages.AVAILABILITY_TABLE_NOT_ACCESSABLE.getMessage());
- }
- return entityList;
- }
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingService.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingService.java
deleted file mode 100644
index 8eca128283e..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingService.java
+++ /dev/null
@@ -1,1103 +0,0 @@
-package io.mosip.preregistration.booking.service;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-import java.util.stream.Collectors;
-
-import io.mosip.kernel.core.idvalidator.exception.InvalidIDException;
-import jakarta.annotation.PostConstruct;
-
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import io.mosip.kernel.core.authmanager.authadapter.model.AuthUserDetails;
-import io.mosip.kernel.core.logger.spi.Logger;
-import io.mosip.preregistration.booking.codes.RequestCodes;
-import io.mosip.preregistration.booking.dto.AvailabilityDto;
-import io.mosip.preregistration.booking.dto.BookingDataByRegIdDto;
-import io.mosip.preregistration.booking.dto.BookingRequestDTO;
-import io.mosip.preregistration.booking.dto.BookingStatus;
-import io.mosip.preregistration.booking.dto.BookingStatusDTO;
-import io.mosip.preregistration.booking.dto.DateTimeDto;
-import io.mosip.preregistration.booking.dto.MultiBookingRequest;
-import io.mosip.preregistration.booking.dto.MultiBookingRequestDTO;
-import io.mosip.preregistration.booking.dto.RegistrationCenterDto;
-import io.mosip.preregistration.booking.dto.SlotTimeDto;
-import io.mosip.preregistration.booking.entity.AvailibityEntity;
-import io.mosip.preregistration.booking.errorcodes.ErrorCodes;
-import io.mosip.preregistration.booking.errorcodes.ErrorMessages;
-import io.mosip.preregistration.booking.exception.AvailablityNotFoundException;
-import io.mosip.preregistration.booking.exception.DemographicGetStatusException;
-import io.mosip.preregistration.booking.exception.RecordNotFoundException;
-import io.mosip.preregistration.booking.exception.util.BookingExceptionCatcher;
-import io.mosip.preregistration.booking.repository.impl.BookingDAO;
-import io.mosip.preregistration.core.common.service.ApplicationIdentityMigrationService;
-import io.mosip.preregistration.booking.service.util.BookingLock;
-import io.mosip.preregistration.booking.service.util.BookingServiceUtil;
-import io.mosip.preregistration.core.code.AuditLogVariables;
-import io.mosip.preregistration.core.code.EventId;
-import io.mosip.preregistration.core.code.EventName;
-import io.mosip.preregistration.core.code.EventType;
-import io.mosip.preregistration.core.code.StatusCodes;
-import io.mosip.preregistration.core.common.dto.AuditRequestDto;
-import io.mosip.preregistration.core.common.dto.BookingRegistrationDTO;
-import io.mosip.preregistration.core.common.dto.CancelBookingResponseDTO;
-import io.mosip.preregistration.core.common.dto.DeleteBookingDTO;
-import io.mosip.preregistration.core.common.dto.MainRequestDTO;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import io.mosip.preregistration.core.common.dto.PreRegIdsByRegCenterIdResponseDTO;
-import io.mosip.preregistration.core.common.entity.RegistrationBookingEntity;
-import io.mosip.preregistration.core.config.LoggerConfiguration;
-import io.mosip.preregistration.core.util.AuditLogUtil;
-import io.mosip.preregistration.core.util.UUIDGeneratorUtil;
-import io.mosip.preregistration.core.util.ValidationUtil;
-
-/**
- * This class provides the service implementation for Booking application.
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-@Component
-public class BookingService implements BookingServiceIntf {
-
- /**
- * Autowired reference for {@link #serviceUtil}
- */
- @Autowired
- BookingServiceUtil serviceUtil;
-
- /**
- * Best-effort canonical-identity backfill.
- *
- *
Propagation differs by call site, deliberately. The backfill is
- * annotated {@code REQUIRED}, so in {@link #deleteBooking(String)} - which is
- * {@code REQUIRES_NEW} - it joins that transaction and rolls back with it,
- * while {@link #book(String, BookingRequestDTO)} and
- * {@link #cancelBooking(String, boolean)} are intentionally non-transactional
- * (see the note on their declarations, which predates this change), so there it
- * runs in its own short transaction that commits independently of the booking.
- *
- *
Both are acceptable: the backfill is idempotent, converts only
- * still-raw values, re-runs on the user's next activity, and is backstopped by
- * the nightly identity reconciliation job. An independent commit is in fact the
- * better outcome - the conversion survives even if the surrounding booking
- * later fails. This class alters no transactional annotation.
- */
- @Autowired
- private ApplicationIdentityMigrationService applicationIdentityMigrationService;
-
- /**
- * Reference for ${preregistration.availability.sync} from property file
- */
- @Value("${preregistration.availability.sync}")
- int syncDays;
-
- /**
- * Reference for ${preregistration.availability.noOfDays} from property file
- */
- @Value("${preregistration.availability.noOfDays}")
- long displayDays;
-
- /**
- * Reference for ${preregistration.booking.offset} from property file
- */
- @Value("${preregistration.booking.offset}")
- int availabilityOffset;
-
- @Autowired
- private BookingDAO bookingDAO;
-
- @Autowired
- private BookingLock bookingLock;
-
- @Value("${version}")
- String versionUrl;
-
- @Value("${mosip.preregistration.booking.availability.sync.id}")
- String idUrlSync;
-
- @Value("${mosip.preregistration.booking.id.book}")
- String idUrlBookAppointment;
-
- @Value("${mosip.preregistration.booking.fetch.booking.id}")
- String idUrlFetch;
-
- @Value("${mosip.preregistration.booking.cancel.id}")
- String idUrlCancel;
-
- @Value("${mosip.preregistration.booking.delete.id}")
- String idUrlDelete;
-
- @Value("${mosip.preregistration.booking.fetch.availability.id}")
- String idUrlAvailability;
-
- @Value("${mosip.preregistration.booking.fetchPreidByDate.id}")
- String idUrlBookingByDate;
-
- @Value("${mosip.preregistration.booking.availability.increase.id}")
- String idUrlIncreaseAvailability;
-
- @Value("${mosip.preregistration.booking.availability.check.id}")
- String idUrlCheckSlotAvailability;
-
- @Value("${mosip.preregistration.booking.delete.old.id}")
- String idUrlDeleteOld;
-
- @Autowired
- private ValidationUtil validationUtil;
-
- @PostConstruct
- public void setupBookingService() {
-
- }
-
- private Logger log = LoggerConfiguration.logConfig(BookingService.class);
-
- @Autowired
- private AuditLogUtil auditLogUtil;
-
- public AuthUserDetails authUserDetails() {
- return (AuthUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * getAvailability(java.lang.String)
- */
- @Override
- public MainResponseDTO getAvailability(String regID) {
- log.info("sessionId", "idType", "id", "In getAvailability method of Booking Service");
- MainResponseDTO response = new MainResponseDTO<>();
- response.setId(idUrlAvailability);
- response.setVersion(versionUrl);
- boolean isSaveSuccess = false;
-
- LocalDate endDate = LocalDate.now().plusDays(displayDays + availabilityOffset).minusDays(1);
- LocalDate fromDate = LocalDate.now().plusDays(availabilityOffset);
- AvailabilityDto availability = new AvailabilityDto();
- try {
- if (serviceUtil.isValidRegCenter(regID)) {
- int noOfHoliday = 0;
- List availableEntity = bookingDAO.findAvailability(regID, fromDate, endDate);
- List dateTimeList = new ArrayList<>();
- if (availableEntity == null) {
- throw new RecordNotFoundException(ErrorCodes.PRG_BOOK_RCI_015.getCode(),
- ErrorMessages.NO_TIME_SLOTS_ASSIGNED_TO_THAT_REG_CENTER.getMessage());
- }
-
- noOfHoliday = getSlot(dateTimeList, noOfHoliday, availableEntity);
- while (noOfHoliday > 0) {
- fromDate = endDate.plusDays(1);
- endDate = endDate.plusDays(noOfHoliday);
- availableEntity = bookingDAO.findAvailability(regID, fromDate, endDate);
- if (availableEntity == null) {
- log.info("sessionId", "idType", "id",
- "There no slots available in case of holidays present in the given date range and no of Holidays is "
- + noOfHoliday);
- noOfHoliday = 0;
- } else {
- noOfHoliday = 0;
- noOfHoliday = getSlot(dateTimeList, noOfHoliday, availableEntity);
- }
- }
- availability.setCenterDetails(dateTimeList);
- availability.setRegCenterId(regID);
- isSaveSuccess = true;
- }
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id", "In getAvailability method of Booking Service- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, response);
- } finally {
- if (isSaveSuccess) {
- setAuditValues(EventId.PRE_401.toString(), EventName.RETRIEVE.toString(), EventType.BUSINESS.toString(),
- "Availability retrieved successfully for booking", AuditLogVariables.MULTIPLE_ID.toString(),
- authUserDetails().getUserId(), authUserDetails().getUsername(), regID);
- } else {
- setAuditValues(EventId.PRE_405.toString(), EventName.EXCEPTION.toString(), EventType.SYSTEM.toString(),
- "Availability failed to get", AuditLogVariables.NO_ID.toString(), authUserDetails().getUserId(),
- authUserDetails().getUsername(), regID);
- }
- }
- response.setResponsetime(serviceUtil.getCurrentResponseTime());
- response.setResponse(availability);
- return response;
- }
-
- /**
- * Retrieve number of holidays based on date Time, number of holidays and
- * available slots
- *
- * @param dateTimeList
- * @param noOfHoliday
- * @param availableEntity
- * @return noOfHoliday
- */
- public int getSlot(List dateTimeList, int noOfHoliday, List availableEntity) {
- Map> result = null;
- result = availableEntity.stream().collect(
- Collectors.groupingBy(AvailibityEntity::getRegDate, () -> new TreeMap<>(), Collectors.toList()));
- for (Entry> entity : result.entrySet()) {
- DateTimeDto dateTime = new DateTimeDto();
- noOfHoliday = noOfHoliday
- + serviceUtil.slotSetter(entity.getKey(), dateTimeList, dateTime, entity.getValue());
- }
- return noOfHoliday;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * bookAppointment(io.mosip.preregistration.core.common.dto.MainRequestDTO,
- * java.lang.String)
- */
- @Override
- @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
- public MainResponseDTO bookAppointment(MainRequestDTO bookingRequestDTOs,
- String preRegistrationId) {
- bookingLock.setDate(bookingRequestDTOs.getRequest().getRegDate());
- bookingLock.setRegistrationCenter(bookingRequestDTOs.getRequest().getRegDate());
- bookingLock.setTimeslot(bookingRequestDTOs.getRequest().getSlotFromTime());
- log.info("sessionId", "idType", "id", "In bookAppointment method of Booking Service");
- MainResponseDTO responseDTO = new MainResponseDTO<>();
- responseDTO.setId(idUrlBookAppointment);
- responseDTO.setVersion(versionUrl);
- boolean isSaveSuccess = false;
- synchronized (bookingLock) {
-
- log.info("Sync block :", preRegistrationId, " Start", "");
-
- BookingStatusDTO response = new BookingStatusDTO();
- try {
-
- BookingRequestDTO bookingRequestDTO = bookingRequestDTOs.getRequest();
- Map dateMap = new HashMap<>();
- dateMap.put(RequestCodes.REG_DATE.getCode(), bookingRequestDTO.getRegDate());
- dateMap.put(RequestCodes.FROM_SLOT_TIME.getCode(), bookingRequestDTO.getSlotFromTime());
- dateMap.put(RequestCodes.PRE_REGISTRAION_ID.getCode(), preRegistrationId);
- if (serviceUtil.validateAppointmentDate(dateMap)) {
- /* Getting Status From Demographic */
- String preRegStatusCode = serviceUtil.getApplicationBookingStatus(preRegistrationId);
- log.info("preRegStatusCode : {}", preRegStatusCode);
-
- if (preRegStatusCode.equals(StatusCodes.APPLICATION_INCOMPLETE.getCode())
- || preRegStatusCode.equals(StatusCodes.PREFETCHED.getCode())) {
-
- if (preRegStatusCode.equals(StatusCodes.APPLICATION_INCOMPLETE.getCode())) {
- throw new DemographicGetStatusException(ErrorCodes.PRG_BOOK_RCI_036.getCode(),
- ErrorMessages.APPOINTMENT_CANNOT_BE_BOOKED_FOR_INCOMPLETE_APPLICATION.getMessage());
- } else {
- throw new DemographicGetStatusException(ErrorCodes.PRG_BOOK_RCI_036.getCode(),
- ErrorMessages.APPOINTMENT_CANNOT_BE_BOOKED_FOR_PREFETCHED_APPLICATION.getMessage());
- }
-
- }
-
- if (serviceUtil.mandatoryParameterCheck(preRegistrationId, bookingRequestDTO)
- && serviceUtil.slotTimeValidCheck(preRegistrationId, bookingRequestDTO)) {
-
- /* Checking the availability of slots */
- checkSlotAvailability(bookingRequestDTO);
-
- if (preRegStatusCode.equals(StatusCodes.PENDING_APPOINTMENT.getCode())
- || preRegStatusCode.equals(StatusCodes.CANCELLED.getCode())) {
-
- /* Creating new booking */
- response = book(preRegistrationId, bookingRequestDTO);
-
- } else if (preRegStatusCode.equals(StatusCodes.BOOKED.getCode())) {
-
- /* Concatenating Booking date and slot from time */
- RegistrationBookingEntity bookingEntity = bookingDAO
- .findByPreRegistrationId(preRegistrationId);
-
- System.out.println("Booking Entity " + bookingEntity);
-
- BookingRequestDTO oldBooking = new BookingRequestDTO();
- oldBooking.setRegDate(bookingEntity.getRegDate().toString());
- oldBooking.setRegistrationCenterId(bookingEntity.getRegistrationCenterId());
- oldBooking.setSlotFromTime(bookingEntity.getSlotFromTime().toString());
- oldBooking.setSlotToTime(bookingEntity.getSlotToTime().toString());
-
- String str = bookingEntity.getRegDate() + " " + bookingEntity.getSlotFromTime();
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
- LocalDateTime bookedDateTime = LocalDateTime.parse(str, formatter);
-
- log.info("sessionId", "idType", "id",
- "In bookAppointment method of Booking Service for booking Date Time- "
- + bookedDateTime);
- /* Time span check for re-book */
- serviceUtil.timeSpanCheckForRebook(bookedDateTime, bookingRequestDTOs.getRequesttime());
-
- /* Deleting old booking */
- deleteOldBooking(preRegistrationId);
-
- /* Increase availability */
- increaseAvailability(oldBooking);
-
- /* Creating new booking */
- response = book(preRegistrationId, bookingRequestDTO);
-
- } else if (preRegStatusCode.equals(StatusCodes.EXPIRED.getCode())) {
-
- /* Deleting old booking */
- deleteOldBooking(preRegistrationId);
-
- /* Creating new booking */
- response = book(preRegistrationId, bookingRequestDTO);
- }
-
- }
-
- }
- isSaveSuccess = true;
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id",
- "In bookAppointment method of Booking Service- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, responseDTO);
- } finally {
- if (isSaveSuccess) {
- setAuditValues(EventId.PRE_407.toString(), EventName.PERSIST.toString(),
- EventType.BUSINESS.toString(), "Appointment booked successfully",
- AuditLogVariables.MULTIPLE_ID.toString(), authUserDetails().getUserId(),
- authUserDetails().getUsername(), bookingRequestDTOs.getRequest().getRegistrationCenterId());
- } else {
- setAuditValues(EventId.PRE_405.toString(), EventName.EXCEPTION.toString(),
- EventType.SYSTEM.toString(), "Appointment failed to book",
- AuditLogVariables.NO_ID.toString(), authUserDetails().getUserId(),
- authUserDetails().getUsername(), bookingRequestDTOs.getRequest().getRegistrationCenterId());
- }
- }
- responseDTO.setResponsetime(serviceUtil.getCurrentResponseTime());
- responseDTO.setResponse(response);
- log.info("Sync block :", preRegistrationId, " End", "");
- return responseDTO;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * bookMultiAppointment(io.mosip.preregistration.core.common.dto.MainRequestDTO)
- */
- @Override
- @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
- public MainResponseDTO bookMultiAppointment(MainRequestDTO bookingRequestDTOs) {
-
- log.info("sessionId", "idType", "id", "In bookMultiAppointment method of Booking Service");
-
- bookingLock.setDate(bookingRequestDTOs.getRequest().getBookingRequest().get(0).getRegDate());
- bookingLock.setRegistrationCenter(bookingRequestDTOs.getRequest().getBookingRequest().get(0).getRegDate());
- bookingLock.setTimeslot(bookingRequestDTOs.getRequest().getBookingRequest().get(0).getSlotFromTime());
-
- synchronized (bookingLock) {
- log.info("Sync block :", bookingRequestDTOs.getRequest().getBookingRequest().get(0).getPreRegistrationId(),
- " Start", "");
- MainResponseDTO responseDTO = new MainResponseDTO<>();
- BookingStatus response = new BookingStatus();
- responseDTO.setId(idUrlBookAppointment);
- responseDTO.setVersion(versionUrl);
- boolean isSaveSuccess = false;
- List respList = new ArrayList<>();
- try {
- for (MultiBookingRequestDTO bookingRequestDTO : bookingRequestDTOs.getRequest().getBookingRequest()) {
- Map dateMap = new HashMap<>();
- dateMap.put(RequestCodes.REG_DATE.getCode(), bookingRequestDTO.getRegDate());
- dateMap.put(RequestCodes.FROM_SLOT_TIME.getCode(), bookingRequestDTO.getSlotFromTime());
- dateMap.put(RequestCodes.PRE_REGISTRAION_ID.getCode(), bookingRequestDTO.getPreRegistrationId());
- if (serviceUtil.validateAppointmentDate(dateMap)) {
- /* Getting Status From Demographic */
- String preRegStatusCode = serviceUtil
- .getApplicationBookingStatus(bookingRequestDTO.getPreRegistrationId());
- log.debug("preRegStatusCode" + preRegStatusCode);
-
- if (preRegStatusCode.equals(StatusCodes.APPLICATION_INCOMPLETE.getCode())
- || preRegStatusCode.equals(StatusCodes.PREFETCHED.getCode())) {
-
- if (preRegStatusCode.equals(StatusCodes.APPLICATION_INCOMPLETE.getCode())) {
- throw new DemographicGetStatusException(ErrorCodes.PRG_BOOK_RCI_036.getCode(),
- ErrorMessages.APPOINTMENT_CANNOT_BE_BOOKED_FOR_INCOMPLETE_APPLICATION
- .getMessage());
- } else {
- throw new DemographicGetStatusException(ErrorCodes.PRG_BOOK_RCI_036.getCode(),
- ErrorMessages.APPOINTMENT_CANNOT_BE_BOOKED_FOR_PREFETCHED_APPLICATION
- .getMessage());
- }
-
- }
-
- // Taking one booking request from multiple
- BookingRequestDTO bookingRequest = new BookingRequestDTO();
- bookingRequest.setRegDate(bookingRequestDTO.getRegDate());
- bookingRequest.setRegistrationCenterId(bookingRequestDTO.getRegistrationCenterId());
- bookingRequest.setSlotFromTime(bookingRequestDTO.getSlotFromTime());
- bookingRequest.setSlotToTime(bookingRequestDTO.getSlotToTime());
-
- if (serviceUtil.mandatoryParameterCheck(bookingRequestDTO.getPreRegistrationId(),
- bookingRequest)
- && serviceUtil.slotTimeValidCheck(bookingRequestDTO.getPreRegistrationId(),
- bookingRequest)) {
-
- /* Checking the availability of slots */
- checkSlotAvailability(bookingRequest);
-
- if (preRegStatusCode.equals(StatusCodes.PENDING_APPOINTMENT.getCode())
- || preRegStatusCode.equals(StatusCodes.CANCELLED.getCode())) {
-
- /* Creating new booking */
- respList.add(book(bookingRequestDTO.getPreRegistrationId(), bookingRequest));
-
- } else if (preRegStatusCode.equals(StatusCodes.BOOKED.getCode())) {
-
- /* Concatenating Booking date and slot from time */
- RegistrationBookingEntity bookingEntity = bookingDAO
- .findByPreRegistrationId(bookingRequestDTO.getPreRegistrationId());
- BookingRequestDTO oldBooking = new BookingRequestDTO();
- oldBooking.setRegDate(bookingEntity.getRegDate().toString());
- oldBooking.setRegistrationCenterId(bookingEntity.getRegistrationCenterId());
- oldBooking.setSlotFromTime(bookingEntity.getSlotFromTime().toString());
- oldBooking.setSlotToTime(bookingEntity.getSlotToTime().toString());
-
- String str = bookingEntity.getRegDate() + " " + bookingEntity.getSlotFromTime();
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
- LocalDateTime bookedDateTime = LocalDateTime.parse(str, formatter);
-
- log.info("sessionId", "idType", "id",
- "In bookMultiAppointment method of Booking Service for booking Date Time- "
- + bookedDateTime);
- /* Time span check for re-book */
- serviceUtil.timeSpanCheckForRebook(bookedDateTime, bookingRequestDTOs.getRequesttime());
-
- /* Deleting old booking */
- deleteOldBooking(bookingRequestDTO.getPreRegistrationId());
-
- /* Increase availability */
- increaseAvailability(oldBooking);
-
- /* Creating new booking */
- respList.add(book(bookingRequestDTO.getPreRegistrationId(), bookingRequest));
-
- } else if (preRegStatusCode.equals(StatusCodes.EXPIRED.getCode())) {
-
- /* Deleting old booking */
- deleteOldBooking(bookingRequestDTO.getPreRegistrationId());
-
- /* Creating new booking */
- respList.add(book(bookingRequestDTO.getPreRegistrationId(), bookingRequest));
- }
-
- }
- }
- }
- isSaveSuccess = true;
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id",
- "In bookMultiAppointment method of Booking Service- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, responseDTO);
- } finally {
- if (isSaveSuccess) {
- setAuditValues(EventId.PRE_407.toString(), EventName.PERSIST.toString(),
- EventType.BUSINESS.toString(), "Appointment booked successfully",
- AuditLogVariables.MULTIPLE_ID.toString(), authUserDetails().getUserId(),
- authUserDetails().getUsername(),
- bookingRequestDTOs.getRequest().getBookingRequest().get(0).getRegistrationCenterId());
- } else {
- setAuditValues(EventId.PRE_405.toString(), EventName.EXCEPTION.toString(),
- EventType.SYSTEM.toString(), "Appointment failed to book",
- AuditLogVariables.NO_ID.toString(), authUserDetails().getUserId(),
- authUserDetails().getUsername(),
- bookingRequestDTOs.getRequest().getBookingRequest().get(0).getRegistrationCenterId());
- }
- }
- responseDTO.setResponsetime(serviceUtil.getCurrentResponseTime());
- response.setBookingStatusResponse(respList);
- responseDTO.setResponse(response);
- log.info("Sync block :", bookingRequestDTOs.getRequest().getBookingRequest().get(0).getPreRegistrationId(),
- " End", "");
- return responseDTO;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * getAppointmentDetails(java.lang.String)
- */
- @Override
- public MainResponseDTO getAppointmentDetails(String preRegID) {
- log.info("sessionId", "idType", "id", "In getAppointmentDetails method of Booking Service");
- BookingRegistrationDTO bookingRegistrationDTO = new BookingRegistrationDTO();
- MainResponseDTO responseDto = new MainResponseDTO<>();
- responseDto.setId(idUrlFetch);
- responseDto.setVersion(versionUrl);
- RegistrationBookingEntity entity = null;
- try {
- this.applicationIdValidation(preRegID);
- // This call will check if the PRID belongs to the logged in user or not
- serviceUtil.checkApplicationStatus(preRegID);
- entity = bookingDAO.findByPreRegistrationId(preRegID);
-
- bookingRegistrationDTO.setRegDate(entity.getRegDate().toString());
- bookingRegistrationDTO.setRegistrationCenterId(entity.getRegistrationCenterId());
- bookingRegistrationDTO.setSlotFromTime(entity.getSlotFromTime().toString());
- bookingRegistrationDTO.setSlotToTime(entity.getSlotToTime().toString());
- responseDto.setResponse(bookingRegistrationDTO);
-
- responseDto.setErrors(null);
- responseDto.setResponsetime(serviceUtil.getCurrentResponseTime());
-
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id",
- "In getAppointmentDetails method of Booking Service- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, responseDto);
- }
-
- return responseDto;
- }
-
- private void applicationIdValidation(String applicationId) {
- if (applicationId == null || applicationId.trim().isEmpty()) {
- throw new InvalidIDException(
- ErrorCodes.PRG_BOOK_RCI_022.getCode(),
- "preRegistrationId cannot be empty."
- );
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * cancelAppointment(java.lang.String)
- */
- @Override
- @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
- public MainResponseDTO cancelAppointment(String preRegistrationId) {
- log.info("sessionId", "idType", "id", "In cancelAppointment method of Booking Service");
- MainResponseDTO responseDto = new MainResponseDTO<>();
- boolean isBatchUser = false;
- responseDto.setId(idUrlCancel);
- responseDto.setVersion(versionUrl);
- responseDto.setResponse(cancelBooking(preRegistrationId, isBatchUser));
-
- responseDto.setResponsetime(serviceUtil.getCurrentResponseTime());
-
- return responseDto;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * cancelAppointmentBatch(java.lang.String)
- */
- @Override
- @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
- public MainResponseDTO cancelAppointmentBatch(String preRegistrationId) {
- log.info("sessionId", "idType", "id", "In cancelAppointment method of Booking Service");
- MainResponseDTO responseDto = new MainResponseDTO<>();
- boolean isBatchUser = true;
- responseDto.setId(idUrlCancel);
- responseDto.setVersion(versionUrl);
- responseDto.setResponse(cancelBooking(preRegistrationId, isBatchUser));
-
- responseDto.setResponsetime(serviceUtil.getCurrentResponseTime());
-
- return responseDto;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#book(
- * java.lang.String,
- * io.mosip.preregistration.booking.serviceimpl.dto.BookingRequestDTO)
- */
- @Override
- //Please note that this method is NOT creating a new transaction.
- //@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
- public BookingStatusDTO book(String preRegistrationId, BookingRequestDTO bookingRequestDTO) {
- log.info("sessionId", "idType", "id", "In book method of Booking Service");
- BookingStatusDTO bookingStatusDTO = new BookingStatusDTO();
- MainResponseDTO> response = new MainResponseDTO<>();
- response.setId(idUrlBookAppointment);
- response.setVersion(versionUrl);
- try {
- AvailibityEntity availableEntity;
-
- availableEntity = bookingDAO.findFirstByRegDateAndRegcntrIdAndFromTimeAndToTime(
- LocalDate.parse(bookingRequestDTO.getRegDate()), bookingRequestDTO.getRegistrationCenterId(),
- LocalTime.parse(bookingRequestDTO.getSlotFromTime()),
- LocalTime.parse(bookingRequestDTO.getSlotToTime()));
- log.info("In Availablity of book method",
- "available slots before update :" + availableEntity.getAvailableKiosks(),
- " for Reg center" + availableEntity.getRegcntrId(),
- " and Date and Time " + availableEntity.getRegDate() + " " + availableEntity.getFromTime());
- if (serviceUtil.isKiosksAvailable(availableEntity)) {
- /* Updating booking */
- RegistrationBookingEntity bookingEntity = bookingDAO.saveRegistrationEntityForBooking(
- serviceUtil.bookingEntitySetter(preRegistrationId, bookingRequestDTO));
- /*
- * Best-effort backfill: a failure here must never fail the booking. The
- * booking's own crBy is already canonical at this point, so ownership and
- * auth are unaffected; missed rows self-heal on the user's next activity and
- * are swept by the nightly identity reconciliation job.
- */
- try {
- applicationIdentityMigrationService.migrateRawUserToEffectiveUser(preRegistrationId,
- bookingEntity.getCrBy());
- } catch (Exception migrationEx) {
- log.error("sessionId", "idType", "id",
- "Identity migration failed for preRegistrationId " + preRegistrationId
- + ", booking continues - " + migrationEx.getMessage());
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(migrationEx));
- }
- /* Reduce Availability */
- availableEntity.setAvailableKiosks(availableEntity.getAvailableKiosks() - 1);
- AvailibityEntity availableUpdate = bookingDAO.updateAvailibityEntity(availableEntity);
-
- log.info("In Availablity of book method",
- "available slots after upadate :" + availableUpdate.getAvailableKiosks(),
- " for Reg center" + availableUpdate.getRegcntrId(),
- " and Date and Time " + availableUpdate.getRegDate() + " " + availableUpdate.getFromTime());
-
- /* Updating demographic */
- // serviceUtil.updateDemographicStatus(preRegistrationId,
- // StatusCodes.BOOKED.getCode());
- bookingStatusDTO.setBookingMessage("Appointment booked successfully");
-
- }
-
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id", "In book method of Booking Service- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, response);
- }
-
- return bookingStatusDTO;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * cancelBooking(java.lang.String, boolean)
- */
- @Override
- //Please note that this method is NOT creating a new transaction.
- //@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
- public CancelBookingResponseDTO cancelBooking(String preRegistrationId, boolean isBatchUser) {
- log.info("sessionId", "idType", "id", "In cancelBooking method of Booking Service");
- CancelBookingResponseDTO cancelBookingResponseDTO = new CancelBookingResponseDTO();
- MainResponseDTO> response = new MainResponseDTO<>();
- response.setId(idUrlCancel);
- response.setVersion(versionUrl);
- boolean isSaveSuccess = false;
- AvailibityEntity availableEntity;
- RegistrationBookingEntity bookingEntity;
- try {
- if (serviceUtil.mandatoryParameterCheckforCancel(preRegistrationId)) {
- if (serviceUtil.getDemographicStatusForCancel(preRegistrationId)) {
- /* Getting Booking details */
- bookingEntity = bookingDAO.findByPreRegistrationId(preRegistrationId);
-
- availableEntity = bookingDAO.findFirstByRegDateAndRegcntrIdAndFromTimeAndToTime(
- bookingEntity.getRegDate(), bookingEntity.getRegistrationCenterId(),
- bookingEntity.getSlotFromTime(), bookingEntity.getSlotToTime());
-
- /* For batch condition will skip */
- if (!isBatchUser) {
- String str = bookingEntity.getRegDate() + " " + bookingEntity.getSlotFromTime();
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
- LocalDateTime bookedDateTime = LocalDateTime.parse(str, formatter);
-
- serviceUtil.timeSpanCheckForCancle(bookedDateTime);
- }
- /*
- * Best-effort backfill. The resolved id is not used beyond this call, so
- * an unresolvable legacy crBy must not block a cancellation.
- */
- try {
- String effectiveUserId = applicationIdentityMigrationService
- .resolveEffectiveUserId(bookingEntity.getCrBy());
- applicationIdentityMigrationService.migrateRawUserToEffectiveUser(preRegistrationId,
- effectiveUserId);
- } catch (Exception migrationEx) {
- log.error("sessionId", "idType", "id",
- "Identity migration failed for preRegistrationId " + preRegistrationId
- + ", cancellation continues - " + migrationEx.getMessage());
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(migrationEx));
- }
- /* Deleting the canceled booking */
- // bookingDAO.deleteRegistrationEntity(bookingEntity);
- bookingDAO.deleteByPreRegistrationId(preRegistrationId);
-
- /* Update the status to Canceled in demographic Table */
- // serviceUtil.updateDemographicStatus(preRegistrationId,
- // StatusCodes.CANCELLED.getCode());
-
- /* No. of Availability. update */
- availableEntity.setAvailableKiosks(availableEntity.getAvailableKiosks() + 1);
-
- bookingDAO.updateAvailibityEntity(availableEntity);
-
- cancelBookingResponseDTO.setTransactionId(UUIDGeneratorUtil.generateId());
- cancelBookingResponseDTO
- .setMessage("Appointment for the selected application has been successfully cancelled");
-
- }
- }
- isSaveSuccess = true;
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id", "In cancelBooking method of Booking Service- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, response);
- } finally {
-
- if (isSaveSuccess) {
- setAuditValues(EventId.PRE_402.toString(), EventName.UPDATE.toString(), EventType.BUSINESS.toString(),
- "Booking cancel successfully", AuditLogVariables.MULTIPLE_ID.toString(),
- authUserDetails().getUserId(), authUserDetails().getUsername(), null);
- } else {
- setAuditValues(EventId.PRE_405.toString(), EventName.EXCEPTION.toString(), EventType.SYSTEM.toString(),
- "Booking failed to cancel", AuditLogVariables.NO_ID.toString(), authUserDetails().getUserId(),
- authUserDetails().getUsername(), null);
- }
- }
- return cancelBookingResponseDTO;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * deleteBooking(java.lang.String)
- */
- @Override
- @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
- public MainResponseDTO deleteBooking(String preregId) {
- log.info("sessionId", "idType", "id", "In deleteIndividual method of pre-registration service ");
- MainResponseDTO response = new MainResponseDTO<>();
- response.setId(idUrlDelete);
- response.setVersion(versionUrl);
- DeleteBookingDTO deleteDto = new DeleteBookingDTO();
- Map requestParamMap = new HashMap<>();
- AvailibityEntity availableEntity;
- boolean isSaveSuccess = false;
- try {
- requestParamMap.put(RequestCodes.PRE_REGISTRAION_ID.getCode(), preregId);
- if (validationUtil.requstParamValidator(requestParamMap)
- && serviceUtil.checkApplicationStatus(preregId)) {
- RegistrationBookingEntity registrationEntityList = bookingDAO.findByPreRegistrationId(preregId);
- /*
- * Best-effort backfill: a failure here must never fail the deletion. The
- * backfill resolves each column from its own stored value, so the booking's
- * own crBy is all it needs.
- */
- try {
- applicationIdentityMigrationService.migrateRawUserToEffectiveUser(preregId,
- registrationEntityList.getCrBy());
- } catch (Exception migrationEx) {
- log.error("sessionId", "idType", "id", "Identity migration failed for preRegistrationId "
- + preregId + ", deletion continues - " + migrationEx.getMessage());
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(migrationEx));
- }
- String str = registrationEntityList.getRegDate() + " " + registrationEntityList.getSlotFromTime();
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
- LocalDateTime bookedDateTime = LocalDateTime.parse(str, formatter);
- serviceUtil.timeSpanCheckForCancle(bookedDateTime);
- bookingDAO.deleteByPreRegistrationId(preregId);
- availableEntity = bookingDAO.findFirstByRegDateAndRegcntrIdAndFromTimeAndToTime(
- LocalDate.parse(registrationEntityList.getRegDate().toString()),
- registrationEntityList.getRegistrationCenterId(),
- LocalTime.parse(registrationEntityList.getSlotFromTime().toString()),
- LocalTime.parse(registrationEntityList.getSlotToTime().toString()));
- /* No. of Availability. update */
- availableEntity.setAvailableKiosks(availableEntity.getAvailableKiosks() + 1);
-
- /* Updating slot in DB */
- bookingDAO.updateAvailibityEntity(availableEntity);
-
- deleteDto.setPreRegistrationId(registrationEntityList.getPreregistrationId());
- deleteDto.setDeletedDateTime(new Date(System.currentTimeMillis()));
- /*
- * Response-only attribution, resolved after the deletion so it can never
- * block it. An unresolvable legacy identifier leaves the field unset - it
- * must never fall back to the raw value, which would put the plaintext
- * identifier back on the wire. The audit trail is unaffected: it records the
- * authenticated caller, not this value.
- */
- try {
- deleteDto.setDeletedBy(applicationIdentityMigrationService
- .resolveEffectiveUserId(registrationEntityList.getCrBy()));
- } catch (Exception resolveEx) {
- log.error("sessionId", "idType", "id", "Could not resolve deletedBy for preRegistrationId "
- + preregId + ", field omitted - " + resolveEx.getMessage());
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(resolveEx));
- }
-
- }
- isSaveSuccess = true;
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id", "In deleteBooking method of Booking Service- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, response);
- } finally {
-
- if (isSaveSuccess) {
- setAuditValues(EventId.PRE_403.toString(), EventName.DELETE.toString(), EventType.BUSINESS.toString(),
- "Booking deleted successfully", AuditLogVariables.MULTIPLE_ID.toString(),
- authUserDetails().getUserId(), authUserDetails().getUsername(), null);
- } else {
- setAuditValues(EventId.PRE_405.toString(), EventName.EXCEPTION.toString(), EventType.SYSTEM.toString(),
- "Booking failed to delete", AuditLogVariables.NO_ID.toString(), authUserDetails().getUserId(),
- authUserDetails().getUsername(), null);
- }
- }
-
- response.setResponsetime(serviceUtil.getCurrentResponseTime());
- response.setResponse(deleteDto);
- return response;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * checkSlotAvailability(io.mosip.preregistration.booking.serviceimpl.dto.
- * BookingRequestDTO)
- */
- @Override
- public void checkSlotAvailability(BookingRequestDTO bookingRequestDTO) {
- MainResponseDTO> response = new MainResponseDTO<>();
- response.setId(idUrlCheckSlotAvailability);
- response.setVersion(versionUrl);
- try {
- List regCenter = serviceUtil.getRegCenterMasterData(
- bookingRequestDTO.getRegistrationCenterId());
- Boolean isValidRegCenter = regCenter.stream()
- .anyMatch(iterate -> iterate.getId().contains(bookingRequestDTO.getRegistrationCenterId()));
-
- if (!isValidRegCenter) {
- throw new RecordNotFoundException(ErrorCodes.PRG_BOOK_RCI_035.getCode(),
- ErrorMessages.REG_CENTER_ID_NOT_FOUND.getMessage());
- }
-
- bookingDAO.findRegistrationCenterId(bookingRequestDTO.getRegistrationCenterId());
- AvailibityEntity entity = bookingDAO.findByRegDateAndRegcntrIdAndFromTimeAndToTime(
- LocalDate.parse(bookingRequestDTO.getRegDate()), bookingRequestDTO.getRegistrationCenterId(),
- LocalTime.parse(bookingRequestDTO.getSlotFromTime()),
- LocalTime.parse(bookingRequestDTO.getSlotToTime()));
- log.info("In Availablity", "available slots :" + entity.getAvailableKiosks(),
- " for Reg center" + entity.getRegcntrId(),
- " and Date and Time " + entity.getRegDate() + " " + entity.getFromTime());
-
- log.info("sessionId", "idType", "id", "In checkSlotAvailability method of Booking Service");
- if (entity.getAvailableKiosks() < 1) {
- throw new AvailablityNotFoundException(ErrorCodes.PRG_BOOK_RCI_002.getCode(),
- ErrorMessages.AVAILABILITY_NOT_FOUND_FOR_THE_SELECTED_TIME.getMessage());
- }
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id",
- "In checkSlotAvailability method of Booking Service for Exception- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, response);
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * deleteOldBooking(java.lang.String)
- */
- @Override
- public boolean deleteOldBooking(String preId) {
- MainResponseDTO> response = new MainResponseDTO<>();
- response.setId(idUrlDeleteOld);
- response.setVersion(versionUrl);
- try {
- int count = bookingDAO.deleteByPreRegistrationId(preId);
- if (count > 0) {
- log.info("sessionId", "idType", "id", "In deleteOldBooking method of Booking Service");
- return true;
- }
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id",
- "In deleteOldBooking method of Booking Service for Exception- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, response);
- }
- return false;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * increaseAvailability(io.mosip.preregistration.booking.serviceimpl.dto.
- * BookingRequestDTO)
- */
- @Override
- public boolean increaseAvailability(BookingRequestDTO oldBooking) {
- MainResponseDTO> response = new MainResponseDTO<>();
- response.setId(idUrlIncreaseAvailability);
- response.setVersion(versionUrl);
- try {
- AvailibityEntity availableEntity;
- availableEntity = bookingDAO.findByRegDateAndRegcntrIdAndFromTimeAndToTime(
- LocalDate.parse(oldBooking.getRegDate()), oldBooking.getRegistrationCenterId(),
- LocalTime.parse(oldBooking.getSlotFromTime()), LocalTime.parse(oldBooking.getSlotToTime()));
- availableEntity.setAvailableKiosks(availableEntity.getAvailableKiosks() + 1);
- bookingDAO.updateAvailibityEntity(availableEntity);
- log.info("sessionId", "idType", "id", "In increaseAvailability method of Booking Service");
-
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id",
- "In increaseAvailability method of Booking Service for Exception- " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, response);
- }
- return true;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * setAuditValues(java.lang.String, java.lang.String, java.lang.String,
- * java.lang.String, java.lang.String, java.lang.String, java.lang.String,
- * java.lang.String)
- */
- @Override
- public void setAuditValues(String eventId, String eventName, String eventType, String description, String idType,
- String userId, String userName, String ref_id) {
- AuditRequestDto auditRequestDto = new AuditRequestDto();
- auditRequestDto.setEventId(eventId);
- auditRequestDto.setEventName(eventName);
- auditRequestDto.setEventType(eventType);
- auditRequestDto.setDescription(description);
- auditRequestDto.setId(idType);
- auditRequestDto.setSessionUserId(userId);
- auditRequestDto.setSessionUserName(userName);
- auditRequestDto.setModuleId(AuditLogVariables.BOOK.toString());
- auditRequestDto.setModuleName(AuditLogVariables.BOOKING_SERVICE.toString());
- auditRequestDto.setId(ref_id);
- auditLogUtil.saveAuditDetails(auditRequestDto);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see io.mosip.preregistration.booking.serviceimpl.service.BookingServiceIntf#
- * getBookedPreRegistrationByDate(java.lang.String, java.lang.String,
- * java.lang.String)
- */
-
- @Override
- public MainResponseDTO getBookedPreRegistrationByDate(String fromDateStr,
- String toDateStr, String regCenterId) {
- log.info("sessionId", "idType", "id", "In getBookedPreRegistrationByDate method of booking service ");
- MainResponseDTO response = new MainResponseDTO<>();
- response.setId(idUrlBookingByDate);
- response.setVersion(versionUrl);
- try {
-
- if (toDateStr == null || toDateStr.isEmpty()) {
- toDateStr = fromDateStr;
- }
- String format = "yyyy-MM-dd";
- if (serviceUtil.validateFromDateAndToDate(fromDateStr, toDateStr, format)) {
- DateTimeFormatter parseFormatter = DateTimeFormatter.ofPattern(format);
- LocalDate fromDate = LocalDate.parse(fromDateStr, parseFormatter);
- LocalDate toDate = LocalDate.parse(toDateStr, parseFormatter);
- Map> idsWithSlotTime = new HashMap>();
- List details = bookingDAO.findByBookingDateBetweenAndRegCenterId(fromDate, toDate, regCenterId,
- idsWithSlotTime);
- PreRegIdsByRegCenterIdResponseDTO responseDTO = new PreRegIdsByRegCenterIdResponseDTO();
- responseDTO.setPreRegistrationIds(details);
- responseDTO.setRegistrationCenterId(regCenterId);
-
- response.setResponse(responseDTO);
- }
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id",
- "In getPreRegistrationByDate method of pre-registration service - " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, response);
- }
- response.setResponsetime(serviceUtil.getCurrentResponseTime());
- response.setId(idUrlBookingByDate);
- response.setVersion(versionUrl);
- response.setErrors(null);
- return response;
- }
-
- @Override
- public MainResponseDTO getBookedPreRegistrations(String fromDateStr, String toDateStr,
- String regCenterId) {
- log.info("sessionId", "idType", "id", "In getBookedPreRegistrations method of booking service ");
- MainResponseDTO response = new MainResponseDTO<>();
- response.setId(idUrlBookingByDate);
- response.setVersion(versionUrl);
- try {
-
- if (toDateStr == null || toDateStr.isEmpty()) {
- toDateStr = fromDateStr;
- }
- String format = "yyyy-MM-dd";
- if (serviceUtil.validateFromDateAndToDate(fromDateStr, toDateStr, format)) {
- DateTimeFormatter parseFormatter = DateTimeFormatter.ofPattern(format);
- LocalDate fromDate = LocalDate.parse(fromDateStr, parseFormatter);
- LocalDate toDate = LocalDate.parse(toDateStr, parseFormatter);
- Map> idsWithSlotTime = new HashMap>();
- bookingDAO.findByBookingDateBetweenAndRegCenterId(fromDate, toDate, regCenterId, idsWithSlotTime);
- BookingDataByRegIdDto responseDTO = new BookingDataByRegIdDto();
- responseDTO.setRegistrationCenterId(regCenterId);
- responseDTO.setIdsWithAppointmentDate(idsWithSlotTime);
- response.setResponse(responseDTO);
- }
- } catch (Exception ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id",
- "In getBookedPreRegistrations method of pre-registration service - " + ex.getMessage());
- new BookingExceptionCatcher().handle(ex, response);
- }
- response.setResponsetime(serviceUtil.getCurrentResponseTime());
- response.setId(idUrlBookingByDate);
- response.setVersion(versionUrl);
- response.setErrors(null);
- return response;
-
- }
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingServiceIntf.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingServiceIntf.java
deleted file mode 100644
index 39fadb70e41..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingServiceIntf.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package io.mosip.preregistration.booking.service;
-
-
-import org.springframework.stereotype.Service;
-
-import io.mosip.preregistration.booking.dto.AvailabilityDto;
-import io.mosip.preregistration.booking.dto.BookingDataByRegIdDto;
-import io.mosip.preregistration.booking.dto.BookingRequestDTO;
-import io.mosip.preregistration.booking.dto.BookingStatus;
-import io.mosip.preregistration.booking.dto.BookingStatusDTO;
-import io.mosip.preregistration.booking.dto.MultiBookingRequest;
-import io.mosip.preregistration.core.common.dto.BookingRegistrationDTO;
-import io.mosip.preregistration.core.common.dto.CancelBookingResponseDTO;
-import io.mosip.preregistration.core.common.dto.DeleteBookingDTO;
-import io.mosip.preregistration.core.common.dto.MainRequestDTO;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import io.mosip.preregistration.core.common.dto.PreRegIdsByRegCenterIdResponseDTO;
-
-/**
- * Booking operations: availability, book, multi-book, cancel, delete, and queries by centre/date.
- */
-@Service
-public interface BookingServiceIntf {
-
- /**
- * Gives the availability details based on registrationId
- *
- * @param regID pass the RegistartionId
- * @return AvailabilityDto return the registration details
- */
- MainResponseDTO getAvailability(String regID);
-
-
- /**
- * This method use to book the appointment.
- *
- * @param bookingRequestDTO pass the booking details
- * @return BookingStatusDTO response with booking status code
- */
- MainResponseDTO bookAppointment(MainRequestDTO bookingRequestDTOs,
- String preRegistrationId);
-
- /**
- * This method will book the multiple appointments.
- *
- * @param bookingRequestDTOs pass the list of booking details
- * @return BookingStatus response with list of booking status code
- */
- MainResponseDTO bookMultiAppointment(MainRequestDTO bookingRequestDTOs);
-
- /**
- * This method is for getting appointment details for given preRegistrationId.
- *
- * @param preRegID pass the preRegId
- * @return BookingRegistrationDTO return the appointment details for given preRegId
- */
- MainResponseDTO getAppointmentDetails(String preRegID);
-
- /**
- * This method will cancel the appointment based on the preRegistrationId.
- *
- * @param preRegistrationId pass the preRegistrationId
- * @return CancelBookingResponseDTO return the status code for cancel booking
- */
- MainResponseDTO cancelAppointment(String preRegistrationId);
-
- /**
- * This method will cancel the appointment using batch.
- *
- * @param preRegistrationId pass the preRegistartionId
- * @return CancelBookingResponseDTO return the status code for cancel booking
- */
- MainResponseDTO cancelAppointmentBatch(String preRegistrationId);
-
- /**
- *
- * This booking API will be called by bookAppointment method.
- *
- * @param preRegistrationId pass the peRegistartionId
- * @param bookingRequestDTO pass the booking details
- * @return BookingStatusDTO return the status code
- */
- BookingStatusDTO book(String preRegistrationId, BookingRequestDTO bookingRequestDTO);
-
- /**
- * This cancel API will be called by cancelAppointment method.
- *
- * @param preRegistrationId pass the preRegistrationId
- * @param isBatchUser
- * @return CancelBookingResponseDTO response with status code
- */
- CancelBookingResponseDTO cancelBooking(String preRegistrationId, boolean isBatchUser);
-
- /**
- * This Method is used to delete the Individual Application and documents
- * associated with it
- *
- * @param preregId
- * pass the preregId of individual
- * @return response
- *
- */
- MainResponseDTO deleteBooking(String preregId);
-
- /**
- * This Method is used to check the slot availability
- *
- * @param bookingRequestDTO
- * pass the booking details
- *
- */
- void checkSlotAvailability(BookingRequestDTO bookingRequestDTO);
-
- /**
- * This Method is used to delete the old booking
- *
- * @param preId
- * pass the PreRegistrationId
- *
- */
- boolean deleteOldBooking(String preId);
-
- /**
- * This Method is used to update the availability after cancel of booking
- *
- * @param oldBooking
- * pass the old Booking details
- *
- */
- boolean increaseAvailability(BookingRequestDTO oldBooking);
-
- /**
- * This method is used to audit all the booking events
- *
- * @param eventId
- * @param eventName
- * @param eventType
- * @param description
- * @param idType
- */
- void setAuditValues(String eventId, String eventName, String eventType, String description, String idType,
- String userId, String userName, String ref_id);
-
- /**
- * This Method is used to retrieve booked PreIds by date and regCenterId**
- *
- * @param fromDate
- * pass fromDate*
- * @param toDate
- * pass toDate*
- * @param regCenterId
- * @return MainResponseDTO
- ***/
-
- MainResponseDTO getBookedPreRegistrationByDate(String fromDateStr,
- String toDateStr, String regCenterId);
-
- /**
- * This Method is used to retrieve booked PreIds by date and regCenterId**
- *
- * @param fromDate
- * pass fromDate*
- * @param toDate
- * pass toDate*
- * @param regCenterId
- * @return MainResponseDTO
- ***/
-
- MainResponseDTO getBookedPreRegistrations(String fromDateStr,
- String toDateStr, String regCenterId);
-
-
-}
\ No newline at end of file
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingLock.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingLock.java
deleted file mode 100644
index 8155aa09c29..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingLock.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.service.util;
-
-import org.springframework.stereotype.Component;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * This class provides the locking object.
- *
- * @author Rudra Tripathy
- * @since 1.0.0
- *
- */
-@Component
-@Getter
-@Setter
-@NoArgsConstructor
-@AllArgsConstructor
-public class BookingLock {
-
- String registrationCenter;
- String date;
- String timeslot;
-
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return 1;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- BookingLock other = (BookingLock) obj;
- if (date == null) {
- if (other.date != null)
- return false;
- } else if (!date.equals(other.date)) {
- return false;
- }
- if (registrationCenter == null) {
- if (other.registrationCenter != null)
- return false;
- } else if (!registrationCenter.equals(other.registrationCenter)) {
- return false;
- }
- if (timeslot == null) {
- if (other.timeslot != null)
- return false;
- } else if (!timeslot.equals(other.timeslot)) {
- return false;
- }
-
- return true;
- }
-
-}
diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingServiceUtil.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingServiceUtil.java
deleted file mode 100644
index d8d690543bc..00000000000
--- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingServiceUtil.java
+++ /dev/null
@@ -1,775 +0,0 @@
-/*
- * Copyright
- *
- */
-package io.mosip.preregistration.booking.service.util;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeParseException;
-import java.time.temporal.ChronoUnit;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-
-import jakarta.annotation.PostConstruct;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.json.JsonMapper;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Component;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.client.HttpClientErrorException;
-import org.springframework.web.client.RestClientException;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.util.UriComponentsBuilder;
-
-import io.mosip.kernel.core.authmanager.authadapter.model.AuthUserDetails;
-import io.mosip.kernel.core.exception.ExceptionUtils;
-import io.mosip.kernel.core.exception.ServiceError;
-import io.mosip.kernel.core.logger.spi.Logger;
-import io.mosip.kernel.core.util.DateUtils2;
-import io.mosip.preregistration.booking.codes.RequestCodes;
-import io.mosip.preregistration.booking.dto.BookingRequestDTO;
-import io.mosip.preregistration.booking.dto.CancelBookingDTO;
-import io.mosip.preregistration.booking.dto.DateTimeDto;
-import io.mosip.preregistration.booking.dto.RegistrationCenterDto;
-import io.mosip.preregistration.booking.dto.RegistrationCenterResponseDto;
-import io.mosip.preregistration.booking.dto.SlotDto;
-import io.mosip.preregistration.booking.entity.AvailibityEntity;
-import io.mosip.preregistration.booking.errorcodes.ErrorCodes;
-import io.mosip.preregistration.booking.errorcodes.ErrorMessages;
-import io.mosip.preregistration.booking.exception.AppointmentCannotBeCanceledException;
-import io.mosip.preregistration.booking.exception.AppointmentReBookingFailedException;
-import io.mosip.preregistration.booking.exception.AvailablityNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingDataNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingDateNotSeletectedException;
-import io.mosip.preregistration.booking.exception.BookingPreIdNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingRegistrationCenterIdNotFoundException;
-import io.mosip.preregistration.booking.exception.BookingTimeSlotNotSeletectedException;
-import io.mosip.preregistration.booking.exception.AppointmentBookingFailedException;
-import io.mosip.preregistration.booking.exception.DemographicGetStatusException;
-import io.mosip.preregistration.booking.exception.InvalidDateTimeFormatException;
-import io.mosip.preregistration.booking.exception.RecordNotFoundException;
-import io.mosip.preregistration.booking.exception.TimeSpanException;
-import io.mosip.preregistration.core.code.StatusCodes;
-import io.mosip.preregistration.core.common.dto.BookingRegistrationDTO;
-import io.mosip.preregistration.core.common.dto.MainRequestDTO;
-import io.mosip.preregistration.core.common.dto.MainResponseDTO;
-import io.mosip.preregistration.core.common.dto.NotificationDTO;
-import io.mosip.preregistration.core.common.dto.RequestWrapper;
-import io.mosip.preregistration.core.common.dto.ResponseWrapper;
-import io.mosip.preregistration.core.common.entity.RegistrationBookingEntity;
-import io.mosip.preregistration.core.config.LoggerConfiguration;
-import io.mosip.preregistration.core.exception.MasterDataNotAvailableException;
-import io.mosip.preregistration.core.exception.NotificationException;
-import io.mosip.preregistration.core.exception.RestCallException;
-import io.mosip.preregistration.core.util.UUIDGeneratorUtil;
-import io.mosip.preregistration.core.util.ValidationUtil;
-import io.mosip.preregistration.core.common.service.UserDetailsService;
-import io.mosip.preregistration.core.exception.UserLookupException;
-import io.mosip.preregistration.core.util.GenericUtil;
-
-/**
- * This class provides the utility methods for Booking application.
- *
- * @author Kishan Rathore
- * @author Jagadishwari
- * @author Ravi C. Balaji
- * @since 1.0.0
- *
- */
-@Component
-public class BookingServiceUtil {
-
- @Qualifier("selfTokenRestTemplate")
- @Autowired
- private RestTemplate selfTokenRestTemplate;
-
- @Autowired
- private RestTemplate restTemplate;
-
- @Autowired
- private UserDetailsService userDetailsService;
-
- /**
- * Reference for ${regCenter.url} from property file
- */
- @Value("${regCenter.url}")
- String regCenterUrl;
-
- /**
- * Reference for ${holiday.url} from property file
- */
- @Value("${holiday.url}")
- String holidayListUrl;
-
- /**
- * Reference for ${demographic.resource.url} from property file
- */
- @Value("${demographic.resource.url}")
- private String preRegResourceUrl;
-
- @Value("${preregistration.timespan.cancel}")
- private long timeSpanCheckForCancel;
-
- @Value("${preregistration.timespan.rebook}")
- private long timeSpanCheckForRebook;
-
- @Value("${mosip.utc-datetime-pattern}")
- private String utcDateTimePattern;
-
- @Value("${notification.url}")
- private String notificationResourseurl;
-
- @Value("${mosip.notification.timezone}")
- private String specificZoneId;
-
- /**
- * ObjectMapper global object creation
- */
- private ObjectMapper mapper;
-
- @PostConstruct
- public void init() {
- mapper = JsonMapper.builder().addModule(new AfterburnerModule()).build();
- mapper.registerModule(new JavaTimeModule());
- }
-
- private Logger log = LoggerConfiguration.logConfig(BookingServiceUtil.class);
-
- public AuthUserDetails authUserDetails() {
- return (AuthUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
- }
-
- /**
- * This method will call kernel service for registration center date.
- *
- * @return List of RegistrationCenterDto
- */
- public List getRegCenterMasterData(String regCenterId) {
- log.info("sessionId", "idType", "id", "In callRegCenterDateRestService method of Booking Service Util");
- List regCenter = null;
- try {
- String regCentersDetailsPageNo = new StringBuilder(regCenterUrl).append("/").append(regCenterId)
- .append("/all").toString();
-
- UriComponentsBuilder regbuilder = UriComponentsBuilder.fromUriString(regCentersDetailsPageNo);
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_JSON);
- HttpEntity> entity = new HttpEntity<>(headers);
- String uriBuilder = regbuilder.build().encode().toUriString();
- log.info("sessionId", "idType", "id",
- "In callRegCenterDateRestService method of Booking Service URL- " + uriBuilder);
- ResponseEntity> responseEntity = selfTokenRestTemplate.exchange(
- uriBuilder, HttpMethod.GET, entity,
- new ParameterizedTypeReference>() {
- });
- ResponseWrapper body = responseEntity.getBody();
- if (body != null) {
- if (body.getErrors() != null && !body.getErrors().isEmpty()) {
- throw new MasterDataNotAvailableException(body.getErrors().get(0).getErrorCode(),
- body.getErrors().get(0).getMessage());
- }
- regCenter = body.getResponse().getRegistrationCenters();
- }
- if (regCenter == null || regCenter.isEmpty()) {
- throw new MasterDataNotAvailableException(ErrorCodes.PRG_BOOK_RCI_020.getCode(),
- ErrorMessages.MASTER_DATA_NOT_FOUND.getMessage());
- }
- } catch (HttpClientErrorException ex) {
- log.debug("sessionId", "idType", "id", ExceptionUtils.getStackTrace(ex));
- log.error("sessionId", "idType", "id",
- "In callRegCenterDateRestService method of Booking Service Util for HttpClientErrorException- "
- + ex.getMessage());
- throw new RestCallException(ErrorCodes.PRG_BOOK_RCI_020.getCode(),
- ErrorMessages.MASTER_DATA_NOT_FOUND.getMessage());
- }
- return regCenter;
- }
-
- /**
- * This method will call demographic service for status.
- *
- * @param preId
- * @return status code
- */
- public String getApplicationBookingStatus(String preId) {
- log.info("sessionId", "idType", "id", "In callGetStatusRestService method of Booking Service Util");
-
- MainResponseDTO getApplicationStatus = getApplicationStatus(preId);
-
- if (getApplicationStatus.getErrors() != null) {
- throw new DemographicGetStatusException(getApplicationStatus.getErrors().get(0).getErrorCode(),
- getApplicationStatus.getErrors().get(0).getMessage());
- }
- return getApplicationStatus.getResponse();
-
- }
-
- /**
- * This method will call demographic service for cancel status.
- *
- * @param preId
- * @return status code
- */
- public boolean getDemographicStatusForCancel(String preId) {
- log.info("sessionId", "idType", "id", "In callGetStatusForCancelRestService method of Booking Service Util");
-
- MainResponseDTO getApplicationStatus = getApplicationStatus(preId);
- if (getApplicationStatus.getErrors() != null) {
- throw new DemographicGetStatusException(getApplicationStatus.getErrors().get(0).getErrorCode(),
- getApplicationStatus.getErrors().get(0).getMessage());
- }
- String statusCode = getApplicationStatus.getResponse();
-
- if (!statusCode.equals(StatusCodes.BOOKED.getCode())) {
- if (statusCode.equals(StatusCodes.PENDING_APPOINTMENT.getCode())
- || statusCode.equals(StatusCodes.APPLICATION_INCOMPLETE.getCode())) {
- throw new BookingDataNotFoundException(ErrorCodes.PRG_BOOK_RCI_013.getCode(),
- ErrorMessages.BOOKING_DATA_NOT_FOUND.getMessage());
- }
-
- else {
- throw new AppointmentCannotBeCanceledException(ErrorCodes.PRG_BOOK_RCI_018.getCode(),
- ErrorMessages.APPOINTMENT_CANNOT_BE_CANCELED.getMessage());
- }
-
- }
- return true;
- }
-
- /**
- * This method will call demographic service to get application status for
- * delete flow and it will also check if the PRID belongs to the logged in user
- * or not.
- *
- * @param preId
- * @return status code
- */
- public boolean checkApplicationStatus(String preId) {
- log.info("sessionId", "idType", "id", "In callgetDemographicStatusForDelete method of Booking Service Util");
- // This call will check if the PRID belongs to the logged in user or not
- MainResponseDTO getApplicationStatus = getApplicationStatus(preId);
- if (getApplicationStatus.getErrors() != null) {
- throw new DemographicGetStatusException(getApplicationStatus.getErrors().get(0).getErrorCode(),
- getApplicationStatus.getErrors().get(0).getMessage());
- }
- return true;
- }
-
- public boolean timeSpanCheckForCancle(LocalDateTime bookedDateTime) {
- boolean isTimeSpanCheckForCancel = true;
- ZonedDateTime currentTime = ZonedDateTime.now();
- LocalDateTime requestTimeCountrySpecific = currentTime.toInstant().atZone(ZoneId.of(specificZoneId))
- .toLocalDateTime();
- log.info("sessionId", "idType", "id",
- "In timeSpanCheckForCancle method of Booking Service for request Date Time- "
- + requestTimeCountrySpecific);
- long hours = ChronoUnit.HOURS.between(requestTimeCountrySpecific, bookedDateTime);
- if (timeSpanCheckForCancel > 0) {
- if (hours >= timeSpanCheckForCancel)
- isTimeSpanCheckForCancel = true;
- else
- throw new TimeSpanException(ErrorCodes.PRG_BOOK_RCI_026.getCode(),
- ErrorMessages.CANCEL_BOOKING_CANNOT_BE_DONE.getMessage() + " " + timeSpanCheckForCancel
- + "hours");
- }
- return isTimeSpanCheckForCancel;
- }
-
- public boolean timeSpanCheckForRebook(LocalDateTime bookedDateTime, Date requestTime) {
-
- boolean isTimeSpanCheckForRebook = true;
- LocalDateTime requestTimeCountrySpecific = requestTime.toInstant().atZone(ZoneId.of(specificZoneId))
- .toLocalDateTime();
-
- log.info("sessionId", "idType", "id",
- "In timeSpanCheckForRebook method of Booking Service for request Date Time- "
- + requestTimeCountrySpecific);
- long hours = ChronoUnit.HOURS.between(requestTimeCountrySpecific, bookedDateTime);
-
- if (timeSpanCheckForRebook > 0) {
- if (hours >= timeSpanCheckForRebook)
- isTimeSpanCheckForRebook = true;
-
- else
- throw new TimeSpanException(ErrorCodes.PRG_BOOK_RCI_026.getCode(),
- ErrorMessages.BOOKING_CANNOT_BE_DONE.getMessage() + " " + timeSpanCheckForRebook + " hours");
- }
- return isTimeSpanCheckForRebook;
-
- }
-
- /**
- * This method will check mandatory parameter check.
- *
- * @param bookingDto
- * @return true or false
- * @throws java.text.ParseException
- */
- public boolean mandatoryParameterCheck(String preRegistrationId, BookingRequestDTO bookingRequestDTO) {
- log.info("sessionId", "idType", "id", "In mandatoryParameterCheck method of Booking Service Util");
- boolean flag = true;
- if (isNull(preRegistrationId)) {
- throw new BookingPreIdNotFoundException(ErrorCodes.PRG_BOOK_RCI_006.getCode(),
- ErrorMessages.PREREGISTRATION_ID_NOT_ENTERED.getMessage());
- } else if (bookingRequestDTO != null) {
- if (isNull(bookingRequestDTO.getRegistrationCenterId())) {
- throw new BookingRegistrationCenterIdNotFoundException(ErrorCodes.PRG_BOOK_RCI_007.getCode(),
- ErrorMessages.REGISTRATION_CENTER_ID_NOT_ENTERED.getMessage());
- } else if (isNull(bookingRequestDTO.getRegDate())) {
- throw new BookingDateNotSeletectedException(ErrorCodes.PRG_BOOK_RCI_008.getCode(),
- ErrorMessages.BOOKING_DATE_TIME_NOT_SELECTED.getMessage());
- } else if (isNull(bookingRequestDTO.getSlotFromTime()) || isNull(bookingRequestDTO.getSlotToTime())) {
- throw new BookingTimeSlotNotSeletectedException(ErrorCodes.PRG_BOOK_RCI_003.getCode(),
- ErrorMessages.USER_HAS_NOT_SELECTED_TIME_SLOT.getMessage());
- }
- } else {
- flag = false;
- }
- return flag;
-
- }
-
- /**
- * This method will check if Slot Time is Valid or not.
- *
- * @param preRegistrationId
- * @param bookingDto
- * @return true or false
- */
- public boolean slotTimeValidCheck(String preRegistrationId, BookingRequestDTO bookingRequestDTO) {
- log.info("sessionId", "idType", "id", "In slotTimeValidCheck method of Booking Service Util");
- boolean flag = true;
- try {
- LocalTime.parse(bookingRequestDTO.getSlotFromTime());
- LocalTime.parse(bookingRequestDTO.getSlotToTime());
- } catch (DateTimeParseException e) {
- throw new BookingTimeSlotNotSeletectedException(ErrorCodes.PRG_BOOK_RCI_003.getCode(),
- ErrorMessages.USER_HAS_NOT_SELECTED_TIME_SLOT.getMessage());
- }
- return flag;
- }
-
- /**
- * This method is used as Null checker for different input keys.
- *
- * @param key pass the key
- * @return true if key not null and return false if key is null.
- */
-
- public boolean isNull(Object key) {
- log.info("sessionId", "idType", "id", "In isNull method of Booking Service Util");
- if (key instanceof String) {
- if (key.equals("") || ((String) key).trim().length() == 0)
- return true;
- } else {
- if (key == null)
- return true;
- }
- return false;
- }
-
- /**
- *
- * @param date
- * @param dateTimeList
- * @param dateTime
- * @param entity
- * @return
- */
- public int slotSetter(LocalDate date, List dateTimeList, DateTimeDto dateTime,
- List entity) {
- int noOfHoliday = 0;
- List slotList = new ArrayList<>();
- for (AvailibityEntity en : entity) {
- if (en.getAvailableKiosks() > 0) {
- SlotDto slots = new SlotDto();
- slots.setAvailability(en.getAvailableKiosks());
- slots.setFromTime(en.getFromTime());
- slots.setToTime(en.getToTime());
- slotList.add(slots);
- }
- }
- if (entity.size() == 1) {
- dateTime.setHoliday(true);
- noOfHoliday++;
- } else {
- dateTime.setHoliday(false);
- }
- if (!slotList.isEmpty()) {
- dateTime.setTimeSlots(slotList);
- dateTime.setDate(date.toString());
- dateTimeList.add(dateTime);
- }
- return noOfHoliday;
-
- }
-
- /**
- * This method will do mandatory parameter check for cancel.
- *
- * @param cancelBookingDTO
- * @return true or false
- */
- public boolean mandatoryParameterCheckforCancel(String preRegistrationId) {
- log.info("sessionId", "idType", "id", "In mandatoryParameterCheckforCancel method of Booking Service Util");
- boolean flag = true;
-
- if (isNull(preRegistrationId)) {
- throw new BookingPreIdNotFoundException(ErrorCodes.PRG_BOOK_RCI_006.getCode(),
- ErrorMessages.PREREGISTRATION_ID_NOT_ENTERED.getMessage());
- }
-
- return flag;
-
- }
-
- /**
- * This method will check for duplicates.
- *
- * @param oldBookingRegistrationDTO
- * @param newBookingRegistrationDTO
- * @return boolean
- */
- public boolean isNotDuplicate(BookingRegistrationDTO oldBookingRegistrationDTO,
- BookingRegistrationDTO newBookingRegistrationDTO) {
- log.info("sessionId", "idType", "id", "In isNotDuplicate method of Booking Service Util");
- if (oldBookingRegistrationDTO.getRegDate().equals(newBookingRegistrationDTO.getRegDate())
- && oldBookingRegistrationDTO.getRegistrationCenterId()
- .equals(newBookingRegistrationDTO.getRegistrationCenterId())
- && oldBookingRegistrationDTO.getSlotFromTime().equals(newBookingRegistrationDTO.getSlotFromTime())
- && oldBookingRegistrationDTO.getSlotToTime().equals(newBookingRegistrationDTO.getSlotToTime())) {
- throw new AppointmentReBookingFailedException(ErrorCodes.PRG_BOOK_RCI_021.getCode(),
- ErrorMessages.APPOINTMENT_REBOOKING_FAILED.getMessage());
- }
- return true;
- }
-
- /**
- * This method is used to add the initial request values into a map for request
- * map.
- *
- * @param MainRequestDTO pass requestDTO
- * @return a map for request request map
- */
- public Map prepareRequestMap(MainRequestDTO> requestDto) {
- log.info("sessionId", "idType", "id", "In prepareRequestMap method of Booking Service Util");
- Map requestMap = new HashMap<>();
- requestMap.put("id", requestDto.getId());
- requestMap.put("ver", requestDto.getVersion());
- requestMap.put("reqTime", new SimpleDateFormat(utcDateTimePattern).format(requestDto.getRequesttime()));
- requestMap.put("request", requestDto.getRequest().toString());
- return requestMap;
- }
-
- /**
- * Helper method for setting CancelBookingDTO.
- *
- * @param preRegistrationId
- * @param oldBookingRegistrationDTO
- * @return
- */
- public CancelBookingDTO cancelBookingDtoSetter(String preRegistrationId,
- BookingRegistrationDTO oldBookingRegistrationDTO) {
- log.info("sessionId", "idType", "id", "In cancelBookingDtoSetter method of Booking Service Util");
- CancelBookingDTO cancelBookingDTO = new CancelBookingDTO();
- cancelBookingDTO.setRegistrationCenterId(oldBookingRegistrationDTO.getRegistrationCenterId());
- cancelBookingDTO.setRegDate(oldBookingRegistrationDTO.getRegDate());
- cancelBookingDTO.setSlotFromTime(oldBookingRegistrationDTO.getSlotFromTime());
- cancelBookingDTO.setSlotToTime(oldBookingRegistrationDTO.getSlotToTime());
- return cancelBookingDTO;
- }
-
- public String getCurrentResponseTime() {
- log.info("sessionId", "idType", "id", "In getCurrentResponseTime method of Booking Service Util");
- return DateUtils2.formatDate(new Date(System.currentTimeMillis()), utcDateTimePattern);
- }
-
- /**
- * This method will check for availability.
- *
- * @param availableEntity
- * @return boolean
- */
- public boolean isKiosksAvailable(AvailibityEntity availableEntity) {
- log.info("sessionId", "idType", "id", "In isKiosksAvailable method of Booking Service Util");
-
- if (availableEntity.getAvailableKiosks() > 0) {
- return true;
- } else {
- throw new AvailablityNotFoundException(ErrorCodes.PRG_BOOK_RCI_002.getCode(),
- ErrorMessages.AVAILABILITY_NOT_FOUND_FOR_THE_SELECTED_TIME.getMessage());
- }
- }
-
- /**
- * Helper method for setting RegistrationBookingEntity.
- *
- * @param preRegistrationId
- * @param oldBookingRegistrationDTO
- * @return
- */
- public RegistrationBookingEntity bookingEntitySetter(String preRegistrationId,
- BookingRequestDTO bookingRequestDTO) {// should set preid
- log.info("sessionId", "idType", "id", "In bookingEntitySetter method of Booking Service Util");
- RegistrationBookingEntity entity = new RegistrationBookingEntity();
- //entity.setBookingPK(new RegistrationBookingPK(DateUtils2.parseDateToLocalDateTime(new Date())));
- entity.setBookingDateTime(DateUtils2.parseDateToLocalDateTime(new Date()));
- entity.setRegistrationCenterId(bookingRequestDTO.getRegistrationCenterId());
- entity.setId(UUIDGeneratorUtil.generateId());
- entity.setLangCode("12L");
- String userId = authUserDetails().getUserId();
- entity.setCrBy(resolveEffectiveCrBy(userId));
- entity.setCrDate(DateUtils2.parseDateToLocalDateTime(new Date()));
- entity.setRegDate(LocalDate.parse(bookingRequestDTO.getRegDate()));
- entity.setSlotFromTime(LocalTime.parse(bookingRequestDTO.getSlotFromTime()));
- entity.setSlotToTime(LocalTime.parse(bookingRequestDTO.getSlotToTime()));
- entity.setPreregistrationId(preRegistrationId);
- return entity;
- }
-
- private String resolveEffectiveCrBy(String userId) {
- String maskedUserId = GenericUtil.maskIdentifier(userId);
- /*
- * getOrCreateInternalUserId returns null for a null or blank id rather than
- * throwing, so without this guard a missing authenticated user would flow
- * through as a null crBy and fail only at the NOT NULL constraint - surfacing
- * as an opaque "table not accessible" error instead of an identity one.
- */
- if (userId == null || userId.isBlank()) {
- log.warn("sessionId", "idType", "id",
- "Cannot resolve effective booking user id: authenticated user id is absent");
- throw new AppointmentBookingFailedException(ErrorCodes.PRG_BOOK_RCI_005.getCode(),
- ErrorMessages.APPOINTMENT_BOOKING_FAILED.getMessage());
- }
- try {
- String effectiveCrBy = userDetailsService.getOrCreateInternalUserId(userId);
- boolean canonicalApplied = effectiveCrBy != null && !effectiveCrBy.isBlank()
- && !effectiveCrBy.trim().equals(userId == null ? "" : userId.trim());
- log.info("sessionId", "idType", "id",
- "Resolved effective user id for booking write. maskedUserId=" + maskedUserId
- + ", canonicalApplied=" + canonicalApplied);
- return effectiveCrBy;
- } catch (UserLookupException ex) {
- log.warn("sessionId", "idType", "id",
- "Failed to resolve effective booking user id for " + maskedUserId);
- throw new AppointmentBookingFailedException(ErrorCodes.PRG_BOOK_RCI_005.getCode(),
- ErrorMessages.APPOINTMENT_BOOKING_FAILED.getMessage());
- }
- }
-
- /**
- *
- * @param notificationDTO
- * @param langCode
- * @return NotificationResponseDTO
- * @throws JsonProcessingException
- */
- public void emailNotification(NotificationDTO notificationDTO, String langCode) throws JsonProcessingException {
- String emailResourseUrl = notificationResourseurl + "/notify";
- ResponseEntity resp = null;
- HttpHeaders headers = new HttpHeaders();
- MainRequestDTO request = new MainRequestDTO<>();
- mapper.setTimeZone(TimeZone.getDefault());
- try {
- request.setRequest(notificationDTO);
- request.setId("mosip.pre-registration.notification.notify");
- request.setVersion("1.0");
- request.setRequesttime(new Date());
- headers.setContentType(MediaType.MULTIPART_FORM_DATA);
- MultiValueMap