Package com.Server.controller
Class ReservationController
java.lang.Object
com.Server.controller.ReservationController
@RequestMapping("/reservation")
@RestController
@CrossOrigin
public class ReservationController
extends java.lang.Object
ReservationController is use to supports operations about database table Reservation.
- Since:
- 2020-04-27.
- Version:
- 2.0.
- Author:
- Krystian Cwioro Kamil Bieniasz Damian Mierzynski.
-
Field Summary
Fields Modifier and Type Field Description private CarServicecarServiceImplCarService operation on database table Carprivate LocalizationServicelocalizationServiceImplLocationSercive operation on database table Localizationprivate static org.slf4j.LoggerloggerLogger use to logger on server.private PdfResumepdfResumePdf generatedprivate ReservationServicereservationServiceImplReservationService operation on database table Reservationprivate SendMailImplsendMailImplSendMail use to send mailprivate UserServiceuserServiceImplUserService operation on database table User -
Constructor Summary
Constructors Constructor Description ReservationController(PdfResume pdfResume, ReservationService reservationServiceImpl, UserService userServiceImpl, CarService carServiceImpl, LocalizationService localizationServiceImpl, SendMailImpl sendMailImpl)Constructor -
Method Summary
Modifier and Type Method Description org.springframework.http.ResponseEntity<?>addReservation(javax.servlet.http.HttpServletResponse response, @Valid ReservationRequest reservationRequest)This method add new reservation user.org.springframework.http.ResponseEntity<?>addReservationGenerateFile(javax.servlet.http.HttpServletResponse response, @Valid ReservationRequest reservationRequest)This method gnerate resume on reservation This method use endpoint /reservation/pdf.org.springframework.http.ResponseEntity<?>deleteReservation(java.lang.Long id)This method delete reservation.org.springframework.http.ResponseEntity<?>getReservation(java.lang.Long id)This method get all reservation user about id user.org.springframework.http.ResponseEntity<?>getReservationById(java.lang.Long id)This method get all current reservation user about id user.org.springframework.http.ResponseEntity<java.util.List<ReservationResponse>>getReservations()This method get all reservation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
logger
private static final org.slf4j.Logger loggerLogger use to logger on server. -
pdfResume
Pdf generated -
reservationServiceImpl
ReservationService operation on database table Reservation -
userServiceImpl
UserService operation on database table User -
carServiceImpl
CarService operation on database table Car -
localizationServiceImpl
LocationSercive operation on database table Localization -
sendMailImpl
SendMail use to send mail
-
-
Constructor Details
-
ReservationController
@Autowired public ReservationController(PdfResume pdfResume, ReservationService reservationServiceImpl, UserService userServiceImpl, CarService carServiceImpl, LocalizationService localizationServiceImpl, SendMailImpl sendMailImpl)Constructor
-
-
Method Details
-
getReservations
@ResponseBody @PreAuthorize("hasRole(\'ADMIN\')") @GetMapping("/show") public org.springframework.http.ResponseEntity<java.util.List<ReservationResponse>> getReservations()This method get all reservation. This method use endpoint /reservation/show.- Returns:
- List Reservation all.
-
deleteReservation
@PreAuthorize("hasRole(\'ADMIN\')") @DeleteMapping("/delete") public org.springframework.http.ResponseEntity<?> deleteReservation(@RequestParam java.lang.Long id)This method delete reservation. This method use endpoint /reservation/delete.- Parameters:
id- id reservation.- Returns:
- return id delete reservation Http.Status 200 or 400.
- Throws:
WrongDataException- when reservation id not exist.
-
getReservation
@ResponseBody @GetMapping("/get") public org.springframework.http.ResponseEntity<?> getReservation(@RequestParam java.lang.Long id)This method get all reservation user about id user. This method use endpoint /reservation/get.- Parameters:
id- id user.- Returns:
- list reservation Http.Status 200 or 400.
- Throws:
WrongDataException- when reservation id not exist.
-
addReservationGenerateFile
@PostMapping("/add-pdf") public org.springframework.http.ResponseEntity<?> addReservationGenerateFile(javax.servlet.http.HttpServletResponse response, @Valid @RequestBody @Valid ReservationRequest reservationRequest) throws java.io.IOException, com.itextpdf.text.DocumentExceptionThis method gnerate resume on reservation This method use endpoint /reservation/pdf.- Parameters:
reservationRequest- data to create resume- Throws:
java.io.IOExceptioncom.itextpdf.text.DocumentException
-
addReservation
@ResponseBody @PostMapping("/add") public org.springframework.http.ResponseEntity<?> addReservation(javax.servlet.http.HttpServletResponse response, @Valid @RequestBody @Valid ReservationRequest reservationRequest) throws java.io.IOException, com.itextpdf.text.DocumentExceptionThis method add new reservation user. This method use endpoint /reservation/add.- Parameters:
reservationRequest- data new reservation.- Returns:
- return data new reservation Http.Status 200 or 400.
- Throws:
WrongDataException- when reservation add error.java.io.IOExceptioncom.itextpdf.text.DocumentException
-
getReservationById
@ResponseBody @GetMapping("/get-all-user") public org.springframework.http.ResponseEntity<?> getReservationById(@RequestParam java.lang.Long id)This method get all current reservation user about id user. This method use endpoint /reservation/get-all-user.- Parameters:
id- id user.- Returns:
- list reservation Http.Status 200 or 400.
- Throws:
WrongDataException- when user not exist.
-