From 07d0d4df66d0aa64978c9d6c6fcfc995d0a4f09b Mon Sep 17 00:00:00 2001 From: Janis Saldabols Date: Thu, 3 Oct 2024 10:54:25 +0300 Subject: [PATCH] CIRC-2141 Rebase to latest master --- .../org/folio/circulation/domain/Item.java | 14 +++------ .../api/support/builders/RequestBuilder.java | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/folio/circulation/domain/Item.java b/src/main/java/org/folio/circulation/domain/Item.java index ca7436dd3b..a5341abb48 100644 --- a/src/main/java/org/folio/circulation/domain/Item.java +++ b/src/main/java/org/folio/circulation/domain/Item.java @@ -417,14 +417,10 @@ public String getDcbItemTitle() { } public boolean isAtLocation(String locationCode) { - if (locationCode == null || locationCode.isEmpty()) { - return true; - } else { - return getLocation() != null && ( - locationCode.equals(getLocation().getCode()) || - locationCode.equals(getLocation().getLibrary().getCode()) || - locationCode.equals(getLocation().getCampus().getCode()) || - locationCode.equals(getLocation().getInstitution().getCode())); - } + return locationCode != null && getLocation() != null && ( + locationCode.equals(getLocation().getCode()) || + locationCode.equals(getLocation().getLibrary().getCode()) || + locationCode.equals(getLocation().getCampus().getCode()) || + locationCode.equals(getLocation().getInstitution().getCode())); } } diff --git a/src/test/java/api/support/builders/RequestBuilder.java b/src/test/java/api/support/builders/RequestBuilder.java index 893eeb1197..c9eea6fa95 100644 --- a/src/test/java/api/support/builders/RequestBuilder.java +++ b/src/test/java/api/support/builders/RequestBuilder.java @@ -333,4 +333,35 @@ private static class PatronSummary { public static class Tags { private final List tagList; } + + @AllArgsConstructor + @Getter + public static class PrintDetails { + private final Integer printCount; + private final String requesterId; + private final Boolean isPrinted; + private final String printEventDate; + + public static PrintDetails fromRepresentation(JsonObject representation) { + JsonObject printDetails = representation.getJsonObject("printDetails"); + if (printDetails != null) { + final Integer printCount = printDetails.getInteger("printCount"); + final String requesterId = printDetails.getString("requesterId"); + final Boolean isPrinted = printDetails.getBoolean("isPrinted"); + final String printEventDate = printDetails.getString("printEventDate"); + return new PrintDetails(printCount, requesterId, isPrinted, + printEventDate); + } + return null; + } + + public JsonObject toJsonObject() { + JsonObject printDetails = new JsonObject(); + printDetails.put("printCount", printCount); + printDetails.put("requesterId", requesterId); + printDetails.put("isPrinted", isPrinted); + printDetails.put("printEventDate", printEventDate); + return printDetails; + } + } }