From 6b624bfa52ffeaf8d8618f246c782ff49726cd54 Mon Sep 17 00:00:00 2001
From: Paulo Gomes da Cruz Junior
Date: Mon, 18 Dec 2023 11:30:50 -0800
Subject: [PATCH 1/6] fix: changing submission list limit
added it as parameter
---
.../app/configuration/ForestClientConfiguration.java | 2 ++
.../app/service/client/ClientSubmissionService.java | 12 +++++++++++-
backend/src/main/resources/application.yml | 12 +-----------
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/backend/src/main/java/ca/bc/gov/app/configuration/ForestClientConfiguration.java b/backend/src/main/java/ca/bc/gov/app/configuration/ForestClientConfiguration.java
index adfe417f05..321ffdfd9d 100644
--- a/backend/src/main/java/ca/bc/gov/app/configuration/ForestClientConfiguration.java
+++ b/backend/src/main/java/ca/bc/gov/app/configuration/ForestClientConfiguration.java
@@ -36,6 +36,8 @@ public class ForestClientConfiguration {
@NestedConfigurationProperty
private CognitoConfiguration cognito;
+ private Duration submissionLimit;
+
/**
* The Common hosted email service configuration.
*/
diff --git a/backend/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionService.java b/backend/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionService.java
index f272efde26..577c13bac1 100644
--- a/backend/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionService.java
+++ b/backend/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionService.java
@@ -7,6 +7,7 @@
import static org.springframework.data.relational.core.query.Query.query;
import ca.bc.gov.app.ApplicationConstant;
+import ca.bc.gov.app.configuration.ForestClientConfiguration;
import ca.bc.gov.app.dto.client.ClientContactDto;
import ca.bc.gov.app.dto.client.ClientListSubmissionDto;
import ca.bc.gov.app.dto.client.ClientSubmissionDto;
@@ -66,6 +67,7 @@ public class ClientSubmissionService {
private final SubmissionMatchDetailRepository submissionMatchDetailRepository;
private final ChesService chesService;
private final R2dbcEntityTemplate template;
+ private final ForestClientConfiguration configuration;
public Flux listSubmissions(
int page,
@@ -415,7 +417,15 @@ private Flux loadSubmissions(int page, int size, String[] requ
.orEqualTo(new String[]{"SPP"}, ApplicationConstant.SUBMISSION_TYPE)
.or(
QueryPredicates
- .isAfter(LocalDateTime.now().minusDays(1L), "submissionDate")
+ .isAfter(
+ LocalDateTime
+ .now()
+ .minus(configuration.getSubmissionLimit())
+ .withHour(0)
+ .withMinute(0)
+ .withSecond(0),
+ "submissionDate"
+ )
.and(
QueryPredicates
//When I said AAC and RNC, I meant AAC or RNC for query purpose
diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml
index 2705ec63e2..7b6b640a58 100644
--- a/backend/src/main/resources/application.yml
+++ b/backend/src/main/resources/application.yml
@@ -44,21 +44,11 @@ management:
recording:
include: principal,request-headers,response-headers,cookie-headers,time-taken,authorization-header,remote-address,session-id
-springdoc:
- enable-native-support: true
- webjars:
- prefix: /v3
- api-docs:
- groups:
- enabled: true
- show-actuator: false
- swagger-ui:
- path: /
-
ca:
bc:
gov:
nrs:
+ submissionLimit: ${SUBMISSION_LIMIT:7D}
ches:
uri: ${CHES_API_URL:http://127.0.0.1:10010/chess/uri}
tokenUrl: ${CHES_TOKEN_URL:http://127.0.0.1:10010/token/uri}
From 67f7b7f1703f9611c0f90ed4510123246153e5a4 Mon Sep 17 00:00:00 2001
From: Paulo Gomes da Cruz Junior
Date: Mon, 18 Dec 2023 11:31:26 -0800
Subject: [PATCH 2/6] chore: removing swagger from legacy
---
legacy/pom.xml | 6 --
.../java/ca/bc/gov/app/LegacyApplication.java | 12 ----
.../GlobalServiceConfiguration.java | 16 ------
.../configuration/LegacyConfiguration.java | 3 +-
.../controller/ClientSearchController.java | 46 ---------------
.../bc/gov/app/dto/ClientPublicViewDto.java | 56 -------------------
.../ca/bc/gov/app/dto/OrgBookNameDto.java | 18 ------
.../app/dto/OrgBookResultListResponse.java | 21 -------
.../ca/bc/gov/app/dto/OrgBookTopicDto.java | 27 ---------
.../gov/app/dto/OrgBookTopicListResponse.java | 15 -----
.../bc/gov/app/dto/OrgBookTopicNameDto.java | 11 ----
legacy/src/main/resources/application.yml | 10 ----
12 files changed, 2 insertions(+), 239 deletions(-)
delete mode 100644 legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicViewDto.java
delete mode 100644 legacy/src/main/java/ca/bc/gov/app/dto/OrgBookNameDto.java
delete mode 100644 legacy/src/main/java/ca/bc/gov/app/dto/OrgBookResultListResponse.java
delete mode 100644 legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicDto.java
delete mode 100644 legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicListResponse.java
delete mode 100644 legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicNameDto.java
diff --git a/legacy/pom.xml b/legacy/pom.xml
index ba73c88b63..67024de06e 100644
--- a/legacy/pom.xml
+++ b/legacy/pom.xml
@@ -81,12 +81,6 @@
runtime
-
- org.springdoc
- springdoc-openapi-starter-webflux-ui
- 2.2.0
-
-
org.apache.commons
commons-lang3
diff --git a/legacy/src/main/java/ca/bc/gov/app/LegacyApplication.java b/legacy/src/main/java/ca/bc/gov/app/LegacyApplication.java
index f77b71ea21..cce874711b 100644
--- a/legacy/src/main/java/ca/bc/gov/app/LegacyApplication.java
+++ b/legacy/src/main/java/ca/bc/gov/app/LegacyApplication.java
@@ -1,23 +1,11 @@
package ca.bc.gov.app;
-import io.swagger.v3.oas.annotations.OpenAPIDefinition;
-import io.swagger.v3.oas.annotations.info.Info;
-import io.swagger.v3.oas.annotations.servers.Server;
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
-@OpenAPIDefinition(info = @Info(
- title = "${info.app.name}",
- version = "${info.app.version}",
- description = "${info.app.description}"
-),
- servers = {
- @Server(url = "/", description = "Default Server URL")
- }
-)
@EnableScheduling
public class LegacyApplication {
diff --git a/legacy/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java b/legacy/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java
index 17ce1298b7..1fbfd00c77 100644
--- a/legacy/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java
+++ b/legacy/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java
@@ -1,28 +1,12 @@
package ca.bc.gov.app.configuration;
-import ca.bc.gov.app.dto.OrgBookTopicDto;
-import ca.bc.gov.app.dto.OrgBookTopicListResponse;
-import org.springframework.aot.hint.annotation.RegisterReflectionForBinding;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.client.WebClient;
@Configuration
-@RegisterReflectionForBinding({OrgBookTopicDto.class, OrgBookTopicListResponse.class})
public class GlobalServiceConfiguration {
- /**
- * Creates and configures a WebClient instance for accessing OrgBook API based on the provided
- * {@link LegacyConfiguration}.
- *
- * @param configuration The {@link LegacyConfiguration} containing the OrgBook API URI.
- * @return A {@link WebClient} instance configured for accessing OrgBook API.
- */
- @Bean
- public WebClient orgBookApi(LegacyConfiguration configuration) {
- return WebClient.builder().baseUrl(configuration.getOrgbook()).build();
- }
-
@Bean
public WebClient forestClientApi(LegacyConfiguration configuration) {
return WebClient.builder().baseUrl(configuration.getForest().getUri()).build();
diff --git a/legacy/src/main/java/ca/bc/gov/app/configuration/LegacyConfiguration.java b/legacy/src/main/java/ca/bc/gov/app/configuration/LegacyConfiguration.java
index 49760e46bd..27852c135c 100644
--- a/legacy/src/main/java/ca/bc/gov/app/configuration/LegacyConfiguration.java
+++ b/legacy/src/main/java/ca/bc/gov/app/configuration/LegacyConfiguration.java
@@ -14,14 +14,15 @@
@Component
@ConfigurationProperties("ca.bc.gov.nrs")
public class LegacyConfiguration {
+
private ForestClientConfiguration forest;
- private String orgbook;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ForestClientConfiguration {
+
private String uri;
}
}
diff --git a/legacy/src/main/java/ca/bc/gov/app/controller/ClientSearchController.java b/legacy/src/main/java/ca/bc/gov/app/controller/ClientSearchController.java
index 1f02adb953..d60698f320 100644
--- a/legacy/src/main/java/ca/bc/gov/app/controller/ClientSearchController.java
+++ b/legacy/src/main/java/ca/bc/gov/app/controller/ClientSearchController.java
@@ -2,14 +2,6 @@
import ca.bc.gov.app.dto.ForestClientDto;
import ca.bc.gov.app.service.ClientSearchService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.ExampleObject;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
-import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
@@ -21,10 +13,6 @@
@RestController
@Slf4j
-@Tag(
- name = "Search Client",
- description = "Search clients based on some criterias"
-)
@RequestMapping(value = "/api/search", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class ClientSearchController {
@@ -32,42 +20,8 @@ public class ClientSearchController {
private final ClientSearchService service;
@GetMapping("/incorporationOrName")
- @Operation(
- summary = "List forest client entries by incorporation number or name",
- responses = {
- @ApiResponse(
- responseCode = "200",
- description = "Returns a client based on it's number",
- content = @Content(
- mediaType = MediaType.APPLICATION_JSON_VALUE,
- array = @ArraySchema(
- schema = @Schema(
- name = "ForestClient",
- implementation = ForestClientDto.class
- )
- )
- )
- ),
- @ApiResponse(
- responseCode = "412",
- description = "Missing value for parameter incorporationNumber or companyName",
- content = @Content(
- mediaType = MediaType.APPLICATION_JSON_VALUE,
- schema = @Schema(implementation = String.class),
- examples = {
- @ExampleObject(
- value =
- "Missing value for parameter incorporationNumber or companyName")
- }
- )
- )
- }
- )
public Flux findByIncorporationOrName(
- @Parameter(description = "The incorporation ID to lookup", example = "BC0772006")
@RequestParam(required = false) String incorporationNumber,
-
- @Parameter(description = "The name to lookup", example = "Power Corp")
@RequestParam(required = false) String companyName
) {
return service
diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicViewDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicViewDto.java
deleted file mode 100644
index d0d4dfc9d0..0000000000
--- a/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicViewDto.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package ca.bc.gov.app.dto;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
-
-public record ClientPublicViewDto(
- String clientNumber,
- String clientName,
- String incorporationNumber,
-
- String orgBookNumber,
-
- String orgBookName,
- boolean status
-
-) {
-
- @JsonProperty
- public String sameName() {
- return
- BooleanUtils.toStringYesNo(
- StringUtils.equalsIgnoreCase(orgBookName, clientName)
- );
- }
-
- @JsonProperty
- public String sameNumber() {
- return
- BooleanUtils.toStringYesNo(
- StringUtils.equalsIgnoreCase(orgBookNumber, incorporationNumber)
- );
- }
-
- @JsonProperty
- public String found() {
- return
- BooleanUtils.toString(
- StringUtils.equalsIgnoreCase(orgBookName, clientName)
- && StringUtils.equalsIgnoreCase(orgBookNumber, incorporationNumber),
- "F",
- BooleanUtils.toString(
- StringUtils.equalsIgnoreCase(orgBookName, clientName)
- || StringUtils.equalsIgnoreCase(orgBookNumber, incorporationNumber),
- "PF",
- "NF"
- )
- );
- }
-
- @JsonProperty
- public String active() {
- return BooleanUtils.toStringYesNo(status);
- }
-
-}
diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookNameDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookNameDto.java
deleted file mode 100644
index 4006abd951..0000000000
--- a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookNameDto.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package ca.bc.gov.app.dto;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.List;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public record OrgBookNameDto(
-
- String value,
- @JsonProperty("sub_type")
- String subType,
- @JsonProperty("topic_source_id")
- String topicSourceId,
- List names
-) {
-}
-
diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookResultListResponse.java b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookResultListResponse.java
deleted file mode 100644
index 5dbf7840e5..0000000000
--- a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookResultListResponse.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package ca.bc.gov.app.dto;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import io.swagger.v3.oas.annotations.media.Schema;
-import java.util.List;
-
-@Schema(name = "NameListResponse", description = "A list of name results")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public record OrgBookResultListResponse(
- @Schema(description = "The total amount of entries on all pages", example = "75")
- int total,
- @Schema(description = "The zero-index current page number", example = "3")
- Integer page,
-
- @Schema(description = "The list of named results")
- List results
-) {
- public boolean empty(){
- return results == null || results.isEmpty();
- }
-}
\ No newline at end of file
diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicDto.java
deleted file mode 100644
index eb2cc3736b..0000000000
--- a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicDto.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package ca.bc.gov.app.dto;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.util.CollectionUtils;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public record OrgBookTopicDto(
- Integer id,
- @JsonProperty("source_id") String sourceId,
- List names,
- Boolean inactive
-) {
- public String name() {
- if (CollectionUtils.isEmpty(names)) {
- return StringUtils.EMPTY;
- }
- return names
- .stream()
- .filter(entry -> entry.topicNameType().equalsIgnoreCase("entity_name"))
- .map(OrgBookTopicNameDto::text)
- .findFirst()
- .orElse(StringUtils.EMPTY);
- }
-}
diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicListResponse.java b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicListResponse.java
deleted file mode 100644
index 389ac3239b..0000000000
--- a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicListResponse.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package ca.bc.gov.app.dto;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.List;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public record OrgBookTopicListResponse(
- int total,
- Integer page,
- @JsonProperty("page_size")
- Integer pageSize,
- List results
-) {
-}
diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicNameDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicNameDto.java
deleted file mode 100644
index 8eb060528a..0000000000
--- a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicNameDto.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package ca.bc.gov.app.dto;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public record OrgBookTopicNameDto(
- String text,
- @JsonProperty("type") String topicNameType
-) {
-}
\ No newline at end of file
diff --git a/legacy/src/main/resources/application.yml b/legacy/src/main/resources/application.yml
index 4194bf17d8..1380a4eb83 100644
--- a/legacy/src/main/resources/application.yml
+++ b/legacy/src/main/resources/application.yml
@@ -33,16 +33,6 @@ management:
exposure:
include: health,metrics
-springdoc:
- enable-native-support: true
- webjars:
- prefix: /v3
- api-docs:
- groups:
- enabled: true
- show-actuator: false
- swagger-ui:
- path: /
ca:
bc:
From 1f3bafbb4f44308ff02f5a64142564d1810dc7ba Mon Sep 17 00:00:00 2001
From: Paulo Gomes da Cruz Junior
Date: Mon, 18 Dec 2023 15:16:29 -0800
Subject: [PATCH 3/6] fix(FSADT1-936): fixing non-dev ches issues
---
.../GlobalServiceConfiguration.java | 36 +++++++++++--------
.../app/controller/ches/ChesController.java | 18 +++++-----
.../bc/gov/app/service/ches/ChesService.java | 8 +++--
.../main/resources/templates/approval.html | 2 +-
4 files changed, 35 insertions(+), 29 deletions(-)
diff --git a/backend/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java b/backend/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java
index 1efd2dbce9..d85a9820a2 100644
--- a/backend/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java
+++ b/backend/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java
@@ -132,8 +132,13 @@ public WebClient authApi(ForestClientConfiguration configuration) {
return WebClient
.builder()
.baseUrl(configuration.getChes().getTokenUrl())
- .filter(ExchangeFilterFunctions.basicAuthentication(configuration.getChes().getClientId(),
- configuration.getChes().getClientSecret()))
+ .filter(
+ ExchangeFilterFunctions
+ .basicAuthentication(
+ configuration.getChes().getClientId(),
+ configuration.getChes().getClientSecret()
+ )
+ )
.build();
}
@@ -183,23 +188,24 @@ public WebClient addressCompleteApi(ForestClientConfiguration configuration) {
/**
* Returns a configured instance of WebClient for accessing the Cognito API.
+ *
* @param objectMapper the object mapper
* @return A configured instance of WebClient for accessing the Cognito API.
*/
@Bean
- public WebClient cognitoApi(ObjectMapper objectMapper) {
- return WebClient
- .builder()
- .codecs(clientCodecConfigurer -> {
- clientCodecConfigurer
- .customCodecs()
- .register(new AwsJsonMessageEncoder(objectMapper));
- clientCodecConfigurer
- .customCodecs()
- .register(new AwsJsonMessageDecoder(objectMapper));
- })
- .build();
- }
+ public WebClient cognitoApi(ObjectMapper objectMapper) {
+ return WebClient
+ .builder()
+ .codecs(clientCodecConfigurer -> {
+ clientCodecConfigurer
+ .customCodecs()
+ .register(new AwsJsonMessageEncoder(objectMapper));
+ clientCodecConfigurer
+ .customCodecs()
+ .register(new AwsJsonMessageDecoder(objectMapper));
+ })
+ .build();
+ }
@Bean
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
diff --git a/backend/src/main/java/ca/bc/gov/app/controller/ches/ChesController.java b/backend/src/main/java/ca/bc/gov/app/controller/ches/ChesController.java
index 98e68bc304..bac6cf34ff 100644
--- a/backend/src/main/java/ca/bc/gov/app/controller/ches/ChesController.java
+++ b/backend/src/main/java/ca/bc/gov/app/controller/ches/ChesController.java
@@ -2,8 +2,8 @@
import ca.bc.gov.app.dto.client.EmailRequestDto;
import ca.bc.gov.app.service.client.ClientService;
-import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
@@ -14,20 +14,17 @@
import reactor.core.publisher.Mono;
/**
- * Controller for handling email sending via CHES (Common Hosted Email Service).
- * This controller provides endpoints for sending emails using the CHES service.
+ * Controller for handling email sending via CHES (Common Hosted Email Service). This controller
+ * provides endpoints for sending emails using the CHES service.
*/
@RestController
-@Tag(
- name = "CHES",
- description = "The CHES endpoint is responsible for handling the sending of emails"
-)
+@Slf4j
@RequestMapping(value = "/api/ches", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class ChesController {
-
+
private final ClientService clientService;
-
+
/**
* Endpoint for sending an email using CHES.
*
@@ -37,7 +34,8 @@ public class ChesController {
@PostMapping("/email")
@ResponseStatus(HttpStatus.ACCEPTED)
public Mono sendEmail(@RequestBody EmailRequestDto emailRequestDto) {
+ log.info("Sending email using CHES {}", emailRequestDto);
return clientService.sendEmail(emailRequestDto);
}
-
+
}
diff --git a/backend/src/main/java/ca/bc/gov/app/service/ches/ChesService.java b/backend/src/main/java/ca/bc/gov/app/service/ches/ChesService.java
index 35e24a54a4..0230661b63 100644
--- a/backend/src/main/java/ca/bc/gov/app/service/ches/ChesService.java
+++ b/backend/src/main/java/ca/bc/gov/app/service/ches/ChesService.java
@@ -75,7 +75,9 @@ public Mono sendEmail(String templateName,
String subject,
Map variables,
Integer emailLogId) {
- return this.buildTemplate(templateName, variables).flatMap(body -> {
+ return this
+ .buildTemplate(templateName, variables)
+ .flatMap(body -> {
ChesRequestDto chesRequestDto = new ChesRequestDto(List.of(emailAddress,
"paulo.cruz@gov.bc.ca",
"ziad.bhunnoo@gov.bc.ca",
@@ -203,10 +205,11 @@ public Mono sendEmail(ChesRequestDto requestContent, String subject) {
"FSA_donotreply@gov.bc.ca",
ChesMailPriority.NORMAL,
subject,
- null,
+ "email_fds_client",
request.emailTo()
)
)
+ .doOnNext(request -> log.info("Sending email using CHES {}", request))
.flatMap(request ->
getToken()
.flatMap(token ->
@@ -221,7 +224,6 @@ public Mono sendEmail(ChesRequestDto requestContent, String subject) {
response -> Mono.error(new InvalidAccessTokenException()))
.onStatus(httpStatusCode -> httpStatusCode.value() == 403,
response -> Mono.error(new InvalidRoleException()))
-
.onStatus(httpStatusCode -> httpStatusCode.value() == 400,
get400ErrorMessage())
.onStatus(httpStatusCode -> httpStatusCode.value() == 422,
diff --git a/backend/src/main/resources/templates/approval.html b/backend/src/main/resources/templates/approval.html
index 9b0cabddbb..6a8d5e80c4 100644
--- a/backend/src/main/resources/templates/approval.html
+++ b/backend/src/main/resources/templates/approval.html
@@ -21,7 +21,7 @@
An application for a client number for ${userName} has been approved.
- The client number is ${clientNumber}.
+ The client number is ${business.clientNumber}.
From f2fd7cb03ded4912665fcff52639cc0828e1edb4 Mon Sep 17 00:00:00 2001
From: Paulo Gomes da Cruz Junior
Date: Mon, 18 Dec 2023 15:24:27 -0800
Subject: [PATCH 4/6] chore: removing swagger
---
backend/pom.xml | 5 --
.../client/ClientAddressController.java | 62 ---------------
.../app/dto/bcregistry/ClientDetailsDto.java | 76 +------------------
.../gov/app/dto/client/ClientAddressDto.java | 42 +---------
.../gov/app/dto/client/ClientLocationDto.java | 10 +--
.../gov/app/dto/client/ClientLookUpDto.java | 18 +----
.../app/dto/client/ClientValueTextDto.java | 14 +---
.../ca/bc/gov/app/dto/client/CodeNameDto.java | 26 ++-----
8 files changed, 12 insertions(+), 241 deletions(-)
diff --git a/backend/pom.xml b/backend/pom.xml
index fbb6ac2b06..55dd6a322c 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -102,11 +102,6 @@
lombok
true
-
- org.springdoc
- springdoc-openapi-starter-webflux-ui
- 2.2.0
-
org.springframework.boot
spring-boot-starter-test
diff --git a/backend/src/main/java/ca/bc/gov/app/controller/client/ClientAddressController.java b/backend/src/main/java/ca/bc/gov/app/controller/client/ClientAddressController.java
index 6805fdea6d..b495bd79a0 100644
--- a/backend/src/main/java/ca/bc/gov/app/controller/client/ClientAddressController.java
+++ b/backend/src/main/java/ca/bc/gov/app/controller/client/ClientAddressController.java
@@ -3,13 +3,6 @@
import ca.bc.gov.app.dto.client.ClientAddressDto;
import ca.bc.gov.app.dto.client.CodeNameDto;
import ca.bc.gov.app.service.client.ClientAddressService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-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.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
@@ -23,10 +16,6 @@
@RestController
@Slf4j
-@Tag(
- name = "FSA Clients",
- description = "The FSA Client endpoint, responsible for handling client data"
-)
@RequestMapping(value = "/api/clients", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class ClientAddressController {
@@ -34,38 +23,11 @@ public class ClientAddressController {
private final ClientAddressService clientAddressService;
@GetMapping("/addresses")
- @Operation(
- summary = "Autocomplete addresses",
- responses = {
- @ApiResponse(
- responseCode = "200",
- description = "Returns a list of possible addresses",
- content = @Content(
- mediaType = MediaType.APPLICATION_JSON_VALUE,
- array = @ArraySchema(
- schema = @Schema(
- name = "NameCode",
- implementation = CodeNameDto.class
- )
- )
- )
- )
- }
- )
public Flux findPossibleAddresses(
- @Parameter(description =
- "The name or ISO 2 or 3 character code for the country to search in, defaults to CA",
- example = "UK")
@RequestParam(value = "country", required = false, defaultValue = "CA")
String country,
-
- @Parameter(description =
- "The maximum number of autocomplete suggestions to return, defaults to 7",
- example = "7")
@RequestParam(value = "maxSuggestions", required = false, defaultValue = "7")
Integer maxSuggestions,
-
- @Parameter(description = "The search term to find", example = "2701 ri")
@RequestParam(value = "searchTerm", required = true)
String searchTerm) {
return clientAddressService
@@ -73,31 +35,7 @@ public Flux findPossibleAddresses(
}
@GetMapping("/addresses/{addressId}")
- @Operation(
- summary = "Retrieve address",
- responses = {
- @ApiResponse(
- responseCode = "200",
- description = "Returns an addresses",
- content = @Content(
- mediaType = MediaType.APPLICATION_JSON_VALUE,
- array = @ArraySchema(
- schema = @Schema(
- name = "Address",
- implementation = ClientAddressDto.class
- )
- )
- )
- )
- }
- )
public Mono getAddress(
- @Parameter(
- description = """
- The id of the address to retrieve the details for.
- The id can be obtained through /api/client/addresses endpoint""",
- example = "CA|CP|B|0000001"
- )
@PathVariable String addressId) {
return clientAddressService
.getAddress(addressId);
diff --git a/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/ClientDetailsDto.java b/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/ClientDetailsDto.java
index d7e6e82cf1..16269a3cfd 100644
--- a/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/ClientDetailsDto.java
+++ b/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/ClientDetailsDto.java
@@ -2,94 +2,20 @@
import ca.bc.gov.app.dto.client.ClientAddressDto;
import ca.bc.gov.app.dto.client.ClientContactDto;
-import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.With;
/**
* A data transfer object representing the details of a client.
*/
-@Schema(
- example = """
- {
- "name": "Acme Inc.",
- "id": "AC0000000",
- "goodStanding": true,
- "addresses": [
- {
- "streetAddress": "123 Main St",
- "country": {"value": "CA", "text": "Canada"},
- "province": {"value": "ON", text": "Ontario"},
- "city": "Toronto",
- "postalCode": "M5V1E3",
- "locationName":"Billing Address",
- "index": 0
- },
- {
- "streetAddress": "456 Queen St",
- "country": {"value": "CA", text": "Canada"},
- "province": {"value": "QC", text": "Quebec"},
- "city": "Montreal",
- "postalCode": "H3B1A7",
- "locationName":"Mailing address",
- "index": 1,
- },
- ],
- "contacts":[{
- "type": "person",
- "firstName": "JAMES",
- "lastName": "BAXTER",
- "phoneNumber": "123456789"
- "email": "james@email.ca",
- "locations":[
- {"value": "0", text": "Billing Address"}
- }]
- }"""
-)
@With
public record ClientDetailsDto(
- @Schema(description = "The client name as registered on the BC Registry", example = "Acme Inc.")
String name,
- @Schema(description = "ID of the client", example = "AC0000000")
String id,
- @Schema(
- description = "Defines if the client is in good standing with the Ministry of Finance",
- example = "true"
- )
boolean goodStanding,
- @Schema(description = "All available addresses", example = """
- [
- {
- "streetAddress": "123 Main St",
- "country": {"value": "CA", "text": "Canada"},
- "province": {"value": "ON", text": "Ontario"},
- "city": "Toronto",
- "postalCode": "M5V1E3",
- "locationName":"Billing Address",
- "index": 0
- },
- {
- "streetAddress": "456 Queen St",
- "country": {"value": "CA", text": "Canada"},
- "province": {"value": "QC", text": "Quebec"},
- "city": "Montreal",
- "postalCode": "H3B1A7",
- "locationName":"Mailing Address",
- "index": 1
- }
- ]""")
List addresses,
- @Schema(description = "All available contacts", example = """
- [
- {
- "type": "person",
- "firstName": "JAMES",
- "lastName": "BAXTER",
- "phoneNumber": "123456789"
- "email": "james@email.ca",
- }
- ]""")
List contacts
) {
+
}
diff --git a/backend/src/main/java/ca/bc/gov/app/dto/client/ClientAddressDto.java b/backend/src/main/java/ca/bc/gov/app/dto/client/ClientAddressDto.java
index c725db4c22..48e5a0ddcf 100644
--- a/backend/src/main/java/ca/bc/gov/app/dto/client/ClientAddressDto.java
+++ b/backend/src/main/java/ca/bc/gov/app/dto/client/ClientAddressDto.java
@@ -1,59 +1,21 @@
package ca.bc.gov.app.dto.client;
-import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Map;
import lombok.With;
-@Schema(
- description = "An address information",
- title = "ClientAddressData",
- example = """
- {
- "locationName": "Billing Address",
- "streetAddress": "123 Main St",
- "country": {
- "value": "CA",
- "text": "Canada"
- },
- "province": {
- "value": "ON",
- "text": "Ontario"
- },
- "city": "Toronto",
- "postalCode": "M5V2L7",
- "index": 1
- }"""
-)
+
@With
public record ClientAddressDto(
- @Schema(description = "The street address", example = "123 Main St")
String streetAddress,
- @Schema(description = "The country for this address", example = """
- {
- "value": "CA",
- "text": "Canada"
- }""")
ClientValueTextDto country,
- @Schema(description = "The province or state for this address", example = """
- {
- "value": "ON",
- "text": "Ontario"
- }""")
ClientValueTextDto province,
- @Schema(description = "The city for this address", example = "Toronto")
String city,
- @Schema(description = "The postal code or zip code for this address", example = "M5V2L7")
String postalCode,
- @Schema(description = "The index for this address. It is used to order the addresses",
- example = "3")
int index,
- @Schema(description = """
- The location name of an address. Examples of location names include,
- but are not limited to, Mailing Address, Billing Address among others.""",
- example = "Billing Address")
String locationName
) {
+
public Map description() {
final String indexFormatted = String.format("address.[%d]", index);
diff --git a/backend/src/main/java/ca/bc/gov/app/dto/client/ClientLocationDto.java b/backend/src/main/java/ca/bc/gov/app/dto/client/ClientLocationDto.java
index 79edfb1f2b..88ee9ec161 100644
--- a/backend/src/main/java/ca/bc/gov/app/dto/client/ClientLocationDto.java
+++ b/backend/src/main/java/ca/bc/gov/app/dto/client/ClientLocationDto.java
@@ -1,6 +1,5 @@
package ca.bc.gov.app.dto.client;
-import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -9,16 +8,9 @@
public record ClientLocationDto(
List addresses,
- @Schema(description = "A list of contacts for this address", example = """
- {
- "type": "person",
- "firstName": "JAMES",
- "lastName": "BAXTER",
- "phoneNumber": "123456789"
- "email": "james@email.ca",
- }""")
List contacts
) {
+
public Map description() {
return
Stream.concat(
diff --git a/backend/src/main/java/ca/bc/gov/app/dto/client/ClientLookUpDto.java b/backend/src/main/java/ca/bc/gov/app/dto/client/ClientLookUpDto.java
index d7110b4bbd..27814b5073 100644
--- a/backend/src/main/java/ca/bc/gov/app/dto/client/ClientLookUpDto.java
+++ b/backend/src/main/java/ca/bc/gov/app/dto/client/ClientLookUpDto.java
@@ -1,30 +1,14 @@
package ca.bc.gov.app.dto.client;
-import io.swagger.v3.oas.annotations.media.Schema;
import lombok.With;
-@Schema(
- description = "A simple client lookup response object",
- title = "ClientLookup",
- example = """
- {
- "code": "00000002",
- "name": "BAXTER",
- "status": "ACTIVE",
- "legalType": "SP"
- }"""
-)
@With
public record ClientLookUpDto(
- @Schema(description = "The code for that specific object", example = "00000002")
String code,
- @Schema(description = "The name information for that specific object", example = "BAXTER")
String name,
- @Schema(description = "The status of the client, could be ACTIVE or INACTIVE",
- example = "ACTIVE")
String status,
- @Schema(description = "The legal type of the client", example = "SP")
String legalType
) {
+
}
diff --git a/backend/src/main/java/ca/bc/gov/app/dto/client/ClientValueTextDto.java b/backend/src/main/java/ca/bc/gov/app/dto/client/ClientValueTextDto.java
index bd2730f66e..86c35c68e5 100644
--- a/backend/src/main/java/ca/bc/gov/app/dto/client/ClientValueTextDto.java
+++ b/backend/src/main/java/ca/bc/gov/app/dto/client/ClientValueTextDto.java
@@ -1,22 +1,10 @@
package ca.bc.gov.app.dto.client;
-import io.swagger.v3.oas.annotations.media.Schema;
-
-@Schema(
- description = "A simple text and value object",
- title = "NameCode",
- example = """
- {
- "value": "00000002",
- "text": "BAXTER"
- }"""
-)
public record ClientValueTextDto(
- @Schema(description = "The value for that specific object", example = "00000002")
String value,
- @Schema(description = "The textual information for that specific object", example = "BAXTER")
String text
) {
+
}
diff --git a/backend/src/main/java/ca/bc/gov/app/dto/client/CodeNameDto.java b/backend/src/main/java/ca/bc/gov/app/dto/client/CodeNameDto.java
index 89cd432b12..42f786b26e 100644
--- a/backend/src/main/java/ca/bc/gov/app/dto/client/CodeNameDto.java
+++ b/backend/src/main/java/ca/bc/gov/app/dto/client/CodeNameDto.java
@@ -1,13 +1,11 @@
package ca.bc.gov.app.dto.client;
-import io.swagger.v3.oas.annotations.media.Schema;
-
/**
- * The {@code CodeNameDto} class represents a simple data transfer object (DTO) that encapsulates
- * a name and code for a specific object. It is used to transfer this information between different
- * parts of an application.
- * This class is annotated with Swagger annotations for generating API documentation. It provides
- * a description and example JSON representation for the object it represents.
+ * The {@code CodeNameDto} class represents a simple data transfer object (DTO) that encapsulates a
+ * name and code for a specific object. It is used to transfer this information between different
+ * parts of an application. This class is annotated with Swagger annotations for generating API
+ * documentation. It provides a description and example JSON representation for the object it
+ * represents.
*
*
* Example JSON representation:
@@ -18,23 +16,11 @@
* }
* }
*
- *
- * @see Schema
*/
-@Schema(
- description = "A simple name and code object",
- title = "NameCode",
- example = """
- {
- "code": "00000002",
- "name": "BAXTER"
- }"""
-)
public record CodeNameDto(
- @Schema(description = "The code for that specific object", example = "00000002")
String code,
- @Schema(description = "The name information for that specific object", example = "BAXTER")
String name
) {
+
}
From 1f1efb0fcd7bb288432604ac75bdb789c5719d00 Mon Sep 17 00:00:00 2001
From: Paulo Gomes da Cruz Junior
Date: Mon, 18 Dec 2023 15:24:46 -0800
Subject: [PATCH 5/6] fix(FSADT1-936): fixing ches params
---
.github/workflows/merge-main.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge-main.yml
index d46fb9f5df..5f14dccdf1 100644
--- a/.github/workflows/merge-main.yml
+++ b/.github/workflows/merge-main.yml
@@ -250,7 +250,7 @@ jobs:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/backend:${{ env.ZONE }}
-p CHES_TOKEN_URL='https://test.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token'
- -p CHES_API_URL='https://ches-test.api.gov.bc.ca/api/v1'
+ -p CHES_API_URL='https://ches-test.api.gov.bc.ca/api/v1/email'
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'
-p COGNITO_REGION=ca-central-1
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
@@ -403,7 +403,7 @@ jobs:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/backend:${{ env.PREV }}
-p CHES_TOKEN_URL='https://loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token'
- -p CHES_API_URL='https://ches.api.gov.bc.ca/api/v1'
+ -p CHES_API_URL='https://ches.api.gov.bc.ca/api/v1/email'
-p BCREGISTRY_URI='https://bcregistry-prod.apigee.net'
-p COGNITO_REGION=ca-central-1
-p COGNITO_COOKIE_DOMAIN=gov.bc.ca
From 5070c46931cf17278d7cc355129047fe5db96d2a Mon Sep 17 00:00:00 2001
From: Paulo Gomes da Cruz Junior
Date: Mon, 18 Dec 2023 17:00:26 -0800
Subject: [PATCH 6/6] fix(FSADT1-639): fixing email mechanism that is not
triggered
---
.../ProcessorIntegrationConfiguration.java | 23 +++-------
.../ClientSubmissionProcessingService.java | 2 +-
.../LegacyAbstractPersistenceService.java | 45 +++++++++++++++++--
3 files changed, 47 insertions(+), 23 deletions(-)
diff --git a/processor/src/main/java/ca/bc/gov/app/configuration/ProcessorIntegrationConfiguration.java b/processor/src/main/java/ca/bc/gov/app/configuration/ProcessorIntegrationConfiguration.java
index 69f0e26977..2777ae349d 100644
--- a/processor/src/main/java/ca/bc/gov/app/configuration/ProcessorIntegrationConfiguration.java
+++ b/processor/src/main/java/ca/bc/gov/app/configuration/ProcessorIntegrationConfiguration.java
@@ -11,6 +11,7 @@
import org.springframework.integration.channel.FluxMessageChannel;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.Pollers;
+import org.springframework.integration.handler.LoggingHandler.Level;
import org.springframework.integration.r2dbc.inbound.R2dbcMessageSource;
@Configuration
@@ -117,6 +118,10 @@ public FluxMessageChannel submissionLegacyOtherChannel() {
return new FluxMessageChannel();
}
+ @Bean
+ public FluxMessageChannel submissionMailChannel() {
+ return new FluxMessageChannel();
+ }
@Bean
@@ -186,22 +191,4 @@ public IntegrationFlow notifyingIntegrationFlow(
.get();
}
- @Bean
- public IntegrationFlow aggregateLegacyData(
- @Value("${ca.bc.gov.nrs.processor.poolTime:1M}") Duration poolingTime
- ){
- return
- IntegrationFlow
- .from("submissionLegacyAggregateChannel")
- .aggregate(spec ->
- spec
- .expireTimeout(poolingTime.toMillis())
- .releaseStrategy(new LastItemReleaseStrategy())
- .correlationStrategy(message -> message.getHeaders().get(ApplicationConstant.SUBMISSION_ID))
- .sendPartialResultOnExpiry(true)
- )
- .channel(submissionLegacyNotifyChannel())
- .get();
- }
-
}
diff --git a/processor/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionProcessingService.java b/processor/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionProcessingService.java
index 74dc0a2bde..2a73e3f2ea 100644
--- a/processor/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionProcessingService.java
+++ b/processor/src/main/java/ca/bc/gov/app/service/client/ClientSubmissionProcessingService.java
@@ -162,7 +162,7 @@ public Mono> notificationProcessing(Message message) {
submissionMatchDetailRepository
.findBySubmissionId(message.getPayload())
diff --git a/processor/src/main/java/ca/bc/gov/app/service/legacy/LegacyAbstractPersistenceService.java b/processor/src/main/java/ca/bc/gov/app/service/legacy/LegacyAbstractPersistenceService.java
index f7ea4ad459..57397db2a3 100644
--- a/processor/src/main/java/ca/bc/gov/app/service/legacy/LegacyAbstractPersistenceService.java
+++ b/processor/src/main/java/ca/bc/gov/app/service/legacy/LegacyAbstractPersistenceService.java
@@ -29,6 +29,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiFunction;
+import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.IntFunction;
import lombok.Getter;
@@ -270,8 +271,16 @@ public Flux> createLocations(Message message) {
}
Flux data = locationRepository.findBySubmissionId(
- message.getPayload()
- );
+ message.getPayload()
+ )
+ .doOnNext(submissionLocation ->
+ log.info(
+ "Loaded submission location for persistence on oracle {} {} {}",
+ message.getPayload(),
+ submissionLocation.getName(),
+ submissionLocation.getSubmissionLocationId()
+ )
+ );
BiFunction> locateClientLocation = (clientNumber, locationCode) ->
legacyR2dbcEntityTemplate
@@ -329,6 +338,14 @@ public Flux> createLocations(Message message) {
.flatMap(forestClient ->
data
.count()
+ .doOnNext(count ->
+ log.info(
+ "Proceeding with location {}/{} of submission id {}",
+ index,
+ count,
+ message.getPayload()
+ )
+ )
.map(count ->
MessageBuilder
.fromMessage(message)
@@ -353,7 +370,7 @@ public Flux> createLocations(Message message) {
*/
@ServiceActivator(
inputChannel = ApplicationConstant.SUBMISSION_LEGACY_CONTACT_CHANNEL,
- outputChannel = ApplicationConstant.SUBMISSION_LEGACY_AGGREGATE_CHANNEL,
+ outputChannel = ApplicationConstant.SUBMISSION_LEGACY_NOTIFY_CHANNEL,
async = "true"
)
public Mono> createContact(Message message) {
@@ -382,7 +399,8 @@ public Mono> createContact(Message message) {
)
)
.and("CONTACT_NAME").is(
- String.format("%s %s", submissionContact.getFirstName().toUpperCase(),
+ String.format("%s %s",
+ submissionContact.getFirstName().toUpperCase(),
submissionContact.getLastName().toUpperCase())
)
),
@@ -470,10 +488,25 @@ public Mono> createContact(Message message) {
async = "true"
)
public Mono> sendNotification(Message message) {
+
if (!filterByType(
message.getHeaders().get(ApplicationConstant.CLIENT_TYPE_CODE, String.class))) {
return Mono.empty();
}
+
+ Long total = message.getHeaders().get(ApplicationConstant.TOTAL, Long.class);
+ Long index = message.getHeaders().get(ApplicationConstant.INDEX, Long.class);
+
+ if ((total == null || index == null) || ((total - 1) > index)) {
+ log.info("Skipping notification for submission {} until last location is processed",
+ message.getHeaders().get(ApplicationConstant.SUBMISSION_ID, Integer.class)
+ );
+ return Mono.empty();
+ }
+
+ log.info("Sending notification for submission {}",
+ message.getHeaders().get(ApplicationConstant.SUBMISSION_ID, Integer.class)
+ );
return Mono.just(
MessageBuilder
.fromMessage(message)
@@ -675,4 +708,8 @@ private ForestClientContactEntity toForestClientContactEntity(
.build();
}
+ private Consumer debug(String message) {
+ return data -> log.info("[{}] :: {}", message, data);
+ }
+
}