88 * Data transfer object that encapsulates the optional search criteria used by
99 * the advanced client search endpoint.
1010 *
11- * <p>All fields are optional – when a field is {@code null} or blank it is
11+ * <p>All fields are optional - when a field is {@code null} or blank it is
1212 * ignored by the search query. Non-blank fields are combined with AND logic
1313 * to narrow down the result set.
1414 *
1515 * @param clientName the client's last name or organization name to search for
1616 * @param firstName the client's first name to search for
1717 * @param middleName the client's middle name to search for
18- * @param clientStatus the client status code (e.g. {@code "ACT"}, {@code "DAC"})
19- * @param clientType the client type code (e.g. {@code "I"} for individual,
18+ * @param clientStatus the client status code (for example {@code "ACT"} or {@code "DAC"})
19+ * @param clientType the client type code (for example {@code "I"} for individual or
2020 * {@code "C"} for corporation)
2121 * @param clientIdType the type of the client identification document
22- * @param clientIdentification the client identification number
22+ * @param clientIdentification the client identification or registration value to match
2323 * @param emailAddress the email address associated with the client contact or location
2424 * @param contactName the name of a contact person associated with the client
25- * @param userId the user ID performing the search
26- * @param updatedFromDate the lower bound for the last updated date (inclusive)
27- * @param updatedToDate the upper bound for the last updated date (inclusive)
25+ * @param userId the updating user ID to search for
26+ * @param updatedFromDate the lower bound for the last updated date, inclusive
27+ * @param updatedToDate the upper bound for the last updated date, inclusive
28+ * @param birthdate the client's birthdate for exact-date matching
29+ * @param city the primary client location city to search for
30+ * @param postalCode the primary client location postal code to search for
31+ * @param comment text to match against client or primary location comments
2832 */
2933public record ClientAdvancedSearchCriteriaDto (
3034 String clientName ,
@@ -38,7 +42,11 @@ public record ClientAdvancedSearchCriteriaDto(
3842 String contactName ,
3943 String userId ,
4044 LocalDate updatedFromDate ,
41- LocalDate updatedToDate
45+ LocalDate updatedToDate ,
46+ LocalDate birthdate ,
47+ String city ,
48+ String postalCode ,
49+ String comment
4250) {
4351
4452 /**
@@ -66,13 +74,20 @@ public boolean hasValidParams() {
6674 sanitizedCriteria .contactName ,
6775 sanitizedCriteria .userId ,
6876 sanitizedCriteria .updatedFromDate ,
69- sanitizedCriteria .updatedToDate )
77+ sanitizedCriteria .updatedToDate ,
78+ sanitizedCriteria .birthdate ,
79+ sanitizedCriteria .city ,
80+ sanitizedCriteria .postalCode ,
81+ sanitizedCriteria .comment )
7082 .anyMatch (java .util .Objects ::nonNull );
7183 }
7284
7385 /**
74- * Returns a new instance with all blank/empty values converted to null,
75- * so the SQL query can skip them via {@code :param IS NULL}.
86+ * Returns a new instance with all blank or empty string values converted to
87+ * {@code null} so the SQL query can skip them via {@code :param IS NULL}.
88+ *
89+ * @return a normalized copy of this criteria with blank string values
90+ * replaced by {@code null}
7691 */
7792 public ClientAdvancedSearchCriteriaDto sanitized () {
7893 return new ClientAdvancedSearchCriteriaDto (
@@ -87,23 +102,28 @@ public ClientAdvancedSearchCriteriaDto sanitized() {
87102 blankToNull (contactName ),
88103 blankToNull (userId ),
89104 blankToNull (updatedFromDate ),
90- blankToNull (updatedToDate )
105+ blankToNull (updatedToDate ),
106+ blankToNull (birthdate ),
107+ blankToNull (city ),
108+ blankToNull (postalCode ),
109+ blankToNull (comment )
91110 );
92111 }
93112
94113 /**
95114 * Returns {@code null} if the given value is a {@link String} that is blank;
96115 * otherwise returns the original value unchanged.
97116 *
98- * <p>A value is considered blank if it is {@code null}, empty, or contains only
99- * whitespace ( as defined by {@code StringUtils. isBlank}) .
117+ * <p>A value is considered blank if it is {@code null}, empty, or contains
118+ * only whitespace as defined by {@link StringUtils# isBlank(CharSequence)} .
100119 *
101- * <p>For non-{@link String} types (e.g., {@link java.time.LocalDateTime}),
102- * the value is returned as-is.
120+ * <p>For non-{@link String} types such as {@link java.time.LocalDate}, the
121+ * value is returned as-is.
103122 *
104123 * @param <T> the type of the input value
105124 * @param value the value to check
106- * @return {@code null} if the value is a blank {@link String}; otherwise the original value
125+ * @return {@code null} if the value is a blank {@link String}; otherwise the
126+ * original value
107127 */
108128 private static <T > T blankToNull (T value ) {
109129 if (value instanceof String str ) {
0 commit comments