diff --git a/ramls/acq-models b/ramls/acq-models index 72dd1b15a..4aab2ae48 160000 --- a/ramls/acq-models +++ b/ramls/acq-models @@ -1 +1 @@ -Subproject commit 72dd1b15ae5b846d61d9ad14bb780ea233e01e38 +Subproject commit 4aab2ae4808333aac379cae40828dacdf0ef986c diff --git a/src/main/java/org/folio/service/inventory/InventoryManager.java b/src/main/java/org/folio/service/inventory/InventoryManager.java index 3bb87626a..458662f13 100644 --- a/src/main/java/org/folio/service/inventory/InventoryManager.java +++ b/src/main/java/org/folio/service/inventory/InventoryManager.java @@ -1269,14 +1269,27 @@ private Future> fetchHoldingsByFundIds(List holdingIds, } private void updateItemWithPieceFields(Piece piece, JsonObject item) { - Optional.ofNullable(piece.getEnumeration()) - .ifPresentOrElse(enumeration -> item.put(ITEM_ENUMERATION, enumeration), () -> item.remove(ITEM_ENUMERATION)); - Optional.ofNullable(piece.getCopyNumber()) - .ifPresentOrElse(copyNumber -> item.put(COPY_NUMBER, copyNumber), () -> item.remove(COPY_NUMBER)); - Optional.ofNullable(piece.getChronology()) - .ifPresentOrElse(chronology -> item.put(ITEM_CHRONOLOGY, chronology), () -> item.remove(ITEM_CHRONOLOGY)); - Optional.ofNullable(piece.getDiscoverySuppress()) - .ifPresentOrElse(discSup -> item.put(ITEM_DISCOVERY_SUPPRESS, discSup), () -> item.remove(ITEM_DISCOVERY_SUPPRESS)); + if (StringUtils.isNotEmpty(piece.getEnumeration())) { + item.put(ITEM_ENUMERATION, piece.getEnumeration()); + } + if (StringUtils.isNotEmpty(piece.getCopyNumber())) { + item.put(COPY_NUMBER, piece.getCopyNumber()); + } + if (StringUtils.isNotEmpty(piece.getChronology())) { + item.put(ITEM_CHRONOLOGY, piece.getChronology()); + } + if (StringUtils.isNotEmpty(piece.getBarcode())) { + item.put(ITEM_BARCODE, piece.getBarcode()); + } + if (StringUtils.isNotEmpty(piece.getAccessionNumber())) { + item.put(ITEM_ACCESSION_NUMBER, piece.getAccessionNumber()); + } + if (StringUtils.isNotEmpty(piece.getCallNumber())) { + item.put(ITEM_LEVEL_CALL_NUMBER, piece.getCallNumber()); + } + if (piece.getDiscoverySuppress() != null) { + item.put(ITEM_DISCOVERY_SUPPRESS, piece.getDiscoverySuppress()); + } } public Future createShadowInstanceIfNeeded(String instanceId, RequestContext requestContext) { diff --git a/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowInventoryManager.java b/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowInventoryManager.java index 198de6ae0..8074b8632 100644 --- a/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowInventoryManager.java +++ b/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowInventoryManager.java @@ -3,7 +3,6 @@ import static org.folio.service.inventory.InventoryManager.ID; import static org.folio.service.inventory.InventoryManager.ITEM_HOLDINGS_RECORD_ID; import static org.folio.service.inventory.InventoryManager.ITEM_PURCHASE_ORDER_LINE_IDENTIFIER; -import static org.folio.service.inventory.InventoryManager.COPY_NUMBER; import java.util.Optional; @@ -127,8 +126,6 @@ private Future handleItem(PieceUpdateHolder holder, RequestContext reque private Future updateItemWithFields(JsonObject item, CompositePoLine compPOL, Piece piece) { Optional.ofNullable(piece.getHoldingId()) .ifPresent(pieceHoldingId -> item.put(ITEM_HOLDINGS_RECORD_ID, piece.getHoldingId())); - Optional.ofNullable(piece.getCopyNumber()) - .ifPresentOrElse(copyNumber -> item.put(COPY_NUMBER, copyNumber), () -> item.remove(COPY_NUMBER)); item.put(ITEM_PURCHASE_ORDER_LINE_IDENTIFIER, compPOL.getId()); return Future.succeededFuture(); }