1 package org.kuali.asr.processor;
2
3 import org.apache.log4j.Logger;
4 import org.kuali.asr.bo.*;
5 import org.kuali.asr.service.ASRService;
6 import org.kuali.asr.service.impl.ASRServiceImpl;
7
8 import javax.ws.rs.*;
9 import javax.ws.rs.core.MediaType;
10 import javax.ws.rs.core.Response;
11
12
13
14
15
16
17
18
19
20
21
22
23 @Path("/asr")
24 public class ASRRequestProcessor {
25 private static final Logger LOG = Logger.getLogger(ASRRequestProcessor.class);
26 private ASRService asrService ;
27
28 public ASRService getAsrService() {
29 if(asrService==null){
30 asrService = new ASRServiceImpl();
31 }
32 return asrService;
33 }
34
35 public ASRRequestProcessor(){
36 getAsrService();
37 }
38
39
40
41 @GET
42 @Path("/lookupNewAsrItems/{operatorId}")
43 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
44 public Response lookUpNewASRItems(@PathParam("operatorId") String operatorId){
45 Object object = asrService.lookupNewASRItems(operatorId);
46 if(object instanceof ASRItems){
47 return Response.status(200).entity(object).build();
48 } else {
49 ASRResponseBo asrResponseBo = (ASRResponseBo)object;
50 return Response.status(asrResponseBo.getStatusCode()).entity(object).build();
51 }
52 }
53
54 @GET
55 @Path("/lookupAsrRequests/{operatorId},{asrLocation}")
56 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
57 public Response lookUpNewASRTypeRequests(@PathParam("operatorId") String operatorId,@PathParam("asrLocation") String asrLocation){
58 Object object = asrService.lookupASRTypeRequest(operatorId, asrLocation);
59 if(object instanceof ASRRequests){
60 return Response.status(200).entity(object).build();
61 } else {
62 ASRResponseBo asrResponseBo = (ASRResponseBo)object;
63 return Response.status(asrResponseBo.getStatusCode()).entity(object).build();
64 }
65 }
66
67
68 @GET
69 @Path("/lookupAsrItemHolds/{operatorId},{itemBarcode}")
70 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
71 public Response lookUpASRRequests(@PathParam("operatorId") String operatorId,@PathParam("itemBarcode") String itemBarcode){
72 Object object =asrService.lookupAsrRequest(operatorId,itemBarcode);
73 if(object instanceof LookupASRRequestResponseBO){
74 LookupASRRequestResponseBO lookupASRRequestResponseBO = (LookupASRRequestResponseBO)object;
75 return Response.status(lookupASRRequestResponseBO.getStatusCode()).entity(lookupASRRequestResponseBO).build();
76 }else{
77 ASRResponseBo asrResponseBo = (ASRResponseBo)object;
78 return Response.status(asrResponseBo.getStatusCode()).entity(object).build();
79 }
80 }
81
82
83 @DELETE
84 @Path("/cancelHold/{holdId},{operatorId}")
85 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
86 public Response cancelHold(@PathParam("holdId") String holdId,@PathParam("operatorId") String operatorId){
87 ASRResponseBo asrResponseBo = asrService.cancelASRRequest(holdId,operatorId);
88 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
89
90 }
91
92 @DELETE
93 @Path("/removeASRItem/{itemBarcode}")
94 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
95 public Response removeASRItem(@PathParam("itemBarcode") String itemBarcode){
96 ASRResponseBo asrResponseBo = asrService.removeASRItem(itemBarcode);
97 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
98 }
99
100 @POST
101 @Path("/updateASRItemStatusAvailable")
102 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
103 public Response updateASRItemStatusToAvailable(UpdateASRItemRequestBo updateASRItemRequestBo){
104 Object object = asrService.updateASRItemStatusToAvailable(updateASRItemRequestBo);
105 if(object==null){
106 return Response.status(200).entity(object).build();
107 } else if(object instanceof ASRResponseBo) {
108 ASRResponseBo asrResponseBo = (ASRResponseBo)object;
109 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
110 }
111 return Response.status(200).entity("").build();
112 }
113
114
115 @POST
116 @Path("/updateASRItemStatusMissing")
117 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
118 public Response updateASRItemStatusToMissing(UpdateASRItemStatusBo updateASRItemStatusBo){
119 Object object = asrService.updateASRItemStatusToMissing(updateASRItemStatusBo);
120 if(object==null){
121 return Response.status(200).entity(object).build();
122 } else if(object instanceof ASRResponseBo) {
123 ASRResponseBo asrResponseBo = (ASRResponseBo)object;
124 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
125 }
126 return Response.status(200).entity("").build();
127 }
128
129 @POST
130 @Path("/updateASRItemStatusBeingRetrieved")
131 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
132 public Response updateASRItemStatus(UpdateASRItemStatusBo updateASRItemStatusBo){
133 Object object= asrService.updateASRItemStatusToBeingRetrieved(updateASRItemStatusBo);
134 if(object==null){
135 return Response.status(200).entity(object).build();
136 } else if(object instanceof ASRResponseBo) {
137 ASRResponseBo asrResponseBo = (ASRResponseBo)object;
138 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
139 }
140 return Response.status(200).entity("").build();
141 }
142
143 @POST
144 @Path("/placeASRRequest")
145 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
146 public Response placeRequestOnASRItem(PlaceASRItemRequestBo placeASRItemRequestBo){
147 ASRResponseBo asrResponseBo = asrService.placeRequestOnASRItem(placeASRItemRequestBo);
148 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
149 }
150
151
152 @POST
153 @Path("/updateASRRequest")
154 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
155 public Response updateASRRequestStatus(UpdateASRRequestStatusBo updateASRRequestStatusBo){
156 Object object= asrService.updateASRRequestStatus(updateASRRequestStatusBo);
157 if(object==null){
158 return Response.status(200).entity(object).build();
159 } else if(object instanceof ASRResponseBo) {
160 ASRResponseBo asrResponseBo = (ASRResponseBo)object;
161 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
162 }
163 return Response.status(200).entity("").build();
164 }
165
166
167 @POST
168 @Path("/addNewASRItem")
169 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
170 public Response addNewASRItem(ASRItem asrItem){
171 ASRResponseBo asrResponseBo = asrService.addNewASRItem(asrItem);
172 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
173 }
174
175 @POST
176 @Path("/sendASRRequest")
177 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
178 public Response sendASRRequest(ASRRequestBo asrRequestBo){
179 ASRResponseBo asrResponseBo = asrService.sendASRRequest(asrRequestBo);
180 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
181 }
182
183 @POST
184 @Path("/receiveTransitOfASRItem")
185 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
186 public Response receiveASRItemTransit(ReceiveTransitRequestBo receiveTransitRequestBo){
187 ASRResponseBo asrResponseBo = asrService.receiveASRItemTransit(receiveTransitRequestBo);
188 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
189 }
190
191 @POST
192 @Path("/checkInASRItem")
193 @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
194 public Response checkInASRItem(ASRCheckInBo asrCheckInBo){
195 ASRResponseBo asrResponseBo = asrService.checkInASRItem(asrCheckInBo);
196 return Response.status(asrResponseBo.getStatusCode()).entity(asrResponseBo).build();
197 }
198
199
200 }