Search in sources :

Example 1 with AddressTypeRepository

use of org.folio.circulation.infrastructure.storage.users.AddressTypeRepository in project mod-circulation by folio-org.

the class PickSlipsResource method getMany.

private void getMany(RoutingContext routingContext) {
    final WebContext context = new WebContext(routingContext);
    final Clients clients = Clients.create(context, client);
    final var userRepository = new UserRepository(clients);
    final var itemRepository = new ItemRepository(clients);
    final AddressTypeRepository addressTypeRepository = new AddressTypeRepository(clients);
    final ServicePointRepository servicePointRepository = new ServicePointRepository(clients);
    final UUID servicePointId = UUID.fromString(routingContext.request().getParam(SERVICE_POINT_ID_PARAM));
    fetchLocationsForServicePoint(servicePointId, clients).thenComposeAsync(r -> r.after(locations -> fetchPagedItemsForLocations(locations, itemRepository, LocationRepository.using(clients, servicePointRepository)))).thenComposeAsync(r -> r.after(items -> fetchOpenPageRequestsForItems(items, clients))).thenComposeAsync(r -> r.after(userRepository::findUsersForRequests)).thenComposeAsync(r -> r.after(addressTypeRepository::findAddressTypesForRequests)).thenComposeAsync(r -> r.after(servicePointRepository::findServicePointsForRequests)).thenApply(flatMapResult(this::mapResultToJson)).thenApply(r -> r.map(JsonHttpResponse::ok)).thenAccept(context::writeResultToHttpResponse);
}
Also used : UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) Clients(org.folio.circulation.support.Clients) RecordFetching.findWithMultipleCqlIndexValues(org.folio.circulation.support.fetching.RecordFetching.findWithMultipleCqlIndexValues) Location(org.folio.circulation.domain.Location) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) WebContext(org.folio.circulation.support.http.server.WebContext) Request(org.folio.circulation.domain.Request) Router(io.vertx.ext.web.Router) CompletableFuture(java.util.concurrent.CompletableFuture) RoutingContext(io.vertx.ext.web.RoutingContext) ItemStatus(org.folio.circulation.domain.ItemStatus) StringUtils(org.apache.commons.lang3.StringUtils) Item(org.folio.circulation.domain.Item) JsonHttpResponse(org.folio.circulation.support.http.server.JsonHttpResponse) LocationRepository(org.folio.circulation.infrastructure.storage.inventory.LocationRepository) CqlQuery.exactMatch(org.folio.circulation.support.http.client.CqlQuery.exactMatch) Collectors.toMap(java.util.stream.Collectors.toMap) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository) MultipleCqlIndexValuesCriteria.byIndex(org.folio.circulation.support.fetching.MultipleCqlIndexValuesCriteria.byIndex) Map(java.util.Map) PageLimit(org.folio.circulation.support.http.client.PageLimit) TemplateContextUtil(org.folio.circulation.domain.notice.TemplateContextUtil) JsonObject(io.vertx.core.json.JsonObject) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) Collectors.toSet(java.util.stream.Collectors.toSet) RecordFetching.findWithCqlQuery(org.folio.circulation.support.fetching.RecordFetching.findWithCqlQuery) RequestType(org.folio.circulation.domain.RequestType) MultipleRecords(org.folio.circulation.domain.MultipleRecords) Collections.emptyList(java.util.Collections.emptyList) Result.succeeded(org.folio.circulation.support.results.Result.succeeded) Collection(java.util.Collection) Set(java.util.Set) UUID(java.util.UUID) Result(org.folio.circulation.support.results.Result) Collectors(java.util.stream.Collectors) ResultBinding.flatMapResult(org.folio.circulation.support.results.ResultBinding.flatMapResult) RouteRegistration(org.folio.circulation.support.RouteRegistration) List(java.util.List) AddressTypeRepository(org.folio.circulation.infrastructure.storage.users.AddressTypeRepository) RequestStatus(org.folio.circulation.domain.RequestStatus) Function.identity(java.util.function.Function.identity) CqlQuery(org.folio.circulation.support.http.client.CqlQuery) HttpClient(io.vertx.core.http.HttpClient) WebContext(org.folio.circulation.support.http.server.WebContext) JsonHttpResponse(org.folio.circulation.support.http.server.JsonHttpResponse) Clients(org.folio.circulation.support.Clients) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository) ItemRepository(org.folio.circulation.infrastructure.storage.inventory.ItemRepository) UserRepository(org.folio.circulation.infrastructure.storage.users.UserRepository) AddressTypeRepository(org.folio.circulation.infrastructure.storage.users.AddressTypeRepository) UUID(java.util.UUID)

