remove old people methods

This commit is contained in:
Stuart Boston
2015-03-04 12:39:36 +00:00
parent 9f5a8b1650
commit e95de23049
8 changed files with 11 additions and 961 deletions
@@ -1,292 +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.person;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
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;
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,135 +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.person;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
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,247 +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.person;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import java.util.Collections;
import java.util.List;
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;
@JsonProperty("video")
private boolean video;
@JsonProperty("original_name")
private String tvOriginalName = DEFAULT_STRING;
@JsonProperty("name")
private String tvName = DEFAULT_STRING;
@JsonProperty("first_air_date")
private String firstAirDate = DEFAULT_STRING;
@JsonProperty("origin_country")
private List<String> originCountry = Collections.emptyList();
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 boolean getVideo() {
return video;
}
public String getTvOriginalName() {
return tvOriginalName;
}
public String getTvName() {
return tvName;
}
public String getFirstAirDate() {
return firstAirDate;
}
public List<String> getOriginCountry() {
return originCountry;
}
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;
}
public void setVideo(boolean video) {
this.video = video;
}
public void setTvOriginalName(String tvOriginalName) {
this.tvOriginalName = tvOriginalName;
}
public void setTvName(String tvName) {
this.tvName = tvName;
}
public void setFirstAirDate(String firstAirDate) {
this.firstAirDate = firstAirDate;
}
public void setOriginCountry(List<String> originCountry) {
this.originCountry = originCountry;
}
}
@@ -1,124 +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.person;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
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-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.person;
/**
* @author stuart.boston
*/
public enum PersonType {
// A member of the cast
CAST,
// A member of the crew
CREW,
// No specific type
PERSON
}
@@ -19,26 +19,26 @@
*/
package com.omertron.themoviedbapi.model2.movie;
import com.omertron.themoviedbapi.model2.Language;
import com.omertron.themoviedbapi.model2.Genre;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.person.PersonCast;
import com.omertron.themoviedbapi.model.person.PersonCrew;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.omertron.themoviedbapi.model2.Genre;
import com.omertron.themoviedbapi.model2.Language;
import com.omertron.themoviedbapi.model2.artwork.Artwork;
import com.omertron.themoviedbapi.model2.collection.Collection;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model2.list.UserList;
import com.omertron.themoviedbapi.model2.media.MediaCreditCast;
import com.omertron.themoviedbapi.model2.media.MediaCreditCrew;
import com.omertron.themoviedbapi.model2.media.MediaCreditList;
import com.omertron.themoviedbapi.model2.review.Review;
import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles;
import com.omertron.themoviedbapi.wrapper.WrapperImages;
import com.omertron.themoviedbapi.wrapper.WrapperMovie;
import com.omertron.themoviedbapi.wrapper.WrapperMovieCasts;
import com.omertron.themoviedbapi.wrapper.WrapperMovieKeywords;
import com.omertron.themoviedbapi.wrapper.WrapperUserList;
import com.omertron.themoviedbapi.wrapper.WrapperReleaseInfo;
import com.omertron.themoviedbapi.wrapper.WrapperReviews;
import com.omertron.themoviedbapi.wrapper.WrapperTranslations;
import com.omertron.themoviedbapi.wrapper.WrapperUserList;
import com.omertron.themoviedbapi.wrapper.WrapperVideos;
import java.util.List;
import org.apache.commons.lang3.builder.EqualsBuilder;
@@ -106,7 +106,7 @@ public class MovieDb extends AbstractJsonMapping {
@JsonProperty("alternative_titles")
private WrapperAlternativeTitles alternativeTitles;
@JsonProperty("casts")
private WrapperMovieCasts casts;
private MediaCreditList casts;
@JsonProperty("images")
private WrapperImages images;
@JsonProperty("keywords")
@@ -343,11 +343,11 @@ public class MovieDb extends AbstractJsonMapping {
return alternativeTitles.getTitles();
}
public List<PersonCast> getCast() {
public List<MediaCreditCast> getCast() {
return casts.getCast();
}
public List<PersonCrew> getCrew() {
public List<MediaCreditCrew> getCrew() {
return casts.getCrew();
}
@@ -389,8 +389,8 @@ public class MovieDb extends AbstractJsonMapping {
this.alternativeTitles = alternativeTitles;
}
public void setCasts(WrapperMovieCasts casts) {
this.casts = casts;
public void setCasts(MediaCreditList credits) {
this.casts = credits;
}
public void setImages(WrapperImages images) {
@@ -1,77 +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.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.person.Person;
import com.omertron.themoviedbapi.model.person.PersonCast;
import com.omertron.themoviedbapi.model.person.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,42 +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.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.person.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;
}
}