From cb329b454f1595de5af92888fee9fd79efc08c13 Mon Sep 17 00:00:00 2001 From: Roman_Chernetskyi Date: Mon, 19 Aug 2024 15:53:37 +0300 Subject: [PATCH] [MODINV-1060] Update ownership of holdings with new location --- ramls/holdings_update_ownership.json | 4 ++ .../resources/UpdateOwnershipApi.java | 9 ++- .../HoldingsUpdateOwnershipApiTest.java | 56 +++++++++++++------ ...gsRecordUpdateOwnershipRequestBuilder.java | 7 ++- 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/ramls/holdings_update_ownership.json b/ramls/holdings_update_ownership.json index e185dcfbc..fb3e9e47f 100644 --- a/ramls/holdings_update_ownership.json +++ b/ramls/holdings_update_ownership.json @@ -14,6 +14,10 @@ "$ref": "uuid.json" } }, + "targetLocationId": { + "description": "Id of the location at the target tenant where Holdings will be created.", + "$ref": "uuid.json" + }, "targetTenantId": { "description": "Target tenant Id, where selected Holdings will be created.", "type": "string" diff --git a/src/main/java/org/folio/inventory/resources/UpdateOwnershipApi.java b/src/main/java/org/folio/inventory/resources/UpdateOwnershipApi.java index 0852b3d23..7d41dc5d0 100644 --- a/src/main/java/org/folio/inventory/resources/UpdateOwnershipApi.java +++ b/src/main/java/org/folio/inventory/resources/UpdateOwnershipApi.java @@ -276,7 +276,7 @@ private CompletableFuture> updateOwnershipOfHoldingsRecords(Holding if (!jsons.isEmpty()) { List validatedHoldingsRecords = validateHoldingsRecords(jsons, holdingsUpdateOwnership.getToInstanceId(), notUpdatedEntities); List holdingsRecordWrappers = - validatedHoldingsRecords.stream().map(this::mapHoldingsRecordWrapper).toList(); + validatedHoldingsRecords.stream().map(h -> mapHoldingsRecordWrapper(h, holdingsUpdateOwnership)).toList(); return validateHoldingsRecordsBoundWith(holdingsRecordWrappers, notUpdatedEntities, routingContext, context) .thenCompose(wrappersWithoutBoundWith -> createHoldings(wrappersWithoutBoundWith, notUpdatedEntities, targetTenantHoldingsRecordCollection)) @@ -571,10 +571,13 @@ private String getTargetHoldingId(JsonObject itemJson, List