public class MovieDAOImpl extends Object
Modifier and Type | Class and Description |
---|---|
private class |
MovieDAOImpl.DateParam |
protected static class |
MovieDAOImpl.Pair<T,U> |
private class |
MovieDAOImpl.QueryLogger<T> |
Modifier and Type | Field and Description |
---|---|
private EntityManager |
em |
private static org.apache.commons.logging.Log |
log |
Constructor and Description |
---|
MovieDAOImpl() |
Modifier and Type | Method and Description |
---|---|
protected <T> MovieDAOImpl.QueryLogger<T> |
createQuery(String jpaql,
Class<T> resultClass)
Helper method to log the JPAQL portion of the query.
|
int |
getCastCountForMovie(String movieId) |
Person |
getKevinBacon()
Returns a Person instance for the Kevin Bacon actor who
played in Tremors.
|
List<String> |
getKevinBaconMovieIds(Integer offset,
Integer limit,
String orderBy) |
List<Object[]> |
getMovieAndDirector(Integer offset,
Integer limit,
String orderBy) |
Movie |
getMovieById(String id) |
Movie |
getMovieByIdUnfetched(String id) |
int |
getMovieCastCountByDAO(String movieId) |
int |
getMovieCastCountByDAORelation(String movieId) |
int |
getMovieCastCountByDB(String movieId) |
Movie |
getMovieFetchedByIdFetched(String id) |
List<Movie> |
getMovies(Integer offset,
Integer limit,
String orderBy)
Returns a bulk, unordered page of movies.
|
List<Movie> |
getMoviesByLikeRole(String role,
Integer offset,
Integer limit,
String orderBy) |
List<Movie> |
getMoviesByRatingLowerFunction(MovieRating rating,
Integer offset,
Integer limit)
Returns an unordered page of movies matching the supplied rating -- but
calling lower() on the DB value.
|
List<Movie> |
getMoviesByRatingUpperFunction(MovieRating rating,
Integer offset,
Integer limit)
Returns an unordered page of movies matching the supplied rating -- but
calling upper() on the DB value.
|
List<Movie> |
getMoviesByRatingValue(MovieRating rating,
Integer offset,
Integer limit,
String orderBy)
Returns an unordered page of movies matching the supplied rating --
without calling any function()s on the stored data.
|
List<Movie> |
getMoviesByReleaseDate(Date releaseDate,
Integer offset,
Integer limit) |
List<Movie> |
getMoviesByReleaseDateAndRating(Date releaseDate,
MovieRating rating,
Integer offset,
Integer limit) |
List<Movie> |
getMoviesByReleaseDateAndTitle(String title,
Date releaseDate,
Integer offset,
Integer limit) |
List<Movie> |
getMoviesByRole(String role,
Integer offset,
Integer limit,
String orderBy) |
List<Movie> |
getMoviesByTitleAndReleaseDate(String title,
Date releaseDate,
Integer offset,
Integer limit) |
List<Movie> |
getMoviesByTitleAndReleaseDateAndRating(String title,
Date releaseDate,
MovieRating rating,
Integer offset,
Integer limit) |
List<Movie> |
getMoviesEqualsTitle(String title,
Integer offset,
Integer limit)
Returns movies exactly matching the provided title.
|
protected MovieDAOImpl.Pair<Subquery<Movie>,Void> |
getMoviesForPerson(AbstractQuery<String> parentQuery,
Person person) |
protected MovieDAOImpl.Pair<Subquery<Movie>,Join<Actor,Person>> |
getMoviesForPersonIds(AbstractQuery<String> parentQuery) |
List<Movie> |
getMoviesLikeTitle(String title,
Integer offset,
Integer limit,
String orderBy)
Returns an unordered page of movies that have a title "like" the one passed
in.
|
protected CriteriaQuery<Person> |
getPeopleQuery(Person person,
int steps) |
protected CriteriaQuery<Person> |
getPeopleQuery2(Person person,
int steps) |
protected MovieDAOImpl.Pair<Subquery<String>,Join<MovieRole,Movie>> |
getPersonIdsInMovie(AbstractQuery<?> parentQuery) |
List<String> |
getRatingsByTitle(String title,
Integer offset,
Integer limit,
String orderBy)
Returns a list of ratings for movies that exactly match the provided title.
|
List<String> |
getRatingsLikeTitle(String title,
Integer offset,
Integer limit,
String orderBy)
Returns ratings that match the title like criteria.
|
List<MovieRole> |
getRolesByMovie(String title,
Date releaseDate,
Integer offset,
Integer limit,
String orderBy) |
List<String> |
getTitlesByRating(MovieRating rating,
Integer offset,
Integer limit)
Returns an unordered page of titles that match a specified rating.
|
protected MovieDAOImpl.Pair<Subquery<String>,Join<MovieRole,Movie>> |
nthRemoved(AbstractQuery<String> parentQuery,
Path<Movie> parentTerm,
Person person) |
List<Person> |
oneStepFromPerson0(Person p,
Integer offset,
Integer limit)
Find people who are 1 step from Kevin Bacon.
|
Collection<Person> |
oneStepFromPersonByDAO(Person p)
Find people who are 1 step from Person.
|
Collection<Person> |
oneStepFromPersonByDAO(Person p,
Integer offset,
Integer limit,
String orderBy) |
List<Person> |
oneStepFromPersonByDB(Person p)
Find people who are 1 step from Person.
|
List<Person> |
oneStepFromPersonByDB(Person p,
Integer offset,
Integer limit,
String orderBy) |
void |
setEntityManager(EntityManager em) |
List<Person> |
stepsFromPerson(Person person,
int steps,
Integer offset,
Integer limit) |
protected <T> MovieDAOImpl.QueryLogger<T> |
withPaging(MovieDAOImpl.QueryLogger<T> query,
Integer offset,
Integer limit,
String orderBy)
Helper method to add paging parameters to a query
|
private static final org.apache.commons.logging.Log log
private EntityManager em
public void setEntityManager(EntityManager em)
protected <T> MovieDAOImpl.QueryLogger<T> createQuery(String jpaql, Class<T> resultClass)
jpaql
- resultClass
- protected <T> MovieDAOImpl.QueryLogger<T> withPaging(MovieDAOImpl.QueryLogger<T> query, Integer offset, Integer limit, String orderBy)
query
- offset
- limit
- public Person getKevinBacon()
public List<String> getKevinBaconMovieIds(Integer offset, Integer limit, String orderBy)
public List<Person> oneStepFromPerson0(Person p, Integer offset, Integer limit)
p
- offset
- limit
- public Collection<Person> oneStepFromPersonByDAO(Person p)
p
- offset
- limit
- orderBy
- public Collection<Person> oneStepFromPersonByDAO(Person p, Integer offset, Integer limit, String orderBy)
public List<Person> oneStepFromPersonByDB(Person p)
p
- offset
- limit
- orderBy
- public List<Person> oneStepFromPersonByDB(Person p, Integer offset, Integer limit, String orderBy)
protected MovieDAOImpl.Pair<Subquery<Movie>,Void> getMoviesForPerson(AbstractQuery<String> parentQuery, Person person)
protected MovieDAOImpl.Pair<Subquery<Movie>,Join<Actor,Person>> getMoviesForPersonIds(AbstractQuery<String> parentQuery)
protected MovieDAOImpl.Pair<Subquery<String>,Join<MovieRole,Movie>> getPersonIdsInMovie(AbstractQuery<?> parentQuery)
protected MovieDAOImpl.Pair<Subquery<String>,Join<MovieRole,Movie>> nthRemoved(AbstractQuery<String> parentQuery, Path<Movie> parentTerm, Person person)
protected CriteriaQuery<Person> getPeopleQuery2(Person person, int steps)
protected CriteriaQuery<Person> getPeopleQuery(Person person, int steps)
public List<Person> stepsFromPerson(Person person, int steps, Integer offset, Integer limit)
public List<Movie> getMovies(Integer offset, Integer limit, String orderBy)
offset
- limit
- orderBy
- public List<Movie> getMoviesByRatingUpperFunction(MovieRating rating, Integer offset, Integer limit)
rating
- offset
- limit
- public List<Movie> getMoviesByRatingLowerFunction(MovieRating rating, Integer offset, Integer limit)
rating
- offset
- limit
- public List<Movie> getMoviesByRatingValue(MovieRating rating, Integer offset, Integer limit, String orderBy)
rating
- offset
- limit
- orderBy
- public List<Movie> getMoviesLikeTitle(String title, Integer offset, Integer limit, String orderBy)
title
- offset
- limit
- orderBy
- public List<Movie> getMoviesEqualsTitle(String title, Integer offset, Integer limit)
title
- offset
- limit
- public List<String> getRatingsByTitle(String title, Integer offset, Integer limit, String orderBy)
title
- offset
- limit
- orderBy
- public List<String> getRatingsLikeTitle(String title, Integer offset, Integer limit, String orderBy)
title
- offset
- limit
- orderBy
- public List<String> getTitlesByRating(MovieRating rating, Integer offset, Integer limit)
rating
- offset
- limit
- public List<Movie> getMoviesByTitleAndReleaseDate(String title, Date releaseDate, Integer offset, Integer limit)
public List<Movie> getMoviesByReleaseDateAndTitle(String title, Date releaseDate, Integer offset, Integer limit)
public List<Movie> getMoviesByTitleAndReleaseDateAndRating(String title, Date releaseDate, MovieRating rating, Integer offset, Integer limit)
public List<Movie> getMoviesByReleaseDate(Date releaseDate, Integer offset, Integer limit)
public List<Movie> getMoviesByReleaseDateAndRating(Date releaseDate, MovieRating rating, Integer offset, Integer limit)
public List<Movie> getMoviesByRole(String role, Integer offset, Integer limit, String orderBy)
public List<Movie> getMoviesByLikeRole(String role, Integer offset, Integer limit, String orderBy)
public List<MovieRole> getRolesByMovie(String title, Date releaseDate, Integer offset, Integer limit, String orderBy)
public int getMovieCastCountByDAORelation(String movieId)
public int getMovieCastCountByDAO(String movieId)
public int getMovieCastCountByDB(String movieId)
public int getCastCountForMovie(String movieId)
Copyright © 2015 John's Hopkins University, Engineering Programs for Professionals. All rights reserved.