Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. /**
  2. * Gets called when confirming a booking to add it to the DB.
  3. */
  4. @PostMapping("/roomBookingConfirmation")
  5. fun roomBookingConfirmation(model: Model, @ModelAttribute roomBookingRequest: RoomBookingRequest): String {
  6.  
  7. makeBooking(roomBookingRequest)
  8.  
  9. val date = roomBookingRequest.datetimeFrom
  10. val start = roomBookingRequest.datetimeFrom.minusDays(date.dayOfWeek.value.toLong())
  11. val end = roomBookingRequest.datetimeFrom.plusDays(7 - date.dayOfWeek.value.toLong())
  12.  
  13. model.addAttribute("eventAppointmentSearchRequest", EventAppointmentSearchRequest(
  14. startDateTime = start,
  15. endDateTime = end,
  16. rooms = listOf(roomRepository.findByRoomName(roomBookingRequest.roomNr))
  17. ))
  18. return "roomBookingConfirmation"
  19. }
  20.  
  21. /**
  22. * Displays the appointments in the calendar view according to the request
  23. */
  24. @PostMapping("/calendarView")
  25. fun calendarView(model: Model, @ModelAttribute eventAppointmentSearchRequest: EventAppointmentSearchRequest): String {
  26. // THIS THROWS THE EXCEPTION: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method ...requests.EventAppointmentSearchRequest.<init>, parameter startDateTime
  27. ...
  28. }
  29.  
  30. <!-- /*@thymesVar id="eventAppointmentSearchRequest" type="de.tudarmstadt.pvw.tulpe.soonToBeArtifactory.requests.EventAppointmentSearchRequest"*/ -->
  31. <form th:action="@{/calendarView}" method="post" th:object="${eventAppointmentSearchRequest}" id="forwardToCalendar" style="grid-column: span 4">
  32. <H1 th:text="#{roomBooking.bookingConfirmed}">
  33. Booking confirmed.
  34. </H1>
  35. <div class="links">
  36. <a href="#" th:text="#{roomBooking.nowRedirecting}" onclick="forwardToCalendar()">Redirecting to
  37. calendarView in </a> <b id="secondsLeft">7</b>
  38. <input type="hidden" th:field="${eventAppointmentSearchRequest.startDateTime}" th:name="startDateTime" th:value="${eventAppointmentSearchRequest.startDateTime}">
  39. <input type="hidden" th:field="${eventAppointmentSearchRequest.endDateTime}" th:name="endDateTime" th:value="${eventAppointmentSearchRequest.endDateTime}">
  40. <input type="hidden" th:field="${eventAppointmentSearchRequest.rooms}" name="rooms[]" th:each="room: ${eventAppointmentSearchRequest.rooms}" th:value="${room.RoomId}">
  41. </div>
  42. ...
  43. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement