Search in sources :

Example 26 with Request

use of org.folio.circulation.domain.Request in project mod-circulation by folio-org.

the class MoveRequestTests method dueDateChangedEventIsPublished.

@Test
void dueDateChangedEventIsPublished() {
    val secondFloorEconomics = locationsFixture.secondFloorEconomics();
    val mezzanineDisplayCase = locationsFixture.mezzanineDisplayCase();
    val instance = instancesFixture.basedUponDunkirk();
    val itemCopyA = itemsFixture.basedUponDunkirk(holdingBuilder -> holdingBuilder.withPermanentLocation(secondFloorEconomics).withNoTemporaryLocation(), instanceBuilder -> instanceBuilder.withId(instance.getId()), itemBuilder -> itemBuilder.withNoPermanentLocation().withNoTemporaryLocation().withBarcode("10203040506"));
    val itemCopyB = itemsFixture.basedUponDunkirk(holdingBuilder -> holdingBuilder.withPermanentLocation(mezzanineDisplayCase).withNoTemporaryLocation(), instanceBuilder -> instanceBuilder.withId(instance.getId()), itemBuilder -> itemBuilder.withNoPermanentLocation().withNoTemporaryLocation().withBarcode("90806050402"));
    val james = usersFixture.james();
    val jessica = usersFixture.jessica();
    val steve = usersFixture.steve();
    val charlotte = usersFixture.charlotte();
    IndividualResource itemCopyALoan = checkOutFixture.checkOutByBarcode(itemCopyA, james, getZonedDateTime());
    requestsFixture.placeItemLevelHoldShelfRequest(itemCopyB, jessica, getZonedDateTime().minusHours(3), RequestType.PAGE.getValue());
    IndividualResource recallRequestForItemCopyB = requestsFixture.placeItemLevelHoldShelfRequest(itemCopyB, steve, getZonedDateTime().minusHours(2), RequestType.RECALL.getValue());
    requestsFixture.placeItemLevelHoldShelfRequest(itemCopyA, charlotte, getZonedDateTime().minusHours(1), RequestType.HOLD.getValue());
    requestsFixture.move(new MoveRequestBuilder(recallRequestForItemCopyB.getId(), itemCopyA.getId()));
    itemCopyALoan = loansClient.get(itemCopyALoan);
    // There should be four events published - for "check out", for "log event", for "hold" and for "move"
    final var publishedEvents = Awaitility.await().atMost(1, TimeUnit.SECONDS).until(FakePubSub::getPublishedEvents, hasSize(11));
    Map<String, List<JsonObject>> events = publishedEvents.stream().collect(groupingBy(o -> o.getString("eventType")));
    Map<String, List<JsonObject>> logEvents = events.get(LOG_RECORD.name()).stream().collect(groupingBy(e -> new JsonObject(e.getString("eventPayload")).getString("logEventType")));
    Request originalCreatedFromEventPayload = Request.from(new JsonObject(logEvents.get(REQUEST_MOVED.value()).get(0).getString("eventPayload")).getJsonObject("payload").getJsonObject("requests").getJsonObject("original"));
    Request updatedCreatedFromEventPayload = Request.from(new JsonObject(logEvents.get(REQUEST_MOVED.value()).get(0).getString("eventPayload")).getJsonObject("payload").getJsonObject("requests").getJsonObject("updated"));
    assertThat(originalCreatedFromEventPayload.asJson(), Matchers.not(equalTo(updatedCreatedFromEventPayload.asJson())));
    assertThat(originalCreatedFromEventPayload.getItemId(), not(equalTo(updatedCreatedFromEventPayload.getItemId())));
    assertThat(updatedCreatedFromEventPayload.getItemId(), equalTo(itemCopyA.getId().toString()));
    assertThat(events.get(LOAN_DUE_DATE_CHANGED.name()).get(1), isValidLoanDueDateChangedEvent(itemCopyALoan.getJson()));
}
Also used : lombok.val(lombok.val) MoveRequestBuilder(api.support.builders.MoveRequestBuilder) FakePubSub(api.support.fakes.FakePubSub) REQUEST_MOVED(org.folio.circulation.domain.representations.logs.LogEventType.REQUEST_MOVED) Response(org.folio.circulation.support.http.client.Response) LoanPolicyBuilder(api.support.builders.LoanPolicyBuilder) ZonedDateTime(java.time.ZonedDateTime) APITests(api.support.APITests) ClockUtil.setDefaultClock(org.folio.circulation.support.utils.ClockUtil.setDefaultClock) ItemStatus(org.folio.circulation.domain.ItemStatus) FakePubSub(api.support.fakes.FakePubSub) ClockUtil.setClock(org.folio.circulation.support.utils.ClockUtil.setClock) Period(org.folio.circulation.domain.policy.Period) Map(java.util.Map) JsonObject(io.vertx.core.json.JsonObject) ZoneOffset(java.time.ZoneOffset) Instant(java.time.Instant) MoveRequestBuilder(api.support.builders.MoveRequestBuilder) ItemResource(api.support.http.ItemResource) ZoneId(java.time.ZoneId) Test(org.junit.jupiter.api.Test) EventMatchers.isValidLoanDueDateChangedEvent(api.support.matchers.EventMatchers.isValidLoanDueDateChangedEvent) UserResource(api.support.http.UserResource) List(java.util.List) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) RequestStatus(org.folio.circulation.domain.RequestStatus) REQUEST_TYPE(org.folio.circulation.domain.representations.RequestProperties.REQUEST_TYPE) Matchers.is(org.hamcrest.Matchers.is) Clock.offset(java.time.Clock.offset) Awaitility(org.awaitility.Awaitility) KEEP_THE_CURRENT_DUE_DATE(org.folio.circulation.domain.policy.DueDateManagement.KEEP_THE_CURRENT_DUE_DATE) ClockUtil.getZonedDateTime(org.folio.circulation.support.utils.ClockUtil.getZonedDateTime) ValidationErrorMatchers.hasMessage(api.support.matchers.ValidationErrorMatchers.hasMessage) ConfigurationExample.timezoneConfigurationFor(api.support.fixtures.ConfigurationExample.timezoneConfigurationFor) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) CoreMatchers.not(org.hamcrest.CoreMatchers.not) Request(org.folio.circulation.domain.Request) RequestBuilder(api.support.builders.RequestBuilder) ValidationErrorMatchers.hasParameter(api.support.matchers.ValidationErrorMatchers.hasParameter) IndividualResource(api.support.http.IndividualResource) TextDateTimeMatcher.isEquivalentTo(api.support.matchers.TextDateTimeMatcher.isEquivalentTo) CoreMatchers.allOf(org.hamcrest.CoreMatchers.allOf) Matchers.hasSize(org.hamcrest.Matchers.hasSize) ItemStatusCodeMatcher.hasItemStatus(api.support.matchers.ItemStatusCodeMatcher.hasItemStatus) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) LOAN_DUE_DATE_CHANGED(org.folio.circulation.domain.EventType.LOAN_DUE_DATE_CHANGED) Clock.fixed(java.time.Clock.fixed) Duration.ofDays(java.time.Duration.ofDays) RequestType(org.folio.circulation.domain.RequestType) MultipleRecords(org.folio.circulation.domain.MultipleRecords) PAGED(api.support.builders.ItemBuilder.PAGED) OPEN_AWAITING_PICKUP(api.support.builders.RequestBuilder.OPEN_AWAITING_PICKUP) ClockUtil.getClock(org.folio.circulation.support.utils.ClockUtil.getClock) lombok.val(lombok.val) Matchers(org.hamcrest.Matchers) AVAILABLE(api.support.builders.ItemBuilder.AVAILABLE) TimeUnit(java.util.concurrent.TimeUnit) ValidationErrorMatchers.hasErrorWith(api.support.matchers.ValidationErrorMatchers.hasErrorWith) CALL_NUMBER_COMPONENTS(org.folio.circulation.domain.representations.ItemProperties.CALL_NUMBER_COMPONENTS) AfterEach(org.junit.jupiter.api.AfterEach) LOG_RECORD(org.folio.circulation.domain.EventType.LOG_RECORD) Request(org.folio.circulation.domain.Request) JsonObject(io.vertx.core.json.JsonObject) List(java.util.List) IndividualResource(api.support.http.IndividualResource) Test(org.junit.jupiter.api.Test)

Example 27 with Request

use of org.folio.circulation.domain.Request in project mod-circulation by folio-org.

the class ItemsInTransitReport method buildEntry.

private JsonObject buildEntry(Item item) {
    if (item == null || item.isNotFound()) {
        return new JsonObject();
    }
    item = ofNullable(item.getHoldingsRecordId()).map(reportContext.getHoldingsRecords()::get).map(Holdings::getInstanceId).map(reportContext.getInstances()::get).map(item::withInstance).orElse(item);
    Loan loan = reportContext.getLoans().get(item.getItemId());
    Request request = reportContext.getRequests().get(item.getItemId());
    Location location = reportContext.getLocations().get(item.getLocationId());
    if (location != null) {
        ServicePoint primaryServicePoint = reportContext.getServicePoints().get(location.getPrimaryServicePointId().toString());
        item = item.withLocation(location.withPrimaryServicePoint(primaryServicePoint));
    }
    ServicePoint inTransitDestinationServicePoint = reportContext.getServicePoints().get(item.getInTransitDestinationServicePointId());
    ServicePoint lastCheckInServicePoint = reportContext.getServicePoints().get(item.getLastCheckInServicePointId().toString());
    item = item.updateLastCheckInServicePoint(lastCheckInServicePoint).updateDestinationServicePoint(inTransitDestinationServicePoint);
    final JsonObject entry = new JsonObject();
    write(entry, "id", item.getItemId());
    write(entry, "title", item.getTitle());
    write(entry, "barcode", item.getBarcode());
    write(entry, "contributors", mapContributorNamesToJson(item));
    write(entry, "callNumber", item.getCallNumber());
    write(entry, "enumeration", item.getEnumeration());
    write(entry, "volume", item.getVolume());
    write(entry, "yearCaption", new JsonArray(item.getYearCaption()));
    writeNamedObject(entry, "status", ofNullable(item.getStatus()).map(ItemStatus::getValue).orElse(null));
    write(entry, "inTransitDestinationServicePointId", item.getInTransitDestinationServicePointId());
    write(entry, "copyNumber", item.getCopyNumber());
    write(entry, "effectiveCallNumberComponents", createCallNumberComponents(item.getCallNumberComponents()));
    if (inTransitDestinationServicePoint != null) {
        writeServicePoint(entry, inTransitDestinationServicePoint, "inTransitDestinationServicePoint");
    }
    if (location != null) {
        writeLocation(entry, location);
    }
    if (request != null) {
        User requester = reportContext.getUsers().get(request.getRequesterId());
        PatronGroup requesterPatronGroup = requester == null ? null : reportContext.getPatronGroups().get(requester.getPatronGroupId());
        if (requesterPatronGroup != null) {
            request = request.withRequester(requester.withPatronGroup(requesterPatronGroup));
        }
        ServicePoint pickupServicePoint = reportContext.getServicePoints().get(request.getPickupServicePointId());
        request = request.withPickupServicePoint(pickupServicePoint);
        writeRequest(request, entry);
    }
    if (loan != null) {
        ServicePoint checkoutServicePoint = reportContext.getServicePoints().get(loan.getCheckoutServicePointId());
        ServicePoint checkInServicePoint = reportContext.getServicePoints().get(loan.getCheckInServicePointId());
        loan = loan.withCheckinServicePoint(checkInServicePoint).withCheckoutServicePoint(checkoutServicePoint);
        writeLoan(entry, loan);
    }
    final LastCheckIn lastCheckIn = item.getLastCheckIn();
    if (lastCheckIn != null) {
        writeLastCheckIn(entry, lastCheckIn);
    }
    return entry;
}
Also used : ServicePoint(org.folio.circulation.domain.ServicePoint) JsonArray(io.vertx.core.json.JsonArray) ItemStatus(org.folio.circulation.domain.ItemStatus) LastCheckIn(org.folio.circulation.domain.LastCheckIn) User(org.folio.circulation.domain.User) Loan(org.folio.circulation.domain.Loan) Holdings(org.folio.circulation.domain.Holdings) Request(org.folio.circulation.domain.Request) JsonObject(io.vertx.core.json.JsonObject) PatronGroup(org.folio.circulation.domain.PatronGroup) Location(org.folio.circulation.domain.Location)

