Add more information to CollectionInfo
This commit is contained in:
@@ -55,7 +55,6 @@ import com.omertron.themoviedbapi.model.authentication.TokenAuthorisation;
|
||||
import com.omertron.themoviedbapi.model.authentication.TokenSession;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.model.collection.Collection;
|
||||
import com.omertron.themoviedbapi.model.collection.CollectionInfo;
|
||||
import com.omertron.themoviedbapi.model.company.Company;
|
||||
import com.omertron.themoviedbapi.model.config.Configuration;
|
||||
@@ -1327,7 +1326,7 @@ public class TheMovieDbApi {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public ResultList<Collection> searchCollection(String query, Integer page, String language) throws MovieDbException {
|
||||
public ResultList<MovieBasic> searchCollection(String query, Integer page, String language) throws MovieDbException {
|
||||
return tmdbSearch.searchCollection(query, page, language);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,7 @@ import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.artwork.ArtworkMedia;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.model.collection.Collection;
|
||||
import com.omertron.themoviedbapi.model.company.Company;
|
||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.list.UserList;
|
||||
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
@@ -78,10 +76,6 @@ public class AbstractMethod {
|
||||
});
|
||||
TYPE_REFS.put(Company.class, new TypeReference<WrapperGenericList<Company>>() {
|
||||
});
|
||||
TYPE_REFS.put(Collection.class, new TypeReference<WrapperGenericList<Collection>>() {
|
||||
});
|
||||
TYPE_REFS.put(Keyword.class, new TypeReference<WrapperGenericList<Keyword>>() {
|
||||
});
|
||||
TYPE_REFS.put(MovieInfo.class, new TypeReference<WrapperGenericList<MovieInfo>>() {
|
||||
});
|
||||
TYPE_REFS.put(PersonInfo.class, new TypeReference<WrapperGenericList<PersonInfo>>() {
|
||||
|
||||
@@ -22,11 +22,11 @@ package com.omertron.themoviedbapi.methods;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.enumeration.SearchType;
|
||||
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||
import com.omertron.themoviedbapi.model.collection.Collection;
|
||||
import com.omertron.themoviedbapi.model.company.Company;
|
||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.list.UserList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaBasic;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||
import com.omertron.themoviedbapi.model.person.PersonFind;
|
||||
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||
@@ -92,14 +92,14 @@ public class TmdbSearch extends AbstractMethod {
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public ResultList<Collection> searchCollection(String query, Integer page, String language) throws MovieDbException {
|
||||
public ResultList<MovieBasic> searchCollection(String query, Integer page, String language) throws MovieDbException {
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.QUERY, query);
|
||||
parameters.add(Param.PAGE, page);
|
||||
parameters.add(Param.LANGUAGE, language);
|
||||
|
||||
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.COLLECTION).buildUrl(parameters);
|
||||
WrapperGenericList<Collection> wrapper = processWrapper(getTypeReference(Collection.class), url, "collection");
|
||||
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "collection");
|
||||
return wrapper.getResultsList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2015 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.collection;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||
import java.io.Serializable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("collection")
|
||||
public class Collection extends AbstractJsonMapping implements Serializable, Identification {
|
||||
|
||||
private static final long serialVersionUID = 100L;
|
||||
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath;
|
||||
@JsonProperty("backdrop_path")
|
||||
private String backdropPath;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate;
|
||||
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
if (StringUtils.isBlank(title)) {
|
||||
return name;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return title;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
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 setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Collection) {
|
||||
final Collection other = (Collection) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(id, other.id)
|
||||
.append(name, other.name)
|
||||
.append(title, other.title)
|
||||
.append(backdropPath, other.backdropPath)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder()
|
||||
.append(id)
|
||||
.append(backdropPath)
|
||||
.append(title)
|
||||
.append(name)
|
||||
.append(posterPath)
|
||||
.append(releaseDate)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ package com.omertron.themoviedbapi.model.collection;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -45,7 +46,7 @@ public class CollectionInfo extends AbstractJsonMapping implements Serializable,
|
||||
@JsonProperty("backdrop_path")
|
||||
private String backdropPath;
|
||||
@JsonProperty("parts")
|
||||
private List<Collection> parts = new ArrayList<>();
|
||||
private List<MovieBasic> parts = new ArrayList<>();
|
||||
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
@@ -64,7 +65,7 @@ public class CollectionInfo extends AbstractJsonMapping implements Serializable,
|
||||
return overview;
|
||||
}
|
||||
|
||||
public List<Collection> getParts() {
|
||||
public List<MovieBasic> getParts() {
|
||||
return parts;
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ public class CollectionInfo extends AbstractJsonMapping implements Serializable,
|
||||
this.overview = overview;
|
||||
}
|
||||
|
||||
public void setParts(List<Collection> parts) {
|
||||
public void setParts(List<MovieBasic> parts) {
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.omertron.themoviedbapi.model.Genre;
|
||||
import com.omertron.themoviedbapi.model.Language;
|
||||
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||
import com.omertron.themoviedbapi.model.collection.Collection;
|
||||
import com.omertron.themoviedbapi.model.collection.CollectionInfo;
|
||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.list.UserList;
|
||||
import com.omertron.themoviedbapi.model.credits.MediaCreditCast;
|
||||
@@ -62,7 +62,7 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
|
||||
private static final long serialVersionUID = 100L;
|
||||
|
||||
@JsonProperty("belongs_to_collection")
|
||||
private Collection belongsToCollection;
|
||||
private CollectionInfo belongsToCollection;
|
||||
@JsonProperty("budget")
|
||||
private long budget;
|
||||
@JsonProperty("genres")
|
||||
@@ -99,7 +99,7 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
|
||||
private List<ChangeKeyItem> changes = Collections.emptyList();
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public Collection getBelongsToCollection() {
|
||||
public CollectionInfo getBelongsToCollection() {
|
||||
return belongsToCollection;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBelongsToCollection(Collection belongsToCollection) {
|
||||
public void setBelongsToCollection(CollectionInfo belongsToCollection) {
|
||||
this.belongsToCollection = belongsToCollection;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestSuite;
|
||||
import com.omertron.themoviedbapi.enumeration.MediaType;
|
||||
import com.omertron.themoviedbapi.enumeration.SearchType;
|
||||
import com.omertron.themoviedbapi.model.collection.Collection;
|
||||
import com.omertron.themoviedbapi.model.company.Company;
|
||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.list.UserList;
|
||||
import com.omertron.themoviedbapi.model.media.MediaBasic;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||
import com.omertron.themoviedbapi.model.person.PersonFind;
|
||||
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||
@@ -77,7 +77,7 @@ public class TmdbSearchTest extends AbstractTests {
|
||||
LOG.info("searchCollection");
|
||||
String query = "batman";
|
||||
int page = 0;
|
||||
ResultList<Collection> result = instance.searchCollection(query, page, LANGUAGE_DEFAULT);
|
||||
ResultList<MovieBasic> result = instance.searchCollection(query, page, LANGUAGE_DEFAULT);
|
||||
TestSuite.test(result, "Collection");
|
||||
TestSuite.testId(result, 263, "Collection");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user