Package com.inesm.KeyManager.controller
Class RequestController
java.lang.Object
com.inesm.KeyManager.controller.Controller
com.inesm.KeyManager.controller.RequestController
@RestController
@CrossOrigin("http://localhost:4200")
@RequestMapping("/requests")
public class RequestController
extends Controller
REST Controller for the requests endpoint.
-
Constructor Summary
ConstructorsConstructorDescriptionRequestController(SessionService session, RequestService requestService, AppInterface appInterface, LoggerService logger) Constructor for MissionController class. -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptRequest(javax.servlet.http.HttpServletRequest requestz) Accepts a request inside the station.voiddeleteRequest(javax.servlet.http.HttpServletRequest request) Deletes a request from the station.voiddenyRequest(javax.servlet.http.HttpServletRequest requestz) Denies a request inside the station.Gets the requests made by the current user.Gets the pending requests the current user is authorized to accept.voidrequestPassword(javax.servlet.http.HttpServletRequest request) Creates a password request inside the station.
-
Constructor Details
-
RequestController
@Autowired public RequestController(SessionService session, RequestService requestService, AppInterface appInterface, LoggerService logger) Constructor for MissionController class.- Parameters:
session- the session service to be usedrequestService- the request service to be usedappInterface- the class that defines the interface between java and json objectslogger- the logger service
-
-
Method Details
-
listPendingRequests
@PostMapping(path="list/pending", produces="application/json;charset=UTF-8") public String listPendingRequests() throws SessionTimeoutException, PermissionDeniedExceptionGets the pending requests the current user is authorized to accept.- Returns:
- a string containing a list of the requests in JSON array format
- Throws:
SessionTimeoutException- 401 | Session Timeout | If the session timed outPermissionDeniedException- 403 | Permission Denied | If the user is not authorized to access this operation
-
listMyRequests
@PostMapping(path="list/mine", produces="application/json;charset=UTF-8") public String listMyRequests() throws SessionTimeoutException, PermissionDeniedExceptionGets the requests made by the current user.- Returns:
- a string containing a list of the requests in JSON array format
- Throws:
SessionTimeoutException- 401 | Session Timeout | If the session timed outPermissionDeniedException- 403 | Permission Denied | If the user is not authorized to access this operation
-
deleteRequest
@PostMapping(path="delete", consumes="application/json;charset=UTF-8", produces="application/json;charset=UTF-8") public void deleteRequest(javax.servlet.http.HttpServletRequest request) throws SessionTimeoutException, PermissionDeniedException, RequestReadException, JsonBadSintaxException, ObjectNotFoundException Deletes a request from the station.- Parameters:
request- the HTTP request received, containing a request object in JSON format, containing the requestID set.- Throws:
SessionTimeoutException- 401 | Session Timeout | If the session timed outPermissionDeniedException- 403 | Permission Denied | If the user is not authorized to access this operationJsonBadSintaxException- 400 | Invalid Payload | If the JSON received contained incorrect syntax or mission fieldsRequestReadException- 500 | Couldn't Read Request Body | If the application could not retrieve the request body of the HTTP requestObjectNotFoundException- 400 | Object Not Found | If the requested resource was not found.
-
acceptRequest
@PostMapping(path="accept", consumes="application/json;charset=UTF-8", produces="application/json;charset=UTF-8") public void acceptRequest(javax.servlet.http.HttpServletRequest requestz) throws SessionTimeoutException, PermissionDeniedException, RequestReadException, JsonBadSintaxException, ObjectNotFoundException, InvalidParametersException, ObjectNotMappedException, OperationProcessException, GlobalOperationException, OperationNotSupportedException Accepts a request inside the station.- Parameters:
requestz- the HTTP request received, containing a request object in JSON format, with the requestID, verifierFullname, verifierCitizenCard and (optionally) reason set.- Throws:
GlobalOperationException- 202 | Global Operation | If the resource is not owned by the current stationOperationNotSupportedException- 400 | Invalid Operation Request | if the operation is not mappedInvalidParametersException- 400 | Invalid Parameters | If the shared resource did not have the missionUUID field set, or if there are invalid fields for the resource are providedSessionTimeoutException- 401 | Session Timeout | If the session timed outPermissionDeniedException- 403 | Permission Denied | If the user is not authorized to access this operationJsonBadSintaxException- 400 | Invalid Payload | If the JSON received contained incorrect syntax or mission fieldsRequestReadException- 500 | Couldn't Read Request Body | If the application could not retrieve the request body of the HTTP requestObjectNotMappedException- 500 | Object Not Mapped | If the input data received mapped to an object that is not mapped in the applicationObjectNotFoundException- 400 | Object Not Found | If the requested resource was not found.OperationProcessException- 422 | Could not process requested operation |
-
denyRequest
@PostMapping(path="deny", consumes="application/json;charset=UTF-8", produces="application/json;charset=UTF-8") public void denyRequest(javax.servlet.http.HttpServletRequest requestz) throws SessionTimeoutException, PermissionDeniedException, RequestReadException, JsonBadSintaxException, ObjectNotFoundException Denies a request inside the station.- Parameters:
requestz- the HTTP request received, containing a request object in JSON format, with the requestID, verifierFullname, verifierCitizenCard and (optionally) reason set. have the missionUUID field set, or if there are invalid fields for the resource are provided- Throws:
SessionTimeoutException- 401 | Session Timeout | If the session timed outPermissionDeniedException- 403 | Permission Denied | If the user is not authorized to access this operationJsonBadSintaxException- 400 | Invalid Payload | If the JSON received contained incorrect syntax or mission fieldsRequestReadException- 500 | Couldn't Read Request Body | If the application could not retrieve the request body of the HTTP request object that is not mapped in the applicationObjectNotFoundException- 400 | Object Not Found | If the requested resource was not found.
-
requestPassword
@PostMapping(path="password", consumes="application/json;charset=UTF-8", produces="application/json;charset=UTF-8") public void requestPassword(javax.servlet.http.HttpServletRequest request) throws ObjectNotFoundException, RequestReadException, JsonBadSintaxException, InvalidParametersException Creates a password request inside the station.- Parameters:
request- the HTTP request received, containing a request object in JSON format with the username field set- Throws:
InvalidParametersException- 400 | Invalid Parameters | If the shared resource did not have the missionUUID field set, or if there are invalid fields for the resource are providedJsonBadSintaxException- 400 | Invalid Payload | If the JSON received contained incorrect syntax or mission fieldsRequestReadException- 500 | Couldn't Read Request Body | If the application could not retrieve the request body of the HTTP requestObjectNotFoundException- 400 | Object Not Found | If the requested resource was not found.
-