Skip to content

Commit 6c03a7d

Browse files
feat(be): Added javadocs
1 parent 74e30d4 commit 6c03a7d

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/main/java/ca/bc/gov/api/oracle/legacy/controller/ClientSearchController.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,22 @@ public Flux<ClientPublicViewDto> searchClients(
116116
.putIfAbsent(ApplicationConstants.X_TOTAL_COUNT, List.of(dto.getCount().toString())));
117117
}
118118

119+
/**
120+
* Searches for clients based on the provided parameters using a fuzzy match algorithm.
121+
* The search is case-insensitive and has a threshold cutout of 0.8 for the fuzzy match.
122+
*
123+
* @param page the one-based page number to retrieve, defaults to 0 if not provided.
124+
* @param size the number of results per page, defaults to 10 if not provided.
125+
* @param name the name of the client to search for (optional).
126+
* @param acronym the acronym of the client to search for (optional).
127+
* @param number the unique number of the client to search for (optional).
128+
* @param serverResponse the {@link ServerHttpResponse} to include response headers.
129+
* @return a reactive stream of {@link ClientPublicViewDto} objects representing matching
130+
* clients.
131+
*
132+
* @apiNote This method provides a paginated, fuzzy search for client details. Results
133+
* include a total record count in the response headers under {@code X-Total-Count}.
134+
*/
119135
@GetMapping("/by")
120136
@Operation(
121137
summary = "Search for clients",

src/main/java/ca/bc/gov/api/oracle/legacy/service/ClientSearchService.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,21 @@ public Flux<ClientPublicViewDto> searchClientByQuery(
109109
.doOnNext(client -> log.info("Found client with id {}", client.getClientNumber()));
110110
}
111111

112+
/**
113+
* Constructs a search {@link Criteria} object based on the provided client name, acronym, or
114+
* number.
115+
* This method normalizes input values for case-insensitive searches and validates the client
116+
* number.
117+
*
118+
* @param name the name of the client to search for, or null if not specified.
119+
* @param acronym the acronym of the client to search for, or null if not specified.
120+
* @param number the unique number of the client to search for, or null if not specified.
121+
* @return a {@link Mono} emitting the constructed {@link Criteria} object for the search.
122+
*
123+
* @implNote Input values are transformed to uppercase for case-insensitivity. The client
124+
* number is validated using {@link #checkClientNumber(String)}. Repository results are
125+
* mapped to a search criteria object.
126+
*/
112127
public Mono<Criteria> searchByAcronymNameNumber(String name, String acronym, String number) {
113128
log.info("Searching for clients with name {}, acronym {} or number {}", name, acronym, number);
114129

0 commit comments

Comments
 (0)