Example 28 with Request

use of org.folio.circulation.domain.Request in project mod-circulation by folio-org.

the class LoanPolicy method isAlternatePeriod.

private boolean isAlternatePeriod(RequestQueue requestQueue) {
    final JsonObject holds = getHolds();
    if (Objects.isNull(requestQueue) || !holds.containsKey(ALTERNATE_CHECKOUT_LOAN_PERIOD_KEY)) {
        return false;
    }
    Optional<Request> potentialRequest = requestQueue.getRequests().stream().skip(1).findFirst();
    boolean isAlternateDueDateSchedule = false;
    if (potentialRequest.isPresent()) {
        Request request = potentialRequest.get();
        boolean isHold = request.getRequestType() == RequestType.HOLD;
        boolean isOpenNotYetFilled = request.getStatus() == RequestStatus.OPEN_NOT_YET_FILLED;
        if (isHold && isOpenNotYetFilled) {
            isAlternateDueDateSchedule = true;
        }
    }
    return isAlternateDueDateSchedule;
}
Also used : Request(org.folio.circulation.domain.Request) JsonObject(io.vertx.core.json.JsonObject)

Example 29 with Request

use of org.folio.circulation.domain.Request in project mod-circulation by folio-org.

the class RequestByInstanceIdResource method createInstanceLevelRequests.

private void createInstanceLevelRequests(RoutingContext routingContext) {
    final WebContext context = new WebContext(routingContext);
    final Clients clients = Clients.create(context, client);
    final var itemRepository = new ItemRepository(clients);
    final var userRepository = new UserRepository(clients);
    final var loanRepository = new LoanRepository(clients, itemRepository, userRepository);
    final var requestRepository = RequestRepository.using(clients, itemRepository, userRepository, loanRepository);
    final var requestQueueRepository = new RequestQueueRepository(requestRepository);
    final var itemFinder = new ItemByInstanceIdFinder(clients.holdingsStorage(), itemRepository);
    final var eventPublisher = new EventPublisher(routingContext);
    final var requestBody = routingContext.getBodyAsJson();
    new ConfigurationRepository(clients).lookupTlrSettings().thenCompose(r -> r.after(config -> buildAndPlaceRequests(clients, eventPublisher, itemRepository, loanRepository, requestRepository, requestQueueRepository, userRepository, itemFinder, config, requestBody))).thenApply(r -> r.map(RequestAndRelatedRecords::getRequest)).thenApply(r -> r.map(new RequestRepresentation()::extendedRepresentation)).thenApply(r -> r.map(JsonHttpResponse::created)).thenAccept(context::writeResultToHttpResponse).exceptionally(err -> {
        String reason = "Error processing instance-level request";
        log.error(reason, err);
        ServerErrorResponse.internalError(routingContext.response(), reason);
        return null;
    });
}
Also used : HOLD(org.folio.circulation.domain.RequestType.HOLD) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) UpdateRequestQueue(org.folio.circulation.domain.UpdateRequestQueue) CreateRequestService(org.folio.circulation.domain.CreateRequestService) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) InstanceRequestRelatedRecords(org.folio.circulation.domain.InstanceRequestRelatedRecords) ZonedDateTime(java.time.ZonedDateTime) RequestQueueRepository(org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository) LoanPolicyRepository(org.folio.circulation.infrastructure.storage.loans.LoanPolicyRepository) ServerErrorResponse(org.folio.circulation.support.http.server.ServerErrorResponse) Router(io.vertx.ext.web.Router) ValidationErrorFailure.singleValidationError(org.folio.circulation.support.ValidationErrorFailure.singleValidationError) UpdateItem(org.folio.circulation.domain.UpdateItem) RoutingContext(io.vertx.ext.web.RoutingContext) JsonPropertyWriter.write(org.folio.circulation.support.json.JsonPropertyWriter.write) Item(org.folio.circulation.domain.Item) REQUEST_LEVEL(org.folio.circulation.domain.representations.RequestProperties.REQUEST_LEVEL) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository) HttpFailure(org.folio.circulation.support.HttpFailure) Map(java.util.Map) CommonFailures.failedDueToServerError(org.folio.circulation.support.results.CommonFailures.failedDueToServerError) JsonObject(io.vertx.core.json.JsonObject) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) RequestRepresentation(org.folio.circulation.domain.RequestRepresentation) RequestBlockValidators.regularRequestBlockValidators(org.folio.circulation.resources.RequestBlockValidators.regularRequestBlockValidators) Result.of(org.folio.circulation.support.results.Result.of) Result.succeeded(org.folio.circulation.support.results.Result.succeeded) MethodHandles(java.lang.invoke.MethodHandles) Collection(java.util.Collection) Loan(org.folio.circulation.domain.Loan) RequestLoanValidator(org.folio.circulation.domain.validation.RequestLoanValidator) RequestPolicyRepository(org.folio.circulation.infrastructure.storage.requests.RequestPolicyRepository) UUID(java.util.UUID) ValidationError(org.folio.circulation.support.http.server.ValidationError) Result(org.folio.circulation.support.results.Result) Collectors(java.util.stream.Collectors) EventPublisher(org.folio.circulation.services.EventPublisher) Objects(java.util.Objects) PROXY_USER_ID(org.folio.circulation.domain.representations.RequestProperties.PROXY_USER_ID) ServicePointPickupLocationValidator(org.folio.circulation.domain.validation.ServicePointPickupLocationValidator) RouteRegistration(org.folio.circulation.support.RouteRegistration) List(java.util.List) PAGE(org.folio.circulation.domain.RequestType.PAGE) Logger(org.apache.logging.log4j.Logger) RECALL(org.folio.circulation.domain.RequestType.RECALL) HOLD_SHELF(org.folio.circulation.domain.RequestFulfilmentPreference.HOLD_SHELF) InstanceRepository(org.folio.circulation.infrastructure.storage.inventory.InstanceRepository) REQUEST_TYPE(org.folio.circulation.domain.representations.RequestProperties.REQUEST_TYPE) Optional(java.util.Optional) BadRequestFailure(org.folio.circulation.support.BadRequestFailure) FULFILMENT_PREFERENCE(org.folio.circulation.domain.representations.RequestProperties.FULFILMENT_PREFERENCE) CreateRequestRepositories(org.folio.circulation.domain.CreateRequestRepositories) RequestRepository(org.folio.circulation.infrastructure.storage.requests.RequestRepository) HttpClient(io.vertx.core.http.HttpClient) Clients(org.folio.circulation.support.Clients) WebContext(org.folio.circulation.support.http.server.WebContext) Request(org.folio.circulation.domain.Request) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) FailFastErrorHandler(org.folio.circulation.resources.handlers.error.FailFastErrorHandler) JsonHttpResponse(org.folio.circulation.support.http.server.JsonHttpResponse) UpdateUponRequest(org.folio.circulation.domain.UpdateUponRequest) ArrayList(java.util.ArrayList) TlrSettingsConfiguration(org.folio.circulation.domain.configuration.TlrSettingsConfiguration) ForwardOnFailure(org.folio.circulation.support.ForwardOnFailure) RequestAndRelatedRecords(org.folio.circulation.domain.RequestAndRelatedRecords) RequestQueue(org.folio.circulation.domain.RequestQueue) REQUESTER_ID(org.folio.circulation.domain.representations.RequestProperties.REQUESTER_ID) LinkedList(java.util.LinkedList) RequestType(org.folio.circulation.domain.RequestType) RequestFulfilmentPreference(org.folio.circulation.domain.RequestFulfilmentPreference) ItemByInstanceIdFinder(org.folio.circulation.storage.ItemByInstanceIdFinder) ValidationErrorFailure(org.folio.circulation.support.ValidationErrorFailure) ServerErrorFailure(org.folio.circulation.support.ServerErrorFailure) Result.ofAsync(org.folio.circulation.support.results.Result.ofAsync) ITEM_ID(org.folio.circulation.domain.representations.RequestProperties.ITEM_ID) ValidationErrorFailure.failedValidation(org.folio.circulation.support.ValidationErrorFailure.failedValidation) InstanceRequestItemsComparer.sortRequestQueues(org.folio.circulation.domain.InstanceRequestItemsComparer.sortRequestQueues) UpdateLoan(org.folio.circulation.domain.UpdateLoan) Collectors.toList(java.util.stream.Collectors.toList) RequestLevel(org.folio.circulation.domain.RequestLevel) ProxyRelationshipValidator(org.folio.circulation.domain.validation.ProxyRelationshipValidator) RequestByInstanceIdRequest(org.folio.circulation.domain.representations.RequestByInstanceIdRequest) LogManager(org.apache.logging.log4j.LogManager) WebContext(org.folio.circulation.support.http.server.WebContext) EventPublisher(org.folio.circulation.services.EventPublisher) RequestRepresentation(org.folio.circulation.domain.RequestRepresentation) ItemByInstanceIdFinder(org.folio.circulation.storage.ItemByInstanceIdFinder) Clients(org.folio.circulation.support.Clients) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) RequestQueueRepository(org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository)

