@@ -116,43 +116,44 @@ public class LawCaseHandler implements RequestHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void validateLawCaseRequestFilters(LawCaseRequest lawCaseRequest) {
|
private void validateLawCaseRequestFilters(LawCaseRequest lawCaseRequest) {
|
||||||
if (lawCaseRequest.getFilterType() != null && !lawCaseRequest.getFilterType().getName().isEmpty()) {
|
// if (lawCaseRequest.getFilterType() != null && !lawCaseRequest.getFilterType().getName().isEmpty()) {
|
||||||
boolean isValidType = Arrays.stream(LawCaseType.values())
|
// boolean isValidType = Arrays.stream(LawCaseType.values())
|
||||||
.anyMatch(type -> type.getName().equalsIgnoreCase(lawCaseRequest.getFilterType().name()));
|
// .anyMatch(type -> type.getName().equalsIgnoreCase(lawCaseRequest.getFilterType().name()));
|
||||||
|
//
|
||||||
if (!isValidType) {
|
// if (!isValidType) {
|
||||||
throw new NotValidFieldException("Not valid filter type",
|
// throw new NotValidFieldException("Not valid filter type",
|
||||||
new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
|
// new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
|
||||||
MessageCode.NOT_VALID_FIELD.getDescription(),
|
// MessageCode.NOT_VALID_FIELD.getDescription(),
|
||||||
Map.of("field", "filterType",
|
// Map.of("field", "filterType",
|
||||||
"valid_values", Arrays.stream(LawCaseType.values())
|
// "valid_values", Arrays.stream(LawCaseType.values())
|
||||||
.map(LawCaseType::getName)
|
// .map(LawCaseType::getName)
|
||||||
.collect(Collectors.toList()),
|
// .collect(Collectors.toList()),
|
||||||
"received_value", lawCaseRequest.getFilterType())));
|
// "received_value", lawCaseRequest.getFilterType())));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (lawCaseRequest.getFilterPriority() != null && !lawCaseRequest.getFilterPriority().name().isEmpty()) {
|
// if (lawCaseRequest.getFilterPriority() != null && !lawCaseRequest.getFilterPriority().name().isEmpty()) {
|
||||||
boolean isValidPriority = Arrays.stream(LawCasePriority.values())
|
// boolean isValidPriority = Arrays.stream(LawCasePriority.values())
|
||||||
.anyMatch(priority ->
|
// .anyMatch(priority ->
|
||||||
priority.name().equalsIgnoreCase(lawCaseRequest.getFilterPriority().name()));
|
// priority.name().equalsIgnoreCase(lawCaseRequest.getFilterPriority().name()));
|
||||||
|
//
|
||||||
if (!isValidPriority) {
|
// if (!isValidPriority) {
|
||||||
throw new NotValidFieldException("Not valid filter priority",
|
// throw new NotValidFieldException("Not valid filter priority",
|
||||||
new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
|
// new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
|
||||||
MessageCode.NOT_VALID_FIELD.getDescription(),
|
// MessageCode.NOT_VALID_FIELD.getDescription(),
|
||||||
Map.of("field", "filterPriority",
|
// Map.of("field", "filterPriority",
|
||||||
"valid_values", Arrays.stream(LawCasePriority.values())
|
// "valid_values", Arrays.stream(LawCasePriority.values())
|
||||||
.map(LawCasePriority::name)
|
// .map(LawCasePriority::name)
|
||||||
.collect(Collectors.toList()),
|
// .collect(Collectors.toList()),
|
||||||
"received_value", lawCaseRequest.getFilterPriority())));
|
// "received_value", lawCaseRequest.getFilterPriority())));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (lawCaseRequest.getFilterPriority() != null && lawCaseRequest.getFilterPriority() != LawCasePriority.HIGH &&
|
if (lawCaseRequest.getFilterPriority() != null && lawCaseRequest.getFilterPriority() != LawCasePriority.HIGH &&
|
||||||
lawCaseRequest.getFilterPriority() != LawCasePriority.MIDDLE &&
|
lawCaseRequest.getFilterPriority() != LawCasePriority.MIDDLE &&
|
||||||
lawCaseRequest.getFilterPriority() != LawCasePriority.LOW &&
|
lawCaseRequest.getFilterPriority() != LawCasePriority.LOW &&
|
||||||
lawCaseRequest.getFilterPriority() != LawCasePriority.CRITICAL) {
|
lawCaseRequest.getFilterPriority() != LawCasePriority.CRITICAL) {
|
||||||
|
|
||||||
throw new NotValidFieldException("Not valid filter priority",
|
throw new NotValidFieldException("Not valid filter priority",
|
||||||
new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
|
new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
|
||||||
MessageCode.NOT_VALID_FIELD.getDescription(),
|
MessageCode.NOT_VALID_FIELD.getDescription(),
|
||||||
|
|||||||
Reference in New Issue
Block a user