Skip to content

Commit

Permalink
Remove unused method in item repository CIRC-1416
Browse files Browse the repository at this point in the history
  • Loading branch information
marcjohnson-kint committed Jun 22, 2022
1 parent b8b7022 commit 9a701ac
Showing 1 changed file with 0 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static java.util.concurrent.CompletableFuture.completedFuture;
import static java.util.function.Function.identity;
import static org.folio.circulation.domain.ItemStatusName.AVAILABLE;
import static org.folio.circulation.domain.MultipleRecords.CombinationMatchers.matchRecordsById;
import static org.folio.circulation.support.fetching.MultipleCqlIndexValuesCriteria.byIndex;
import static org.folio.circulation.support.http.CommonResponseInterpreters.noContentRecordInterpreter;
Expand Down Expand Up @@ -119,23 +118,6 @@ private void setLastCheckIn(JsonObject representation, LastCheckIn lastCheckIn)
}
}

public CompletableFuture<Result<Item>> getFirstAvailableItemByInstanceId(String instanceId) {
return holdingsRepository.fetchByInstanceId(instanceId)
.thenCompose(r -> r.after(this::getAvailableItem));
}

private CompletableFuture<Result<Item>> getAvailableItem(
MultipleRecords<Holdings> holdingsRecords) {

if (holdingsRecords == null || holdingsRecords.isEmpty()) {
return ofAsync(() -> Item.from(null));
}

return findByIndexNameAndQuery(holdingsRecords.toKeys(Holdings::getId),
"holdingsRecordId", exactMatch("status.name", AVAILABLE.getName()))
.thenApply(mapResult(MultipleRecords::firstOrNull));
}

public CompletableFuture<Result<Item>> fetchByBarcode(String barcode) {
return fetchItemByBarcode(barcode)
.thenComposeAsync(this::fetchItemRelatedRecords);
Expand Down

0 comments on commit 9a701ac

Please sign in to comment.