Example 2 with AddressTypeRepository

use of org.folio.circulation.infrastructure.storage.users.AddressTypeRepository in project mod-circulation by folio-org.

the class CheckInProcessAdapter method newInstance.

public static CheckInProcessAdapter newInstance(Clients clients, ItemRepository itemRepository, UserRepository userRepository, LoanRepository loanRepository, RequestRepository requestRepository, RequestQueueRepository requestQueueRepository) {
    final var itemFinder = new ItemByBarcodeInStorageFinder(itemRepository);
    final SingleOpenLoanForItemInStorageFinder singleOpenLoanFinder = new SingleOpenLoanForItemInStorageFinder(loanRepository, userRepository, true);
    final var overdueFineService = new OverdueFineService(new OverdueFinePolicyRepository(clients), itemRepository, new FeeFineOwnerRepository(clients), new FeeFineRepository(clients), ScheduledNoticesRepository.using(clients), new OverduePeriodCalculatorService(new CalendarRepository(clients), new LoanPolicyRepository(clients)), new FeeFineFacade(clients));
    return new CheckInProcessAdapter(itemFinder, singleOpenLoanFinder, new LoanCheckInService(), requestQueueRepository, new UpdateItem(itemRepository), UpdateRequestQueue.using(clients, requestRepository, requestQueueRepository), loanRepository, new ServicePointRepository(clients), userRepository, new AddressTypeRepository(clients), new LogCheckInService(clients), overdueFineService, FeeFineScheduledNoticeService.using(clients), new LostItemFeeRefundService(clients, itemRepository, userRepository, loanRepository), new EventPublisher(clients.pubSubPublishingService()));
}
Also used : FeeFineFacade(org.folio.circulation.services.FeeFineFacade) EventPublisher(org.folio.circulation.services.EventPublisher) FeeFineOwnerRepository(org.folio.circulation.infrastructure.storage.feesandfines.FeeFineOwnerRepository) CalendarRepository(org.folio.circulation.infrastructure.storage.CalendarRepository) OverdueFineService(org.folio.circulation.domain.OverdueFineService) ItemByBarcodeInStorageFinder(org.folio.circulation.storage.ItemByBarcodeInStorageFinder) LostItemFeeRefundService(org.folio.circulation.services.LostItemFeeRefundService) ServicePointRepository(org.folio.circulation.infrastructure.storage.ServicePointRepository) FeeFineRepository(org.folio.circulation.infrastructure.storage.feesandfines.FeeFineRepository) OverduePeriodCalculatorService(org.folio.circulation.domain.OverduePeriodCalculatorService) SingleOpenLoanForItemInStorageFinder(org.folio.circulation.storage.SingleOpenLoanForItemInStorageFinder) UpdateItem(org.folio.circulation.domain.UpdateItem) AddressTypeRepository(org.folio.circulation.infrastructure.storage.users.AddressTypeRepository) LoanPolicyRepository(org.folio.circulation.infrastructure.storage.loans.LoanPolicyRepository) LogCheckInService(org.folio.circulation.services.LogCheckInService) LoanCheckInService(org.folio.circulation.domain.LoanCheckInService) OverdueFinePolicyRepository(org.folio.circulation.infrastructure.storage.loans.OverdueFinePolicyRepository)

Aggregations

ServicePointRepository (org.folio.circulation.infrastructure.storage.ServicePointRepository)2 AddressTypeRepository (org.folio.circulation.infrastructure.storage.users.AddressTypeRepository)2 HttpClient (io.vertx.core.http.HttpClient)1 JsonObject (io.vertx.core.json.JsonObject)1 Router (io.vertx.ext.web.Router)1 RoutingContext (io.vertx.ext.web.RoutingContext)1 Collection (java.util.Collection)1 Collections.emptyList (java.util.Collections.emptyList)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 UUID (java.util.UUID)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CompletableFuture.completedFuture (java.util.concurrent.CompletableFuture.completedFuture)1 Function.identity (java.util.function.Function.identity)1 Collectors (java.util.stream.Collectors)1 Collectors.toMap (java.util.stream.Collectors.toMap)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Item (org.folio.circulation.domain.Item)1