From b19abf32e966091e93c84424ac98537dc4511ca7 Mon Sep 17 00:00:00 2001 From: backdev-1 Date: Mon, 4 May 2026 11:09:52 +0700 Subject: [PATCH] dev add method link --- .../soune/nocopy/handler/LawCaseHandler.java | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/src/main/java/ru/soune/nocopy/handler/LawCaseHandler.java b/src/main/java/ru/soune/nocopy/handler/LawCaseHandler.java index 8021547..b3af151 100644 --- a/src/main/java/ru/soune/nocopy/handler/LawCaseHandler.java +++ b/src/main/java/ru/soune/nocopy/handler/LawCaseHandler.java @@ -116,43 +116,44 @@ public class LawCaseHandler implements RequestHandler { } private void validateLawCaseRequestFilters(LawCaseRequest lawCaseRequest) { - if (lawCaseRequest.getFilterType() != null && !lawCaseRequest.getFilterType().getName().isEmpty()) { - boolean isValidType = Arrays.stream(LawCaseType.values()) - .anyMatch(type -> type.getName().equalsIgnoreCase(lawCaseRequest.getFilterType().name())); - - if (!isValidType) { - throw new NotValidFieldException("Not valid filter type", - new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(), - MessageCode.NOT_VALID_FIELD.getDescription(), - Map.of("field", "filterType", - "valid_values", Arrays.stream(LawCaseType.values()) - .map(LawCaseType::getName) - .collect(Collectors.toList()), - "received_value", lawCaseRequest.getFilterType()))); - } - } - - if (lawCaseRequest.getFilterPriority() != null && !lawCaseRequest.getFilterPriority().name().isEmpty()) { - boolean isValidPriority = Arrays.stream(LawCasePriority.values()) - .anyMatch(priority -> - priority.name().equalsIgnoreCase(lawCaseRequest.getFilterPriority().name())); - - if (!isValidPriority) { - throw new NotValidFieldException("Not valid filter priority", - new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(), - MessageCode.NOT_VALID_FIELD.getDescription(), - Map.of("field", "filterPriority", - "valid_values", Arrays.stream(LawCasePriority.values()) - .map(LawCasePriority::name) - .collect(Collectors.toList()), - "received_value", lawCaseRequest.getFilterPriority()))); - } - } +// if (lawCaseRequest.getFilterType() != null && !lawCaseRequest.getFilterType().getName().isEmpty()) { +// boolean isValidType = Arrays.stream(LawCaseType.values()) +// .anyMatch(type -> type.getName().equalsIgnoreCase(lawCaseRequest.getFilterType().name())); +// +// if (!isValidType) { +// throw new NotValidFieldException("Not valid filter type", +// new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(), +// MessageCode.NOT_VALID_FIELD.getDescription(), +// Map.of("field", "filterType", +// "valid_values", Arrays.stream(LawCaseType.values()) +// .map(LawCaseType::getName) +// .collect(Collectors.toList()), +// "received_value", lawCaseRequest.getFilterType()))); +// } +// } +// +// if (lawCaseRequest.getFilterPriority() != null && !lawCaseRequest.getFilterPriority().name().isEmpty()) { +// boolean isValidPriority = Arrays.stream(LawCasePriority.values()) +// .anyMatch(priority -> +// priority.name().equalsIgnoreCase(lawCaseRequest.getFilterPriority().name())); +// +// if (!isValidPriority) { +// throw new NotValidFieldException("Not valid filter priority", +// new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(), +// MessageCode.NOT_VALID_FIELD.getDescription(), +// Map.of("field", "filterPriority", +// "valid_values", Arrays.stream(LawCasePriority.values()) +// .map(LawCasePriority::name) +// .collect(Collectors.toList()), +// "received_value", lawCaseRequest.getFilterPriority()))); +// } +// } if (lawCaseRequest.getFilterPriority() != null && lawCaseRequest.getFilterPriority() != LawCasePriority.HIGH && lawCaseRequest.getFilterPriority() != LawCasePriority.MIDDLE && lawCaseRequest.getFilterPriority() != LawCasePriority.LOW && lawCaseRequest.getFilterPriority() != LawCasePriority.CRITICAL) { + throw new NotValidFieldException("Not valid filter priority", new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(), MessageCode.NOT_VALID_FIELD.getDescription(),