Search in sources :

Example 1 with RequestRepository

use of org.folio.circulation.infrastructure.storage.requests.RequestRepository in project mod-circulation by folio-org.

the class RequestCollectionResource method replace.

@Override
void replace(RoutingContext routingContext) {
    final var context = new WebContext(routingContext);
    final var clients = Clients.create(context, client);
    final var representation = routingContext.getBodyAsJson();
    write(representation, "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 updateRequestQueue = UpdateRequestQueue.using(clients, requestRepository, requestQueueRepository);
    final var loanPolicyRepository = new LoanPolicyRepository(clients);
    final var eventPublisher = new EventPublisher(routingContext);
    final var requestNoticeSender = createRequestNoticeSender(clients, representation);
    final var configurationRepository = new ConfigurationRepository(clients);
    final var updateItem = new UpdateItem(itemRepository);
    final var updateUponRequest = new UpdateUponRequest(updateItem, new UpdateLoan(clients, loanRepository, loanPolicyRepository), updateRequestQueue);
    final var errorHandler = new FailFastErrorHandler();
    final var createRequestService = new CreateRequestService(new CreateRequestRepositories(requestRepository, new RequestPolicyRepository(clients), configurationRepository), updateUponRequest, new RequestLoanValidator(new ItemByInstanceIdFinder(clients.holdingsStorage(), itemRepository), loanRepository), requestNoticeSender, regularRequestBlockValidators(clients), eventPublisher, errorHandler);
    final var updateRequestService = new UpdateRequestService(requestRepository, updateRequestQueue, new ClosedRequestValidator(requestRepository), requestNoticeSender, updateItem, eventPublisher);
    final var requestFromRepresentationService = new RequestFromRepresentationService(new InstanceRepository(clients), itemRepository, new RequestQueueRepository(requestRepository), userRepository, loanRepository, new ServicePointRepository(clients), configurationRepository, createProxyRelationshipValidator(representation, clients), new ServicePointPickupLocationValidator(), errorHandler, new ItemByInstanceIdFinder(clients.holdingsStorage(), itemRepository));
    final var requestScheduledNoticeService = RequestScheduledNoticeService.using(clients);
    fromFutureResult(requestFromRepresentationService.getRequestFrom(Request.Operation.REPLACE, representation)).flatMapFuture(when(requestRepository::exists, updateRequestService::replaceRequest, createRequestService::createRequest)).flatMapFuture(records -> eventPublisher.publishDueDateChangedEvent(records, loanRepository)).map(requestScheduledNoticeService::rescheduleRequestNotices).map(toFixedValue(NoContentResponse::noContent)).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) FailFastErrorHandler(org.folio.circulation.resources.handlers.error.FailFastErrorHandler) CreateRequestRepositories(org.folio.circulation.domain.CreateRequestRepositories) ItemByInstanceIdFinder(org.folio.circulation.storage.ItemByInstanceIdFinder) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) UpdateLoan(org.folio.circulation.domain.UpdateLoan) CreateRequestService(org.folio.circulation.domain.CreateRequestService) LoanPolicyRepository(org.folio.circulation.infrastructure.storage.loans.LoanPolicyRepository) ServicePointPickupLocationValidator(org.folio.circulation.domain.validation.ServicePointPickupLocationValidator) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) UpdateRequestService(org.folio.circulation.domain.UpdateRequestService) EventPublisher(org.folio.circulation.services.EventPublisher) 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) ClosedRequestValidator(org.folio.circulation.domain.validation.ClosedRequestValidator) UpdateItem(org.folio.circulation.domain.UpdateItem) InstanceRepository(org.folio.circulation.infrastructure.storage.inventory.InstanceRepository) NoContentResponse(org.folio.circulation.support.http.server.NoContentResponse) RequestQueueRepository(org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository) UpdateUponRequest(org.folio.circulation.domain.UpdateUponRequest)

Example 2 with RequestRepository

use of org.folio.circulation.infrastructure.storage.requests.RequestRepository 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 3 with RequestRepository

use of org.folio.circulation.infrastructure.storage.requests.RequestRepository in project mod-circulation by folio-org.

the class RequestQueueResource method reorderQueue.

