Search in sources :

Example 1 with ReorderQueueRequest

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

the class UpdateRequestQueueTest method createReorderContext.

private ReorderRequestContext createReorderContext() {
    UUID itemId = UUID.randomUUID();
    RequestQueue requestQueue = createRequestQueue(itemId, 4);
    ReorderQueueRequest reorderQueueRequest = new ReorderQueueRequest();
    reorderQueueRequest.setReorderedQueue(new ArrayList<>());
    final int requestCount = requestQueue.getRequests().size();
    for (Request request : requestQueue.getRequests()) {
        ReorderRequest reorderRequest = new ReorderRequest();
        reorderQueueRequest.getReorderedQueue().add(reorderRequest);
        reorderRequest.setId(request.getId());
        // i.e. reverse positions
        reorderRequest.setNewPosition(requestCount - request.getPosition());
    }
    return new ReorderRequestContext(null, itemId.toString(), reorderQueueRequest).withRequestQueue(requestQueue);
}
Also used : ReorderRequest(org.folio.circulation.domain.reorder.ReorderRequest) ReorderRequest(org.folio.circulation.domain.reorder.ReorderRequest) ReorderQueueRequest(org.folio.circulation.domain.reorder.ReorderQueueRequest) UUID(java.util.UUID) ReorderRequestContext(org.folio.circulation.resources.context.ReorderRequestContext) ReorderQueueRequest(org.folio.circulation.domain.reorder.ReorderQueueRequest)

Aggregations

UUID (java.util.UUID)1 ReorderQueueRequest (org.folio.circulation.domain.reorder.ReorderQueueRequest)1 ReorderRequest (org.folio.circulation.domain.reorder.ReorderRequest)1 ReorderRequestContext (org.folio.circulation.resources.context.ReorderRequestContext)1