@Override public boolean addMovie(String title, String description, String endTime) { // TODO Auto-generated method stub Movie movie = new Movie(); movie.setDescription(description); movie.setName(title); endTime += " 00:00:00"; Timestamp ts = Timestamp.valueOf(endTime); movie.setEndTime(ts); return movieDao.insert(movie); }
@Override public ArrayList<MoviePlanBean> getMoviePlanBeans() { // TODO Auto-generated method stub List<Movie> movies = movieDao.getAllMovies(); ArrayList<MoviePlanBean> moviePlanBeans = new ArrayList<MoviePlanBean>(); for (Movie movie : movies) { int id = movie.getId(); List<Plan> plans = planDao.getPlansByMovieId(id); MoviePlanBean moviePlanBean = new MoviePlanBean(); moviePlanBean.setMovie(movie); moviePlanBean.setPlans(plans); moviePlanBean.setHasEnd(); moviePlanBeans.add(moviePlanBean); } return moviePlanBeans; }
@Override public ArrayList<SimpleMovieBean> getSimpleMovieBeans() { // TODO Auto-generated method stub ArrayList<SimpleMovieBean> simpleMovieBeans = new ArrayList<SimpleMovieBean>(); List<Movie> movies = movieDao.getAllMovies(); for (Movie movie : movies) { SimpleMovieBean simpleMovieBean = new SimpleMovieBean(); simpleMovieBean.setId(movie.getId() + ""); simpleMovieBean.setName(movie.getName()); if (isOffLine(movie.getEndTime())) { simpleMovieBean.setOffLine("已下线"); } else { simpleMovieBean.setOffLine("未下线"); } simpleMovieBeans.add(simpleMovieBean); } return simpleMovieBeans; }