private void reorderQueue(RoutingContext routingContext, RequestQueueType requestQueueType) {
    String idParamValue = getIdParameterValueByQueueType(routingContext, requestQueueType);
    ReorderRequestContext reorderContext = new ReorderRequestContext(requestQueueType, idParamValue, routingContext.getBodyAsJson().mapTo(ReorderQueueRequest.class));
    final EventPublisher eventPublisher = new EventPublisher(routingContext);
    final var context = new WebContext(routingContext);
    final var 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 configurationRepository = new ConfigurationRepository(clients);
    final var requestQueueRepository = new RequestQueueRepository(requestRepository);
    final UpdateRequestQueue updateRequestQueue = new UpdateRequestQueue(requestQueueRepository, requestRepository, new ServicePointRepository(clients), configurationRepository);
    getRequestQueueByType(routingContext, requestQueueType, requestQueueRepository);
    validateTlrFeatureStatus(configurationRepository, requestQueueType, idParamValue).thenCompose(r -> r.after(tlrSettings -> getRequestQueueByType(routingContext, requestQueueType, requestQueueRepository))).thenApply(r -> r.map(reorderContext::withRequestQueue)).thenApply(RequestQueueValidation::queueIsFound).thenApply(RequestQueueValidation::positionsAreSequential).thenApply(RequestQueueValidation::queueIsConsistent).thenApply(RequestQueueValidation::pageRequestsPositioning).thenApply(RequestQueueValidation::fulfillingRequestsPositioning).thenCompose(updateRequestQueue::onReorder).thenApply(q -> publishReorderedQueue(eventPublisher, q)).thenCompose(r -> r.after(this::toRepresentation)).thenApply(r -> r.map(JsonHttpResponse::ok)).thenAccept(context::writeResultToHttpResponse);
}
Also used : FOR_INSTANCE(org.folio.circulation.resources.context.RequestQueueType.FOR_INSTANCE) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) Clients(org.folio.circulation.support.Clients) UpdateRequestQueue(org.folio.circulation.domain.UpdateRequestQueue) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) WebContext(org.folio.circulation.support.http.server.WebContext) Request(org.folio.circulation.domain.Request) RequestQueueRepository(org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository) Router(io.vertx.ext.web.Router) CompletableFuture(java.util.concurrent.CompletableFuture) ValidationErrorFailure.singleValidationError(org.folio.circulation.support.ValidationErrorFailure.singleValidationError) RoutingContext(io.vertx.ext.web.RoutingContext) ReorderRequestContext(org.folio.circulation.resources.context.ReorderRequestContext) JsonHttpResponse(org.folio.circulation.support.http.server.JsonHttpResponse) TlrSettingsConfiguration(org.folio.circulation.domain.configuration.TlrSettingsConfiguration) RequestUpdateLogEventMapper.mapToRequestLogEventJson(org.folio.circulation.domain.representations.logs.RequestUpdateLogEventMapper.mapToRequestLogEventJson) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository) RequestQueueType(org.folio.circulation.resources.context.RequestQueueType) RequestQueueValidation(org.folio.circulation.domain.validation.RequestQueueValidation) JsonObject(io.vertx.core.json.JsonObject) RequestQueue(org.folio.circulation.domain.RequestQueue) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) RequestRepresentation(org.folio.circulation.domain.RequestRepresentation) LogEventType(org.folio.circulation.domain.representations.logs.LogEventType) MultipleRecords(org.folio.circulation.domain.MultipleRecords) Result.succeeded(org.folio.circulation.support.results.Result.succeeded) Result(org.folio.circulation.support.results.Result) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) EventPublisher(org.folio.circulation.services.EventPublisher) FOR_ITEM(org.folio.circulation.resources.context.RequestQueueType.FOR_ITEM) RouteRegistration(org.folio.circulation.support.RouteRegistration) List(java.util.List) ReorderQueueRequest(org.folio.circulation.domain.reorder.ReorderQueueRequest) RequestRepository(org.folio.circulation.infrastructure.storage.requests.RequestRepository) HttpClient(io.vertx.core.http.HttpClient) WebContext(org.folio.circulation.support.http.server.WebContext) JsonHttpResponse(org.folio.circulation.support.http.server.JsonHttpResponse) EventPublisher(org.folio.circulation.services.EventPublisher) RequestQueueValidation(org.folio.circulation.domain.validation.RequestQueueValidation) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) UpdateRequestQueue(org.folio.circulation.domain.UpdateRequestQueue) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) ReorderRequestContext(org.folio.circulation.resources.context.ReorderRequestContext) RequestQueueRepository(org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository) ReorderQueueRequest(org.folio.circulation.domain.reorder.ReorderQueueRequest)

Example 4 with RequestRepository

use of org.folio.circulation.infrastructure.storage.requests.RequestRepository in project mod-circulation by folio-org.

the class ScheduledNoticeProcessingResource method process.