Example 30 with Request

use of org.folio.circulation.domain.Request in project mod-circulation by folio-org.

the class RequestByInstanceIdResource method placeRequest.

private CompletableFuture<Result<RequestAndRelatedRecords>> placeRequest(List<JsonObject> itemRequests, int startIndex, CreateRequestService createRequestService, Clients clients, LoanRepository loanRepository, List<String> errors, ItemRepository itemRepository, UserRepository userRepository, RequestQueueRepository requestQueueRepository) {
    log.debug("RequestByInstanceIdResource.placeRequest, startIndex={}, itemRequestSize={}", startIndex, itemRequests.size());
    if (startIndex >= itemRequests.size()) {
        String aggregateFailures = String.format("%n%s", String.join("%n", errors));
        return CompletableFuture.completedFuture(failedDueToServerError("Failed to place a request for the instance. Reasons: " + aggregateFailures));
    }
    JsonObject currentItemRequest = itemRequests.get(startIndex);
    final RequestFromRepresentationService requestFromRepresentationService = new RequestFromRepresentationService(new InstanceRepository(clients), itemRepository, requestQueueRepository, userRepository, loanRepository, new ServicePointRepository(clients), new ConfigurationRepository(clients), createProxyRelationshipValidator(currentItemRequest, clients), new ServicePointPickupLocationValidator(), new FailFastErrorHandler(), new ItemByInstanceIdFinder(clients.holdingsStorage(), itemRepository));
    return requestFromRepresentationService.getRequestFrom(Request.Operation.CREATE, currentItemRequest).thenCompose(r -> r.after(createRequestService::createRequest)).thenCompose(r -> {
        if (r.succeeded()) {
            log.debug("RequestByInstanceIdResource.placeRequest: succeeded creating request for item {}", currentItemRequest.getString(ITEM_ID));
            return CompletableFuture.completedFuture(r);
        } else {
            String reason = getErrorMessage(r.cause());
            errors.add(reason);
            log.debug("Failed to create request for item {} with reason: {}", currentItemRequest.getString(ITEM_ID), reason);
            return placeRequest(itemRequests, startIndex + 1, createRequestService, clients, loanRepository, errors, itemRepository, userRepository, requestQueueRepository);
        }
    });
}
Also used : HOLD(org.folio.circulation.domain.RequestType.HOLD) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) UpdateRequestQueue(org.folio.circulation.domain.UpdateRequestQueue) CreateRequestService(org.folio.circulation.domain.CreateRequestService) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) InstanceRequestRelatedRecords(org.folio.circulation.domain.InstanceRequestRelatedRecords) ZonedDateTime(java.time.ZonedDateTime) RequestQueueRepository(org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository) LoanPolicyRepository(org.folio.circulation.infrastructure.storage.loans.LoanPolicyRepository) ServerErrorResponse(org.folio.circulation.support.http.server.ServerErrorResponse) Router(io.vertx.ext.web.Router) ValidationErrorFailure.singleValidationError(org.folio.circulation.support.ValidationErrorFailure.singleValidationError) UpdateItem(org.folio.circulation.domain.UpdateItem) RoutingContext(io.vertx.ext.web.RoutingContext) JsonPropertyWriter.write(org.folio.circulation.support.json.JsonPropertyWriter.write) Item(org.folio.circulation.domain.Item) REQUEST_LEVEL(org.folio.circulation.domain.representations.RequestProperties.REQUEST_LEVEL) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository) HttpFailure(org.folio.circulation.support.HttpFailure) Map(java.util.Map) CommonFailures.failedDueToServerError(org.folio.circulation.support.results.CommonFailures.failedDueToServerError) JsonObject(io.vertx.core.json.JsonObject) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) RequestRepresentation(org.folio.circulation.domain.RequestRepresentation) RequestBlockValidators.regularRequestBlockValidators(org.folio.circulation.resources.RequestBlockValidators.regularRequestBlockValidators) Result.of(org.folio.circulation.support.results.Result.of) Result.succeeded(org.folio.circulation.support.results.Result.succeeded) MethodHandles(java.lang.invoke.MethodHandles) Collection(java.util.Collection) Loan(org.folio.circulation.domain.Loan) RequestLoanValidator(org.folio.circulation.domain.validation.RequestLoanValidator) RequestPolicyRepository(org.folio.circulation.infrastructure.storage.requests.RequestPolicyRepository) UUID(java.util.UUID) ValidationError(org.folio.circulation.support.http.server.ValidationError) Result(org.folio.circulation.support.results.Result) Collectors(java.util.stream.Collectors) EventPublisher(org.folio.circulation.services.EventPublisher) Objects(java.util.Objects) PROXY_USER_ID(org.folio.circulation.domain.representations.RequestProperties.PROXY_USER_ID) ServicePointPickupLocationValidator(org.folio.circulation.domain.validation.ServicePointPickupLocationValidator) RouteRegistration(org.folio.circulation.support.RouteRegistration) List(java.util.List) PAGE(org.folio.circulation.domain.RequestType.PAGE) Logger(org.apache.logging.log4j.Logger) RECALL(org.folio.circulation.domain.RequestType.RECALL) HOLD_SHELF(org.folio.circulation.domain.RequestFulfilmentPreference.HOLD_SHELF) InstanceRepository(org.folio.circulation.infrastructure.storage.inventory.InstanceRepository) REQUEST_TYPE(org.folio.circulation.domain.representations.RequestProperties.REQUEST_TYPE) Optional(java.util.Optional) BadRequestFailure(org.folio.circulation.support.BadRequestFailure) FULFILMENT_PREFERENCE(org.folio.circulation.domain.representations.RequestProperties.FULFILMENT_PREFERENCE) CreateRequestRepositories(org.folio.circulation.domain.CreateRequestRepositories) RequestRepository(org.folio.circulation.infrastructure.storage.requests.RequestRepository) HttpClient(io.vertx.core.http.HttpClient) Clients(org.folio.circulation.support.Clients) WebContext(org.folio.circulation.support.http.server.WebContext) Request(org.folio.circulation.domain.Request) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) FailFastErrorHandler(org.folio.circulation.resources.handlers.error.FailFastErrorHandler) JsonHttpResponse(org.folio.circulation.support.http.server.JsonHttpResponse) UpdateUponRequest(org.folio.circulation.domain.UpdateUponRequest) ArrayList(java.util.ArrayList) TlrSettingsConfiguration(org.folio.circulation.domain.configuration.TlrSettingsConfiguration) ForwardOnFailure(org.folio.circulation.support.ForwardOnFailure) RequestAndRelatedRecords(org.folio.circulation.domain.RequestAndRelatedRecords) RequestQueue(org.folio.circulation.domain.RequestQueue) REQUESTER_ID(org.folio.circulation.domain.representations.RequestProperties.REQUESTER_ID) LinkedList(java.util.LinkedList) RequestType(org.folio.circulation.domain.RequestType) RequestFulfilmentPreference(org.folio.circulation.domain.RequestFulfilmentPreference) ItemByInstanceIdFinder(org.folio.circulation.storage.ItemByInstanceIdFinder) ValidationErrorFailure(org.folio.circulation.support.ValidationErrorFailure) ServerErrorFailure(org.folio.circulation.support.ServerErrorFailure) Result.ofAsync(org.folio.circulation.support.results.Result.ofAsync) ITEM_ID(org.folio.circulation.domain.representations.RequestProperties.ITEM_ID) ValidationErrorFailure.failedValidation(org.folio.circulation.support.ValidationErrorFailure.failedValidation) InstanceRequestItemsComparer.sortRequestQueues(org.folio.circulation.domain.InstanceRequestItemsComparer.sortRequestQueues) UpdateLoan(org.folio.circulation.domain.UpdateLoan) Collectors.toList(java.util.stream.Collectors.toList) RequestLevel(org.folio.circulation.domain.RequestLevel) ProxyRelationshipValidator(org.folio.circulation.domain.validation.ProxyRelationshipValidator) RequestByInstanceIdRequest(org.folio.circulation.domain.representations.RequestByInstanceIdRequest) LogManager(org.apache.logging.log4j.LogManager) FailFastErrorHandler(org.folio.circulation.resources.handlers.error.FailFastErrorHandler) JsonObject(io.vertx.core.json.JsonObject) InstanceRepository(org.folio.circulation.infrastructure.storage.inventory.InstanceRepository) ServicePointPickupLocationValidator(org.folio.circulation.domain.validation.ServicePointPickupLocationValidator) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) ItemByInstanceIdFinder(org.folio.circulation.storage.ItemByInstanceIdFinder) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository)

Aggregations

Request (org.folio.circulation.domain.Request)35 JsonObject (io.vertx.core.json.JsonObject)17 Loan (org.folio.circulation.domain.Loan)12 Result (org.folio.circulation.support.results.Result)11 Item (org.folio.circulation.domain.Item)10 ZonedDateTime (java.time.ZonedDateTime)9 List (java.util.List)9 Map (java.util.Map)9 ValidationError (org.folio.circulation.support.http.server.ValidationError)9 Result.succeeded (org.folio.circulation.support.results.Result.succeeded)9 HashMap (java.util.HashMap)8 UUID (java.util.UUID)8 CompletableFuture (java.util.concurrent.CompletableFuture)8 RequestAndRelatedRecords (org.folio.circulation.domain.RequestAndRelatedRecords)8 LoanRepository (org.folio.circulation.infrastructure.storage.loans.LoanRepository)8 Clients (org.folio.circulation.support.Clients)8 Collection (java.util.Collection)7 Collectors (java.util.stream.Collectors)7 ItemRepository (org.folio.circulation.infrastructure.storage.inventory.ItemRepository)7 UserRepository (org.folio.circulation.infrastructure.storage.users.UserRepository)7