forked from folio-org/mod-circulation-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRequestsAPI.java
76 lines (58 loc) · 2.36 KB
/
RequestsAPI.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package org.folio.rest.impl;
import java.util.Map;
import javax.ws.rs.core.Response;
import org.folio.rest.annotations.Validate;
import org.folio.rest.jaxrs.model.Request;
import org.folio.rest.jaxrs.resource.RequestStorage;
import org.folio.service.request.RequestService;
import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Handler;
public class RequestsAPI implements RequestStorage {
@Validate
@Override
public void deleteRequestStorageRequests(Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
new RequestService(vertxContext, okapiHeaders).deleteAll()
.onComplete(asyncResultHandler);
}
@Validate
@Override
public void getRequestStorageRequests(String totalRecords, int offset, int limit, String query,
Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
new RequestService(vertxContext, okapiHeaders).findByQuery(query, offset, limit)
.onComplete(asyncResultHandler);
}
@Validate
@Override
public void postRequestStorageRequests(Request request, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
new RequestService(vertxContext, okapiHeaders).create(request)
.onComplete(asyncResultHandler);
}
@Validate
@Override
public void getRequestStorageRequestsByRequestId(String requestId,
Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
new RequestService(vertxContext, okapiHeaders).findById(requestId)
.onComplete(asyncResultHandler);
}
@Validate
@Override
public void deleteRequestStorageRequestsByRequestId(String requestId,
Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
new RequestService(vertxContext, okapiHeaders).delete(requestId)
.onComplete(asyncResultHandler);
}
@Validate
@Override
public void putRequestStorageRequestsByRequestId(String requestId, Request request,
Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
new RequestService(vertxContext, okapiHeaders).createOrUpdate(requestId, request)
.onComplete(asyncResultHandler);
}
}