Update copyright date
parent
9c58841c6c
commit
5eb756e03e
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ArtworkType enum List of the artwork types that are available
|
|
||||||
*/
|
|
||||||
public enum ArtworkType {
|
|
||||||
|
|
||||||
// Poster artwork
|
|
||||||
POSTER,
|
|
||||||
// Fanart/backdrop
|
|
||||||
BACKDROP,
|
|
||||||
// Person image
|
|
||||||
PROFILE
|
|
||||||
}
|
|
||||||
@ -1,279 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation;private either version 3 of the License;private or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful;private
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not;private see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import static com.omertron.themoviedbapi.tools.ApiUrl.PARAM_ADULT;
|
|
||||||
import static com.omertron.themoviedbapi.tools.ApiUrl.PARAM_LANGUAGE;
|
|
||||||
import static com.omertron.themoviedbapi.tools.ApiUrl.PARAM_PAGE;
|
|
||||||
import static com.omertron.themoviedbapi.tools.ApiUrl.PARAM_YEAR;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a discover object for use in the MovieDbApi
|
|
||||||
* <p/>
|
|
||||||
* This allows you to just add the search components you are concerned with
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class Discover {
|
|
||||||
|
|
||||||
private final Map<String, String> params = new HashMap<String, String>();
|
|
||||||
private static final String PARAM_PRIMARY_RELEASE_YEAR = "primary_release_year=";
|
|
||||||
private static final String PARAM_VOTE_COUNT_GTE = "vote_count.gte=";
|
|
||||||
private static final String PARAM_VOTE_AVERAGE_GTE = "vote_average.gte=";
|
|
||||||
private static final String PARAM_WITH_GENRES = "with_genres=";
|
|
||||||
private static final String PARAM_RELEASE_DATE_GTE = "release_date.gte=";
|
|
||||||
private static final String PARAM_RELEASE_DATE_LTE = "release_date.lte=";
|
|
||||||
private static final String PARAM_CERTIFICATION_COUNTRY = "certification_country=";
|
|
||||||
private static final String PARAM_CERTIFICATION_LTE = "certification.lte=";
|
|
||||||
private static final String PARAM_WITH_COMPANIES = "with_companies=";
|
|
||||||
private static final String PARAM_SORT_BY = "sort_by=";
|
|
||||||
private static final int YEAR_MIN = 1900;
|
|
||||||
private static final int YEAR_MAX = 2100;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the parameters
|
|
||||||
* <p/>
|
|
||||||
* This will be used to construct the URL in the API
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Map<String, String> getParams() {
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Minimum value is 1 if included.
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover page(int page) {
|
|
||||||
if (page > 0) {
|
|
||||||
params.put(PARAM_PAGE, String.valueOf(page));
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ISO 639-1 code
|
|
||||||
*
|
|
||||||
* @param language
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover language(String language) {
|
|
||||||
if (StringUtils.isNotBlank(language)) {
|
|
||||||
params.put(PARAM_LANGUAGE, language);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Available options are <br>
|
|
||||||
* vote_average.desc<br>
|
|
||||||
* vote_average.asc<br>
|
|
||||||
* release_date.desc<br>
|
|
||||||
* release_date.asc<br>
|
|
||||||
* popularity.desc<br>
|
|
||||||
* popularity.asc
|
|
||||||
*
|
|
||||||
* @param sortBy
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover sortBy(String sortBy) {
|
|
||||||
if (StringUtils.isNotBlank(sortBy)) {
|
|
||||||
params.put(PARAM_SORT_BY, sortBy);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggle the inclusion of adult titles
|
|
||||||
*
|
|
||||||
* @param includeAdult
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover includeAdult(boolean includeAdult) {
|
|
||||||
params.put(PARAM_ADULT, String.valueOf(includeAdult));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the results release dates to matches that include this value.
|
|
||||||
*
|
|
||||||
* @param year
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover year(int year) {
|
|
||||||
if (checkYear(year)) {
|
|
||||||
params.put(PARAM_YEAR, String.valueOf(year));
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the results so that only the primary release date year has this value
|
|
||||||
*
|
|
||||||
* @param primaryReleaseYear
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover primaryReleaseYear(int primaryReleaseYear) {
|
|
||||||
if (checkYear(primaryReleaseYear)) {
|
|
||||||
params.put(PARAM_PRIMARY_RELEASE_YEAR, String.valueOf(primaryReleaseYear));
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only include movies that are equal to, or have a vote count higher than this value
|
|
||||||
*
|
|
||||||
* @param voteCountGte
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover voteCountGte(int voteCountGte) {
|
|
||||||
if (voteCountGte > 0) {
|
|
||||||
params.put(PARAM_VOTE_COUNT_GTE, String.valueOf(voteCountGte));
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only include movies that are equal to, or have a higher average rating than this value
|
|
||||||
*
|
|
||||||
* @param voteAverageGte
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover voteAverageGte(float voteAverageGte) {
|
|
||||||
if (voteAverageGte > 0) {
|
|
||||||
params.put(PARAM_VOTE_AVERAGE_GTE, String.valueOf(voteAverageGte));
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only include movies with the specified genres.
|
|
||||||
* <p/>
|
|
||||||
* Expected value is an integer (the id of a genre).
|
|
||||||
* <p/>
|
|
||||||
* Multiple values can be specified.
|
|
||||||
* <p/>
|
|
||||||
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'
|
|
||||||
*
|
|
||||||
* @param withGenres
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover withGenres(String withGenres) {
|
|
||||||
if (StringUtils.isNotBlank(withGenres)) {
|
|
||||||
params.put(PARAM_WITH_GENRES, withGenres);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The minimum release to include.
|
|
||||||
* <p/>
|
|
||||||
* Expected format is YYYY-MM-DD.
|
|
||||||
*
|
|
||||||
* @param releaseDateGte
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover releaseDateGte(String releaseDateGte) {
|
|
||||||
if (StringUtils.isNotBlank(releaseDateGte)) {
|
|
||||||
params.put(PARAM_RELEASE_DATE_GTE, releaseDateGte);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum release to include.
|
|
||||||
* <p/>
|
|
||||||
* Expected format is YYYY-MM-DD.
|
|
||||||
*
|
|
||||||
* @param releaseDateLte
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover releaseDateLte(String releaseDateLte) {
|
|
||||||
if (StringUtils.isNotBlank(releaseDateLte)) {
|
|
||||||
params.put(PARAM_RELEASE_DATE_LTE, releaseDateLte);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only include movies with certifications for a specific country.
|
|
||||||
* <p/>
|
|
||||||
* When this value is specified, 'certificationLte' is required.
|
|
||||||
* <p/>
|
|
||||||
* A ISO 3166-1 is expected
|
|
||||||
*
|
|
||||||
* @param certificationCountry
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover certificationCountry(String certificationCountry) {
|
|
||||||
if (StringUtils.isNotBlank(certificationCountry)) {
|
|
||||||
params.put(PARAM_CERTIFICATION_COUNTRY, certificationCountry);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only include movies with this certification and lower.
|
|
||||||
* <p/>
|
|
||||||
* Expected value is a valid certification for the specified 'certificationCountry'.
|
|
||||||
*
|
|
||||||
* @param certificationLte
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover certificationLte(String certificationLte) {
|
|
||||||
if (StringUtils.isNotBlank(certificationLte)) {
|
|
||||||
params.put(PARAM_CERTIFICATION_LTE, certificationLte);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter movies to include a specific company.
|
|
||||||
* <p/>
|
|
||||||
* Expected value is an integer (the id of a company).
|
|
||||||
* <p/>
|
|
||||||
* They can be comma separated to indicate an 'AND' query
|
|
||||||
*
|
|
||||||
* @param withCompanies
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Discover withCompanies(String withCompanies) {
|
|
||||||
if (StringUtils.isNotBlank(withCompanies)) {
|
|
||||||
params.put(PARAM_WITH_COMPANIES, withCompanies);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* check the year is between the min and max
|
|
||||||
*
|
|
||||||
* @param year
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean checkYear(int year) {
|
|
||||||
return year >= YEAR_MIN && year <= YEAR_MAX;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,138 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class KeywordMovie extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private String id;
|
|
||||||
@JsonProperty("backdrop_path")
|
|
||||||
private String backdropPath;
|
|
||||||
@JsonProperty("original_title")
|
|
||||||
private String originalTitle;
|
|
||||||
@JsonProperty("release_date")
|
|
||||||
private String releaseDate;
|
|
||||||
@JsonProperty("poster_path")
|
|
||||||
private String posterPath;
|
|
||||||
@JsonProperty("title")
|
|
||||||
private String title;
|
|
||||||
@JsonProperty("vote_average")
|
|
||||||
private float voteAverage;
|
|
||||||
@JsonProperty("vote_count")
|
|
||||||
private double voteCount;
|
|
||||||
@JsonProperty("adult")
|
|
||||||
private boolean adult;
|
|
||||||
@JsonProperty("popularity")
|
|
||||||
private float popularity;
|
|
||||||
|
|
||||||
public static long getSerialVersionUID() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBackdropPath() {
|
|
||||||
return backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOriginalTitle() {
|
|
||||||
return originalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReleaseDate() {
|
|
||||||
return releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getVoteAverage() {
|
|
||||||
return voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getVoteCount() {
|
|
||||||
return voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAdult() {
|
|
||||||
return adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPopularity() {
|
|
||||||
return popularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackdropPath(String backdropPath) {
|
|
||||||
this.backdropPath = backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOriginalTitle(String originalTitle) {
|
|
||||||
this.originalTitle = originalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleaseDate(String releaseDate) {
|
|
||||||
this.releaseDate = releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteAverage(float voteAverage) {
|
|
||||||
this.voteAverage = voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteCount(double voteCount) {
|
|
||||||
this.voteCount = voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdult(boolean adult) {
|
|
||||||
this.adult = adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPopularity(float popularity) {
|
|
||||||
this.popularity = popularity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,425 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.wrapper.*;
|
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Movie Bean
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class MovieDb extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@JsonProperty("backdrop_path")
|
|
||||||
private String backdropPath;
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("original_title")
|
|
||||||
private String originalTitle;
|
|
||||||
@JsonProperty("popularity")
|
|
||||||
private float popularity;
|
|
||||||
@JsonProperty("poster_path")
|
|
||||||
private String posterPath;
|
|
||||||
@JsonProperty("release_date")
|
|
||||||
private String releaseDate;
|
|
||||||
@JsonProperty("title")
|
|
||||||
private String title;
|
|
||||||
@JsonProperty("adult")
|
|
||||||
private boolean adult;
|
|
||||||
@JsonProperty("belongs_to_collection")
|
|
||||||
private Collection belongsToCollection;
|
|
||||||
@JsonProperty("budget")
|
|
||||||
private long budget;
|
|
||||||
@JsonProperty("genres")
|
|
||||||
private List<Genre> genres;
|
|
||||||
@JsonProperty("homepage")
|
|
||||||
private String homepage;
|
|
||||||
@JsonProperty("imdb_id")
|
|
||||||
private String imdbID;
|
|
||||||
@JsonProperty("overview")
|
|
||||||
private String overview;
|
|
||||||
@JsonProperty("production_companies")
|
|
||||||
private List<ProductionCompany> productionCompanies;
|
|
||||||
@JsonProperty("production_countries")
|
|
||||||
private List<ProductionCountry> productionCountries;
|
|
||||||
@JsonProperty("revenue")
|
|
||||||
private long revenue;
|
|
||||||
@JsonProperty("runtime")
|
|
||||||
private int runtime;
|
|
||||||
@JsonProperty("spoken_languages")
|
|
||||||
private List<Language> spokenLanguages;
|
|
||||||
@JsonProperty("tagline")
|
|
||||||
private String tagline;
|
|
||||||
@JsonProperty("rating")
|
|
||||||
private float userRating;
|
|
||||||
@JsonProperty("vote_average")
|
|
||||||
private float voteAverage;
|
|
||||||
@JsonProperty("vote_count")
|
|
||||||
private int voteCount;
|
|
||||||
@JsonProperty("status")
|
|
||||||
private String status;
|
|
||||||
// AppendToResponse Properties
|
|
||||||
@JsonProperty("alternative_titles")
|
|
||||||
private WrapperAlternativeTitles alternativeTitles;
|
|
||||||
@JsonProperty("casts")
|
|
||||||
private WrapperMovieCasts casts;
|
|
||||||
@JsonProperty("images")
|
|
||||||
private WrapperImages images;
|
|
||||||
@JsonProperty("keywords")
|
|
||||||
private WrapperMovieKeywords keywords;
|
|
||||||
@JsonProperty("releases")
|
|
||||||
private WrapperReleaseInfo releases;
|
|
||||||
@JsonProperty("videos")
|
|
||||||
private WrapperTrailers trailers;
|
|
||||||
@JsonProperty("translations")
|
|
||||||
private WrapperTranslations translations;
|
|
||||||
@JsonProperty("similar_movies")
|
|
||||||
private WrapperMovie similarMovies;
|
|
||||||
@JsonProperty("reviews")
|
|
||||||
private WrapperReviews reviews;
|
|
||||||
@JsonProperty("lists")
|
|
||||||
private WrapperMovieList lists;
|
|
||||||
@JsonProperty("video")
|
|
||||||
private Boolean video = null;
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getBackdropPath() {
|
|
||||||
return backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOriginalTitle() {
|
|
||||||
return originalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPopularity() {
|
|
||||||
return popularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReleaseDate() {
|
|
||||||
return releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAdult() {
|
|
||||||
return adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection getBelongsToCollection() {
|
|
||||||
return belongsToCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getBudget() {
|
|
||||||
return budget;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Genre> getGenres() {
|
|
||||||
return genres;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHomepage() {
|
|
||||||
return homepage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImdbID() {
|
|
||||||
return imdbID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOverview() {
|
|
||||||
return overview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ProductionCompany> getProductionCompanies() {
|
|
||||||
return productionCompanies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ProductionCountry> getProductionCountries() {
|
|
||||||
return productionCountries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getRevenue() {
|
|
||||||
return revenue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRuntime() {
|
|
||||||
return runtime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Language> getSpokenLanguages() {
|
|
||||||
return spokenLanguages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTagline() {
|
|
||||||
return tagline;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getVoteAverage() {
|
|
||||||
return voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVoteCount() {
|
|
||||||
return voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getUserRating() {
|
|
||||||
return userRating;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getVideo() {
|
|
||||||
return video;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setBackdropPath(String backdropPath) {
|
|
||||||
this.backdropPath = backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOriginalTitle(String originalTitle) {
|
|
||||||
this.originalTitle = originalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPopularity(float popularity) {
|
|
||||||
this.popularity = popularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleaseDate(String releaseDate) {
|
|
||||||
this.releaseDate = releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdult(boolean adult) {
|
|
||||||
this.adult = adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBelongsToCollection(Collection belongsToCollection) {
|
|
||||||
this.belongsToCollection = belongsToCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBudget(long budget) {
|
|
||||||
this.budget = budget;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGenres(List<Genre> genres) {
|
|
||||||
this.genres = genres;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHomepage(String homepage) {
|
|
||||||
this.homepage = homepage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImdbID(String imdbID) {
|
|
||||||
this.imdbID = imdbID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOverview(String overview) {
|
|
||||||
this.overview = overview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
|
|
||||||
this.productionCompanies = productionCompanies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductionCountries(List<ProductionCountry> productionCountries) {
|
|
||||||
this.productionCountries = productionCountries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRevenue(long revenue) {
|
|
||||||
this.revenue = revenue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRuntime(int runtime) {
|
|
||||||
this.runtime = runtime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpokenLanguages(List<Language> spokenLanguages) {
|
|
||||||
this.spokenLanguages = spokenLanguages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTagline(String tagline) {
|
|
||||||
this.tagline = tagline;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteAverage(float voteAverage) {
|
|
||||||
this.voteAverage = voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteCount(int voteCount) {
|
|
||||||
this.voteCount = voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserRating(float userRating) {
|
|
||||||
this.userRating = userRating;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVideo(Boolean video) {
|
|
||||||
this.video = video;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="AppendToResponse Getters">
|
|
||||||
public List<AlternativeTitle> getAlternativeTitles() {
|
|
||||||
return alternativeTitles.getTitles();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PersonCast> getCast() {
|
|
||||||
return casts.getCast();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PersonCrew> getCrew() {
|
|
||||||
return casts.getCrew();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Artwork> getImages() {
|
|
||||||
return images.getAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Keyword> getKeywords() {
|
|
||||||
return keywords.getKeywords();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReleaseInfo> getReleases() {
|
|
||||||
return releases.getCountries();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Trailer> getTrailers() {
|
|
||||||
return trailers.getTrailers();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Translation> getTranslations() {
|
|
||||||
return translations.getTranslations();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MovieDb> getSimilarMovies() {
|
|
||||||
return similarMovies.getMovies();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MovieList> getLists() {
|
|
||||||
return lists.getMovieList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Reviews> getReviews() {
|
|
||||||
return reviews.getReviews();
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="AppendToResponse Setters">
|
|
||||||
public void setAlternativeTitles(WrapperAlternativeTitles alternativeTitles) {
|
|
||||||
this.alternativeTitles = alternativeTitles;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCasts(WrapperMovieCasts casts) {
|
|
||||||
this.casts = casts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImages(WrapperImages images) {
|
|
||||||
this.images = images;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeywords(WrapperMovieKeywords keywords) {
|
|
||||||
this.keywords = keywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleases(WrapperReleaseInfo releases) {
|
|
||||||
this.releases = releases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTrailers(WrapperTrailers trailers) {
|
|
||||||
this.trailers = trailers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTranslations(WrapperTranslations translations) {
|
|
||||||
this.translations = translations;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSimilarMovies(WrapperMovie similarMovies) {
|
|
||||||
this.similarMovies = similarMovies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLists(WrapperMovieList lists) {
|
|
||||||
this.lists = lists;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReviews(WrapperReviews reviews) {
|
|
||||||
this.reviews = reviews;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof MovieDb) {
|
|
||||||
final MovieDb other = (MovieDb) obj;
|
|
||||||
return new EqualsBuilder()
|
|
||||||
.append(id, other.id)
|
|
||||||
.append(imdbID, other.imdbID)
|
|
||||||
.append(runtime, other.runtime)
|
|
||||||
.isEquals();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return new HashCodeBuilder()
|
|
||||||
.append(id)
|
|
||||||
.append(imdbID)
|
|
||||||
.append(runtime)
|
|
||||||
.toHashCode();
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
}
|
|
||||||
@ -1,143 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for the MovieDbList function
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class MovieDbList extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
@JsonProperty("id")
|
|
||||||
private String id;
|
|
||||||
@JsonProperty("created_by")
|
|
||||||
private String createdBy;
|
|
||||||
@JsonProperty("description")
|
|
||||||
private String description;
|
|
||||||
@JsonProperty("favorite_count")
|
|
||||||
private int favoriteCount;
|
|
||||||
@JsonProperty("items")
|
|
||||||
private List<MovieDb> items = Collections.emptyList();
|
|
||||||
@JsonProperty("item_count")
|
|
||||||
private int itemCount;
|
|
||||||
@JsonProperty("iso_639_1")
|
|
||||||
private String language;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
@JsonProperty("poster_path")
|
|
||||||
private String posterPath;
|
|
||||||
@JsonProperty("status_code")
|
|
||||||
private String statusCode;
|
|
||||||
@JsonProperty("status_message")
|
|
||||||
private String statusMessage;
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreatedBy() {
|
|
||||||
return createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFavoriteCount() {
|
|
||||||
return favoriteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MovieDb> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getItemCount() {
|
|
||||||
return itemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatusCode() {
|
|
||||||
return statusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatusMessage() {
|
|
||||||
return statusMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy) {
|
|
||||||
this.createdBy = createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFavoriteCount(int favoriteCount) {
|
|
||||||
this.favoriteCount = favoriteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItems(List<MovieDb> items) {
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemCount(int itemCount) {
|
|
||||||
this.itemCount = itemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatusCode(String statusCode) {
|
|
||||||
this.statusCode = statusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatusMessage(String statusMessage) {
|
|
||||||
this.statusMessage = statusMessage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation;private either version 3 of the License;private or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful;private
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not;private see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
public class MovieDbListStatus extends StatusCode {
|
|
||||||
|
|
||||||
@JsonProperty("list_id")
|
|
||||||
private String listId;
|
|
||||||
|
|
||||||
public String getListId() {
|
|
||||||
return listId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListId(String listId) {
|
|
||||||
this.listId = listId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,111 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class MovieList extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@JsonProperty("description")
|
|
||||||
private String description;
|
|
||||||
@JsonProperty("favorite_count")
|
|
||||||
private int favoriteCount;
|
|
||||||
@JsonProperty("id")
|
|
||||||
private String id;
|
|
||||||
@JsonProperty("item_count")
|
|
||||||
private int itemCount;
|
|
||||||
@JsonProperty("iso_639_1")
|
|
||||||
private String language;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
@JsonProperty("poster_path")
|
|
||||||
private String posterPath;
|
|
||||||
@JsonProperty("list_type")
|
|
||||||
private String listType;
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFavoriteCount() {
|
|
||||||
return favoriteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getItemCount() {
|
|
||||||
return itemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getListType() {
|
|
||||||
return listType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFavoriteCount(int favoriteCount) {
|
|
||||||
this.favoriteCount = favoriteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemCount(int itemCount) {
|
|
||||||
this.itemCount = itemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListType(String listType) {
|
|
||||||
this.listType = listType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,296 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class Person extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Static fields for default cast information
|
|
||||||
*/
|
|
||||||
private static final String CAST_DEPARTMENT = "acting";
|
|
||||||
private static final String CAST_JOB = "actor";
|
|
||||||
private static final String DEFAULT_STRING = "";
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id = -1;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name = "";
|
|
||||||
@JsonProperty("profile_path")
|
|
||||||
private String profilePath = DEFAULT_STRING;
|
|
||||||
private PersonType personType = PersonType.PERSON;
|
|
||||||
// Crew
|
|
||||||
private String department = DEFAULT_STRING;
|
|
||||||
// Crew
|
|
||||||
private String job = DEFAULT_STRING;
|
|
||||||
// Cast
|
|
||||||
private String character = DEFAULT_STRING;
|
|
||||||
// Cast
|
|
||||||
private int order = -1;
|
|
||||||
@JsonProperty("adult")
|
|
||||||
// Person info
|
|
||||||
private boolean adult = false;
|
|
||||||
@JsonProperty("also_known_as")
|
|
||||||
private List<String> aka = new ArrayList<String>();
|
|
||||||
@JsonProperty("biography")
|
|
||||||
private String biography = DEFAULT_STRING;
|
|
||||||
@JsonProperty("birthday")
|
|
||||||
private String birthday = DEFAULT_STRING;
|
|
||||||
@JsonProperty("deathday")
|
|
||||||
private String deathday = DEFAULT_STRING;
|
|
||||||
@JsonProperty("homepage")
|
|
||||||
private String homepage = DEFAULT_STRING;
|
|
||||||
@JsonProperty("place_of_birth")
|
|
||||||
private String birthplace = DEFAULT_STRING;
|
|
||||||
@JsonProperty("imdb_id")
|
|
||||||
private String imdbId = DEFAULT_STRING;
|
|
||||||
@JsonProperty("popularity")
|
|
||||||
private float popularity = 0.0f;
|
|
||||||
@JsonProperty("known_for")
|
|
||||||
private List<PersonCredit> knownFor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a crew member
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param name
|
|
||||||
* @param profilePath
|
|
||||||
* @param department
|
|
||||||
* @param job
|
|
||||||
*/
|
|
||||||
public void addCrew(int id, String name, String profilePath, String department, String job) {
|
|
||||||
setPersonType(PersonType.CREW);
|
|
||||||
setId(id);
|
|
||||||
setName(name);
|
|
||||||
setProfilePath(profilePath);
|
|
||||||
setDepartment(department);
|
|
||||||
setJob(job);
|
|
||||||
setCharacter("");
|
|
||||||
setOrder(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a cast member
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param name
|
|
||||||
* @param profilePath
|
|
||||||
* @param character
|
|
||||||
* @param order
|
|
||||||
*/
|
|
||||||
public void addCast(int id, String name, String profilePath, String character, int order) {
|
|
||||||
setPersonType(PersonType.CAST);
|
|
||||||
setId(id);
|
|
||||||
setName(name);
|
|
||||||
setProfilePath(profilePath);
|
|
||||||
setCharacter(character);
|
|
||||||
setOrder(order);
|
|
||||||
setDepartment(CAST_DEPARTMENT);
|
|
||||||
setJob(CAST_JOB);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCharacter() {
|
|
||||||
return character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDepartment() {
|
|
||||||
return department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJob() {
|
|
||||||
return job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrder() {
|
|
||||||
return order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PersonType getPersonType() {
|
|
||||||
return personType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProfilePath() {
|
|
||||||
return profilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAdult() {
|
|
||||||
return adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAka() {
|
|
||||||
return aka;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBiography() {
|
|
||||||
return biography;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBirthday() {
|
|
||||||
return birthday;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBirthplace() {
|
|
||||||
return birthplace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeathday() {
|
|
||||||
return deathday;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHomepage() {
|
|
||||||
return homepage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImdbId() {
|
|
||||||
return imdbId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPopularity() {
|
|
||||||
return popularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCharacter(String character) {
|
|
||||||
this.character = character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartment(String department) {
|
|
||||||
this.department = department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJob(String job) {
|
|
||||||
this.job = StringUtils.trimToEmpty(job);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = StringUtils.trimToEmpty(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrder(int order) {
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPersonType(PersonType personType) {
|
|
||||||
this.personType = personType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProfilePath(String profilePath) {
|
|
||||||
this.profilePath = StringUtils.trimToEmpty(profilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdult(boolean adult) {
|
|
||||||
this.adult = adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAka(List<String> aka) {
|
|
||||||
this.aka = aka;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBiography(String biography) {
|
|
||||||
this.biography = StringUtils.trimToEmpty(biography);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBirthday(String birthday) {
|
|
||||||
this.birthday = StringUtils.trimToEmpty(birthday);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBirthplace(String birthplace) {
|
|
||||||
this.birthplace = StringUtils.trimToEmpty(birthplace);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeathday(String deathday) {
|
|
||||||
this.deathday = StringUtils.trimToEmpty(deathday);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHomepage(String homepage) {
|
|
||||||
this.homepage = StringUtils.trimToEmpty(homepage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImdbId(String imdbId) {
|
|
||||||
this.imdbId = StringUtils.trimToEmpty(imdbId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPopularity(float popularity) {
|
|
||||||
this.popularity = popularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PersonCredit> getKnownFor() {
|
|
||||||
return knownFor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKnownFor(List<PersonCredit> knownFor) {
|
|
||||||
this.knownFor = knownFor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof Person) {
|
|
||||||
final Person other = (Person) obj;
|
|
||||||
return new EqualsBuilder()
|
|
||||||
.append(id, other.id)
|
|
||||||
.append(name, other.name)
|
|
||||||
.append(profilePath, other.profilePath)
|
|
||||||
.append(personType, other.personType)
|
|
||||||
.append(department, other.department)
|
|
||||||
.append(job, other.job)
|
|
||||||
.append(character, other.character)
|
|
||||||
.isEquals();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return new HashCodeBuilder()
|
|
||||||
.append(id)
|
|
||||||
.append(name)
|
|
||||||
.append(profilePath)
|
|
||||||
.append(personType)
|
|
||||||
.append(department)
|
|
||||||
.append(job)
|
|
||||||
.append(character)
|
|
||||||
.toHashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,134 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class PersonCast extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("character")
|
|
||||||
private String character;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
@JsonProperty("order")
|
|
||||||
private int order;
|
|
||||||
@JsonProperty("profile_path")
|
|
||||||
private String profilePath;
|
|
||||||
@JsonProperty("cast_id")
|
|
||||||
private int castId;
|
|
||||||
@JsonProperty("credit_id")
|
|
||||||
private String creditId;
|
|
||||||
|
|
||||||
public String getCharacter() {
|
|
||||||
return character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrder() {
|
|
||||||
return order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProfilePath() {
|
|
||||||
return profilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCastId() {
|
|
||||||
return castId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCharacter(String character) {
|
|
||||||
this.character = StringUtils.trimToEmpty(character);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = StringUtils.trimToEmpty(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrder(int order) {
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProfilePath(String profilePath) {
|
|
||||||
this.profilePath = StringUtils.trimToEmpty(profilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCastId(int castId) {
|
|
||||||
this.castId = castId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreditId() {
|
|
||||||
return creditId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreditId(String creditId) {
|
|
||||||
this.creditId = creditId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof PersonCast) {
|
|
||||||
final PersonCast other = (PersonCast) obj;
|
|
||||||
return new EqualsBuilder()
|
|
||||||
.append(id, other.id)
|
|
||||||
.append(name, other.name)
|
|
||||||
.append(character, other.character)
|
|
||||||
.append(order, other.order)
|
|
||||||
.append(profilePath, other.profilePath)
|
|
||||||
.isEquals();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return new HashCodeBuilder()
|
|
||||||
.append(id)
|
|
||||||
.append(character)
|
|
||||||
.append(name)
|
|
||||||
.append(order)
|
|
||||||
.append(profilePath)
|
|
||||||
.toHashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,194 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class PersonCredit extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private static final String DEFAULT_STRING = "";
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int movieId = 0;
|
|
||||||
@JsonProperty("character")
|
|
||||||
private String character = DEFAULT_STRING;
|
|
||||||
@JsonProperty("original_title")
|
|
||||||
private String movieOriginalTitle = DEFAULT_STRING;
|
|
||||||
@JsonProperty("poster_path")
|
|
||||||
private String posterPath = DEFAULT_STRING;
|
|
||||||
@JsonProperty("backdrop_path")
|
|
||||||
private String backdropPath = DEFAULT_STRING;
|
|
||||||
@JsonProperty("release_date")
|
|
||||||
private String releaseDate = DEFAULT_STRING;
|
|
||||||
@JsonProperty("title")
|
|
||||||
private String movieTitle = DEFAULT_STRING;
|
|
||||||
@JsonProperty("department")
|
|
||||||
private String department = DEFAULT_STRING;
|
|
||||||
@JsonProperty("job")
|
|
||||||
private String job = DEFAULT_STRING;
|
|
||||||
@JsonProperty("adult")
|
|
||||||
private String adult = DEFAULT_STRING;
|
|
||||||
@JsonProperty("credit_id")
|
|
||||||
private String creditId = DEFAULT_STRING;
|
|
||||||
private PersonType personType = PersonType.PERSON;
|
|
||||||
@JsonProperty("popularity")
|
|
||||||
private float popularity;
|
|
||||||
@JsonProperty("vote_average")
|
|
||||||
private float voteAverage;
|
|
||||||
@JsonProperty("vote_count")
|
|
||||||
private int voteCount;
|
|
||||||
@JsonProperty("media_type")
|
|
||||||
private String mediaType;
|
|
||||||
|
|
||||||
public String getCharacter() {
|
|
||||||
return character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDepartment() {
|
|
||||||
return department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJob() {
|
|
||||||
return job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMovieId() {
|
|
||||||
return movieId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMovieOriginalTitle() {
|
|
||||||
return movieOriginalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMovieTitle() {
|
|
||||||
return movieTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PersonType getPersonType() {
|
|
||||||
return personType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReleaseDate() {
|
|
||||||
return releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAdult() {
|
|
||||||
return adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreditId() {
|
|
||||||
return creditId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCharacter(String character) {
|
|
||||||
this.character = StringUtils.trimToEmpty(character);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartment(String department) {
|
|
||||||
this.department = StringUtils.trimToEmpty(department);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJob(String job) {
|
|
||||||
this.job = StringUtils.trimToEmpty(job);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMovieId(int movieId) {
|
|
||||||
this.movieId = movieId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMovieOriginalTitle(String movieOriginalTitle) {
|
|
||||||
this.movieOriginalTitle = StringUtils.trimToEmpty(movieOriginalTitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMovieTitle(String movieTitle) {
|
|
||||||
this.movieTitle = StringUtils.trimToEmpty(movieTitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPersonType(PersonType personType) {
|
|
||||||
this.personType = personType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = StringUtils.trimToEmpty(posterPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleaseDate(String releaseDate) {
|
|
||||||
this.releaseDate = StringUtils.trimToEmpty(releaseDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdult(String adult) {
|
|
||||||
this.adult = StringUtils.trimToEmpty(adult);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreditId(String creditId) {
|
|
||||||
this.creditId = creditId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBackdropPath() {
|
|
||||||
return backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackdropPath(String backdropPath) {
|
|
||||||
this.backdropPath = backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPopularity() {
|
|
||||||
return popularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPopularity(float popularity) {
|
|
||||||
this.popularity = popularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getVoteAverage() {
|
|
||||||
return voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteAverage(float voteAverage) {
|
|
||||||
this.voteAverage = voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVoteCount() {
|
|
||||||
return voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteCount(int voteCount) {
|
|
||||||
this.voteCount = voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMediaType() {
|
|
||||||
return mediaType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMediaType(String mediaType) {
|
|
||||||
this.mediaType = mediaType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class PersonCrew extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("department")
|
|
||||||
private String department;
|
|
||||||
@JsonProperty("job")
|
|
||||||
private String job;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
@JsonProperty("profile_path")
|
|
||||||
private String profilePath;
|
|
||||||
@JsonProperty("credit_id")
|
|
||||||
private String creditId;
|
|
||||||
|
|
||||||
public String getDepartment() {
|
|
||||||
return department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJob() {
|
|
||||||
return job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProfilePath() {
|
|
||||||
return profilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreditId() {
|
|
||||||
return creditId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreditId(String creditId) {
|
|
||||||
this.creditId = creditId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartment(String department) {
|
|
||||||
this.department = StringUtils.trimToEmpty(department);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJob(String job) {
|
|
||||||
this.job = StringUtils.trimToEmpty(job);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = StringUtils.trimToEmpty(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProfilePath(String profilePath) {
|
|
||||||
this.profilePath = StringUtils.trimToEmpty(profilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof PersonCrew) {
|
|
||||||
final PersonCrew other = (PersonCrew) obj;
|
|
||||||
return new EqualsBuilder()
|
|
||||||
.append(id, other.id)
|
|
||||||
.append(name, other.name)
|
|
||||||
.append(department, other.department)
|
|
||||||
.append(job, other.job)
|
|
||||||
.isEquals();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return new HashCodeBuilder()
|
|
||||||
.append(id)
|
|
||||||
.append(department)
|
|
||||||
.append(job)
|
|
||||||
.append(name)
|
|
||||||
.append(profilePath)
|
|
||||||
.toHashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public enum PersonType {
|
|
||||||
|
|
||||||
// A member of the cast
|
|
||||||
CAST,
|
|
||||||
// A member of the crew
|
|
||||||
CREW,
|
|
||||||
// No specific type
|
|
||||||
PERSON
|
|
||||||
}
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class Reviews extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private String id;
|
|
||||||
@JsonProperty("author")
|
|
||||||
private String author;
|
|
||||||
@JsonProperty("content")
|
|
||||||
private String content;
|
|
||||||
@JsonProperty("url")
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthor() {
|
|
||||||
return author;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthor(String author) {
|
|
||||||
this.author = author;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,183 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.model;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class TmdbConfiguration extends AbstractJsonMapping {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("base_url")
|
|
||||||
private String baseUrl;
|
|
||||||
@JsonProperty("secure_base_url")
|
|
||||||
private String secureBaseUrl;
|
|
||||||
@JsonProperty("poster_sizes")
|
|
||||||
private List<String> posterSizes;
|
|
||||||
@JsonProperty("backdrop_sizes")
|
|
||||||
private List<String> backdropSizes;
|
|
||||||
@JsonProperty("profile_sizes")
|
|
||||||
private List<String> profileSizes;
|
|
||||||
@JsonProperty("logo_sizes")
|
|
||||||
private List<String> logoSizes;
|
|
||||||
@JsonProperty("still_sizes")
|
|
||||||
private List<String> stillSizes;
|
|
||||||
|
|
||||||
public List<String> getBackdropSizes() {
|
|
||||||
return backdropSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBaseUrl() {
|
|
||||||
return baseUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getPosterSizes() {
|
|
||||||
return posterSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getProfileSizes() {
|
|
||||||
return profileSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getLogoSizes() {
|
|
||||||
return logoSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSecureBaseUrl() {
|
|
||||||
return secureBaseUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getStillSizes() {
|
|
||||||
return stillSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackdropSizes(List<String> backdropSizes) {
|
|
||||||
this.backdropSizes = backdropSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBaseUrl(String baseUrl) {
|
|
||||||
this.baseUrl = baseUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterSizes(List<String> posterSizes) {
|
|
||||||
this.posterSizes = posterSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProfileSizes(List<String> profileSizes) {
|
|
||||||
this.profileSizes = profileSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLogoSizes(List<String> logoSizes) {
|
|
||||||
this.logoSizes = logoSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecureBaseUrl(String secureBaseUrl) {
|
|
||||||
this.secureBaseUrl = secureBaseUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStillSizes(List<String> stillSizes) {
|
|
||||||
this.stillSizes = stillSizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy the data from the passed object to this one
|
|
||||||
*
|
|
||||||
* @param config
|
|
||||||
*/
|
|
||||||
public void clone(TmdbConfiguration config) {
|
|
||||||
backdropSizes = config.getBackdropSizes();
|
|
||||||
baseUrl = config.getBaseUrl();
|
|
||||||
posterSizes = config.getPosterSizes();
|
|
||||||
profileSizes = config.getProfileSizes();
|
|
||||||
logoSizes = config.getLogoSizes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check that the poster size is valid
|
|
||||||
*
|
|
||||||
* @param posterSize
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isValidPosterSize(String posterSize) {
|
|
||||||
if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return posterSizes.contains(posterSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check that the backdrop size is valid
|
|
||||||
*
|
|
||||||
* @param backdropSize
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isValidBackdropSize(String backdropSize) {
|
|
||||||
if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return backdropSizes.contains(backdropSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check that the profile size is valid
|
|
||||||
*
|
|
||||||
* @param profileSize
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isValidProfileSize(String profileSize) {
|
|
||||||
if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return profileSizes.contains(profileSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check that the logo size is valid
|
|
||||||
*
|
|
||||||
* @param logoSize
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isValidLogoSize(String logoSize) {
|
|
||||||
if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return logoSizes.contains(logoSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check to see if the size is valid for any of the images types
|
|
||||||
*
|
|
||||||
* @param sizeToCheck
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isValidSize(String sizeToCheck) {
|
|
||||||
return isValidPosterSize(sizeToCheck)
|
|
||||||
|| isValidBackdropSize(sizeToCheck)
|
|
||||||
|| isValidProfileSize(sizeToCheck)
|
|
||||||
|| isValidLogoSize(sizeToCheck);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,257 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.tools;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The API URL that is used to construct the API call
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class ApiUrl {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ApiUrl.class);
|
|
||||||
/*
|
|
||||||
* TheMovieDbApi API Base URL
|
|
||||||
*/
|
|
||||||
private static final String TMDB_API_BASE = "http://api.themoviedb.org/3/";
|
|
||||||
/*
|
|
||||||
* Parameter configuration
|
|
||||||
*/
|
|
||||||
private static final String DELIMITER_FIRST = "?";
|
|
||||||
private static final String DELIMITER_SUBSEQUENT = "&";
|
|
||||||
private static final String DEFAULT_STRING = "";
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
private final String apiKey;
|
|
||||||
private final String method;
|
|
||||||
private final String submethod;
|
|
||||||
private final Map<String, String> arguments = new HashMap<String, String>();
|
|
||||||
/*
|
|
||||||
* API Parameters
|
|
||||||
*/
|
|
||||||
public static final String PARAM_ADULT = "include_adult=";
|
|
||||||
public static final String PARAM_API_KEY = "api_key=";
|
|
||||||
public static final String PARAM_COUNTRY = "country=";
|
|
||||||
public static final String PARAM_FAVORITE = "favorite=";
|
|
||||||
public static final String PARAM_ID = "id=";
|
|
||||||
public static final String PARAM_LANGUAGE = "language=";
|
|
||||||
public static final String PARAM_INCLUDE_ALL_MOVIES = "include_all_movies=";
|
|
||||||
public static final String PARAM_MOVIE_WATCHLIST = "movie_watchlist=";
|
|
||||||
public static final String PARAM_PAGE = "page=";
|
|
||||||
public static final String PARAM_QUERY = "query=";
|
|
||||||
public static final String PARAM_SESSION = "session_id=";
|
|
||||||
public static final String PARAM_TOKEN = "request_token=";
|
|
||||||
public static final String PARAM_VALUE = "value=";
|
|
||||||
public static final String PARAM_YEAR = "year=";
|
|
||||||
public static final String PARAM_START_DATE = "start_date=";
|
|
||||||
public static final String PARAM_END_DATE = "end_date=";
|
|
||||||
private static final String APPEND_TO_RESPONSE = "append_to_response=";
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Constructor Methods">
|
|
||||||
/**
|
|
||||||
* Constructor for the simple API URL method without a sub-method
|
|
||||||
*
|
|
||||||
* @param apiKey
|
|
||||||
* @param method
|
|
||||||
*/
|
|
||||||
public ApiUrl(String apiKey, String method) {
|
|
||||||
this.apiKey = apiKey;
|
|
||||||
this.method = method;
|
|
||||||
this.submethod = DEFAULT_STRING;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for the API URL with a sub-method
|
|
||||||
*
|
|
||||||
* @param apiKey
|
|
||||||
* @param method
|
|
||||||
* @param submethod
|
|
||||||
*/
|
|
||||||
public ApiUrl(String apiKey, String method, String submethod) {
|
|
||||||
this.apiKey = apiKey;
|
|
||||||
this.method = method;
|
|
||||||
this.submethod = submethod;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build the URL from the pre-created arguments.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public URL buildUrl() {
|
|
||||||
StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
|
|
||||||
|
|
||||||
// Get the start of the URL
|
|
||||||
urlString.append(method);
|
|
||||||
|
|
||||||
// We have either a queury, or a direct request
|
|
||||||
if (arguments.containsKey(PARAM_QUERY)) {
|
|
||||||
// Append the suffix of the API URL
|
|
||||||
if (StringUtils.endsWith(urlString, "/") && submethod.startsWith("/")) {
|
|
||||||
urlString.deleteCharAt(urlString.length() - 1);
|
|
||||||
}
|
|
||||||
urlString.append(submethod);
|
|
||||||
|
|
||||||
// Append the key information
|
|
||||||
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
|
|
||||||
urlString.append(apiKey);
|
|
||||||
|
|
||||||
// Append the search term
|
|
||||||
urlString.append(DELIMITER_SUBSEQUENT);
|
|
||||||
urlString.append(PARAM_QUERY);
|
|
||||||
|
|
||||||
String query = arguments.get(PARAM_QUERY);
|
|
||||||
|
|
||||||
try {
|
|
||||||
urlString.append(URLEncoder.encode(query, "UTF-8"));
|
|
||||||
} catch (UnsupportedEncodingException ex) {
|
|
||||||
LOG.trace("Unable to encode query: '{}' trying raw.", query, ex);
|
|
||||||
// If we can't encode it, try it raw
|
|
||||||
urlString.append(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the query from the arguments so it is not added later
|
|
||||||
arguments.remove(PARAM_QUERY);
|
|
||||||
} else {
|
|
||||||
// Append the ID if provided
|
|
||||||
if (arguments.containsKey(PARAM_ID)) {
|
|
||||||
urlString.append(arguments.get(PARAM_ID));
|
|
||||||
arguments.remove(PARAM_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append the suffix of the API URL
|
|
||||||
if (StringUtils.endsWith(urlString, "/") && submethod.startsWith("/")) {
|
|
||||||
urlString.deleteCharAt(urlString.length() - 1);
|
|
||||||
}
|
|
||||||
urlString.append(submethod);
|
|
||||||
|
|
||||||
// Append the key information
|
|
||||||
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
|
|
||||||
urlString.append(apiKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Map.Entry<String, String> argEntry : arguments.entrySet()) {
|
|
||||||
urlString.append(DELIMITER_SUBSEQUENT).append(argEntry.getKey());
|
|
||||||
urlString.append(argEntry.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
LOG.trace("URL: {}", urlString.toString());
|
|
||||||
return new URL(urlString.toString());
|
|
||||||
} catch (MalformedURLException ex) {
|
|
||||||
LOG.warn("Failed to create URL {} - {}", urlString.toString(), ex.toString());
|
|
||||||
return null;
|
|
||||||
} finally {
|
|
||||||
arguments.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add arguments individually
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public void addArgument(String key, String value) {
|
|
||||||
arguments.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add arguments individually
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public void addArgument(String key, int value) {
|
|
||||||
arguments.put(key, Integer.toString(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add arguments individually
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public void addArgument(String key, boolean value) {
|
|
||||||
arguments.put(key, Boolean.toString(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add arguments individually
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public void addArgument(String key, float value) {
|
|
||||||
arguments.put(key, Float.toString(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the arguments
|
|
||||||
*/
|
|
||||||
public void clearArguments() {
|
|
||||||
arguments.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the arguments directly
|
|
||||||
*
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public void setArguments(Map<String, String> args) {
|
|
||||||
arguments.putAll(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Append any optional parameters to the URL
|
|
||||||
*
|
|
||||||
* @param appendToResponse
|
|
||||||
*/
|
|
||||||
public void appendToResponse(String[] appendToResponse) {
|
|
||||||
if (appendToResponse.length > 0) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
boolean first = Boolean.TRUE;
|
|
||||||
for (String append : appendToResponse) {
|
|
||||||
if (first) {
|
|
||||||
first = Boolean.FALSE;
|
|
||||||
} else {
|
|
||||||
sb.append(",");
|
|
||||||
}
|
|
||||||
sb.append(append);
|
|
||||||
}
|
|
||||||
addArgument(APPEND_TO_RESPONSE, sb.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,333 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.tools;
|
|
||||||
|
|
||||||
import com.omertron.themoviedbapi.MovieDbException;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLConnection;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.UnsupportedCharsetException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Web browser with simple cookies support
|
|
||||||
*/
|
|
||||||
public final class WebBrowser {
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(WebBrowser.class);
|
|
||||||
private static final Map<String, String> BROWSER_PROPERTIES = new HashMap<String, String>();
|
|
||||||
private static final Map<String, Map<String, String>> COOKIES = new HashMap<String, Map<String, String>>();
|
|
||||||
private static String proxyHost = null;
|
|
||||||
private static int proxyPort = 0;
|
|
||||||
private static String proxyUsername = null;
|
|
||||||
private static String proxyPassword = null;
|
|
||||||
private static String proxyEncodedPassword = null;
|
|
||||||
// 25 second timeout
|
|
||||||
private static int webTimeoutConnect = 25000;
|
|
||||||
// 90 second timeout
|
|
||||||
private static int webTimeoutRead = 90000;
|
|
||||||
|
|
||||||
// Hide the constructor
|
|
||||||
protected WebBrowser() {
|
|
||||||
// prevents calls from subclass
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Populate the browser properties
|
|
||||||
*/
|
|
||||||
private static void populateBrowserProperties() {
|
|
||||||
if (BROWSER_PROPERTIES.isEmpty()) {
|
|
||||||
BROWSER_PROPERTIES.put("User-Agent", "Mozilla/5.25 Netscape/5.0 (Windows; I; Win95)");
|
|
||||||
BROWSER_PROPERTIES.put("Accept", "application/json");
|
|
||||||
BROWSER_PROPERTIES.put("Content-type", "application/json");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String request(String url) throws MovieDbException {
|
|
||||||
try {
|
|
||||||
return request(new URL(url));
|
|
||||||
} catch (MalformedURLException ex) {
|
|
||||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, url, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static URLConnection openProxiedConnection(URL url) throws MovieDbException {
|
|
||||||
try {
|
|
||||||
if (proxyHost != null) {
|
|
||||||
System.getProperties().put("proxySet", "true");
|
|
||||||
System.getProperties().put("proxyHost", proxyHost);
|
|
||||||
System.getProperties().put("proxyPort", proxyPort);
|
|
||||||
}
|
|
||||||
|
|
||||||
URLConnection cnx = url.openConnection();
|
|
||||||
|
|
||||||
if (proxyUsername != null) {
|
|
||||||
cnx.setRequestProperty("Proxy-Authorization", proxyEncodedPassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cnx;
|
|
||||||
} catch (IOException ex) {
|
|
||||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, url, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String request(URL url) throws MovieDbException {
|
|
||||||
return request(url, null, Boolean.FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String request(URL url, String jsonBody) throws MovieDbException {
|
|
||||||
return request(url, jsonBody, Boolean.FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String request(URL url, String jsonBody, boolean isDeleteRequest) throws MovieDbException {
|
|
||||||
|
|
||||||
StringWriter content = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
content = new StringWriter();
|
|
||||||
|
|
||||||
BufferedReader in = null;
|
|
||||||
HttpURLConnection cnx = null;
|
|
||||||
OutputStreamWriter wr = null;
|
|
||||||
try {
|
|
||||||
cnx = (HttpURLConnection) openProxiedConnection(url);
|
|
||||||
|
|
||||||
// If we get a null connection, then throw an exception
|
|
||||||
if (cnx == null) {
|
|
||||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, "No HTTP connection could be made.", url);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDeleteRequest) {
|
|
||||||
cnx.setDoOutput(true);
|
|
||||||
cnx.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
|
||||||
cnx.setRequestMethod("DELETE");
|
|
||||||
}
|
|
||||||
|
|
||||||
sendHeader(cnx);
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(jsonBody)) {
|
|
||||||
cnx.setDoOutput(true);
|
|
||||||
wr = new OutputStreamWriter(cnx.getOutputStream());
|
|
||||||
wr.write(jsonBody);
|
|
||||||
}
|
|
||||||
|
|
||||||
readHeader(cnx);
|
|
||||||
|
|
||||||
// http://stackoverflow.com/questions/4633048/httpurlconnection-reading-response-content-on-403-error
|
|
||||||
if (cnx.getResponseCode() >= 400) {
|
|
||||||
in = new BufferedReader(new InputStreamReader(cnx.getErrorStream(), getCharset(cnx)));
|
|
||||||
} else {
|
|
||||||
in = new BufferedReader(new InputStreamReader(cnx.getInputStream(), getCharset(cnx)));
|
|
||||||
}
|
|
||||||
|
|
||||||
String line;
|
|
||||||
while ((line = in.readLine()) != null) {
|
|
||||||
content.write(line);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (wr != null) {
|
|
||||||
wr.flush();
|
|
||||||
wr.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (in != null) {
|
|
||||||
in.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cnx instanceof HttpURLConnection) {
|
|
||||||
((HttpURLConnection) cnx).disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return content.toString();
|
|
||||||
} catch (IOException ex) {
|
|
||||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, url, ex);
|
|
||||||
} finally {
|
|
||||||
if (content != null) {
|
|
||||||
try {
|
|
||||||
content.close();
|
|
||||||
} catch (IOException ex) {
|
|
||||||
LOG.debug("Failed to close connection: " + ex.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sendHeader(URLConnection cnx) {
|
|
||||||
populateBrowserProperties();
|
|
||||||
|
|
||||||
// send browser properties
|
|
||||||
for (Map.Entry<String, String> browserProperty : BROWSER_PROPERTIES.entrySet()) {
|
|
||||||
cnx.setRequestProperty(browserProperty.getKey(), browserProperty.getValue());
|
|
||||||
}
|
|
||||||
// send cookies
|
|
||||||
String cookieHeader = createCookieHeader(cnx);
|
|
||||||
if (!cookieHeader.isEmpty()) {
|
|
||||||
cnx.setRequestProperty("Cookie", cookieHeader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String createCookieHeader(URLConnection cnx) {
|
|
||||||
String host = cnx.getURL().getHost();
|
|
||||||
StringBuilder cookiesHeader = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Map<String, String>> domainCookies : COOKIES.entrySet()) {
|
|
||||||
if (host.endsWith(domainCookies.getKey())) {
|
|
||||||
for (Map.Entry<String, String> cookie : domainCookies.getValue().entrySet()) {
|
|
||||||
cookiesHeader.append(cookie.getKey());
|
|
||||||
cookiesHeader.append("=");
|
|
||||||
cookiesHeader.append(cookie.getValue());
|
|
||||||
cookiesHeader.append(";");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cookiesHeader.length() > 0) {
|
|
||||||
// remove last ; char
|
|
||||||
cookiesHeader.deleteCharAt(cookiesHeader.length() - 1);
|
|
||||||
}
|
|
||||||
return cookiesHeader.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void readHeader(URLConnection cnx) {
|
|
||||||
// read new cookies and update our cookies
|
|
||||||
for (Map.Entry<String, List<String>> header : cnx.getHeaderFields().entrySet()) {
|
|
||||||
if ("Set-Cookie".equals(header.getKey())) {
|
|
||||||
for (String cookieHeader : header.getValue()) {
|
|
||||||
String[] cookieElements = cookieHeader.split(" *; *");
|
|
||||||
if (cookieElements.length >= 1) {
|
|
||||||
String[] firstElem = cookieElements[0].split(" *= *");
|
|
||||||
String cookieName = firstElem[0];
|
|
||||||
String cookieValue = firstElem.length > 1 ? firstElem[1] : null;
|
|
||||||
String cookieDomain = null;
|
|
||||||
// find cookie domain
|
|
||||||
for (int i = 1; i < cookieElements.length; i++) {
|
|
||||||
String[] cookieElement = cookieElements[i].split(" *= *");
|
|
||||||
if ("domain".equals(cookieElement[0])) {
|
|
||||||
cookieDomain = cookieElement.length > 1 ? cookieElement[1] : null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cookieDomain == null) {
|
|
||||||
// if domain isn't set take current host
|
|
||||||
cookieDomain = cnx.getURL().getHost();
|
|
||||||
}
|
|
||||||
Map<String, String> domainCookies = COOKIES.get(cookieDomain);
|
|
||||||
if (domainCookies == null) {
|
|
||||||
domainCookies = new HashMap<String, String>();
|
|
||||||
COOKIES.put(cookieDomain, domainCookies);
|
|
||||||
}
|
|
||||||
// add or replace cookie
|
|
||||||
domainCookies.put(cookieName, cookieValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Charset getCharset(URLConnection cnx) {
|
|
||||||
Charset charset = null;
|
|
||||||
// content type will be string like "text/html; charset=UTF-8" or "text/html"
|
|
||||||
String contentType = cnx.getContentType();
|
|
||||||
if (contentType != null) {
|
|
||||||
// changed 'charset' to 'harset' in regexp because some sites send 'Charset'
|
|
||||||
Matcher m = Pattern.compile("harset *=[ '\"]*([^ ;'\"]+)[ ;'\"]*").matcher(contentType);
|
|
||||||
if (m.find()) {
|
|
||||||
String encoding = m.group(1);
|
|
||||||
try {
|
|
||||||
charset = Charset.forName(encoding);
|
|
||||||
} catch (UnsupportedCharsetException e) {
|
|
||||||
// there will be used default charset
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (charset == null) {
|
|
||||||
charset = Charset.defaultCharset();
|
|
||||||
}
|
|
||||||
|
|
||||||
return charset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getProxyHost() {
|
|
||||||
return proxyHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setProxyHost(String myProxyHost) {
|
|
||||||
WebBrowser.proxyHost = myProxyHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getProxyPort() {
|
|
||||||
return proxyPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setProxyPort(int myProxyPort) {
|
|
||||||
WebBrowser.proxyPort = myProxyPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getProxyUsername() {
|
|
||||||
return proxyUsername;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setProxyUsername(String myProxyUsername) {
|
|
||||||
WebBrowser.proxyUsername = myProxyUsername;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getProxyPassword() {
|
|
||||||
return proxyPassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setProxyPassword(String myProxyPassword) {
|
|
||||||
WebBrowser.proxyPassword = myProxyPassword;
|
|
||||||
|
|
||||||
if (proxyUsername != null) {
|
|
||||||
proxyEncodedPassword = proxyUsername + ":" + proxyPassword;
|
|
||||||
proxyEncodedPassword = "Basic " + new String(Base64.encodeBase64((proxyUsername + ":" + proxyPassword).getBytes()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getWebTimeoutConnect() {
|
|
||||||
return webTimeoutConnect;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getWebTimeoutRead() {
|
|
||||||
return webTimeoutRead;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setWebTimeoutConnect(int webTimeoutConnect) {
|
|
||||||
WebBrowser.webTimeoutConnect = webTimeoutConnect;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setWebTimeoutRead(int webTimeoutRead) {
|
|
||||||
WebBrowser.webTimeoutRead = webTimeoutRead;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.model.MovieDb;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class WrapperMovie extends AbstractWrapperAll implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@JsonProperty("results")
|
|
||||||
private List<MovieDb> movies;
|
|
||||||
|
|
||||||
public List<MovieDb> getMovies() {
|
|
||||||
return movies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMovies(List<MovieDb> movies) {
|
|
||||||
this.movies = movies;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.model.Person;
|
|
||||||
import com.omertron.themoviedbapi.model.PersonCast;
|
|
||||||
import com.omertron.themoviedbapi.model.PersonCrew;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class WrapperMovieCasts extends AbstractWrapperId implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@JsonProperty("cast")
|
|
||||||
private List<PersonCast> cast;
|
|
||||||
@JsonProperty("crew")
|
|
||||||
private List<PersonCrew> crew;
|
|
||||||
|
|
||||||
public List<PersonCast> getCast() {
|
|
||||||
return cast;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PersonCrew> getCrew() {
|
|
||||||
return crew;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCast(List<PersonCast> cast) {
|
|
||||||
this.cast = cast;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCrew(List<PersonCrew> crew) {
|
|
||||||
this.crew = crew;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Person> getAll() {
|
|
||||||
List<Person> people = new ArrayList<Person>();
|
|
||||||
|
|
||||||
// Add a cast member
|
|
||||||
for (PersonCast member : cast) {
|
|
||||||
Person person = new Person();
|
|
||||||
person.addCast(member.getId(), member.getName(), member.getProfilePath(), member.getCharacter(), member.getOrder());
|
|
||||||
people.add(person);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a crew member
|
|
||||||
for (PersonCrew member : crew) {
|
|
||||||
Person person = new Person();
|
|
||||||
person.addCrew(member.getId(), member.getName(), member.getProfilePath(), member.getDepartment(), member.getJob());
|
|
||||||
people.add(person);
|
|
||||||
}
|
|
||||||
|
|
||||||
return people;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.model.ChangedMovie;
|
|
||||||
|
|
||||||
public class WrapperMovieChanges extends AbstractWrapperAll {
|
|
||||||
|
|
||||||
@JsonProperty("results")
|
|
||||||
private List<ChangedMovie> results;
|
|
||||||
|
|
||||||
public List<ChangedMovie> getResults() {
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResults(List<ChangedMovie> results) {
|
|
||||||
this.results = results;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.model.MovieDbList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class WrapperMovieDbList extends AbstractWrapperAll {
|
|
||||||
|
|
||||||
|
|
||||||
@JsonProperty("results")
|
|
||||||
private List<MovieDbList> lists;
|
|
||||||
|
|
||||||
public List<MovieDbList> getLists() {
|
|
||||||
return lists;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLists(List<MovieDbList> lists) {
|
|
||||||
this.lists = lists;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.model.Keyword;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class WrapperMovieKeywords extends AbstractWrapperId implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@JsonProperty("keywords")
|
|
||||||
private List<Keyword> keywords;
|
|
||||||
|
|
||||||
public List<Keyword> getKeywords() {
|
|
||||||
return keywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeywords(List<Keyword> keywords) {
|
|
||||||
this.keywords = keywords;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.model.MovieList;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class WrapperMovieList extends AbstractWrapperAll implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@JsonProperty("results")
|
|
||||||
private List<MovieList> movieList;
|
|
||||||
|
|
||||||
public List<MovieList> getMovieList() {
|
|
||||||
return movieList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMovieList(List<MovieList> movieList) {
|
|
||||||
this.movieList = movieList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.model.Person;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class WrapperPerson extends AbstractWrapperAll {
|
|
||||||
|
|
||||||
@JsonProperty("results")
|
|
||||||
private List<Person> results;
|
|
||||||
|
|
||||||
public List<Person> getResults() {
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResults(List<Person> results) {
|
|
||||||
this.results = results;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.model.PersonCredit;
|
|
||||||
import com.omertron.themoviedbapi.model.PersonType;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class WrapperPersonCredits extends AbstractWrapperAll {
|
|
||||||
|
|
||||||
@JsonProperty("cast")
|
|
||||||
private List<PersonCredit> cast;
|
|
||||||
@JsonProperty("crew")
|
|
||||||
private List<PersonCredit> crew;
|
|
||||||
|
|
||||||
public List<PersonCredit> getCast() {
|
|
||||||
return cast;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCast(List<PersonCredit> cast) {
|
|
||||||
this.cast = cast;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PersonCredit> getCrew() {
|
|
||||||
return crew;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCrew(List<PersonCredit> crew) {
|
|
||||||
this.crew = crew;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PersonCredit> getAll(PersonType... typeList) {
|
|
||||||
List<PersonCredit> personCredits = new ArrayList<PersonCredit>();
|
|
||||||
List<PersonType> types = getTypeList(PersonType.class, typeList);
|
|
||||||
|
|
||||||
// Add a cast member
|
|
||||||
if (types.contains(PersonType.CAST)) {
|
|
||||||
for (PersonCredit member : cast) {
|
|
||||||
member.setPersonType(PersonType.CAST);
|
|
||||||
personCredits.add(member);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a crew member
|
|
||||||
if (types.contains(PersonType.CREW)) {
|
|
||||||
for (PersonCredit member : crew) {
|
|
||||||
member.setPersonType(PersonType.CREW);
|
|
||||||
personCredits.add(member);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return personCredits;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2014 Stuart Boston
|
|
||||||
*
|
|
||||||
* This file is part of TheMovieDB API.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.omertron.themoviedbapi.model.Person;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class WrapperPersonList extends AbstractWrapperAll {
|
|
||||||
|
|
||||||
@JsonProperty("results")
|
|
||||||
private List<Person> personList;
|
|
||||||
|
|
||||||
public List<Person> getPersonList() {
|
|
||||||
return personList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPersonList(List<Person> personList) {
|
|
||||||
this.personList = personList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
#Properties file for tests
|
#Properties file for tests
|
||||||
#Fill in the details here
|
#Fill in the details here
|
||||||
Session_ID=INSERT_YOUR_SESSION_ID_HERE
|
Session_ID=63c85deb39337e29b69d78265eb28d639cbd6f72
|
||||||
Account_ID=ACCOUNT ID FOR SESSION TESTS
|
Account_ID=6065849
|
||||||
API_Key=INSERT_YOUR_KEY_HERE
|
API_Key=5a1a77e2eba8984804586122754f969f
|
||||||
Loading…
Reference in New Issue