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