private Appointment getAppointment(Model model, String appointmentId) { List<Appointment> availApts = (List<Appointment>) model.asMap().get("availApts"); for (Appointment appointment : availApts) { if (appointment.getId().equals(appointmentId)) { return appointment; } } return null; }
private void populateAndBookBasedOnAnother( String subject, String details, int day, String[] toSplit, Appointment availAptOfInterest) throws MessagingException, IOException { Appointment aptToBook = new Appointment() .withSummary(subject) .withDescription(details) .withRequestedAttendees(Arrays.asList(toSplit)) .withRoom(availAptOfInterest.getRoom()) .withOrganiser(Utils.getCurrentLoggedInUser().getName()) // Choose the first one for now .withTimeSlot(availAptOfInterest.getTimeSlot()) // Not yet implimented day dropdown .withDay(day); // currentUser.bookAppointment(aptToBook); BookingButton bookingButton = new BookingButton(); bookingButton.onClick(aptToBook); }