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 *.war
*.ear *.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) 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/ Originally written for use by Yet Another Movie Jukebox [(YAMJ)](http://code.google.com/p/moviejukebox/)
But anyone can feel free to use it for other projects as well.
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. But anyone can use it for other projects as well.
http://www.themoviedb.org ***
### 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 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) 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 Project Documentation
+30 -17
View File
@@ -13,7 +13,7 @@
<groupId>com.omertron</groupId> <groupId>com.omertron</groupId>
<artifactId>themoviedbapi</artifactId> <artifactId>themoviedbapi</artifactId>
<version>3.5</version> <version>3.6</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>API-The MovieDB</name> <name>API-The MovieDB</name>
@@ -74,37 +74,30 @@
</properties> </properties>
<dependencies> <dependencies>
<!--TESTING-->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.11</version> <version>4.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!--JSON-->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId> <artifactId>jackson-core</artifactId>
<version>2.2.1</version> <version>2.2.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
<version>2.2.1</version> <version>2.2.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.2.1</version> <version>2.2.2</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>
</dependency> </dependency>
<!--LOGGING-->
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
@@ -116,12 +109,19 @@
<version>1.7.5</version> <version>1.7.5</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!--COMMON HTTP TOOLS-->
<dependency>
<groupId>org.yamj</groupId>
<artifactId>api-common</artifactId>
<version>1.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}-${project.version}-${buildNumber}</finalName> <finalName>${project.artifactId}-${project.version}-${buildNumber}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId> <artifactId>buildnumber-maven-plugin</artifactId>
@@ -141,10 +141,11 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version> <version>3.1</version>
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
@@ -153,6 +154,7 @@
<!-- excludes><exclude>**/*</exclude></excludes --> <!-- excludes><exclude>**/*</exclude></excludes -->
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
@@ -168,15 +170,17 @@
</archive> </archive>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version> <version>2.14.1</version>
<configuration> <configuration>
<!-- To skip tests by default --> <!-- To skip tests by default -->
<skipTests>${skipTests}</skipTests> <skipTests>${skipTests}</skipTests>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
@@ -205,6 +209,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
@@ -224,15 +229,17 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId> <artifactId>versions-maven-plugin</artifactId>
<version>2.0</version> <version>2.0</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
<version>3.2</version> <version>3.3</version>
<configuration> <configuration>
<reportPlugins> <reportPlugins>
<plugin> <plugin>
@@ -260,31 +267,37 @@
</reportPlugins> </reportPlugins>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId> <artifactId>maven-clean-plugin</artifactId>
<version>2.5</version> <version>2.5</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version> <version>2.7</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version> <version>1.4</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId> <artifactId>maven-install-plugin</artifactId>
<version>2.4</version> <version>2.4</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>2.6</version> <version>2.6</version>
</plugin> </plugin>
</plugins> </plugins>
<extensions> <extensions>
@@ -55,7 +55,11 @@ public class MovieDbException extends Exception {
/* /*
* Autorisation rejected * Autorisation rejected
*/ */
AUTHORISATION_FAILURE; AUTHORISATION_FAILURE,
/*
* Service Unavailable, usually temporary
*/
HTTP_503_ERROR;
} }
private final MovieDbExceptionType exceptionType; 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -107,10 +109,6 @@ public class AlternativeTitle implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[AlternativeTitle="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[country=").append(country);
sb.append("],[title=").append(title);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -195,14 +197,6 @@ public class Artwork implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Artwork="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -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 com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.StringUtils; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -165,14 +167,6 @@ public class Collection implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Collection="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -122,14 +124,6 @@ public class CollectionInfo implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[CollectionInfo="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -128,6 +130,6 @@ public class Company implements Serializable {
@Override @Override
public String toString() { 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.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -108,10 +110,6 @@ public class Genre implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Genre="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -29,7 +31,7 @@ public class JobDepartment {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// Logger // Logger
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class); private static final Logger LOG = LoggerFactory.getLogger(JobDepartment.class);
// Properties // Properties
@JsonProperty("department") @JsonProperty("department")
private String department; private String department;
@@ -69,4 +71,9 @@ public class JobDepartment {
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString()); 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.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -109,10 +111,6 @@ public class Keyword implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Keyword="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -56,6 +58,10 @@ public class KeywordMovie implements Serializable {
private float voteAverage; private float voteAverage;
@JsonProperty("vote_count") @JsonProperty("vote_count")
private double voteCount; private double voteCount;
@JsonProperty("adult")
private boolean adult;
@JsonProperty("popularity")
private float popularity;
// <editor-fold defaultstate="collapsed" desc="Getter methods"> // <editor-fold defaultstate="collapsed" desc="Getter methods">
public static long getSerialVersionUID() { public static long getSerialVersionUID() {
@@ -93,6 +99,14 @@ public class KeywordMovie implements Serializable {
public double getVoteCount() { public double getVoteCount() {
return voteCount; return voteCount;
} }
public boolean isAdult() {
return adult;
}
public float getPopularity() {
return popularity;
}
// </editor-fold> // </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods"> // <editor-fold defaultstate="collapsed" desc="Setter methods">
@@ -127,6 +141,14 @@ public class KeywordMovie implements Serializable {
public void setVoteCount(double voteCount) { public void setVoteCount(double voteCount) {
this.voteCount = voteCount; this.voteCount = voteCount;
} }
public void setAdult(boolean adult) {
this.adult = adult;
}
public void setPopularity(float popularity) {
this.popularity = popularity;
}
// </editor-fold> // </editor-fold>
/** /**
@@ -143,4 +165,8 @@ public class KeywordMovie implements Serializable {
LOG.trace(sb.toString()); 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.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -108,10 +110,6 @@ public class Language implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Language="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("isoCode=").append(isoCode);
sb.append(", name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -33,6 +33,8 @@ import com.omertron.themoviedbapi.wrapper.WrapperTrailers;
import com.omertron.themoviedbapi.wrapper.WrapperTranslations; import com.omertron.themoviedbapi.wrapper.WrapperTranslations;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -394,7 +396,7 @@ public class MovieDb implements Serializable {
public void setReviews(WrapperReviews reviews) { public void setReviews(WrapperReviews reviews) {
this.reviews = reviews; this.reviews = reviews;
} }
//</editor-fold> //</editor-fold>
/** /**
@@ -445,31 +447,6 @@ public class MovieDb implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[MovieDB="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -23,11 +23,14 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections; import java.util.Collections;
import java.util.List; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Wrapper for the MovieDbList function * Wrapper for the MovieDbList function
*
* @author stuart.boston * @author stuart.boston
*/ */
public class MovieDbList { public class MovieDbList {
@@ -148,4 +151,8 @@ public class MovieDbList {
LOG.trace(sb.toString()); 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -141,6 +143,6 @@ public class MovieList implements Serializable {
@Override @Override
public String toString() { 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.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -321,23 +323,6 @@ public class Person implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Person="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -161,13 +163,6 @@ public class PersonCast implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[PersonCast="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -161,18 +163,6 @@ public class PersonCredit implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[PersonCredit="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -146,13 +148,6 @@ public class PersonCrew implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[PersonCrew="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -109,10 +111,6 @@ public class ProductionCompany implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ProductionCompany="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -109,10 +111,6 @@ public class ProductionCountry implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ProductionCountry="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[isoCode=").append(isoCode);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -121,11 +123,6 @@ public class ReleaseInfo implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ReleaseInfo="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[country=").append(country);
sb.append("],[certification=").append(certification);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -98,4 +100,9 @@ public class Reviews implements Serializable {
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString()); 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -81,9 +83,6 @@ public class StatusCode implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("Status Code: ").append(statusCode);
sb.append(", Message: ").append(statusMessage);
return sb.toString();
} }
} }
@@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -195,13 +197,6 @@ public class TmdbConfiguration implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ImageConfiguration="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -83,7 +85,7 @@ public class TokenAuthorisation {
@Override @Override
public String toString() { 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -115,6 +117,6 @@ public class TokenSession {
@Override @Override
public String toString() { 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 com.fasterxml.jackson.annotation.JsonAnySetter;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -132,12 +134,6 @@ public class Trailer implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Trailer="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
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();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -121,11 +123,6 @@ public class Translation implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Translation="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[englishName=").append(englishName); }
sb.append("],[isoCode=").append(isoCode);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
}
} }
@@ -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 * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.tools; package com.omertron.themoviedbapi.tools;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* The API URL that is used to construct the API call * The API URL that is used to construct the API call
* *
* @author Stuart * @author Stuart
*/ */
public class ApiUrl { public class ApiUrl {
/* /*
* Logger * Logger
*/ */
private static final Logger LOG = LoggerFactory.getLogger(ApiUrl.class); private static final Logger LOG = LoggerFactory.getLogger(ApiUrl.class);
/* /*
* TheMovieDbApi API Base URL * TheMovieDbApi API Base URL
*/ */
private static final String TMDB_API_BASE = "http://api.themoviedb.org/3/"; private static final String TMDB_API_BASE = "http://api.themoviedb.org/3/";
/* /*
* Parameter configuration * Parameter configuration
*/ */
private static final String DELIMITER_FIRST = "?"; private static final String DELIMITER_FIRST = "?";
private static final String DELIMITER_SUBSEQUENT = "&"; private static final String DELIMITER_SUBSEQUENT = "&";
private static final String DEFAULT_STRING = ""; private static final String DEFAULT_STRING = "";
/* /*
* Properties * Properties
*/ */
private String apiKey; private String apiKey;
private String method; private String method;
private String submethod; private String submethod;
private Map<String, String> arguments = new HashMap<String, String>(); private Map<String, String> arguments = new HashMap<String, String>();
/* /*
* API Parameters * API Parameters
*/ */
public static final String PARAM_ADULT = "include_adult="; public static final String PARAM_ADULT = "include_adult=";
public static final String PARAM_API_KEY = "api_key="; public static final String PARAM_API_KEY = "api_key=";
public static final String PARAM_COUNTRY = "country="; public static final String PARAM_COUNTRY = "country=";
public static final String PARAM_FAVORITE = "favorite="; public static final String PARAM_FAVORITE = "favorite=";
public static final String PARAM_ID = "id="; public static final String PARAM_ID = "id=";
public static final String PARAM_LANGUAGE = "language="; public static final String PARAM_LANGUAGE = "language=";
public static final String PARAM_INCLUDE_ALL_MOVIES = "include_all_movies="; 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_MOVIE_WATCHLIST = "movie_watchlist=";
public static final String PARAM_PAGE = "page="; public static final String PARAM_PAGE = "page=";
public static final String PARAM_QUERY = "query="; public static final String PARAM_QUERY = "query=";
public static final String PARAM_SESSION = "session_id="; public static final String PARAM_SESSION = "session_id=";
public static final String PARAM_TOKEN = "request_token="; public static final String PARAM_TOKEN = "request_token=";
public static final String PARAM_VALUE = "value="; public static final String PARAM_VALUE = "value=";
public static final String PARAM_YEAR = "year="; public static final String PARAM_YEAR = "year=";
private static final String APPEND_TO_RESPONSE = "append_to_response="; public static final String PARAM_START_DATE="start_date=";
public static final String PARAM_END_DATE="end_date=";
//<editor-fold defaultstate="collapsed" desc="Constructor Methods"> private static final String APPEND_TO_RESPONSE = "append_to_response=";
/**
* Constructor for the simple API URL method without a sub-method //<editor-fold defaultstate="collapsed" desc="Constructor Methods">
* /**
* @param method * Constructor for the simple API URL method without a sub-method
*/ *
public ApiUrl(String apiKey, String method) { * @param method
this.apiKey = apiKey; */
this.method = method; public ApiUrl(String apiKey, String method) {
this.submethod = DEFAULT_STRING; this.apiKey = apiKey;
} this.method = method;
this.submethod = DEFAULT_STRING;
/** }
* Constructor for the API URL with a sub-method
* /**
* @param method * Constructor for the API URL with a sub-method
* @param submethod *
*/ * @param method
public ApiUrl(String apiKey, String method, String submethod) { * @param submethod
this.apiKey = apiKey; */
this.method = method; public ApiUrl(String apiKey, String method, String submethod) {
this.submethod = submethod; this.apiKey = apiKey;
} this.method = method;
//</editor-fold> this.submethod = submethod;
}
/** //</editor-fold>
* Build the URL from the pre-created arguments.
*/ /**
public URL buildUrl() { * Build the URL from the pre-created arguments.
StringBuilder urlString = new StringBuilder(TMDB_API_BASE); */
public URL buildUrl() {
// Get the start of the URL StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
urlString.append(method);
// Get the start of the URL
// We have either a queury, or a direct request urlString.append(method);
if (arguments.containsKey(PARAM_QUERY)) {
// Append the suffix of the API URL // We have either a queury, or a direct request
if(StringUtils.endsWith(urlString, "/") && submethod.startsWith("/")) { if (arguments.containsKey(PARAM_QUERY)) {
urlString.deleteCharAt(urlString.length()-1); // Append the suffix of the API URL
} if(StringUtils.endsWith(urlString, "/") && submethod.startsWith("/")) {
urlString.append(submethod); urlString.deleteCharAt(urlString.length()-1);
}
// Append the key information urlString.append(submethod);
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
urlString.append(apiKey); // Append the key information
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
// Append the search term urlString.append(apiKey);
urlString.append(DELIMITER_SUBSEQUENT);
urlString.append(PARAM_QUERY); // Append the search term
urlString.append(DELIMITER_SUBSEQUENT);
String query = arguments.get(PARAM_QUERY); urlString.append(PARAM_QUERY);
try { String query = arguments.get(PARAM_QUERY);
urlString.append(URLEncoder.encode(query, "UTF-8"));
} catch (UnsupportedEncodingException ex) { try {
LOG.trace("Unable to encode query: '{}' trying raw.", query); urlString.append(URLEncoder.encode(query, "UTF-8"));
// If we can't encode it, try it raw } catch (UnsupportedEncodingException ex) {
urlString.append(query); 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 { // Remove the query from the arguments so it is not added later
// Append the ID if provided arguments.remove(PARAM_QUERY);
if (arguments.containsKey(PARAM_ID)) { } else {
urlString.append(arguments.get(PARAM_ID)); // Append the ID if provided
arguments.remove(PARAM_ID); 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); // Append the suffix of the API URL
} if(StringUtils.endsWith(urlString, "/") && submethod.startsWith("/")) {
urlString.append(submethod); urlString.deleteCharAt(urlString.length()-1);
}
// Append the key information urlString.append(submethod);
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
urlString.append(apiKey); // 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()); 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()); try {
} catch (MalformedURLException ex) { LOG.trace("URL: {}", urlString.toString());
LOG.warn("Failed to create URL {} - {}", urlString.toString(), ex.toString()); return new URL(urlString.toString());
return null; } catch (MalformedURLException ex) {
} finally { LOG.warn("Failed to create URL {} - {}", urlString.toString(), ex.toString());
arguments.clear(); return null;
} } finally {
} arguments.clear();
}
/** }
* Add arguments individually
* /**
* @param key * Add arguments individually
* @param value *
*/ * @param key
public void addArgument(String key, String value) { * @param value
arguments.put(key, value); */
} public void addArgument(String key, String value) {
arguments.put(key, value);
/** }
* Add arguments individually
* /**
* @param key * Add arguments individually
* @param value *
*/ * @param key
public void addArgument(String key, int value) { * @param value
arguments.put(key, Integer.toString(value)); */
} public void addArgument(String key, int value) {
arguments.put(key, Integer.toString(value));
/** }
* Add arguments individually
* /**
* @param key * Add arguments individually
* @param value *
*/ * @param key
public void addArgument(String key, boolean value) { * @param value
arguments.put(key, Boolean.toString(value)); */
} public void addArgument(String key, boolean value) {
arguments.put(key, Boolean.toString(value));
/** }
* Add arguments individually
* /**
* @param key * Add arguments individually
* @param value *
*/ * @param key
public void addArgument(String key, float value) { * @param value
arguments.put(key, Float.toString(value)); */
} public void addArgument(String key, float value) {
arguments.put(key, Float.toString(value));
/** }
* Clear the arguments
*/ /**
public void clearArguments() { * Clear the arguments
arguments.clear(); */
} public void clearArguments() {
arguments.clear();
/** }
* Set the arguments directly
* /**
* @param args * Set the arguments directly
*/ *
public void setArguments(Map<String, String> args) { * @param args
arguments.putAll(args); */
} public void setArguments(Map<String, String> args) {
arguments.putAll(args);
/** }
* Append any optional parameters to the URL
* /**
* @param appendToResponse * Append any optional parameters to the URL
*/ *
public void appendToResponse(String[] appendToResponse) { * @param appendToResponse
if (appendToResponse.length > 0) { */
StringBuilder sb = new StringBuilder(); public void appendToResponse(String[] appendToResponse) {
boolean first = Boolean.TRUE; if (appendToResponse.length > 0) {
for (String append : appendToResponse) { StringBuilder sb = new StringBuilder();
if (first) { boolean first = Boolean.TRUE;
first = Boolean.FALSE; for (String append : appendToResponse) {
} else { if (first) {
sb.append(","); first = Boolean.FALSE;
} } else {
sb.append(append); sb.append(",");
} }
addArgument(APPEND_TO_RESPONSE, sb.toString()); sb.append(append);
} }
} addArgument(APPEND_TO_RESPONSE, sb.toString());
} }
}
}
@@ -1,82 +1,74 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList;
import java.io.Serializable; import java.util.Arrays;
import java.util.List; import java.util.EnumSet;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/** import org.slf4j.Logger;
* import org.slf4j.LoggerFactory;
* @author Stuart
*/ public abstract class AbstractWrapper {
public class MovieChanges implements Serializable {
private Logger log;
private static final long serialVersionUID = 1L;
public AbstractWrapper(Class classToLog) {
/* this.log = LoggerFactory.getLogger(classToLog);
* Logger }
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class); /**
/* * Get a list of the enums passed
* Properties *
*/ * @param <E>
@JsonProperty("key") * @param clz Class of the enum
private String key; * @param typeList Array of the enums
@JsonProperty("items") * @return
private List<ChangeItem> items; */
public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) {
//<editor-fold defaultstate="collapsed" desc="Getter Methods"> if (typeList.length > 0) {
public String getKey() { return new ArrayList<E>(Arrays.asList(typeList));
return key; } else {
} return new ArrayList<E>(EnumSet.allOf(clz));
}
public List<ChangeItem> getItems() { }
return items;
} /**
//</editor-fold> * Handle unknown properties and print a message
*
//<editor-fold defaultstate="collapsed" desc="Setter Methods"> * @param key
public void setKey(String key) { * @param value
this.key = key; */
} @JsonAnySetter
public void handleUnknown(String key, Object value) {
public void setItems(List<ChangeItem> items) { StringBuilder sb = new StringBuilder();
this.items = items; sb.append("Unknown property: '").append(key);
} sb.append("' value: '").append(value).append("'");
//</editor-fold> log.trace(sb.toString());
}
/**
* Handle unknown properties and print a message @Override
* public String toString() {
* @param key return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
* @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,102 +1,74 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger; /**
* Base class for the wrappers
/** *
* Base class for the wrappers * @author Stuart
* */
* @author Stuart public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, IWrapperPages {
*/ /*
public class WrapperBase { * Properties
/* */
* Logger - set by the sub-classes
*/ @JsonProperty("page")
private int page;
private Logger log; @JsonProperty("total_pages")
/* private int totalPages;
* Properties @JsonProperty("total_results")
*/ private int totalResults;
@JsonProperty("id")
private int id; public AbstractWrapperAll(Class classToLog) {
@JsonProperty("page") super(classToLog);
private int page; }
@JsonProperty("total_pages")
private int totalPages; @Override
@JsonProperty("total_results") public int getPage() {
private int totalResults; return page;
}
public WrapperBase(Logger logger) {
this.log = logger; @Override
} public int getTotalPages() {
return totalPages;
//<editor-fold defaultstate="collapsed" desc="Getter Methods"> }
public int getId() {
return id; @Override
} public int getTotalResults() {
return totalResults;
public int getPage() { }
return page;
} @Override
public void setPage(int page) {
public int getTotalPages() { this.page = page;
return totalPages; }
}
@Override
public int getTotalResults() { public void setTotalPages(int totalPages) {
return totalResults; this.totalPages = totalPages;
} }
//</editor-fold>
@Override
//<editor-fold defaultstate="collapsed" desc="Setter Methods"> public void setTotalResults(int totalResults) {
public void setId(int id) { this.totalResults = totalResults;
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());
}
}
@@ -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 * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model.AlternativeTitle; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperAlternativeTitles extends AbstractWrapperId {
* @author Stuart
*/ @JsonProperty("titles")
public class WrapperAlternativeTitles { private List<AlternativeTitle> titles;
/*
* Logger public WrapperAlternativeTitles() {
*/ super(WrapperAlternativeTitles.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperAlternativeTitles.class);
/* public List<AlternativeTitle> getTitles() {
* Properties return titles;
*/ }
@JsonProperty("id")
private int id; public void setTitles(List<AlternativeTitle> titles) {
@JsonProperty("titles") this.titles = 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());
}
}
@@ -1,70 +1,42 @@
/* package com.omertron.themoviedbapi.wrapper;
* Copyright (c) 2004-2013 Stuart Boston
* import java.util.ArrayList;
* This file is part of TheMovieDB API. import java.util.HashMap;
* import java.util.List;
* TheMovieDB API is free software: you can redistribute it and/or modify import java.util.Map;
* it under the terms of the GNU General Public License as published by import com.fasterxml.jackson.annotation.JsonAnyGetter;
* the Free Software Foundation, either version 3 of the License, or import com.fasterxml.jackson.annotation.JsonAnySetter;
* any later version. import com.fasterxml.jackson.annotation.JsonProperty;
* import com.omertron.themoviedbapi.model.ChangeKeyItem;
* TheMovieDB API is distributed in the hope that it will be useful, import org.apache.commons.lang3.builder.ToStringBuilder;
* but WITHOUT ANY WARRANTY; without even the implied warranty of import org.apache.commons.lang3.builder.ToStringStyle;
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. public class WrapperChanges {
*
* You should have received a copy of the GNU General Public License @JsonProperty("changes")
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. private List<ChangeKeyItem> changedItems = new ArrayList<ChangeKeyItem>();
* private Map<String, Object> newItems = new HashMap<String, Object>();
*/
package com.omertron.themoviedbapi.wrapper; public List<ChangeKeyItem> getChangedItems() {
return changedItems;
import com.fasterxml.jackson.annotation.JsonAnySetter; }
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieChanges; public void setChangedItems(List<ChangeKeyItem> changes) {
import java.util.List; this.changedItems = changes;
import org.slf4j.Logger; }
import org.slf4j.LoggerFactory;
@JsonAnyGetter
/** public Map<String, Object> getNewItems() {
* return this.newItems;
* @author stuart.boston }
*/
public class WrapperChanges { @JsonAnySetter
/* public void setNewItems(String name, Object value) {
* Logger this.newItems.put(name, value);
*/ }
private static final Logger LOG = LoggerFactory.getLogger(WrapperChanges.class); @Override
/* public String toString() {
* Properties return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
*/ }
@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());
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Collection; import com.omertron.themoviedbapi.model.Collection;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCollection extends AbstractWrapperAll {
public class WrapperCollection extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Collection> results;
*/
public WrapperCollection() {
@JsonProperty("results") super(WrapperCollection.class);
private List<Collection> results; }
public WrapperCollection() { public List<Collection> getResults() {
super(LoggerFactory.getLogger(WrapperCollection.class)); return results;
} }
public List<Collection> getResults() { public void setResults(List<Collection> results) {
return results; this.results = results;
} }
}
public void setResults(List<Collection> results) {
this.results = results;
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Company; import com.omertron.themoviedbapi.model.Company;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCompany extends AbstractWrapperAll {
public class WrapperCompany extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Company> results;
*/
public WrapperCompany() {
@JsonProperty("results") super(WrapperCompany.class);
private List<Company> results; }
public WrapperCompany() { public List<Company> getResults() {
super(LoggerFactory.getLogger(WrapperCompany.class)); return results;
} }
public List<Company> getResults() { public void setResults(List<Company> results) {
return results; this.results = results;
} }
}
public void setResults(List<Company> results) {
this.results = results;
}
}
@@ -1,62 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCompanyMovies extends AbstractWrapperAll {
public class WrapperCompanyMovies extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<MovieDb> results;
*/
public WrapperCompanyMovies() {
@JsonProperty("results") super(WrapperCompanyMovies.class);
private List<MovieDb> results; }
public WrapperCompanyMovies() { public List<MovieDb> getResults() {
super(LoggerFactory.getLogger(WrapperCompanyMovies.class)); return results;
} }
public List<MovieDb> getResults() { public void setResults(List<MovieDb> results) {
return results; this.results = 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();
}
}
@@ -1,77 +1,57 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.TmdbConfiguration;
import com.omertron.themoviedbapi.model.TmdbConfiguration; import java.util.Collections;
import java.util.Collections; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperConfig extends AbstractWrapper {
* @author Stuart
*/ @JsonProperty("images")
public class WrapperConfig { private TmdbConfiguration tmdbConfiguration;
/* @JsonProperty("change_keys")
* Logger private List<String> changeKeys = Collections.EMPTY_LIST;
*/
public WrapperConfig() {
private static final Logger LOG = LoggerFactory.getLogger(WrapperConfig.class); super(WrapperConfig.class);
/* }
* Properties
*/ public TmdbConfiguration getTmdbConfiguration() {
@JsonProperty("images") return tmdbConfiguration;
private TmdbConfiguration tmdbConfiguration; }
@JsonProperty("change_keys")
private List<String> changeKeys = Collections.EMPTY_LIST; public void setTmdbConfiguration(TmdbConfiguration tmdbConfiguration) {
this.tmdbConfiguration = tmdbConfiguration;
public TmdbConfiguration getTmdbConfiguration() { }
return tmdbConfiguration;
} public List<String> getChangeKeys() {
return changeKeys;
public void setTmdbConfiguration(TmdbConfiguration tmdbConfiguration) { }
this.tmdbConfiguration = tmdbConfiguration;
} public void setChangeKeys(List<String> changeKeys) {
this.changeKeys = changeKeys;
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());
}
}
@@ -1,67 +1,47 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Genre;
import com.omertron.themoviedbapi.model.Genre; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; * Wrapper class for the Genres searches
*
/** * @author Stuart
* Wrapper class for the Genres searches */
* public class WrapperGenres extends AbstractWrapper {
* @author Stuart
*/ @JsonProperty("genres")
public class WrapperGenres { private List<Genre> genres;
/*
* Logger public WrapperGenres() {
*/ super(WrapperGenres.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperGenres.class);
/* public List<Genre> getGenres() {
* Properties return genres;
*/ }
@JsonProperty("genres")
private List<Genre> genres; public void setGenres(List<Genre> genres) {
this.genres = 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());
}
}
@@ -26,16 +26,12 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/** /**
* *
* @author Stuart * @author Stuart
*/ */
public class WrapperImages extends WrapperBase { public class WrapperImages extends AbstractWrapperAll {
/*
* Properties
*/
@JsonProperty("backdrops") @JsonProperty("backdrops")
private List<Artwork> backdrops = Collections.EMPTY_LIST; private List<Artwork> backdrops = Collections.EMPTY_LIST;
@@ -45,10 +41,9 @@ public class WrapperImages extends WrapperBase {
private List<Artwork> profiles = Collections.EMPTY_LIST; private List<Artwork> profiles = Collections.EMPTY_LIST;
public WrapperImages() { public WrapperImages() {
super(LoggerFactory.getLogger(WrapperImages.class)); super(WrapperImages.class);
} }
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<Artwork> getBackdrops() { public List<Artwork> getBackdrops() {
return backdrops; return backdrops;
} }
@@ -60,9 +55,7 @@ public class WrapperImages extends WrapperBase {
public List<Artwork> getProfiles() { public List<Artwork> getProfiles() {
return profiles; return profiles;
} }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdrops(List<Artwork> backdrops) { public void setBackdrops(List<Artwork> backdrops) {
this.backdrops = backdrops; this.backdrops = backdrops;
} }
@@ -74,7 +67,6 @@ public class WrapperImages extends WrapperBase {
public void setProfiles(List<Artwork> profiles) { public void setProfiles(List<Artwork> profiles) {
this.profiles = profiles; this.profiles = profiles;
} }
//</editor-fold>
/** /**
* Return a list of all the artwork with their types. * 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())); types = new ArrayList<ArtworkType>(Arrays.asList(ArtworkType.values()));
} }
// Add all the posters to the list
if (types.contains(ArtworkType.POSTER)) { if (types.contains(ArtworkType.POSTER)) {
// Add all the posters to the list updateArtworkType(posters, ArtworkType.POSTER);
for (Artwork poster : posters) { artwork.addAll(posters);
poster.setArtworkType(ArtworkType.POSTER);
artwork.add(poster);
}
} }
// Add all the backdrops to the list
if (types.contains(ArtworkType.BACKDROP)) { if (types.contains(ArtworkType.BACKDROP)) {
// Add all the backdrops to the list updateArtworkType(backdrops, ArtworkType.BACKDROP);
for (Artwork backdrop : backdrops) { artwork.addAll(backdrops);
backdrop.setArtworkType(ArtworkType.BACKDROP);
artwork.add(backdrop);
}
} }
// Add all the backdrops to the list
if (types.contains(ArtworkType.PROFILE)) { if (types.contains(ArtworkType.PROFILE)) {
// Add all the backdrops to the list updateArtworkType(profiles, ArtworkType.PROFILE);
for (Artwork backdrop : profiles) { artwork.addAll(profiles);
backdrop.setArtworkType(ArtworkType.PROFILE);
artwork.add(backdrop);
}
} }
return artwork; 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; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model.JobDepartment; import com.omertron.themoviedbapi.model.JobDepartment;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
* @author Stuart * @author Stuart
*/ */
public class WrapperJobList { public class WrapperJobList extends AbstractWrapper {
// Logger
private static final Logger LOG = LoggerFactory.getLogger(WrapperJobList.class);
// Properties
@JsonProperty("jobs") @JsonProperty("jobs")
private List<JobDepartment> jobs; private List<JobDepartment> jobs;
public WrapperJobList() {
super(WrapperJobList.class);
}
public List<JobDepartment> getJobs() { public List<JobDepartment> getJobs() {
return jobs; return jobs;
} }
@@ -46,18 +43,4 @@ public class WrapperJobList {
public void setJobs(List<JobDepartment> jobs) { public void setJobs(List<JobDepartment> jobs) {
this.jobs = 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 * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.KeywordMovie; import com.omertron.themoviedbapi.model.KeywordMovie;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperKeywordMovies extends AbstractWrapperAll {
public class WrapperKeywordMovies extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<KeywordMovie> results;
*/
public WrapperKeywordMovies() {
@JsonProperty("results") super(WrapperKeywordMovies.class);
private List<KeywordMovie> results; }
public WrapperKeywordMovies() { public List<KeywordMovie> getResults() {
super(LoggerFactory.getLogger(WrapperKeywordMovies.class)); return results;
} }
public List<KeywordMovie> getResults() { public void setResults(List<KeywordMovie> results) {
return results; this.results = results;
} }
}
public void setResults(List<KeywordMovie> results) {
this.results = results;
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Keyword; import com.omertron.themoviedbapi.model.Keyword;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperKeywords extends AbstractWrapperAll {
public class WrapperKeywords extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Keyword> results;
*/
public WrapperKeywords() {
@JsonProperty("results") super(WrapperKeywords.class);
private List<Keyword> results; }
public WrapperKeywords() { public List<Keyword> getResults() {
super(LoggerFactory.getLogger(WrapperKeywords.class)); return results;
} }
public List<Keyword> getResults() { public void setResults(List<Keyword> results) {
return results; this.results = results;
} }
}
public void setResults(List<Keyword> results) {
this.results = results;
}
}
@@ -1,62 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperMovie extends AbstractWrapperAll {
public class WrapperMovie extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<MovieDb> movies;
*/
public WrapperMovie() {
@JsonProperty("results") super(WrapperMovie.class);
private List<MovieDb> movies; }
public WrapperMovie() { public List<MovieDb> getMovies() {
super(LoggerFactory.getLogger(WrapperMovie.class)); return movies;
} }
public List<MovieDb> getMovies() { public void setMovies(List<MovieDb> movies) {
return movies; this.movies = 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();
}
}
@@ -1,91 +1,79 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Person;
import com.omertron.themoviedbapi.model.PersonCast; import com.omertron.themoviedbapi.model.PersonCast;
import com.omertron.themoviedbapi.model.PersonCrew; import com.omertron.themoviedbapi.model.PersonCrew;
import java.util.List; import java.util.ArrayList;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author Stuart
* @author Stuart */
*/ public class WrapperMovieCasts extends AbstractWrapperId {
public class WrapperMovieCasts {
/* @JsonProperty("cast")
* Logger private List<PersonCast> cast;
*/ @JsonProperty("crew")
private List<PersonCrew> crew;
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieCasts.class);
/* public WrapperMovieCasts() {
* Properties super(WrapperMovieCasts.class);
*/ }
@JsonProperty("id")
private int id; public List<PersonCast> getCast() {
@JsonProperty("cast") return cast;
private List<PersonCast> cast; }
@JsonProperty("crew")
private List<PersonCrew> crew; public List<PersonCrew> getCrew() {
return crew;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> }
public List<PersonCast> getCast() {
return cast; public void setCast(List<PersonCast> cast) {
} this.cast = cast;
}
public List<PersonCrew> getCrew() {
return crew; public void setCrew(List<PersonCrew> crew) {
} this.crew = crew;
}
public int getId() {
return id; public List<Person> getAll() {
} List<Person> people = new ArrayList<Person>();
//</editor-fold>
// Add a cast member
//<editor-fold defaultstate="collapsed" desc="Setter methods"> for (PersonCast member : cast) {
public void setCast(List<PersonCast> cast) { Person person = new Person();
this.cast = cast; person.addCast(member.getId(), member.getName(), member.getProfilePath(), member.getCharacter(), member.getOrder());
} people.add(person);
}
public void setCrew(List<PersonCrew> crew) {
this.crew = crew; // Add a crew member
} for (PersonCrew member : crew) {
Person person = new Person();
public void setId(int id) { person.addCrew(member.getId(), member.getName(), member.getProfilePath(), member.getDepartment(), member.getJob());
this.id = id; people.add(person);
} }
//</editor-fold>
return people;
/** }
* 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 * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Keyword;
import com.omertron.themoviedbapi.model.Keyword; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperMovieKeywords extends AbstractWrapperId {
* @author Stuart
*/ @JsonProperty("keywords")
public class WrapperMovieKeywords { private List<Keyword> keywords;
/*
* Logger public WrapperMovieKeywords() {
*/ super(WrapperMovieKeywords.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieKeywords.class);
/* public List<Keyword> getKeywords() {
* Properties return keywords;
*/ }
@JsonProperty("id")
private int id; public void setKeywords(List<Keyword> keywords) {
@JsonProperty("keywords") this.keywords = 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());
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieList; import com.omertron.themoviedbapi.model.MovieList;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author Stuart
* @author Stuart */
*/ public class WrapperMovieList extends AbstractWrapperAll {
public class WrapperMovieList extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<MovieList> movieList;
*/
public WrapperMovieList() {
@JsonProperty("results") super(WrapperMovieList.class);
private List<MovieList> movieList; }
public WrapperMovieList() { public List<MovieList> getMovieList() {
super(LoggerFactory.getLogger(WrapperMovieList.class)); return movieList;
} }
public List<MovieList> getMovieList() { public void setMovieList(List<MovieList> movieList) {
return movieList; this.movieList = movieList;
} }
}
public void setMovieList(List<MovieList> movieList) {
this.movieList = movieList;
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Person; import com.omertron.themoviedbapi.model.Person;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperPerson extends AbstractWrapperAll {
public class WrapperPerson extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Person> results;
*/
public WrapperPerson() {
@JsonProperty("results") super(WrapperPerson.class);
private List<Person> results; }
public WrapperPerson() { public List<Person> getResults() {
super(LoggerFactory.getLogger(WrapperPerson.class)); return results;
} }
public List<Person> getResults() { public void setResults(List<Person> results) {
return results; this.results = results;
} }
}
public void setResults(List<Person> results) {
this.results = results;
}
}
@@ -1,60 +1,81 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.PersonCredit; import com.omertron.themoviedbapi.model.PersonCredit;
import java.util.List; import com.omertron.themoviedbapi.model.PersonType;
import org.slf4j.LoggerFactory; import java.util.ArrayList;
import java.util.List;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
public class WrapperPersonCredits extends WrapperBase { */
/* public class WrapperPersonCredits extends AbstractWrapperAll {
* Properties
*/ @JsonProperty("cast")
private List<PersonCredit> cast;
@JsonProperty("cast") @JsonProperty("crew")
private List<PersonCredit> cast; private List<PersonCredit> crew;
@JsonProperty("crew")
private List<PersonCredit> crew; public WrapperPersonCredits() {
super(WrapperMovieCasts.class);
public WrapperPersonCredits() { }
super(LoggerFactory.getLogger(WrapperMovieCasts.class));
} public List<PersonCredit> getCast() {
return cast;
public List<PersonCredit> getCast() { }
return cast;
} public void setCast(List<PersonCredit> cast) {
this.cast = cast;
public void setCast(List<PersonCredit> cast) { }
this.cast = cast;
} public List<PersonCredit> getCrew() {
return crew;
public List<PersonCredit> getCrew() { }
return crew;
} public void setCrew(List<PersonCredit> crew) {
this.crew = 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; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.Person; import com.omertron.themoviedbapi.model.Person;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/** /**
* *
* @author Stuart * @author Stuart
*/ */
public class WrapperPersonList extends WrapperBase { public class WrapperPersonList extends AbstractWrapperAll {
/*
* Properties
*/
@JsonProperty("results") @JsonProperty("results")
private List<Person> personList; private List<Person> personList;
public WrapperPersonList() { public WrapperPersonList() {
super(LoggerFactory.getLogger(WrapperPersonList.class)); super(WrapperPersonList.class);
} }
public List<Person> getPersonList() { public List<Person> getPersonList() {
@@ -1,80 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model.ReleaseInfo; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperReleaseInfo extends AbstractWrapperId {
* @author Stuart
*/ @JsonProperty("countries")
public class WrapperReleaseInfo { private List<ReleaseInfo> countries;
/*
* Logger public WrapperReleaseInfo() {
*/ super(WrapperReleaseInfo.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperReleaseInfo.class);
/* public List<ReleaseInfo> getCountries() {
* Properties return countries;
*/ }
@JsonProperty("id")
private int id; public void setCountries(List<ReleaseInfo> countries) {
@JsonProperty("countries") this.countries = 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());
}
}
@@ -22,22 +22,18 @@ package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Reviews; import com.omertron.themoviedbapi.model.Reviews;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/** /**
* *
* @author stuart.boston * @author stuart.boston
*/ */
public class WrapperReviews extends WrapperBase { public class WrapperReviews extends AbstractWrapperAll {
/*
* Properties
*/
@JsonProperty("results") @JsonProperty("results")
private List<Reviews> reviews; private List<Reviews> reviews;
public WrapperReviews() { public WrapperReviews() {
super(LoggerFactory.getLogger(WrapperReviews.class)); super(WrapperReviews.class);
} }
public List<Reviews> getReviews() { public List<Reviews> getReviews() {
@@ -19,37 +19,24 @@
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Trailer; import com.omertron.themoviedbapi.model.Trailer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
* @author Stuart * @author Stuart
*/ */
public class WrapperTrailers { public class WrapperTrailers extends AbstractWrapperId {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperTrailers.class);
/*
* Properties
*/
@JsonProperty("id")
private int id;
@JsonProperty("quicktime") @JsonProperty("quicktime")
private List<Trailer> quicktime; private List<Trailer> quicktime;
@JsonProperty("youtube") @JsonProperty("youtube")
private List<Trailer> youtube; private List<Trailer> youtube;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public WrapperTrailers() {
public int getId() { super(WrapperTrailers.class);
return id;
} }
public List<Trailer> getQuicktime() { public List<Trailer> getQuicktime() {
@@ -59,12 +46,6 @@ public class WrapperTrailers {
public List<Trailer> getYoutube() { public List<Trailer> getYoutube() {
return youtube; 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) { public void setQuicktime(List<Trailer> quicktime) {
this.quicktime = quicktime; this.quicktime = quicktime;
@@ -73,10 +54,10 @@ public class WrapperTrailers {
public void setYoutube(List<Trailer> youtube) { public void setYoutube(List<Trailer> youtube) {
this.youtube = youtube; this.youtube = youtube;
} }
//</editor-fold>
/** /**
* Get a combined list of the trailers with their source website * Get a combined list of the trailers with their source website
*
* @return * @return
*/ */
public List<Trailer> getAll() { public List<Trailer> getAll() {
@@ -95,18 +76,4 @@ public class WrapperTrailers {
return trailers; 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 * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model.Translation; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperTranslations extends AbstractWrapperId {
* @author Stuart
*/ @JsonProperty("translations")
public class WrapperTranslations { private List<Translation> translations;
/*
* Logger public WrapperTranslations() {
*/ super(WrapperTranslations.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperTranslations.class);
/* public void setTranslations(List<Translation> translations) {
* Properties this.translations = translations;
*/ }
@JsonProperty("id")
private int id; public List<Translation> getTranslations() {
@JsonProperty("translations") return 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());
}
}
@@ -21,6 +21,7 @@ package com.omertron.themoviedbapi;
import com.omertron.themoviedbapi.model.AlternativeTitle; import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model.Artwork; import com.omertron.themoviedbapi.model.Artwork;
import com.omertron.themoviedbapi.model.ChangedItem;
import com.omertron.themoviedbapi.model.Collection; import com.omertron.themoviedbapi.model.Collection;
import com.omertron.themoviedbapi.model.CollectionInfo; import com.omertron.themoviedbapi.model.CollectionInfo;
import com.omertron.themoviedbapi.model.Company; 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.JobDepartment;
import com.omertron.themoviedbapi.model.Keyword; import com.omertron.themoviedbapi.model.Keyword;
import com.omertron.themoviedbapi.model.KeywordMovie; import com.omertron.themoviedbapi.model.KeywordMovie;
import com.omertron.themoviedbapi.model.MovieChanges;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieDbList; import com.omertron.themoviedbapi.model.MovieDbList;
import com.omertron.themoviedbapi.model.MovieList; 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.TokenSession;
import com.omertron.themoviedbapi.model.Trailer; import com.omertron.themoviedbapi.model.Trailer;
import com.omertron.themoviedbapi.model.Translation; import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.results.TmdbResultsList;
import com.omertron.themoviedbapi.results.TmdbResultsMap;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.*; import org.junit.*;
@@ -122,17 +123,17 @@ public class TheMovieDbApiTest {
LOG.info("searchMovie"); LOG.info("searchMovie");
// Try a movie with less than 1 page of results // 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); // 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 // Try a russian langugage movie
movieList = tmdb.searchMovie("О чём говорят мужчины", 0, LANGUAGE_RUSSIAN, true, 0); 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 // Try a movie with more than 20 results
movieList = tmdb.searchMovie("Star Wars", 0, LANGUAGE_ENGLISH, false, 0); 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 { public void testGetMovieAlternativeTitles() throws MovieDbException {
LOG.info("getMovieAlternativeTitles"); LOG.info("getMovieAlternativeTitles");
String country = ""; String country = "";
List<AlternativeTitle> results = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country, "casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists"); 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", results.size() > 0); assertTrue("No alternative titles found", result.getResults().size() > 0);
country = "US"; country = "US";
results = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country); result = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country);
assertTrue("No alternative titles found", results.size() > 0); assertTrue("No alternative titles found", result.getResults().size() > 0);
} }
@@ -167,15 +168,15 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetMovieCasts() throws MovieDbException { public void testGetMovieCasts() throws MovieDbException {
LOG.info("getMovieCasts"); LOG.info("getMovieCasts");
List<Person> people = tmdb.getMovieCasts(ID_MOVIE_BLADE_RUNNER, "alternative_titles,casts,images,keywords,releases,trailers,translations,similar_movies,reviews,lists"); 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.size() > 0); assertTrue("No cast information", people.getResults().size() > 0);
String name1 = "Harrison Ford"; String name1 = "Harrison Ford";
String name2 = "Charles Knode"; String name2 = "Charles Knode";
boolean foundName1 = Boolean.FALSE; boolean foundName1 = Boolean.FALSE;
boolean foundName2 = Boolean.FALSE; boolean foundName2 = Boolean.FALSE;
for (Person person : people) { for (Person person : people.getResults()) {
if (!foundName1 && person.getName().equalsIgnoreCase(name1)) { if (!foundName1 && person.getName().equalsIgnoreCase(name1)) {
foundName1 = Boolean.TRUE; foundName1 = Boolean.TRUE;
} }
@@ -195,8 +196,8 @@ public class TheMovieDbApiTest {
public void testGetMovieImages() throws MovieDbException { public void testGetMovieImages() throws MovieDbException {
LOG.info("getMovieImages"); LOG.info("getMovieImages");
String language = ""; String language = "";
List<Artwork> result = tmdb.getMovieImages(ID_MOVIE_BLADE_RUNNER, language); TmdbResultsList<Artwork> result = tmdb.getMovieImages(ID_MOVIE_BLADE_RUNNER, language);
assertFalse("No artwork found", result.isEmpty()); assertFalse("No artwork found", result.getResults().isEmpty());
} }
/** /**
@@ -205,8 +206,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetMovieKeywords() throws MovieDbException { public void testGetMovieKeywords() throws MovieDbException {
LOG.info("getMovieKeywords"); LOG.info("getMovieKeywords");
List<Keyword> result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER); TmdbResultsList<Keyword> result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER);
assertFalse("No keywords found", result.isEmpty()); assertFalse("No keywords found", result.getResults().isEmpty());
} }
/** /**
@@ -215,8 +216,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetMovieReleaseInfo() throws MovieDbException { public void testGetMovieReleaseInfo() throws MovieDbException {
LOG.info("getMovieReleaseInfo"); LOG.info("getMovieReleaseInfo");
List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, ""); TmdbResultsList<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Release information missing", result.isEmpty()); assertFalse("Release information missing", result.getResults().isEmpty());
} }
/** /**
@@ -225,8 +226,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetMovieTrailers() throws MovieDbException { public void testGetMovieTrailers() throws MovieDbException {
LOG.info("getMovieTrailers"); LOG.info("getMovieTrailers");
List<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, ""); TmdbResultsList<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Movie trailers missing", result.isEmpty()); assertFalse("Movie trailers missing", result.getResults().isEmpty());
} }
/** /**
@@ -235,8 +236,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetMovieTranslations() throws MovieDbException { public void testGetMovieTranslations() throws MovieDbException {
LOG.info("getMovieTranslations"); LOG.info("getMovieTranslations");
List<Translation> result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER); TmdbResultsList<Translation> result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER);
assertFalse("No translations found", result.isEmpty()); assertFalse("No translations found", result.getResults().isEmpty());
} }
/** /**
@@ -305,8 +306,8 @@ public class TheMovieDbApiTest {
LOG.info("searchPeople"); LOG.info("searchPeople");
String personName = "Bruce Willis"; String personName = "Bruce Willis";
boolean includeAdult = false; boolean includeAdult = false;
List<Person> result = tmdb.searchPeople(personName, includeAdult, 0); TmdbResultsList<Person> result = tmdb.searchPeople(personName, includeAdult, 0);
assertTrue("Couldn't find the person", result.size() > 0); assertTrue("Couldn't find the person", result.getResults().size() > 0);
} }
/** /**
@@ -326,8 +327,8 @@ public class TheMovieDbApiTest {
public void testGetPersonCredits() throws MovieDbException { public void testGetPersonCredits() throws MovieDbException {
LOG.info("getPersonCredits"); LOG.info("getPersonCredits");
List<PersonCredit> people = tmdb.getPersonCredits(ID_PERSON_BRUCE_WILLIS); TmdbResultsList<PersonCredit> result = tmdb.getPersonCredits(ID_PERSON_BRUCE_WILLIS);
assertTrue("No cast information", people.size() > 0); assertTrue("No cast information", result.getResults().size() > 0);
} }
/** /**
@@ -337,8 +338,8 @@ public class TheMovieDbApiTest {
public void testGetPersonImages() throws MovieDbException { public void testGetPersonImages() throws MovieDbException {
LOG.info("getPersonImages"); LOG.info("getPersonImages");
List<Artwork> artwork = tmdb.getPersonImages(ID_PERSON_BRUCE_WILLIS); TmdbResultsList<Artwork> result = tmdb.getPersonImages(ID_PERSON_BRUCE_WILLIS);
assertTrue("No cast information", artwork.size() > 0); assertTrue("No cast information", result.getResults().size() > 0);
} }
/** /**
@@ -382,8 +383,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetNowPlayingMovies() throws MovieDbException { public void testGetNowPlayingMovies() throws MovieDbException {
LOG.info("getNowPlayingMovies"); LOG.info("getNowPlayingMovies");
List<MovieDb> results = tmdb.getNowPlayingMovies(LANGUAGE_DEFAULT, 0); TmdbResultsList<MovieDb> result = tmdb.getNowPlayingMovies(LANGUAGE_DEFAULT, 0);
assertTrue("No now playing movies found", !results.isEmpty()); assertTrue("No now playing movies found", !result.getResults().isEmpty());
} }
/** /**
@@ -392,8 +393,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetPopularMovieList() throws MovieDbException { public void testGetPopularMovieList() throws MovieDbException {
LOG.info("getPopularMovieList"); LOG.info("getPopularMovieList");
List<MovieDb> results = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0); TmdbResultsList<MovieDb> result = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
assertTrue("No popular movies found", !results.isEmpty()); assertTrue("No popular movies found", !result.getResults().isEmpty());
} }
/** /**
@@ -402,8 +403,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetTopRatedMovies() throws MovieDbException { public void testGetTopRatedMovies() throws MovieDbException {
LOG.info("getTopRatedMovies"); LOG.info("getTopRatedMovies");
List<MovieDb> results = tmdb.getTopRatedMovies(LANGUAGE_DEFAULT, 0); TmdbResultsList<MovieDb> result = tmdb.getTopRatedMovies(LANGUAGE_DEFAULT, 0);
assertTrue("No top rated movies found", !results.isEmpty()); assertTrue("No top rated movies found", !result.getResults().isEmpty());
} }
/** /**
@@ -422,8 +423,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetCompanyMovies() throws MovieDbException { public void testGetCompanyMovies() throws MovieDbException {
LOG.info("getCompanyMovies"); LOG.info("getCompanyMovies");
List<MovieDb> results = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, LANGUAGE_DEFAULT, 0); TmdbResultsList<MovieDb> result = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, LANGUAGE_DEFAULT, 0);
assertTrue("No company movies found", !results.isEmpty()); assertTrue("No company movies found", !result.getResults().isEmpty());
} }
/** /**
@@ -432,8 +433,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testSearchCompanies() throws MovieDbException { public void testSearchCompanies() throws MovieDbException {
LOG.info("searchCompanies"); LOG.info("searchCompanies");
List<Company> results = tmdb.searchCompanies(COMPANY_NAME, 0); TmdbResultsList<Company> result = tmdb.searchCompanies(COMPANY_NAME, 0);
assertTrue("No company information found", !results.isEmpty()); assertTrue("No company information found", !result.getResults().isEmpty());
} }
/** /**
@@ -442,8 +443,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetSimilarMovies() throws MovieDbException { public void testGetSimilarMovies() throws MovieDbException {
LOG.info("getSimilarMovies"); LOG.info("getSimilarMovies");
List<MovieDb> results = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, LANGUAGE_DEFAULT, 0); TmdbResultsList<MovieDb> result = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, LANGUAGE_DEFAULT, 0);
assertTrue("No similar movies found", !results.isEmpty()); assertTrue("No similar movies found", !result.getResults().isEmpty());
} }
/** /**
@@ -452,8 +453,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetGenreList() throws MovieDbException { public void testGetGenreList() throws MovieDbException {
LOG.info("getGenreList"); LOG.info("getGenreList");
List<Genre> results = tmdb.getGenreList(LANGUAGE_DEFAULT); TmdbResultsList<Genre> result = tmdb.getGenreList(LANGUAGE_DEFAULT);
assertTrue("No genres found", !results.isEmpty()); assertTrue("No genres found", !result.getResults().isEmpty());
} }
/** /**
@@ -462,8 +463,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetGenreMovies() throws MovieDbException { public void testGetGenreMovies() throws MovieDbException {
LOG.info("getGenreMovies"); LOG.info("getGenreMovies");
List<MovieDb> results = tmdb.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, 0, Boolean.TRUE); TmdbResultsList<MovieDb> result = tmdb.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, 0, Boolean.TRUE);
assertTrue("No genre movies found", !results.isEmpty()); assertTrue("No genre movies found", !result.getResults().isEmpty());
} }
/** /**
@@ -472,8 +473,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetUpcoming() throws Exception { public void testGetUpcoming() throws Exception {
LOG.info("getUpcoming"); LOG.info("getUpcoming");
List<MovieDb> results = tmdb.getUpcoming(LANGUAGE_DEFAULT, 0); TmdbResultsList<MovieDb> result = tmdb.getUpcoming(LANGUAGE_DEFAULT, 0);
assertTrue("No upcoming movies found", !results.isEmpty()); assertTrue("No upcoming movies found", !result.getResults().isEmpty());
} }
/** /**
@@ -482,8 +483,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetCollectionImages() throws Exception { public void testGetCollectionImages() throws Exception {
LOG.info("getCollectionImages"); LOG.info("getCollectionImages");
List<Artwork> result = tmdb.getCollectionImages(ID_COLLECTION_STAR_WARS, LANGUAGE_DEFAULT); TmdbResultsList<Artwork> result = tmdb.getCollectionImages(ID_COLLECTION_STAR_WARS, LANGUAGE_DEFAULT);
assertFalse("No artwork found", result.isEmpty()); assertFalse("No artwork found", result.getResults().isEmpty());
} }
/** /**
@@ -530,9 +531,9 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetMovieLists() throws Exception { public void testGetMovieLists() throws Exception {
LOG.info("getMovieLists"); LOG.info("getMovieLists");
List<MovieList> results = tmdb.getMovieLists(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, 0); TmdbResultsList<MovieList> result = tmdb.getMovieLists(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, 0);
assertNotNull("No results found", results); assertNotNull("No results found", result);
assertTrue("No results found", results.size() > 0); assertTrue("No results found", result.getResults().size() > 0);
} }
/** /**
@@ -540,22 +541,21 @@ public class TheMovieDbApiTest {
* *
* TODO: Do not test this until it is fixed * TODO: Do not test this until it is fixed
*/ */
@Ignore("Do not test this until it is fixed")
public void testGetMovieChanges() throws Exception { public void testGetMovieChanges() throws Exception {
LOG.info("getMovieChanges"); LOG.info("getMovieChanges");
String startDate = ""; String startDate = "";
String endDate = null; String endDate = null;
List<MovieChanges> results = Collections.EMPTY_LIST;
// Get some popular movies // Get some popular movies
List<MovieDb> movieList = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0); TmdbResultsList<MovieDb> movieList = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
for (MovieDb movie : movieList) { for (MovieDb movie : movieList.getResults()) {
results = tmdb.getMovieChanges(movie.getId(), startDate, endDate); TmdbResultsMap<String, List<ChangedItem>> result = tmdb.getMovieChanges(movie.getId(), startDate, endDate);
LOG.info("{} has {} changes.", new Object[]{movie.getTitle(), results.size()}); 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 @Test
@@ -576,9 +576,9 @@ public class TheMovieDbApiTest {
LOG.info("searchCollection"); LOG.info("searchCollection");
String query = "batman"; String query = "batman";
int page = 0; 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); 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"); LOG.info("searchList");
String query = "watch"; String query = "watch";
int page = 0; int page = 0;
List<MovieList> result = tmdb.searchList(query, LANGUAGE_DEFAULT, page); TmdbResultsList<MovieList> result = tmdb.searchList(query, LANGUAGE_DEFAULT, page);
assertFalse("No lists found", result == null); assertFalse("No lists found", result.getResults() == null);
assertTrue("No lists found", result.size() > 0); assertTrue("No lists found", result.getResults().size() > 0);
} }
/** /**
@@ -602,9 +602,9 @@ public class TheMovieDbApiTest {
LOG.info("searchKeyword"); LOG.info("searchKeyword");
String query = "action"; String query = "action";
int page = 0; int page = 0;
List<Keyword> result = tmdb.searchKeyword(query, page); TmdbResultsList<Keyword> result = tmdb.searchKeyword(query, page);
assertFalse("No keywords found", result == null); assertFalse("No keywords found", result.getResults() == null);
assertTrue("No keywords found", result.size() > 0); assertTrue("No keywords found", result.getResults().size() > 0);
} }
/** /**
@@ -664,8 +664,8 @@ public class TheMovieDbApiTest {
public void testGetKeywordMovies() throws Exception { public void testGetKeywordMovies() throws Exception {
LOG.info("getKeywordMovies"); LOG.info("getKeywordMovies");
int page = 0; int page = 0;
List<KeywordMovie> result = tmdb.getKeywordMovies(ID_KEYWORD, LANGUAGE_DEFAULT, page); TmdbResultsList<KeywordMovie> result = tmdb.getKeywordMovies(ID_KEYWORD, LANGUAGE_DEFAULT, page);
assertFalse("No keyword movies found", result.isEmpty()); assertFalse("No keyword movies found", result.getResults().isEmpty());
} }
/** /**
@@ -675,9 +675,9 @@ public class TheMovieDbApiTest {
public void testGetReviews() throws Exception { public void testGetReviews() throws Exception {
LOG.info("getReviews"); LOG.info("getReviews");
int page = 0; 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 { public void testGetPersonPopular_int() throws Exception {
LOG.info("getPersonPopular"); LOG.info("getPersonPopular");
int page = 0; int page = 0;
List<Person> result = tmdb.getPersonPopular(page); TmdbResultsList<Person> result = tmdb.getPersonPopular(page);
assertFalse("No popular people", result.isEmpty()); assertFalse("No popular people", result.getResults().isEmpty());
} }
/** /**
@@ -760,8 +760,8 @@ public class TheMovieDbApiTest {
@Test @Test
public void testGetJobs() throws Exception { public void testGetJobs() throws Exception {
LOG.info("getJobs"); LOG.info("getJobs");
List<JobDepartment> result = tmdb.getJobs(); TmdbResultsList<JobDepartment> result = tmdb.getJobs();
assertFalse("No jobs found", result.isEmpty()); assertFalse("No jobs found", result.getResults().isEmpty());
} }
/** /**
@@ -780,7 +780,7 @@ public class TheMovieDbApiTest {
Discover discover = new Discover(); Discover discover = new Discover();
discover.year(2013).language(LANGUAGE_ENGLISH); discover.year(2013).language(LANGUAGE_ENGLISH);
List<MovieDb> result = tmdb.getDiscover(discover); TmdbResultsList<MovieDb> result = tmdb.getDiscover(discover);
assertFalse("No movies discovered", result.isEmpty()); assertFalse("No movies discovered", result.getResults().isEmpty());
} }
} }