public void visitRentals(RentalVisitor visitor) { for (RentalDTO r : rentalService.getAllRentals()) { UserDTO user = userService.getUserById(r.getUserId()); MovieDTO movie = movieService.getMovieById(r.getMovieId()); visitor.visit( r.getId(), r.getRentalDays(), r.getRentalDate(), user.getLastName(), user.getFirstName(), movie.getTitle(), r.getRemainingDays(), r.getRentalFee()); } }
public void visitRentalsOfUser(Long userId, RentalVisitor visitor) { UserDTO user = userService.getUserById(userId); for (Long id : user.getRentalIds()) { RentalDTO r = rentalService.getRentalById(id); MovieDTO movie = movieService.getMovieById(r.getMovieId()); visitor.visit( r.getId(), r.getRentalDays(), r.getRentalDate(), user.getLastName(), user.getFirstName(), movie.getTitle(), r.getRemainingDays(), r.getRentalFee()); } }
public void visitUsers(UserVisitor visitor) { for (UserDTO u : userService.getAllUsers()) { visitor.visit(u.getId(), u.getLastName(), u.getFirstName()); } }