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);
}
Aggregations