public void createRental(Long movieId, Long userId, Integer rentalDays) { rentalService.rentMovie(userId, movieId, rentalDays); // old implementeation based on the old remote interface // MovieDTO movie = getMovie(movieId); // UserDTO user = getUser(userId); // // Date now = Calendar.getInstance().getTime(); // RentalDTO rental = new RentalDTO(null, now, rentalDays, 0, user.getId(), movie.getId(), 0); // Long id = rentalService.saveOrUpdateRental(rental); invalidateCache(); }
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 removeRental(Long rentalId) { rentalService.deleteRental(rentalId); invalidateCache(); }