Search in sources :

Example 1 with RequestAndRelatedRecords

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

the class RequestCollectionResource method move.

void move(RoutingContext routingContext) {
    final var context = new WebContext(routingContext);
    final var clients = Clients.create(context, client);
    final var representation = routingContext.getBodyAsJson();
    final var id = getRequestId(routingContext);
    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 loanPolicyRepository = new LoanPolicyRepository(clients);
    final var configurationRepository = new ConfigurationRepository(clients);
    final var updateUponRequest = new UpdateUponRequest(new UpdateItem(itemRepository), new UpdateLoan(clients, loanRepository, loanPolicyRepository), UpdateRequestQueue.using(clients, requestRepository, requestQueueRepository));
    final var moveRequestProcessAdapter = new MoveRequestProcessAdapter(itemRepository, loanRepository, requestRepository);
    final var eventPublisher = new EventPublisher(routingContext);
    final var moveRequestService = new MoveRequestService(requestRepository, new RequestPolicyRepository(clients), updateUponRequest, moveRequestProcessAdapter, new RequestLoanValidator(new ItemByInstanceIdFinder(clients.holdingsStorage(), itemRepository), loanRepository), RequestNoticeSender.using(clients), configurationRepository, eventPublisher, requestQueueRepository);
    fromFutureResult(requestRepository.getById(id)).map(RequestAndRelatedRecords::new).map(request -> asMove(request, representation)).flatMapFuture(move -> moveRequestService.moveRequest(move, move.getOriginalRequest())).onSuccess(records -> eventPublisher.publishDueDateChangedEvent(records, loanRepository)).map(RequestAndRelatedRecords::getRequest).map(new RequestRepresentation()::extendedRepresentation).map(JsonHttpResponse::ok).onComplete(context::write, context::write);
}
Also used : UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) UpdateRequestQueue(org.folio.circulation.domain.UpdateRequestQueue) RequestScheduledNoticeService(org.folio.circulation.domain.notice.schedule.RequestScheduledNoticeService) CreateRequestService(org.folio.circulation.domain.CreateRequestService) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) MappingFunctions.when(org.folio.circulation.support.results.MappingFunctions.when) RequestQueueRepository(org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository) LoanPolicyRepository(org.folio.circulation.infrastructure.storage.loans.LoanPolicyRepository) 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) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository) 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) AsynchronousResult.fromFutureResult(org.folio.circulation.support.results.AsynchronousResult.fromFutureResult) RequestLoanValidator(org.folio.circulation.domain.validation.RequestLoanValidator) RequestPolicyRepository(org.folio.circulation.infrastructure.storage.requests.RequestPolicyRepository) UpdateRequestService(org.folio.circulation.domain.UpdateRequestService) BlockOverrides(org.folio.circulation.domain.override.BlockOverrides) EventPublisher(org.folio.circulation.services.EventPublisher) PROXY_USER_ID(org.folio.circulation.domain.representations.RequestProperties.PROXY_USER_ID) ServicePointPickupLocationValidator(org.folio.circulation.domain.validation.ServicePointPickupLocationValidator) TITLE(org.folio.circulation.domain.RequestLevel.TITLE) InstanceRepository(org.folio.circulation.infrastructure.storage.inventory.InstanceRepository) CreateRequestRepositories(org.folio.circulation.domain.CreateRequestRepositories) RequestRepository(org.folio.circulation.infrastructure.storage.requests.RequestRepository) NoContentResponse(org.folio.circulation.support.http.server.NoContentResponse) HttpClient(io.vertx.core.http.HttpClient) Clients(org.folio.circulation.support.Clients) ClosedRequestValidator(org.folio.circulation.domain.validation.ClosedRequestValidator) WebContext(org.folio.circulation.support.http.server.WebContext) Request(org.folio.circulation.domain.Request) FailFastErrorHandler(org.folio.circulation.resources.handlers.error.FailFastErrorHandler) MoveRequestProcessAdapter(org.folio.circulation.domain.MoveRequestProcessAdapter) JsonHttpResponse(org.folio.circulation.support.http.server.JsonHttpResponse) UpdateUponRequest(org.folio.circulation.domain.UpdateUponRequest) RequestAndRelatedRecords(org.folio.circulation.domain.RequestAndRelatedRecords) OkapiPermissions(org.folio.circulation.support.http.OkapiPermissions) MoveRequestService(org.folio.circulation.domain.MoveRequestService) OverridingErrorHandler(org.folio.circulation.resources.handlers.error.OverridingErrorHandler) RequestType(org.folio.circulation.domain.RequestType) MultipleRecords(org.folio.circulation.domain.MultipleRecords) ItemByInstanceIdFinder(org.folio.circulation.storage.ItemByInstanceIdFinder) MappingFunctions.toFixedValue(org.folio.circulation.support.results.MappingFunctions.toFixedValue) UpdateLoan(org.folio.circulation.domain.UpdateLoan) ProxyRelationshipValidator(org.folio.circulation.domain.validation.ProxyRelationshipValidator) WebContext(org.folio.circulation.support.http.server.WebContext) EventPublisher(org.folio.circulation.services.EventPublisher) RequestRepresentation(org.folio.circulation.domain.RequestRepresentation) MoveRequestService(org.folio.circulation.domain.MoveRequestService) ItemByInstanceIdFinder(org.folio.circulation.storage.ItemByInstanceIdFinder) RequestPolicyRepository(org.folio.circulation.infrastructure.storage.requests.RequestPolicyRepository) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) RequestLoanValidator(org.folio.circulation.domain.validation.RequestLoanValidator) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) UpdateLoan(org.folio.circulation.domain.UpdateLoan) UpdateItem(org.folio.circulation.domain.UpdateItem) MoveRequestProcessAdapter(org.folio.circulation.domain.MoveRequestProcessAdapter) LoanPolicyRepository(org.folio.circulation.infrastructure.storage.loans.LoanPolicyRepository) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) RequestQueueRepository(org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository) UpdateUponRequest(org.folio.circulation.domain.UpdateUponRequest)

