コード例 #1
0
 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());
   }
 }
コード例 #2
0
 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());
   }
 }