private void process(RoutingContext routingContext) {
    final WebContext context = new WebContext(routingContext);
    final Clients clients = Clients.create(context, client);
    final ScheduledNoticesRepository scheduledNoticesRepository = ScheduledNoticesRepository.using(clients);
    final ConfigurationRepository configurationRepository = new ConfigurationRepository(clients);
    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);
    safelyInitialise(configurationRepository::lookupSchedulerNoticesProcessingLimit).thenCompose(r -> r.after(limit -> findNoticesToSend(configurationRepository, scheduledNoticesRepository, limit))).thenCompose(r -> r.after(notices -> handleNotices(clients, requestRepository, loanRepository, notices))).thenApply(r -> r.map(toFixedValue(NoContentResponse::noContent))).exceptionally(CommonFailures::failedDueToServerError).thenAccept(context::writeResultToHttpResponse);
}
Also used : ScheduledNoticesRepository(org.folio.circulation.infrastructure.storage.notices.ScheduledNoticesRepository) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) Clients(org.folio.circulation.support.Clients) CommonFailures(org.folio.circulation.support.results.CommonFailures) MultipleRecords(org.folio.circulation.domain.MultipleRecords) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) WebContext(org.folio.circulation.support.http.server.WebContext) Router(io.vertx.ext.web.Router) MappingFunctions.toFixedValue(org.folio.circulation.support.results.MappingFunctions.toFixedValue) CompletableFuture(java.util.concurrent.CompletableFuture) RoutingContext(io.vertx.ext.web.RoutingContext) Result(org.folio.circulation.support.results.Result) RouteRegistration(org.folio.circulation.support.RouteRegistration) PageLimit(org.folio.circulation.support.http.client.PageLimit) AsynchronousResultBindings.safelyInitialise(org.folio.circulation.support.results.AsynchronousResultBindings.safelyInitialise) ScheduledNotice(org.folio.circulation.domain.notice.schedule.ScheduledNotice) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) RequestRepository(org.folio.circulation.infrastructure.storage.requests.RequestRepository) NoContentResponse(org.folio.circulation.support.http.server.NoContentResponse) HttpClient(io.vertx.core.http.HttpClient) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) WebContext(org.folio.circulation.support.http.server.WebContext) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) NoContentResponse(org.folio.circulation.support.http.server.NoContentResponse) ScheduledNoticesRepository(org.folio.circulation.infrastructure.storage.notices.ScheduledNoticesRepository) ConfigurationRepository(org.folio.circulation.infrastructure.storage.ConfigurationRepository) Clients(org.folio.circulation.support.Clients) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository)

Example 5 with RequestRepository

use of org.folio.circulation.infrastructure.storage.requests.RequestRepository in project mod-circulation by folio-org.

the class UpdateRequestQueueTest method setUp.

@BeforeEach
public void setUp() {
    Clients clients = createServerErrorMockBatchRequestClient();
    final ItemRepository itemRepository = new ItemRepository(clients);
    final UserRepository userRepository = new UserRepository(clients);
    final var loanRepository = new LoanRepository(clients, itemRepository, userRepository);
    requestRepository = mock(RequestRepository.class);
    requestQueueRepository = spy(new RequestQueueRepository(RequestRepository.using(clients, itemRepository, userRepository, loanRepository)));
    updateRequestQueue = new UpdateRequestQueue(requestQueueRepository, requestRepository, null, null);
}
Also used : ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) Clients(org.folio.circulation.support.Clients) RequestRepository(org.folio.circulation.infrastructure.storage.requests.RequestRepository) RequestQueueRepository(org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository) LoanRepository(org.folio.circulation.infrastructure.storage.loans.LoanRepository) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ItemRepository (org.folio.circulation.infrastructure.storage.inventory.ItemRepository)12 LoanRepository (org.folio.circulation.infrastructure.storage.loans.LoanRepository)12 RequestRepository (org.folio.circulation.infrastructure.storage.requests.RequestRepository)12 UserRepository (org.folio.circulation.infrastructure.storage.users.UserRepository)12 Clients (org.folio.circulation.support.Clients)12 HttpClient (io.vertx.core.http.HttpClient)11 RoutingContext (io.vertx.ext.web.RoutingContext)11 RequestQueueRepository (org.folio.circulation.infrastructure.storage.requests.RequestQueueRepository)11 WebContext (org.folio.circulation.support.http.server.WebContext)11 EventPublisher (org.folio.circulation.services.EventPublisher)10 JsonObject (io.vertx.core.json.JsonObject)9 Router (io.vertx.ext.web.Router)9 ConfigurationRepository (org.folio.circulation.infrastructure.storage.ConfigurationRepository)9 Result (org.folio.circulation.support.results.Result)9 CompletableFuture (java.util.concurrent.CompletableFuture)8 ValidationErrorFailure.singleValidationError (org.folio.circulation.support.ValidationErrorFailure.singleValidationError)8 RequestQueue (org.folio.circulation.domain.RequestQueue)7 UpdateRequestQueue (org.folio.circulation.domain.UpdateRequestQueue)7 LoanPolicyRepository (org.folio.circulation.infrastructure.storage.loans.LoanPolicyRepository)7 RouteRegistration (org.folio.circulation.support.RouteRegistration)7