Example 2 with RequestAndRelatedRecords

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

the class RequestScheduledNoticeService method rescheduleRequestNotices.

public Result<RequestAndRelatedRecords> rescheduleRequestNotices(RequestAndRelatedRecords relatedRecords) {
    Request request = relatedRecords.getRequest();
    scheduledNoticesRepository.deleteByRequestId(request.getId()).thenAccept(r -> r.next(resp -> scheduleRequestNotices(request)));
    return succeeded(relatedRecords);
}
Also used : Clients(org.folio.circulation.support.Clients) ZonedDateTime(java.time.ZonedDateTime) Request(org.folio.circulation.domain.Request) ITEM(org.folio.circulation.domain.RequestLevel.ITEM) CheckInContext(org.folio.circulation.domain.CheckInContext) TlrSettingsConfiguration(org.folio.circulation.domain.configuration.TlrSettingsConfiguration) NoticeEventType(org.folio.circulation.domain.notice.NoticeEventType) TITLE_LEVEL_REQUEST_EXPIRATION(org.folio.circulation.domain.notice.schedule.TriggeringEvent.TITLE_LEVEL_REQUEST_EXPIRATION) RequestAndRelatedRecords(org.folio.circulation.domain.RequestAndRelatedRecords) NoticeConfigurationBuilder(org.folio.circulation.domain.notice.NoticeConfigurationBuilder) PatronNoticePolicyRepository(org.folio.circulation.infrastructure.storage.notices.PatronNoticePolicyRepository) NoticeFormat(org.folio.circulation.domain.notice.NoticeFormat) ScheduledNoticesRepository(org.folio.circulation.infrastructure.storage.notices.ScheduledNoticesRepository) NoticeConfiguration(org.folio.circulation.domain.notice.NoticeConfiguration) REQUEST_EXPIRATION(org.folio.circulation.domain.notice.schedule.TriggeringEvent.REQUEST_EXPIRATION) Result.succeeded(org.folio.circulation.support.results.Result.succeeded) MethodHandles(java.lang.invoke.MethodHandles) UUID(java.util.UUID) PatronNoticePolicy(org.folio.circulation.domain.notice.PatronNoticePolicy) Result(org.folio.circulation.support.results.Result) TITLE(org.folio.circulation.domain.RequestLevel.TITLE) Logger(org.apache.logging.log4j.Logger) RequestLevel(org.folio.circulation.domain.RequestLevel) UPON_AT(org.folio.circulation.domain.notice.NoticeTiming.UPON_AT) Optional(java.util.Optional) LogManager(org.apache.logging.log4j.LogManager) Request(org.folio.circulation.domain.Request)

Example 3 with RequestAndRelatedRecords

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

the class RequestLoanValidator method refuseWhenUserHasAlreadyBeenLoanedItem.

public CompletableFuture<Result<RequestAndRelatedRecords>> refuseWhenUserHasAlreadyBeenLoanedItem(RequestAndRelatedRecords requestAndRelatedRecords) {
    final Request request = requestAndRelatedRecords.getRequest();
    return loanRepository.findOpenLoanForRequest(request).thenApply(loanResult -> loanResult.failWhen(loan -> of(() -> loan != null && loan.getUserId().equals(request.getUserId())), loan -> {
        Map<String, String> parameters = new HashMap<>();
        parameters.put("itemId", request.getItemId());
        parameters.put("userId", request.getUserId());
        parameters.put("loanId", loan.getId());
        String message = "This requester currently has this item on loan.";
        return singleValidationError(new ValidationError(message, parameters));
    }).map(loan -> requestAndRelatedRecords));
}
Also used : MultipleRecords(org.folio.circulation.domain.MultipleRecords) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) Result.of(org.folio.circulation.support.results.Result.of) ItemByInstanceIdFinder(org.folio.circulation.storage.ItemByInstanceIdFinder) Result.succeeded(org.folio.circulation.support.results.Result.succeeded) Collection(java.util.Collection) Loan(org.folio.circulation.domain.Loan) Request(org.folio.circulation.domain.Request) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) PageLimit.limit(org.folio.circulation.support.http.client.PageLimit.limit) ValidationErrorFailure.singleValidationError(org.folio.circulation.support.ValidationErrorFailure.singleValidationError) UUID(java.util.UUID) Result(org.folio.circulation.support.results.Result) ValidationError(org.folio.circulation.support.http.server.ValidationError) Collectors(java.util.stream.Collectors) Item(org.folio.circulation.domain.Item) ValidationErrorFailure.failedValidation(org.folio.circulation.support.ValidationErrorFailure.failedValidation) List(java.util.List) RequestAndRelatedRecords(org.folio.circulation.domain.RequestAndRelatedRecords) Map(java.util.Map) PageLimit(org.folio.circulation.support.http.client.PageLimit) HashMap(java.util.HashMap) Request(org.folio.circulation.domain.Request) ValidationErrorFailure.singleValidationError(org.folio.circulation.support.ValidationErrorFailure.singleValidationError) ValidationError(org.folio.circulation.support.http.server.ValidationError)

Example 4 with RequestAndRelatedRecords

use of org.folio.circulation.domain.RequestAndRelatedRecords 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 5 with RequestAndRelatedRecords

use of org.folio.circulation.domain.RequestAndRelatedRecords 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)5 RequestAndRelatedRecords (org.folio.circulation.domain.RequestAndRelatedRecords)5 UUID (java.util.UUID)4 HttpClient (io.vertx.core.http.HttpClient)3 JsonObject (io.vertx.core.json.JsonObject)3 Router (io.vertx.ext.web.Router)3 RoutingContext (io.vertx.ext.web.RoutingContext)3 MethodHandles (java.lang.invoke.MethodHandles)3 ZonedDateTime (java.time.ZonedDateTime)3 Collection (java.util.Collection)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 Optional (java.util.Optional)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 Collectors (java.util.stream.Collectors)3 LogManager (org.apache.logging.log4j.LogManager)3 Logger (org.apache.logging.log4j.Logger)3 CreateRequestRepositories (org.folio.circulation.domain.CreateRequestRepositories)3 CreateRequestService (org.folio.circulation.domain.CreateRequestService)3