22 Commits

Author SHA1 Message Date
Omertron 24f7b507b9 [maven-release-plugin] prepare release themoviedbapi-3.6 2013-06-26 14:31:25 +02:00
Stuart Boston d298faec9a Removed getMovieChanges test 2013-06-26 13:29:24 +01:00
Stuart Boston 486486b753 Removed unused imports 2013-06-26 13:02:23 +01:00
Stuart Boston 159fe23efb Updated POM versions 2013-06-13 21:48:34 +01:00
Stuart Boston fc1e05d0b4 Added HTTP 503 error and message 2013-06-13 07:30:18 +01:00
Stuart Boston dc6f5f07b1 Standardised toString methods 2013-06-09 22:26:16 +01:00
Stuart Boston 4243b5aa81 Catch RuntimeException when 503 error 2013-06-09 18:23:41 +01:00
Stuart Boston 1070abcabc Update README.md 2013-06-04 10:38:46 +02:00
Stuart Boston 9cca4660bc Add adult and popularity to KeywordMovie 2013-06-03 12:13:46 +01:00
Stuart Boston 5f27260f57 Updated api-common dependency 2013-05-31 09:59:05 +01:00
Stuart Boston bec9b24129 Reverted to "com.moviejukebox" for groupId 2013-05-28 20:18:39 +01:00
Stuart Boston 8679b03930 Updated to use API-Common component for HTTPClient functionality 2013-05-28 14:27:00 +01:00
Stuart Boston 845aedf871 Added MovieChange method 2013-05-20 13:05:19 +01:00
Stuart Boston d6adc40215 Fix correct logging class for JobDepartment 2013-05-20 13:03:55 +01:00
Stuart Boston 17815b9ffc Fixed some issues 2013-05-20 10:36:01 +01:00
Stuart Boston 60cb490eca Add appendToResponse to person methods 2013-05-19 18:42:26 +01:00
Stuart Boston f08c78c921 Corrected resultsMap
Removed unused imports
2013-05-19 08:24:24 +01:00
Stuart Boston 0414369327 Removed unused imports and dead variables 2013-05-18 22:22:51 +01:00
Stuart Boston 44ba85aaa8 Changed return values to include page values 2013-05-18 22:08:40 +01:00
Stuart Boston 009e725cb6 Added new classes to return the results 2013-05-18 11:23:44 +01:00
Stuart Boston edf4518f35 Refactored Wrapper classes 2013-05-17 22:15:52 +01:00
Omertron c6248b621e [maven-release-plugin] prepare for next development iteration 2013-05-15 20:34:38 +02:00
68 changed files with 3701 additions and 3824 deletions
+2 -1
View File
@@ -5,4 +5,5 @@
*.war
*.ear
/target/
/target/
/nbactions.xml
+12 -6
View File
@@ -3,17 +3,23 @@ The Movie DB API
Author: Stuart Boston (Omertron AT Gmail DOT com)
This API uses the TheMovieDB.org API as specified here http://api.themoviedb.org/
This API uses the [TheMovieDB.org API](http://api.themoviedb.org/)
Originally written for use by YetAnotherMovieJukebox (YAMJ) http://code.google.com/p/moviejukebox/
But anyone can feel free to use it for other projects as well.
Originally written for use by Yet Another Movie Jukebox [(YAMJ)](http://code.google.com/p/moviejukebox/)
TheMovieDB.org is an excellent open database for movie and film content. I encourage you to check it out and contribute to keep it growing.
http://www.themoviedb.org
But anyone can use it for other projects as well.
***
### TheMovieDB.org
This is an excellent open database for movie and film content.
I *strongly* encourage you to check it out and contribute to keep it growing.
### http://www.themoviedb.org
***
Project Logging
---------------
This project uses SLF4J (http://www.slf4j.org) to abstract the logging in the project.
This project uses [SLF4J](http://www.slf4j.org) to abstract the logging in the project.
To use the logging in your own project you should add one of the bindings listed [HERE](http://www.slf4j.org/manual.html#swapping)
Project Documentation
+30 -17
View File
@@ -13,7 +13,7 @@
<groupId>com.omertron</groupId>
<artifactId>themoviedbapi</artifactId>
<version>3.5</version>
<version>3.6</version>
<packaging>jar</packaging>
<name>API-The MovieDB</name>
@@ -74,37 +74,30 @@
</properties>
<dependencies>
<!--TESTING-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!--JSON-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.2.1</version>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.2.1</version>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
<version>2.2.2</version>
</dependency>
<!--LOGGING-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -116,12 +109,19 @@
<version>1.7.5</version>
<scope>test</scope>
</dependency>
<!--COMMON HTTP TOOLS-->
<dependency>
<groupId>org.yamj</groupId>
<artifactId>api-common</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}-${buildNumber}</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
@@ -141,10 +141,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -153,6 +154,7 @@
<!-- excludes><exclude>**/*</exclude></excludes -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@@ -168,15 +170,17 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<version>2.14.1</version>
<configuration>
<!-- To skip tests by default -->
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
@@ -205,6 +209,7 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
@@ -224,15 +229,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.2</version>
<version>3.3</version>
<configuration>
<reportPlugins>
<plugin>
@@ -260,31 +267,37 @@
</reportPlugins>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
<extensions>
@@ -55,7 +55,11 @@ public class MovieDbException extends Exception {
/*
* Autorisation rejected
*/
AUTHORISATION_FAILURE;
AUTHORISATION_FAILURE,
/*
* Service Unavailable, usually temporary
*/
HTTP_503_ERROR;
}
private final MovieDbExceptionType exceptionType;
File diff suppressed because it is too large Load Diff
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -107,10 +109,6 @@ public class AlternativeTitle implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[AlternativeTitle=");
sb.append("[country=").append(country);
sb.append("],[title=").append(title);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -195,14 +197,6 @@ public class Artwork implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Artwork=");
sb.append("[aspectRatio=").append(aspectRatio);
sb.append("],[filePath=").append(filePath);
sb.append("],[height=").append(height);
sb.append("],[language=").append(language);
sb.append("],[width=").append(width);
sb.append("],[artworkType=").append(artworkType);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -1,122 +0,0 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ChangeItem {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("id")
private String id;
@JsonProperty("action")
private String action;
@JsonProperty("time")
private String time;
@JsonProperty("value")
private ChangeValue value;
@JsonProperty("original_value")
private ChangeValue originalValue;
@JsonProperty("iso_639_1")
private String language;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public String getId() {
return id;
}
public String getAction() {
return action;
}
public String getTime() {
return time;
}
public ChangeValue getValue() {
return value;
}
public ChangeValue getOriginalValue() {
return originalValue;
}
public String getLanguage() {
return language;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setId(String id) {
this.id = id;
}
public void setAction(String action) {
this.action = action;
}
public void setTime(String time) {
this.time = time;
}
public void setValue(ChangeValue value) {
this.value = value;
}
public void setOriginalValue(ChangeValue originalValue) {
this.originalValue = originalValue;
}
public void setLanguage(String language) {
this.language = language;
}
//</editor-fold>
@Override
public String toString() {
return "ChangeItem{" + "id=" + id + ", action=" + action + ", time=" + time + ", value=" + value + '}';
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -0,0 +1,52 @@
package com.omertron.themoviedbapi.model;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class ChangeKeyItem {
private static final long serialVersionUID = 1L;
@JsonProperty("key")
private String key;
@JsonProperty("items")
private List<ChangedItem> changedItems = new ArrayList<ChangedItem>();
private Map<String, Object> newItems = new HashMap<String, Object>();
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public List<ChangedItem> getChangedItems() {
return changedItems;
}
public void setChangedItems(List<ChangedItem> changes) {
this.changedItems = changes;
}
@JsonAnyGetter
public Map<String, Object> getNewItems() {
return this.newItems;
}
@JsonAnySetter
public void setNewItems(String name, Object value) {
this.newItems.put(name, value);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -1,128 +0,0 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ChangeValue {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("poster")
private Artwork poster;
@JsonProperty("backdrop")
private Artwork backdrop;
@JsonProperty("title")
private String title;
@JsonProperty("iso_3166_1")
private String language;
@JsonProperty("site")
private String site;
@JsonProperty("name")
private String name;
@JsonProperty("id")
private int id;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public Artwork getPoster() {
return poster;
}
public Artwork getBackdrop() {
return backdrop;
}
public String getTitle() {
return title;
}
public String getLanguage() {
return language;
}
public String getSite() {
return site;
}
public String getName() {
return name;
}
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setPoster(Artwork poster) {
this.poster = poster;
}
public void setBackdrop(Artwork backdrop) {
this.backdrop = backdrop;
backdrop.setArtworkType(ArtworkType.BACKDROP);
}
public void setTitle(String title) {
this.title = title;
}
public void setLanguage(String language) {
this.language = language;
}
public void setSite(String site) {
this.site = site;
}
public void setName(String name) {
this.name = name;
}
public void setId(int id) {
this.id = id;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -0,0 +1,80 @@
package com.omertron.themoviedbapi.model;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class ChangedItem {
private static final long serialVersionUID = 1L;
@JsonProperty("id")
private String id;
@JsonProperty("action")
private String action;
@JsonProperty("time")
private String time;
@JsonProperty("iso_639_1")
private String language;
@JsonProperty("value")
private Object value;
private Map<String, Object> newItems = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
@JsonAnyGetter
public Map<String, Object> getNewItems() {
return this.newItems;
}
@JsonAnySetter
public void setNewItems(String name, Object value) {
this.newItems.put(name, value);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -165,14 +167,6 @@ public class Collection implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Collection=");
sb.append("[id=").append(id);
sb.append("],[title=").append(title);
sb.append("],[name=").append(name);
sb.append("],[posterPath=").append(posterPath);
sb.append("],[backdropPath=").append(backdropPath);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -122,14 +124,6 @@ public class CollectionInfo implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[CollectionInfo=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("],[overview=").append(overview);
sb.append("],[posterPath=").append(posterPath);
sb.append("],[backdropPath=").append(backdropPath);
sb.append("],[# of parts=").append(parts.size());
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -128,6 +130,6 @@ public class Company implements Serializable {
@Override
public String toString() {
return "Company{" + "companyId=" + companyId + ", name=" + name + ", description=" + description + ", headquarters=" + headquarters + ", homepage=" + homepage + ", logoPath=" + logoPath + ", parentCompany=" + parentCompany + '}';
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -108,10 +110,6 @@ public class Genre implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Genre=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -29,7 +31,7 @@ public class JobDepartment {
private static final long serialVersionUID = 1L;
// Logger
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
private static final Logger LOG = LoggerFactory.getLogger(JobDepartment.class);
// Properties
@JsonProperty("department")
private String department;
@@ -69,4 +71,9 @@ public class JobDepartment {
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -109,10 +111,6 @@ public class Keyword implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Keyword=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,6 +58,10 @@ public class KeywordMovie implements Serializable {
private float voteAverage;
@JsonProperty("vote_count")
private double voteCount;
@JsonProperty("adult")
private boolean adult;
@JsonProperty("popularity")
private float popularity;
// <editor-fold defaultstate="collapsed" desc="Getter methods">
public static long getSerialVersionUID() {
@@ -93,6 +99,14 @@ public class KeywordMovie implements Serializable {
public double getVoteCount() {
return voteCount;
}
public boolean isAdult() {
return adult;
}
public float getPopularity() {
return popularity;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods">
@@ -127,6 +141,14 @@ public class KeywordMovie implements Serializable {
public void setVoteCount(double voteCount) {
this.voteCount = voteCount;
}
public void setAdult(boolean adult) {
this.adult = adult;
}
public void setPopularity(float popularity) {
this.popularity = popularity;
}
// </editor-fold>
/**
@@ -143,4 +165,8 @@ public class KeywordMovie implements Serializable {
LOG.trace(sb.toString());
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -108,10 +110,6 @@ public class Language implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Language=");
sb.append("isoCode=").append(isoCode);
sb.append(", name=").append(name);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -33,6 +33,8 @@ import com.omertron.themoviedbapi.wrapper.WrapperTrailers;
import com.omertron.themoviedbapi.wrapper.WrapperTranslations;
import java.io.Serializable;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -394,7 +396,7 @@ public class MovieDb implements Serializable {
public void setReviews(WrapperReviews reviews) {
this.reviews = reviews;
}
//</editor-fold>
/**
@@ -445,31 +447,6 @@ public class MovieDb implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[MovieDB=");
sb.append("[backdropPath=").append(backdropPath);
sb.append("],[id=").append(id);
sb.append("],[originalTitle=").append(originalTitle);
sb.append("],[popularity=").append(popularity);
sb.append("],[posterPath=").append(posterPath);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("],[title=").append(title);
sb.append("],[adult=").append(adult);
sb.append("],[belongsToCollection=").append(belongsToCollection);
sb.append("],[budget=").append(budget);
sb.append("],[genres=").append(genres);
sb.append("],[homepage=").append(homepage);
sb.append("],[imdbID=").append(imdbID);
sb.append("],[overview=").append(overview);
sb.append("],[productionCompanies=").append(productionCompanies);
sb.append("],[productionCountries=").append(productionCountries);
sb.append("],[revenue=").append(revenue);
sb.append("],[runtime=").append(runtime);
sb.append("],[spokenLanguages=").append(spokenLanguages);
sb.append("],[tagline=").append(tagline);
sb.append("],[voteAverage=").append(voteAverage);
sb.append("],[voteCount=").append(voteCount);
sb.append("],[status=").append(status);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -23,11 +23,14 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Wrapper for the MovieDbList function
*
* @author stuart.boston
*/
public class MovieDbList {
@@ -148,4 +151,8 @@ public class MovieDbList {
LOG.trace(sb.toString());
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -141,6 +143,6 @@ public class MovieList implements Serializable {
@Override
public String toString() {
return "MovieList{" + "description=" + description + ", favoriteCount=" + favoriteCount + ", id=" + id + ", itemCount=" + itemCount + ", language=" + language + ", name=" + name + ", posterPath=" + posterPath + '}';
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -321,23 +323,6 @@ public class Person implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Person=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("],[profilePath=").append(profilePath);
sb.append("],[personType=").append(personType);
sb.append("],[department=").append(department);
sb.append("],[job=").append(job);
sb.append("],[character=").append(character);
sb.append("],[order=").append(order);
sb.append("],[adult=").append(adult);
sb.append("],[=aka").append(aka.toString());
sb.append("],[biography=").append(biography);
sb.append("],[birthday=").append(birthday);
sb.append("],[deathday=").append(deathday);
sb.append("],[homepage=").append(homepage);
sb.append("],[birthplace=").append(birthplace);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -161,13 +163,6 @@ public class PersonCast implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[PersonCast=");
sb.append("id=").append(id);
sb.append("],[character=").append(character);
sb.append("],[name=").append(name);
sb.append("],[order=").append(order);
sb.append("],[profilePath=").append(profilePath);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -161,18 +163,6 @@ public class PersonCredit implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[PersonCredit=");
sb.append("[movieId=").append(movieId);
sb.append("],[personType=").append(personType);
sb.append("],[originalTitle=").append(movieOriginalTitle);
sb.append("],[movieTitle=").append(movieTitle);
sb.append("],[posterPath=").append(posterPath);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("],[character=").append(character);
sb.append("],[department=").append(department);
sb.append("],[job=").append(job);
sb.append("],[adult=").append(adult);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -146,13 +148,6 @@ public class PersonCrew implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[PersonCrew=");
sb.append("id=").append(id);
sb.append("],[department=").append(department);
sb.append("],[job=").append(job);
sb.append("],[name=").append(name);
sb.append("],[profilePath=").append(profilePath);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -109,10 +111,6 @@ public class ProductionCompany implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ProductionCompany=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -109,10 +111,6 @@ public class ProductionCountry implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ProductionCountry=");
sb.append("[isoCode=").append(isoCode);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -121,11 +123,6 @@ public class ReleaseInfo implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ReleaseInfo=");
sb.append("[country=").append(country);
sb.append("],[certification=").append(certification);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -98,4 +100,9 @@ public class Reviews implements Serializable {
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,9 +83,6 @@ public class StatusCode implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Status Code: ").append(statusCode);
sb.append(", Message: ").append(statusMessage);
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -195,13 +197,6 @@ public class TmdbConfiguration implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ImageConfiguration=");
sb.append("[baseUrl=").append(baseUrl);
sb.append("],[posterSizes=").append(posterSizes.toString());
sb.append("],[backdropSizes=").append(backdropSizes.toString());
sb.append("],[profileSizes=").append(profileSizes.toString());
sb.append("],[logoSizes=").append(logoSizes.toString());
sb.append(("]]"));
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,7 +85,7 @@ public class TokenAuthorisation {
@Override
public String toString() {
return "TokenAuthorisation{" + "expires=" + expires + ", requestToken=" + requestToken + ", success=" + success + '}';
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -115,6 +117,6 @@ public class TokenSession {
@Override
public String toString() {
return "TokenSession{" + "sessionId=" + sessionId + ", success=" + success + ", statusCode=" + statusCode + ", statusMessage=" + statusMessage + ", guestSessionId=" + guestSessionId + ", expiresAt=" + expiresAt + '}';
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -132,12 +134,6 @@ public class Trailer implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Trailer=");
sb.append("name=").append(name);
sb.append("],[size=").append(size);
sb.append("],[source=").append(source);
sb.append("],[website=").append(website);
sb.append("]]");
return sb.toString();
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -121,11 +123,6 @@ public class Translation implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Translation=");
sb.append("[englishName=").append(englishName);
sb.append("],[isoCode=").append(isoCode);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
}
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -0,0 +1,105 @@
/*
* Copyright (c) 2004-2013 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.results;
import com.omertron.themoviedbapi.wrapper.AbstractWrapper;
import com.omertron.themoviedbapi.wrapper.AbstractWrapperAll;
import com.omertron.themoviedbapi.wrapper.AbstractWrapperId;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* Abstract class to return the results and the id/page info
*
* @author Stuart
*/
public abstract class TmdbResults {
private int id = 0;
private int page = 0;
private int totalPages = 0;
private int totalResults = 0;
//<editor-fold defaultstate="collapsed" desc="Getters">
public int getId() {
return id;
}
public int getPage() {
return page;
}
public int getTotalPages() {
return totalPages;
}
public int getTotalResults() {
return totalResults;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setters">
public void setId(int id) {
this.id = id;
}
public void setPage(int page) {
this.page = page;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
//</editor-fold>
public void copyWrapper(AbstractWrapper wrapper) {
// These results have nothing to copy, so this is just a placeholder
}
/**
* Copy the Id from the wrapper
*
* @param wrapper
*/
public void copyWrapper(AbstractWrapperId wrapper) {
this.id = wrapper.getId();
}
/**
* Copy the Id and pages from the wrapper
*
* @param wrapper
*/
public void copyWrapper(AbstractWrapperAll wrapper) {
this.id = wrapper.getId();
this.page = wrapper.getPage();
this.totalPages = wrapper.getTotalPages();
this.totalResults = wrapper.getTotalResults();
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2013 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.results;
import java.util.ArrayList;
import java.util.List;
/**
* List of the results from TheMovieDb
*
* @author Stuart
* @param <T>
*/
public final class TmdbResultsList<T> extends TmdbResults {
private List<T> results;
public TmdbResultsList(List<T> resultList) {
if (resultList != null) {
results = new ArrayList<T>(resultList);
} else {
results = new ArrayList<T>(0);
}
}
public List<T> getResults() {
return results;
}
public void setResults(List<T> results) {
this.results = results;
}
}
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2004-2013 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.results;
import java.util.HashMap;
import java.util.Map;
/**
* Map of the results from TheMovieDb
*
* @author Stuart
* @param <K>
* @param <V>
*/
public final class TmdbResultsMap<K, V> extends TmdbResults {
private Map<K, V> results;
public TmdbResultsMap(Map<K, V> resultsMap) {
results = new HashMap<K, V>(resultsMap);
}
public Map<K, V> getResults() {
return results;
}
public void setResults(Map<K, V> results) {
this.results = results;
}
}
@@ -1,251 +1,253 @@
/*
* Copyright (c) 2004-2013 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 String apiKey;
private String method;
private String submethod;
private 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=";
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 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 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.
*/
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);
// 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());
}
}
}
/*
* Copyright (c) 2004-2013 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 String apiKey;
private String method;
private String submethod;
private 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 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 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.
*/
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);
// 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,82 +1,74 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class MovieChanges implements Serializable {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("key")
private String key;
@JsonProperty("items")
private List<ChangeItem> items;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public String getKey() {
return key;
}
public List<ChangeItem> getItems() {
return items;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setKey(String key) {
this.key = key;
}
public void setItems(List<ChangeItem> items) {
this.items = items;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractWrapper {
private Logger log;
public AbstractWrapper(Class classToLog) {
this.log = LoggerFactory.getLogger(classToLog);
}
/**
* Get a list of the enums passed
*
* @param <E>
* @param clz Class of the enum
* @param typeList Array of the enums
* @return
*/
public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) {
if (typeList.length > 0) {
return new ArrayList<E>(Arrays.asList(typeList));
} else {
return new ArrayList<E>(EnumSet.allOf(clz));
}
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
log.trace(sb.toString());
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -1,102 +1,74 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
/**
* Base class for the wrappers
*
* @author Stuart
*/
public class WrapperBase {
/*
* Logger - set by the sub-classes
*/
private Logger log;
/*
* Properties
*/
@JsonProperty("id")
private int id;
@JsonProperty("page")
private int page;
@JsonProperty("total_pages")
private int totalPages;
@JsonProperty("total_results")
private int totalResults;
public WrapperBase(Logger logger) {
this.log = logger;
}
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public int getId() {
return id;
}
public int getPage() {
return page;
}
public int getTotalPages() {
return totalPages;
}
public int getTotalResults() {
return totalResults;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setId(int id) {
this.id = id;
}
public void setPage(int page) {
this.page = page;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
log.trace(sb.toString());
}
}
/*
* Copyright (c) 2004-2013 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;
/**
* Base class for the wrappers
*
* @author Stuart
*/
public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, IWrapperPages {
/*
* Properties
*/
@JsonProperty("page")
private int page;
@JsonProperty("total_pages")
private int totalPages;
@JsonProperty("total_results")
private int totalResults;
public AbstractWrapperAll(Class classToLog) {
super(classToLog);
}
@Override
public int getPage() {
return page;
}
@Override
public int getTotalPages() {
return totalPages;
}
@Override
public int getTotalResults() {
return totalResults;
}
@Override
public void setPage(int page) {
this.page = page;
}
@Override
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
@Override
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
}
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2013 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;
/**
* Base class for the wrappers
*
* @author Stuart
*/
public class AbstractWrapperId extends AbstractWrapper implements IWrapperId {
/*
* Properties
*/
@JsonProperty("id")
private int id;
public AbstractWrapperId(Class classToLog) {
super(classToLog);
}
@Override
public int getId() {
return id;
}
@Override
public void setId(int id) {
this.id = id;
}
}
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2004-2013 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;
public interface IWrapperId {
int getId();
void setId(int id);
}
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2004-2013 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;
public interface IWrapperPages {
int getPage();
void setPage(int page);
int getTotalPages();
void setTotalPages(int totalPages);
int getTotalResults();
void setTotalResults(int totalResults);
}
@@ -1,76 +1,46 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.AlternativeTitle;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperAlternativeTitles {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperAlternativeTitles.class);
/*
* Properties
*/
@JsonProperty("id")
private int id;
@JsonProperty("titles")
private List<AlternativeTitle> titles;
public int getId() {
return id;
}
public List<AlternativeTitle> getTitles() {
return titles;
}
public void setId(int id) {
this.id = id;
}
public void setTitles(List<AlternativeTitle> titles) {
this.titles = titles;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
/*
* Copyright (c) 2004-2013 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.AlternativeTitle;
import java.util.List;
/**
*
* @author Stuart
*/
public class WrapperAlternativeTitles extends AbstractWrapperId {
@JsonProperty("titles")
private List<AlternativeTitle> titles;
public WrapperAlternativeTitles() {
super(WrapperAlternativeTitles.class);
}
public List<AlternativeTitle> getTitles() {
return titles;
}
public void setTitles(List<AlternativeTitle> titles) {
this.titles = titles;
}
}
@@ -1,70 +1,42 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieChanges;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperChanges {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperChanges.class);
/*
* Properties
*/
@JsonProperty("changes")
private List<MovieChanges> changes;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<MovieChanges> getChanges() {
return changes;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setChanges(List<MovieChanges> changes) {
this.changes = changes;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
package com.omertron.themoviedbapi.wrapper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.ChangeKeyItem;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class WrapperChanges {
@JsonProperty("changes")
private List<ChangeKeyItem> changedItems = new ArrayList<ChangeKeyItem>();
private Map<String, Object> newItems = new HashMap<String, Object>();
public List<ChangeKeyItem> getChangedItems() {
return changedItems;
}
public void setChangedItems(List<ChangeKeyItem> changes) {
this.changedItems = changes;
}
@JsonAnyGetter
public Map<String, Object> getNewItems() {
return this.newItems;
}
@JsonAnySetter
public void setNewItems(String name, Object value) {
this.newItems.put(name, value);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -1,50 +1,46 @@
/*
* Copyright (c) 2004-2013 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.Collection;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperCollection extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<Collection> results;
public WrapperCollection() {
super(LoggerFactory.getLogger(WrapperCollection.class));
}
public List<Collection> getResults() {
return results;
}
public void setResults(List<Collection> results) {
this.results = results;
}
}
/*
* Copyright (c) 2004-2013 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.Collection;
import java.util.List;
/**
*
* @author stuart.boston
*/
public class WrapperCollection extends AbstractWrapperAll {
@JsonProperty("results")
private List<Collection> results;
public WrapperCollection() {
super(WrapperCollection.class);
}
public List<Collection> getResults() {
return results;
}
public void setResults(List<Collection> results) {
this.results = results;
}
}
@@ -1,50 +1,46 @@
/*
* Copyright (c) 2004-2013 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.Company;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperCompany extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<Company> results;
public WrapperCompany() {
super(LoggerFactory.getLogger(WrapperCompany.class));
}
public List<Company> getResults() {
return results;
}
public void setResults(List<Company> results) {
this.results = results;
}
}
/*
* Copyright (c) 2004-2013 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.Company;
import java.util.List;
/**
*
* @author stuart.boston
*/
public class WrapperCompany extends AbstractWrapperAll {
@JsonProperty("results")
private List<Company> results;
public WrapperCompany() {
super(WrapperCompany.class);
}
public List<Company> getResults() {
return results;
}
public void setResults(List<Company> results) {
this.results = results;
}
}
@@ -1,62 +1,46 @@
/*
* Copyright (c) 2004-2013 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.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperCompanyMovies extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<MovieDb> results;
public WrapperCompanyMovies() {
super(LoggerFactory.getLogger(WrapperCompanyMovies.class));
}
public List<MovieDb> getResults() {
return results;
}
public void setResults(List<MovieDb> results) {
this.results = results;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[companyId=").append(getId());
sb.append("],[page=").append(getPage());
sb.append("],[pageResults=").append(getResults().size());
sb.append("],[totalPages=").append(getTotalPages());
sb.append("],[totalResults=").append(getTotalResults());
sb.append("]]");
return sb.toString();
}
}
/*
* Copyright (c) 2004-2013 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.util.List;
/**
*
* @author stuart.boston
*/
public class WrapperCompanyMovies extends AbstractWrapperAll {
@JsonProperty("results")
private List<MovieDb> results;
public WrapperCompanyMovies() {
super(WrapperCompanyMovies.class);
}
public List<MovieDb> getResults() {
return results;
}
public void setResults(List<MovieDb> results) {
this.results = results;
}
}
@@ -1,77 +1,57 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.TmdbConfiguration;
import java.util.Collections;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperConfig {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperConfig.class);
/*
* Properties
*/
@JsonProperty("images")
private TmdbConfiguration tmdbConfiguration;
@JsonProperty("change_keys")
private List<String> changeKeys = Collections.EMPTY_LIST;
public TmdbConfiguration getTmdbConfiguration() {
return tmdbConfiguration;
}
public void setTmdbConfiguration(TmdbConfiguration tmdbConfiguration) {
this.tmdbConfiguration = tmdbConfiguration;
}
public List<String> getChangeKeys() {
return changeKeys;
}
public void setChangeKeys(List<String> changeKeys) {
this.changeKeys = changeKeys;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
/*
* Copyright (c) 2004-2013 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.TmdbConfiguration;
import java.util.Collections;
import java.util.List;
/**
*
* @author Stuart
*/
public class WrapperConfig extends AbstractWrapper {
@JsonProperty("images")
private TmdbConfiguration tmdbConfiguration;
@JsonProperty("change_keys")
private List<String> changeKeys = Collections.EMPTY_LIST;
public WrapperConfig() {
super(WrapperConfig.class);
}
public TmdbConfiguration getTmdbConfiguration() {
return tmdbConfiguration;
}
public void setTmdbConfiguration(TmdbConfiguration tmdbConfiguration) {
this.tmdbConfiguration = tmdbConfiguration;
}
public List<String> getChangeKeys() {
return changeKeys;
}
public void setChangeKeys(List<String> changeKeys) {
this.changeKeys = changeKeys;
}
}
@@ -1,67 +1,47 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Genre;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Wrapper class for the Genres searches
*
* @author Stuart
*/
public class WrapperGenres {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperGenres.class);
/*
* Properties
*/
@JsonProperty("genres")
private List<Genre> genres;
public List<Genre> getGenres() {
return genres;
}
public void setGenres(List<Genre> genres) {
this.genres = genres;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
/*
* Copyright (c) 2004-2013 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.Genre;
import java.util.List;
/**
* Wrapper class for the Genres searches
*
* @author Stuart
*/
public class WrapperGenres extends AbstractWrapper {
@JsonProperty("genres")
private List<Genre> genres;
public WrapperGenres() {
super(WrapperGenres.class);
}
public List<Genre> getGenres() {
return genres;
}
public void setGenres(List<Genre> genres) {
this.genres = genres;
}
}
@@ -26,16 +26,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperImages extends WrapperBase {
/*
* Properties
*/
public class WrapperImages extends AbstractWrapperAll {
@JsonProperty("backdrops")
private List<Artwork> backdrops = Collections.EMPTY_LIST;
@@ -45,10 +41,9 @@ public class WrapperImages extends WrapperBase {
private List<Artwork> profiles = Collections.EMPTY_LIST;
public WrapperImages() {
super(LoggerFactory.getLogger(WrapperImages.class));
super(WrapperImages.class);
}
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<Artwork> getBackdrops() {
return backdrops;
}
@@ -60,9 +55,7 @@ public class WrapperImages extends WrapperBase {
public List<Artwork> getProfiles() {
return profiles;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdrops(List<Artwork> backdrops) {
this.backdrops = backdrops;
}
@@ -74,7 +67,6 @@ public class WrapperImages extends WrapperBase {
public void setProfiles(List<Artwork> profiles) {
this.profiles = profiles;
}
//</editor-fold>
/**
* Return a list of all the artwork with their types.
@@ -93,30 +85,36 @@ public class WrapperImages extends WrapperBase {
types = new ArrayList<ArtworkType>(Arrays.asList(ArtworkType.values()));
}
// Add all the posters to the list
if (types.contains(ArtworkType.POSTER)) {
// Add all the posters to the list
for (Artwork poster : posters) {
poster.setArtworkType(ArtworkType.POSTER);
artwork.add(poster);
}
updateArtworkType(posters, ArtworkType.POSTER);
artwork.addAll(posters);
}
// Add all the backdrops to the list
if (types.contains(ArtworkType.BACKDROP)) {
// Add all the backdrops to the list
for (Artwork backdrop : backdrops) {
backdrop.setArtworkType(ArtworkType.BACKDROP);
artwork.add(backdrop);
}
updateArtworkType(backdrops, ArtworkType.BACKDROP);
artwork.addAll(backdrops);
}
// Add all the backdrops to the list
if (types.contains(ArtworkType.PROFILE)) {
// Add all the backdrops to the list
for (Artwork backdrop : profiles) {
backdrop.setArtworkType(ArtworkType.PROFILE);
artwork.add(backdrop);
}
updateArtworkType(profiles, ArtworkType.PROFILE);
artwork.addAll(profiles);
}
return artwork;
}
/**
* Update the artwork type for the artwork list
*
* @param artworkList
* @param type
*/
private void updateArtworkType(List<Artwork> artworkList, ArtworkType type) {
for (Artwork artwork : artworkList) {
artwork.setArtworkType(type);
}
}
}
@@ -19,26 +19,23 @@
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model.JobDepartment;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperJobList {
public class WrapperJobList extends AbstractWrapper {
// Logger
private static final Logger LOG = LoggerFactory.getLogger(WrapperJobList.class);
// Properties
@JsonProperty("jobs")
private List<JobDepartment> jobs;
public WrapperJobList() {
super(WrapperJobList.class);
}
public List<JobDepartment> getJobs() {
return jobs;
}
@@ -46,18 +43,4 @@ public class WrapperJobList {
public void setJobs(List<JobDepartment> jobs) {
this.jobs = jobs;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,50 +1,46 @@
/*
* Copyright (c) 2004-2013 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.KeywordMovie;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperKeywordMovies extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<KeywordMovie> results;
public WrapperKeywordMovies() {
super(LoggerFactory.getLogger(WrapperKeywordMovies.class));
}
public List<KeywordMovie> getResults() {
return results;
}
public void setResults(List<KeywordMovie> results) {
this.results = results;
}
}
/*
* Copyright (c) 2004-2013 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.KeywordMovie;
import java.util.List;
/**
*
* @author stuart.boston
*/
public class WrapperKeywordMovies extends AbstractWrapperAll {
@JsonProperty("results")
private List<KeywordMovie> results;
public WrapperKeywordMovies() {
super(WrapperKeywordMovies.class);
}
public List<KeywordMovie> getResults() {
return results;
}
public void setResults(List<KeywordMovie> results) {
this.results = results;
}
}
@@ -1,50 +1,46 @@
/*
* Copyright (c) 2004-2013 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.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperKeywords extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<Keyword> results;
public WrapperKeywords() {
super(LoggerFactory.getLogger(WrapperKeywords.class));
}
public List<Keyword> getResults() {
return results;
}
public void setResults(List<Keyword> results) {
this.results = results;
}
}
/*
* Copyright (c) 2004-2013 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.util.List;
/**
*
* @author stuart.boston
*/
public class WrapperKeywords extends AbstractWrapperAll {
@JsonProperty("results")
private List<Keyword> results;
public WrapperKeywords() {
super(WrapperKeywords.class);
}
public List<Keyword> getResults() {
return results;
}
public void setResults(List<Keyword> results) {
this.results = results;
}
}
@@ -1,62 +1,46 @@
/*
* Copyright (c) 2004-2013 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.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperMovie extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<MovieDb> movies;
public WrapperMovie() {
super(LoggerFactory.getLogger(WrapperMovie.class));
}
public List<MovieDb> getMovies() {
return movies;
}
public void setMovies(List<MovieDb> movies) {
this.movies = movies;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[page=").append(getPage());
sb.append("],[pageResults=").append(getMovies().size());
sb.append("],[totalPages=").append(getTotalPages());
sb.append("],[totalResults=").append(getTotalResults());
sb.append("],[id=").append(getId());
sb.append("]]");
return sb.toString();
}
}
/*
* Copyright (c) 2004-2013 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.util.List;
/**
*
* @author stuart.boston
*/
public class WrapperMovie extends AbstractWrapperAll {
@JsonProperty("results")
private List<MovieDb> movies;
public WrapperMovie() {
super(WrapperMovie.class);
}
public List<MovieDb> getMovies() {
return movies;
}
public void setMovies(List<MovieDb> movies) {
this.movies = movies;
}
}
@@ -1,91 +1,79 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.PersonCast;
import com.omertron.themoviedbapi.model.PersonCrew;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperMovieCasts {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieCasts.class);
/*
* Properties
*/
@JsonProperty("id")
private int id;
@JsonProperty("cast")
private List<PersonCast> cast;
@JsonProperty("crew")
private List<PersonCrew> crew;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<PersonCast> getCast() {
return cast;
}
public List<PersonCrew> getCrew() {
return crew;
}
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCast(List<PersonCast> cast) {
this.cast = cast;
}
public void setCrew(List<PersonCrew> crew) {
this.crew = crew;
}
public void setId(int id) {
this.id = id;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
/*
* Copyright (c) 2004-2013 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.util.ArrayList;
import java.util.List;
/**
*
* @author Stuart
*/
public class WrapperMovieCasts extends AbstractWrapperId {
@JsonProperty("cast")
private List<PersonCast> cast;
@JsonProperty("crew")
private List<PersonCrew> crew;
public WrapperMovieCasts() {
super(WrapperMovieCasts.class);
}
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,80 +1,46 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Keyword;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperMovieKeywords {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieKeywords.class);
/*
* Properties
*/
@JsonProperty("id")
private int id;
@JsonProperty("keywords")
private List<Keyword> keywords;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() {
return id;
}
public List<Keyword> getKeywords() {
return keywords;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) {
this.id = id;
}
public void setKeywords(List<Keyword> keywords) {
this.keywords = keywords;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
/*
* Copyright (c) 2004-2013 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.util.List;
/**
*
* @author Stuart
*/
public class WrapperMovieKeywords extends AbstractWrapperId {
@JsonProperty("keywords")
private List<Keyword> keywords;
public WrapperMovieKeywords() {
super(WrapperMovieKeywords.class);
}
public List<Keyword> getKeywords() {
return keywords;
}
public void setKeywords(List<Keyword> keywords) {
this.keywords = keywords;
}
}
@@ -1,50 +1,46 @@
/*
* Copyright (c) 2004-2013 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.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperMovieList extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<MovieList> movieList;
public WrapperMovieList() {
super(LoggerFactory.getLogger(WrapperMovieList.class));
}
public List<MovieList> getMovieList() {
return movieList;
}
public void setMovieList(List<MovieList> movieList) {
this.movieList = movieList;
}
}
/*
* Copyright (c) 2004-2013 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.util.List;
/**
*
* @author Stuart
*/
public class WrapperMovieList extends AbstractWrapperAll {
@JsonProperty("results")
private List<MovieList> movieList;
public WrapperMovieList() {
super(WrapperMovieList.class);
}
public List<MovieList> getMovieList() {
return movieList;
}
public void setMovieList(List<MovieList> movieList) {
this.movieList = movieList;
}
}
@@ -1,50 +1,46 @@
/*
* Copyright (c) 2004-2013 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;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperPerson extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<Person> results;
public WrapperPerson() {
super(LoggerFactory.getLogger(WrapperPerson.class));
}
public List<Person> getResults() {
return results;
}
public void setResults(List<Person> results) {
this.results = results;
}
}
/*
* Copyright (c) 2004-2013 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 WrapperPerson() {
super(WrapperPerson.class);
}
public List<Person> getResults() {
return results;
}
public void setResults(List<Person> results) {
this.results = results;
}
}
@@ -1,60 +1,81 @@
/*
* Copyright (c) 2004-2013 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 java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperPersonCredits extends WrapperBase {
/*
* Properties
*/
@JsonProperty("cast")
private List<PersonCredit> cast;
@JsonProperty("crew")
private List<PersonCredit> crew;
public WrapperPersonCredits() {
super(LoggerFactory.getLogger(WrapperMovieCasts.class));
}
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;
}
}
/*
* Copyright (c) 2004-2013 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 WrapperPersonCredits() {
super(WrapperMovieCasts.class);
}
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;
}
}
@@ -20,25 +20,20 @@
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.Person;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperPersonList extends WrapperBase {
/*
* Properties
*/
public class WrapperPersonList extends AbstractWrapperAll {
@JsonProperty("results")
private List<Person> personList;
public WrapperPersonList() {
super(LoggerFactory.getLogger(WrapperPersonList.class));
super(WrapperPersonList.class);
}
public List<Person> getPersonList() {
@@ -1,80 +1,46 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.ReleaseInfo;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperReleaseInfo {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperReleaseInfo.class);
/*
* Properties
*/
@JsonProperty("id")
private int id;
@JsonProperty("countries")
private List<ReleaseInfo> countries;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<ReleaseInfo> getCountries() {
return countries;
}
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCountries(List<ReleaseInfo> countries) {
this.countries = countries;
}
public void setId(int id) {
this.id = id;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
/*
* Copyright (c) 2004-2013 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.ReleaseInfo;
import java.util.List;
/**
*
* @author Stuart
*/
public class WrapperReleaseInfo extends AbstractWrapperId {
@JsonProperty("countries")
private List<ReleaseInfo> countries;
public WrapperReleaseInfo() {
super(WrapperReleaseInfo.class);
}
public List<ReleaseInfo> getCountries() {
return countries;
}
public void setCountries(List<ReleaseInfo> countries) {
this.countries = countries;
}
}
@@ -22,22 +22,18 @@ package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Reviews;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperReviews extends WrapperBase {
/*
* Properties
*/
public class WrapperReviews extends AbstractWrapperAll {
@JsonProperty("results")
private List<Reviews> reviews;
public WrapperReviews() {
super(LoggerFactory.getLogger(WrapperReviews.class));
super(WrapperReviews.class);
}
public List<Reviews> getReviews() {
@@ -19,37 +19,24 @@
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Trailer;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperTrailers {
/*
* Logger
*/
public class WrapperTrailers extends AbstractWrapperId {
private static final Logger LOG = LoggerFactory.getLogger(WrapperTrailers.class);
/*
* Properties
*/
@JsonProperty("id")
private int id;
@JsonProperty("quicktime")
private List<Trailer> quicktime;
@JsonProperty("youtube")
private List<Trailer> youtube;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() {
return id;
public WrapperTrailers() {
super(WrapperTrailers.class);
}
public List<Trailer> getQuicktime() {
@@ -59,12 +46,6 @@ public class WrapperTrailers {
public List<Trailer> getYoutube() {
return youtube;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) {
this.id = id;
}
public void setQuicktime(List<Trailer> quicktime) {
this.quicktime = quicktime;
@@ -73,10 +54,10 @@ public class WrapperTrailers {
public void setYoutube(List<Trailer> youtube) {
this.youtube = youtube;
}
//</editor-fold>
/**
* Get a combined list of the trailers with their source website
*
* @return
*/
public List<Trailer> getAll() {
@@ -95,18 +76,4 @@ public class WrapperTrailers {
return trailers;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,80 +1,46 @@
/*
* Copyright (c) 2004-2013 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Translation;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperTranslations {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperTranslations.class);
/*
* Properties
*/
@JsonProperty("id")
private int id;
@JsonProperty("translations")
private List<Translation> translations;
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) {
this.id = id;
}
public void setTranslations(List<Translation> translations) {
this.translations = translations;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() {
return id;
}
public List<Translation> getTranslations() {
return translations;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
/*
* Copyright (c) 2004-2013 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.Translation;
import java.util.List;
/**
*
* @author Stuart
*/
public class WrapperTranslations extends AbstractWrapperId {
@JsonProperty("translations")
private List<Translation> translations;
public WrapperTranslations() {
super(WrapperTranslations.class);
}
public void setTranslations(List<Translation> translations) {
this.translations = translations;
}
public List<Translation> getTranslations() {
return translations;
}
}
@@ -21,6 +21,7 @@ package com.omertron.themoviedbapi;
import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model.Artwork;
import com.omertron.themoviedbapi.model.ChangedItem;
import com.omertron.themoviedbapi.model.Collection;
import com.omertron.themoviedbapi.model.CollectionInfo;
import com.omertron.themoviedbapi.model.Company;
@@ -29,7 +30,6 @@ import com.omertron.themoviedbapi.model.Genre;
import com.omertron.themoviedbapi.model.JobDepartment;
import com.omertron.themoviedbapi.model.Keyword;
import com.omertron.themoviedbapi.model.KeywordMovie;
import com.omertron.themoviedbapi.model.MovieChanges;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieDbList;
import com.omertron.themoviedbapi.model.MovieList;
@@ -42,8 +42,9 @@ import com.omertron.themoviedbapi.model.TokenAuthorisation;
import com.omertron.themoviedbapi.model.TokenSession;
import com.omertron.themoviedbapi.model.Trailer;
import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.results.TmdbResultsList;
import com.omertron.themoviedbapi.results.TmdbResultsMap;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.junit.*;
@@ -122,17 +123,17 @@ public class TheMovieDbApiTest {
LOG.info("searchMovie");
// Try a movie with less than 1 page of results
List<MovieDb> movieList = tmdb.searchMovie("Blade Runner", 0, "", true, 0);
TmdbResultsList<MovieDb> movieList = tmdb.searchMovie("Blade Runner", 0, "", true, 0);
// List<MovieDb> movieList = tmdb.searchMovie("Blade Runner", "", true);
assertTrue("No movies found, should be at least 1", movieList.size() > 0);
assertTrue("No movies found, should be at least 1", movieList.getResults().size() > 0);
// Try a russian langugage movie
movieList = tmdb.searchMovie("О чём говорят мужчины", 0, LANGUAGE_RUSSIAN, true, 0);
assertTrue("No 'RU' movies found, should be at least 1", movieList.size() > 0);
assertTrue("No 'RU' movies found, should be at least 1", movieList.getResults().size() > 0);
// Try a movie with more than 20 results
movieList = tmdb.searchMovie("Star Wars", 0, LANGUAGE_ENGLISH, false, 0);
assertTrue("Not enough movies found, should be over 15, found " + movieList.size(), movieList.size() >= 15);
assertTrue("Not enough movies found, should be over 15, found " + movieList.getResults().size(), movieList.getResults().size() >= 15);
}
/**
@@ -152,12 +153,12 @@ public class TheMovieDbApiTest {
public void testGetMovieAlternativeTitles() throws MovieDbException {
LOG.info("getMovieAlternativeTitles");
String country = "";
List<AlternativeTitle> results = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country, "casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists");
assertTrue("No alternative titles found", results.size() > 0);
TmdbResultsList<AlternativeTitle> result = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country, "casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists");
assertTrue("No alternative titles found", result.getResults().size() > 0);
country = "US";
results = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country);
assertTrue("No alternative titles found", results.size() > 0);
result = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country);
assertTrue("No alternative titles found", result.getResults().size() > 0);
}
@@ -167,15 +168,15 @@ public class TheMovieDbApiTest {
@Test
public void testGetMovieCasts() throws MovieDbException {
LOG.info("getMovieCasts");
List<Person> people = tmdb.getMovieCasts(ID_MOVIE_BLADE_RUNNER, "alternative_titles,casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists");
assertTrue("No cast information", people.size() > 0);
TmdbResultsList<Person> people = tmdb.getMovieCasts(ID_MOVIE_BLADE_RUNNER, "alternative_titles,casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists");
assertTrue("No cast information", people.getResults().size() > 0);
String name1 = "Harrison Ford";
String name2 = "Charles Knode";
boolean foundName1 = Boolean.FALSE;
boolean foundName2 = Boolean.FALSE;
for (Person person : people) {
for (Person person : people.getResults()) {
if (!foundName1 && person.getName().equalsIgnoreCase(name1)) {
foundName1 = Boolean.TRUE;
}
@@ -195,8 +196,8 @@ public class TheMovieDbApiTest {
public void testGetMovieImages() throws MovieDbException {
LOG.info("getMovieImages");
String language = "";
List<Artwork> result = tmdb.getMovieImages(ID_MOVIE_BLADE_RUNNER, language);
assertFalse("No artwork found", result.isEmpty());
TmdbResultsList<Artwork> result = tmdb.getMovieImages(ID_MOVIE_BLADE_RUNNER, language);
assertFalse("No artwork found", result.getResults().isEmpty());
}
/**
@@ -205,8 +206,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetMovieKeywords() throws MovieDbException {
LOG.info("getMovieKeywords");
List<Keyword> result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER);
assertFalse("No keywords found", result.isEmpty());
TmdbResultsList<Keyword> result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER);
assertFalse("No keywords found", result.getResults().isEmpty());
}
/**
@@ -215,8 +216,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetMovieReleaseInfo() throws MovieDbException {
LOG.info("getMovieReleaseInfo");
List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Release information missing", result.isEmpty());
TmdbResultsList<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Release information missing", result.getResults().isEmpty());
}
/**
@@ -225,8 +226,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetMovieTrailers() throws MovieDbException {
LOG.info("getMovieTrailers");
List<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Movie trailers missing", result.isEmpty());
TmdbResultsList<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Movie trailers missing", result.getResults().isEmpty());
}
/**
@@ -235,8 +236,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetMovieTranslations() throws MovieDbException {
LOG.info("getMovieTranslations");
List<Translation> result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER);
assertFalse("No translations found", result.isEmpty());
TmdbResultsList<Translation> result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER);
assertFalse("No translations found", result.getResults().isEmpty());
}
/**
@@ -305,8 +306,8 @@ public class TheMovieDbApiTest {
LOG.info("searchPeople");
String personName = "Bruce Willis";
boolean includeAdult = false;
List<Person> result = tmdb.searchPeople(personName, includeAdult, 0);
assertTrue("Couldn't find the person", result.size() > 0);
TmdbResultsList<Person> result = tmdb.searchPeople(personName, includeAdult, 0);
assertTrue("Couldn't find the person", result.getResults().size() > 0);
}
/**
@@ -326,8 +327,8 @@ public class TheMovieDbApiTest {
public void testGetPersonCredits() throws MovieDbException {
LOG.info("getPersonCredits");
List<PersonCredit> people = tmdb.getPersonCredits(ID_PERSON_BRUCE_WILLIS);
assertTrue("No cast information", people.size() > 0);
TmdbResultsList<PersonCredit> result = tmdb.getPersonCredits(ID_PERSON_BRUCE_WILLIS);
assertTrue("No cast information", result.getResults().size() > 0);
}
/**
@@ -337,8 +338,8 @@ public class TheMovieDbApiTest {
public void testGetPersonImages() throws MovieDbException {
LOG.info("getPersonImages");
List<Artwork> artwork = tmdb.getPersonImages(ID_PERSON_BRUCE_WILLIS);
assertTrue("No cast information", artwork.size() > 0);
TmdbResultsList<Artwork> result = tmdb.getPersonImages(ID_PERSON_BRUCE_WILLIS);
assertTrue("No cast information", result.getResults().size() > 0);
}
/**
@@ -382,8 +383,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetNowPlayingMovies() throws MovieDbException {
LOG.info("getNowPlayingMovies");
List<MovieDb> results = tmdb.getNowPlayingMovies(LANGUAGE_DEFAULT, 0);
assertTrue("No now playing movies found", !results.isEmpty());
TmdbResultsList<MovieDb> result = tmdb.getNowPlayingMovies(LANGUAGE_DEFAULT, 0);
assertTrue("No now playing movies found", !result.getResults().isEmpty());
}
/**
@@ -392,8 +393,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetPopularMovieList() throws MovieDbException {
LOG.info("getPopularMovieList");
List<MovieDb> results = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
assertTrue("No popular movies found", !results.isEmpty());
TmdbResultsList<MovieDb> result = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
assertTrue("No popular movies found", !result.getResults().isEmpty());
}
/**
@@ -402,8 +403,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetTopRatedMovies() throws MovieDbException {
LOG.info("getTopRatedMovies");
List<MovieDb> results = tmdb.getTopRatedMovies(LANGUAGE_DEFAULT, 0);
assertTrue("No top rated movies found", !results.isEmpty());
TmdbResultsList<MovieDb> result = tmdb.getTopRatedMovies(LANGUAGE_DEFAULT, 0);
assertTrue("No top rated movies found", !result.getResults().isEmpty());
}
/**
@@ -422,8 +423,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetCompanyMovies() throws MovieDbException {
LOG.info("getCompanyMovies");
List<MovieDb> results = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, LANGUAGE_DEFAULT, 0);
assertTrue("No company movies found", !results.isEmpty());
TmdbResultsList<MovieDb> result = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, LANGUAGE_DEFAULT, 0);
assertTrue("No company movies found", !result.getResults().isEmpty());
}
/**
@@ -432,8 +433,8 @@ public class TheMovieDbApiTest {
@Test
public void testSearchCompanies() throws MovieDbException {
LOG.info("searchCompanies");
List<Company> results = tmdb.searchCompanies(COMPANY_NAME, 0);
assertTrue("No company information found", !results.isEmpty());
TmdbResultsList<Company> result = tmdb.searchCompanies(COMPANY_NAME, 0);
assertTrue("No company information found", !result.getResults().isEmpty());
}
/**
@@ -442,8 +443,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetSimilarMovies() throws MovieDbException {
LOG.info("getSimilarMovies");
List<MovieDb> results = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, LANGUAGE_DEFAULT, 0);
assertTrue("No similar movies found", !results.isEmpty());
TmdbResultsList<MovieDb> result = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, LANGUAGE_DEFAULT, 0);
assertTrue("No similar movies found", !result.getResults().isEmpty());
}
/**
@@ -452,8 +453,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetGenreList() throws MovieDbException {
LOG.info("getGenreList");
List<Genre> results = tmdb.getGenreList(LANGUAGE_DEFAULT);
assertTrue("No genres found", !results.isEmpty());
TmdbResultsList<Genre> result = tmdb.getGenreList(LANGUAGE_DEFAULT);
assertTrue("No genres found", !result.getResults().isEmpty());
}
/**
@@ -462,8 +463,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetGenreMovies() throws MovieDbException {
LOG.info("getGenreMovies");
List<MovieDb> results = tmdb.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, 0, Boolean.TRUE);
assertTrue("No genre movies found", !results.isEmpty());
TmdbResultsList<MovieDb> result = tmdb.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, 0, Boolean.TRUE);
assertTrue("No genre movies found", !result.getResults().isEmpty());
}
/**
@@ -472,8 +473,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetUpcoming() throws Exception {
LOG.info("getUpcoming");
List<MovieDb> results = tmdb.getUpcoming(LANGUAGE_DEFAULT, 0);
assertTrue("No upcoming movies found", !results.isEmpty());
TmdbResultsList<MovieDb> result = tmdb.getUpcoming(LANGUAGE_DEFAULT, 0);
assertTrue("No upcoming movies found", !result.getResults().isEmpty());
}
/**
@@ -482,8 +483,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetCollectionImages() throws Exception {
LOG.info("getCollectionImages");
List<Artwork> result = tmdb.getCollectionImages(ID_COLLECTION_STAR_WARS, LANGUAGE_DEFAULT);
assertFalse("No artwork found", result.isEmpty());
TmdbResultsList<Artwork> result = tmdb.getCollectionImages(ID_COLLECTION_STAR_WARS, LANGUAGE_DEFAULT);
assertFalse("No artwork found", result.getResults().isEmpty());
}
/**
@@ -530,9 +531,9 @@ public class TheMovieDbApiTest {
@Test
public void testGetMovieLists() throws Exception {
LOG.info("getMovieLists");
List<MovieList> results = tmdb.getMovieLists(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, 0);
assertNotNull("No results found", results);
assertTrue("No results found", results.size() > 0);
TmdbResultsList<MovieList> result = tmdb.getMovieLists(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, 0);
assertNotNull("No results found", result);
assertTrue("No results found", result.getResults().size() > 0);
}
/**
@@ -540,22 +541,21 @@ public class TheMovieDbApiTest {
*
* TODO: Do not test this until it is fixed
*/
@Ignore("Do not test this until it is fixed")
public void testGetMovieChanges() throws Exception {
LOG.info("getMovieChanges");
String startDate = "";
String endDate = null;
List<MovieChanges> results = Collections.EMPTY_LIST;
// Get some popular movies
List<MovieDb> movieList = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
for (MovieDb movie : movieList) {
results = tmdb.getMovieChanges(movie.getId(), startDate, endDate);
LOG.info("{} has {} changes.", new Object[]{movie.getTitle(), results.size()});
TmdbResultsList<MovieDb> movieList = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
for (MovieDb movie : movieList.getResults()) {
TmdbResultsMap<String, List<ChangedItem>> result = tmdb.getMovieChanges(movie.getId(), startDate, endDate);
LOG.info("{} has {} changes.", movie.getTitle(), result.getResults().size());
assertTrue("No changes found", result.getResults().size() > 0);
break;
}
assertNotNull("No results found", results);
assertTrue("No results found", results.size() > 0);
}
@Test
@@ -576,9 +576,9 @@ public class TheMovieDbApiTest {
LOG.info("searchCollection");
String query = "batman";
int page = 0;
List<Collection> result = tmdb.searchCollection(query, LANGUAGE_DEFAULT, page);
TmdbResultsList<Collection> result = tmdb.searchCollection(query, LANGUAGE_DEFAULT, page);
assertFalse("No collections found", result == null);
assertTrue("No collections found", result.size() > 0);
assertTrue("No collections found", result.getResults().size() > 0);
}
/**
@@ -589,9 +589,9 @@ public class TheMovieDbApiTest {
LOG.info("searchList");
String query = "watch";
int page = 0;
List<MovieList> result = tmdb.searchList(query, LANGUAGE_DEFAULT, page);
assertFalse("No lists found", result == null);
assertTrue("No lists found", result.size() > 0);
TmdbResultsList<MovieList> result = tmdb.searchList(query, LANGUAGE_DEFAULT, page);
assertFalse("No lists found", result.getResults() == null);
assertTrue("No lists found", result.getResults().size() > 0);
}
/**
@@ -602,9 +602,9 @@ public class TheMovieDbApiTest {
LOG.info("searchKeyword");
String query = "action";
int page = 0;
List<Keyword> result = tmdb.searchKeyword(query, page);
assertFalse("No keywords found", result == null);
assertTrue("No keywords found", result.size() > 0);
TmdbResultsList<Keyword> result = tmdb.searchKeyword(query, page);
assertFalse("No keywords found", result.getResults() == null);
assertTrue("No keywords found", result.getResults().size() > 0);
}
/**
@@ -664,8 +664,8 @@ public class TheMovieDbApiTest {
public void testGetKeywordMovies() throws Exception {
LOG.info("getKeywordMovies");
int page = 0;
List<KeywordMovie> result = tmdb.getKeywordMovies(ID_KEYWORD, LANGUAGE_DEFAULT, page);
assertFalse("No keyword movies found", result.isEmpty());
TmdbResultsList<KeywordMovie> result = tmdb.getKeywordMovies(ID_KEYWORD, LANGUAGE_DEFAULT, page);
assertFalse("No keyword movies found", result.getResults().isEmpty());
}
/**
@@ -675,9 +675,9 @@ public class TheMovieDbApiTest {
public void testGetReviews() throws Exception {
LOG.info("getReviews");
int page = 0;
List<Reviews> result = tmdb.getReviews(ID_MOVIE_THE_AVENGERS, LANGUAGE_DEFAULT, page);
TmdbResultsList<Reviews> result = tmdb.getReviews(ID_MOVIE_THE_AVENGERS, LANGUAGE_DEFAULT, page);
assertFalse("No reviews found", result.isEmpty());
assertFalse("No reviews found", result.getResults().isEmpty());
}
/**
@@ -708,8 +708,8 @@ public class TheMovieDbApiTest {
public void testGetPersonPopular_int() throws Exception {
LOG.info("getPersonPopular");
int page = 0;
List<Person> result = tmdb.getPersonPopular(page);
assertFalse("No popular people", result.isEmpty());
TmdbResultsList<Person> result = tmdb.getPersonPopular(page);
assertFalse("No popular people", result.getResults().isEmpty());
}
/**
@@ -760,8 +760,8 @@ public class TheMovieDbApiTest {
@Test
public void testGetJobs() throws Exception {
LOG.info("getJobs");
List<JobDepartment> result = tmdb.getJobs();
assertFalse("No jobs found", result.isEmpty());
TmdbResultsList<JobDepartment> result = tmdb.getJobs();
assertFalse("No jobs found", result.getResults().isEmpty());
}
/**
@@ -780,7 +780,7 @@ public class TheMovieDbApiTest {
Discover discover = new Discover();
discover.year(2013).language(LANGUAGE_ENGLISH);
List<MovieDb> result = tmdb.getDiscover(discover);
assertFalse("No movies discovered", result.isEmpty());
TmdbResultsList<MovieDb> result = tmdb.getDiscover(discover);
assertFalse("No movies discovered", result.getResults().isEmpty());
}
}