diff --git a/src/main/java/org/folio/circulation/domain/CirculationSetting.java b/src/main/java/org/folio/circulation/domain/CirculationSetting.java index 9be14118d4..03f254f1ed 100644 --- a/src/main/java/org/folio/circulation/domain/CirculationSetting.java +++ b/src/main/java/org/folio/circulation/domain/CirculationSetting.java @@ -39,17 +39,16 @@ public class CirculationSetting { private final JsonObject value; public static CirculationSetting from(JsonObject representation) { - if (getProperty(representation, ID_FIELD) == null || - getProperty(representation, NAME_FIELD) == null || - getObjectProperty(representation, VALUE_FIELD) == null || - !containsOnlyKnownFields(representation)) { + final var id = getProperty(representation, ID_FIELD); + final var name = getProperty(representation, NAME_FIELD); + final var value = getObjectProperty(representation, VALUE_FIELD); - log.info("from:: Circulation setting JSON is invalid: {}", representation); + if (id == null || name == null || value == null || !containsOnlyKnownFields(representation)) { + log.warn("from:: Circulation setting JSON is invalid: {}", representation); return null; } - return new CirculationSetting(representation, getProperty(representation, ID_FIELD), - getProperty(representation, NAME_FIELD), getObjectProperty(representation, VALUE_FIELD)); + return new CirculationSetting(representation, id, name, value); } private static boolean containsOnlyKnownFields(JsonObject representation) { diff --git a/src/main/java/org/folio/circulation/resources/CirculationSettingsResource.java b/src/main/java/org/folio/circulation/resources/CirculationSettingsResource.java index 8e9cc35da7..67eee1ee24 100644 --- a/src/main/java/org/folio/circulation/resources/CirculationSettingsResource.java +++ b/src/main/java/org/folio/circulation/resources/CirculationSettingsResource.java @@ -75,6 +75,8 @@ void get(RoutingContext routingContext) { final var clients = Clients.create(context, client); final var circulationSettingsRepository = new CirculationSettingsRepository(clients); + log.debug("get:: parameters id: {}", routingContext.request().getParam("id")); + ofAsync(routingContext.request().getParam("id")) .thenApply(refuseWhenIdIsInvalid()) .thenCompose(r -> r.after(circulationSettingsRepository::getById)) @@ -88,6 +90,8 @@ void delete(RoutingContext routingContext) { final var context = new WebContext(routingContext); final var clients = Clients.create(context, client); + log.debug("get:: parameters id: {}", routingContext.request().getParam("id")); + ofAsync(routingContext.request().getParam("id")) .thenApply(refuseWhenIdIsInvalid()) .thenCompose(r -> r.after(clients.circulationSettingsStorageClient()::delete)) @@ -102,6 +106,7 @@ void getMany(RoutingContext routingContext) { final var circulationSettingsRepository = new CirculationSettingsRepository(clients); final var query = routingContext.request().query(); + log.debug("get:: parameters id: {}", query); circulationSettingsRepository.findBy(query) .thenApply(multipleLoanRecordsResult -> multipleLoanRecordsResult.map(multipleRecords -> @@ -144,7 +149,7 @@ private static boolean uuidIsValid(String providedId) { try { return providedId != null && providedId.equals(UUID.fromString(providedId).toString()); } catch(IllegalArgumentException e) { - log.debug("uuidIsValid:: Invalid UUID"); + log.warn("uuidIsValid:: Invalid UUID"); return false; } }