44 Commits

Author SHA1 Message Date
Omertron 4c2463b14a [maven-release-plugin] prepare release themoviedbapi-3.4 2013-03-18 13:45:45 +01:00
Omertron 7de82cdba8 Updated POM versions 2013-03-18 13:42:56 +01:00
Stuart Boston bf8730c1ee Updated test case for getGenreMovies 2013-03-18 12:37:24 +00:00
Stuart Boston 3085018cf0 Added "Include All Movies" to getGenreMovies
Old method will be deprecated at some point
2013-03-18 12:36:26 +00:00
Stuart Boston d2972ac927 Added IMDB_ID and POPULARITY to Person 2013-03-07 15:32:10 +00:00
Stuart Boston bea972520b Removed unused imports 2013-02-27 08:54:52 +00:00
Stuart Boston e17db7a15b Tidied up test class 2013-02-25 12:56:09 +00:00
Stuart Boston 9e6a290f63 Added English literal to test cases 2013-02-25 09:32:03 +00:00
Stuart Boston 9e9f0b5c9e Optimised logging output 2013-02-25 08:57:26 +00:00
Stuart Boston 03c6e1917a Added Russian literal 2013-02-25 08:46:52 +00:00
Stuart Boston a0fca9e69a Fixed Russian test name 2013-02-25 08:45:54 +00:00
Stuart Boston 40567c3059 Added example Jackson Replacement code 2013-02-25 08:41:24 +00:00
Stuart Boston 160b478c11 Updated LOG messages 2013-02-25 08:30:14 +00:00
Stuart Boston de67805b0c Updated README with logging information 2013-02-24 19:52:57 +00:00
Omertron 1b62ae2ff8 Removed Log4J dependency and switched to SLF4J 2013-02-24 18:58:27 +00:00
Stuart Boston 618406b459 Removed unused imports 2013-02-04 16:15:10 +00:00
Stuart Boston a7498c5c69 Removed unnecessary locals 2013-02-04 16:04:47 +00:00
Omertron f177026261 Added keyword searches 2013-02-03 21:09:41 +00:00
Omertron 1e45b87508 Refactored to use a base class 2013-02-03 19:25:23 +00:00
Omertron 596cde7621 Removed Apiary URL 2013-02-03 19:24:46 +00:00
Omertron 857071676b Updated test cases 2013-02-03 10:51:22 +00:00
Omertron c275e71ab4 Added Keyword and List functions 2013-02-02 15:49:23 +00:00
Omertron f27f6f35fe Updated Javadoc 2013-01-29 21:05:12 +00:00
Omertron 47faecc207 Updated exception details 2013-01-29 20:48:50 +00:00
Omertron deb9eb6642 Renamed log4j properties file 2013-01-29 20:42:14 +00:00
Stuart Boston d3af326a77 removed blank @return's from javadoc 2013-01-28 21:05:10 +00:00
Stuart Boston 1d91a557eb Updated POM Versions 2013-01-28 14:48:55 +00:00
Stuart Boston e59f724466 Updated README 2013-01-28 13:47:05 +00:00
Stuart Boston ff93629ae8 Updated POM 2013-01-28 13:19:56 +00:00
Stuart Boston 50488f98b7 Added automatic site documentation to POM 2013-01-28 13:16:33 +00:00
Omertron 505b8c06dc Removed revision line from version.txt 2013-01-14 20:15:20 +00:00
Omertron 0f8731ffe5 Added accept for JSON to WebBrowser 2013-01-14 19:52:07 +00:00
Omertron 3029bf4086 Updated copyright date 2013-01-01 07:28:38 +00:00
Omertron 55b9760c34 Updated test cases 2012-12-27 21:50:48 +00:00
Omertron 7034be4681 Added keyword search 2012-12-27 21:50:28 +00:00
Omertron 44d63fbf76 Added new searches 2012-12-24 22:35:31 +00:00
Stuart Boston 1009e2598e Removed test for authentication as requires a HTTP session 2012-12-20 12:46:57 +00:00
Omertron 44a60ba786 Add get person latest method 2012-12-19 21:46:37 +00:00
Stuart Boston af0b657586 Remove deprecated functions 2012-12-19 16:00:57 +00:00
Stuart Boston 46cd35f908 Added getMovieChanges method 2012-12-19 15:56:45 +00:00
Stuart Boston 608c0a9b05 Added getMovieLists method 2012-12-18 16:07:10 +00:00
Stuart Boston 902db42094 Added Get Guest Session method 2012-12-18 15:29:05 +00:00
Omertron e7ec580ea2 Add Levenshtein Difference for movie compare 2012-12-17 22:03:12 +00:00
Omertron 1605a71528 [maven-release-plugin] prepare for next development iteration 2012-12-17 13:51:03 +01:00
66 changed files with 5597 additions and 4079 deletions
+12
View File
@@ -0,0 +1,12 @@
package com.darylbeattie.movies.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value=ElementType.METHOD)
@Retention(value=RetentionPolicy.RUNTIME)
public @interface JsonAnySetter {
}
+12
View File
@@ -0,0 +1,12 @@
package com.darylbeattie.movies.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface JsonProperty {
String value() default "";
}
+12
View File
@@ -0,0 +1,12 @@
package com.darylbeattie.movies.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface JsonRootName {
String value() default "";
}
+69
View File
@@ -0,0 +1,69 @@
package com.darylbeattie.movies.util;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
public class ObjectMapper {
/**
* This takes a JSON string and creates (and populates) an object of the given class
* with the data from that JSON string. It mimics the method signature of the jackson
* JSON API, so that we don't have to import the jackson library into this application.
*
* @param jsonString The JSON string to parse.
* @param objClass The class of object we want to create.
* @return The instantiation of that class, populated with data from the JSON object.
* @throws IOException If there was any kind of issue.
*/
public <T> T readValue(String jsonString, Class<T> objClass) throws IOException {
try {
return readValue(new JSONObject(jsonString), objClass);
}
catch (IOException ioe) {
throw ioe;
}
catch (Exception e) {
e.printStackTrace();
throw new IOException(e);
}
}
@SuppressWarnings("unchecked")
public <T, R> T readValue(JSONObject json, Class<T> objClass) throws IOException {
try {
//TODO Iterate through json object values and call the JsonAnySetter method on the unknown ones.
T obj = objClass.newInstance();
for (Field f : objClass.getFields()) {
Annotation a = f.getAnnotation(JsonProperty.class);
if (List.class.equals(f.getType()) && (json.optJSONArray(((JsonProperty) a).value()) != null)) { // It's a list.
JSONArray jsonArray = json.optJSONArray(((JsonProperty) a).value());
ParameterizedType listType = (ParameterizedType) f.getGenericType();
Class<?> subObj = (Class<?>) listType.getActualTypeArguments()[0];
List<R> subObjList = ((Class<List<R>>) f.getType()).newInstance();
for (int i = 0; i < jsonArray.length(); i++) {
subObjList.add((R) readValue(jsonArray.getJSONObject(i), subObj));
}
f.set(obj, subObjList);
}
else if (a != null) {
f.set(obj, json.opt(((JsonProperty) a).value()));
}
}
return obj;
}
catch (IOException ioe) {
throw ioe;
}
catch (Exception e) {
e.printStackTrace();
throw new IOException(e);
}
}
}
+6
View File
@@ -0,0 +1,6 @@
Jackson Library Replacement
===========================
These files are provided by Darren Beattie as an example of how to replace the Jackson libraries with native libraries inside Android.
They are provided without warrantee and if you modify them or find them useful, please let me know.
+21
View File
@@ -0,0 +1,21 @@
The Movie DB API
================
Author: Stuart Boston (Omertron AT Gmail DOT com)
This API uses the TheMovieDB.org API as specified here http://api.themoviedb.org/
Originally written for use by YetAnotherMovieJukebox (YAMJ) http://code.google.com/p/moviejukebox/
But anyone can feel free to use it for other projects as well.
TheMovieDB.org is an excellent open database for movie and film content. I encourage you to check it out and contribute to keep it growing.
http://www.themoviedb.org
Project Logging
---------------
This project uses SLF4J (http://www.slf4j.org) to abstract the logging in the project.
To use the logging in your own project you should add one of the bindings listed [HERE](http://www.slf4j.org/manual.html#swapping)
Project Documentation
---------------------
The automatically generated documentation can be found [HERE](http://omertron.github.com/api-themoviedb/)
+248 -149
View File
@@ -13,17 +13,48 @@
<groupId>com.omertron</groupId> <groupId>com.omertron</groupId>
<artifactId>themoviedbapi</artifactId> <artifactId>themoviedbapi</artifactId>
<version>3.3</version> <version>3.4</version>
<name>API-The MovieDB</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<description>API for the TheMovieDb.org website</description>
<properties> <name>API-The MovieDB</name>
<skipTests>false</skipTests> <description>API for the TheMovieDb.org website</description>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <url>https://github.com/Omertron/api-themoviedb</url>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <inceptionYear>2012</inceptionYear>
<distribution.format>zip</distribution.format>
</properties> <developers>
<developer>
<name>Stuart Boston</name>
<email>omertron@gmail.com</email>
<id>omertron</id>
<url>http://omertron.com</url>
<timezone>0</timezone>
<roles>
<role>developer</role>
</roles>
</developer>
</developers>
<licenses>
<license>
<name>GNU General Public License v3+</name>
<url>http://www.gnu.org/licenses/gpl-3.0-standalone.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>scm:git:git@github.com:Omertron/api-themoviedb.git</url>
<connection>scm:git:git@github.com:Omertron/api-themoviedb.git</connection>
<developerConnection>scm:git:git@github.com:Omertron/api-themoviedb.git</developerConnection>
</scm>
<distributionManagement>
<site>
<id>github-project-site</id>
<name>GitHub Project Pages</name>
<url>gitsite:git@github.com/Omertron/api-themoviedb.git</url>
</site>
</distributionManagement>
<issueManagement> <issueManagement>
<system>GitHub</system> <system>GitHub</system>
@@ -35,59 +66,246 @@
<url>http://jenkins.omertron.com/job/API-TheMovieDb/</url> <url>http://jenkins.omertron.com/job/API-TheMovieDb/</url>
</ciManagement> </ciManagement>
<scm> <properties>
<url>scm:git:git@github.com:Omertron/api-themoviedb.git</url> <skipTests>false</skipTests>
<connection>scm:git:git@github.com:Omertron/api-themoviedb.git</connection> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<developerConnection>scm:git:git@github.com:Omertron/api-themoviedb.git</developerConnection> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</scm> <distribution.format>zip</distribution.format>
</properties>
<dependencies> <dependencies>
<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>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId> <artifactId>jackson-core</artifactId>
<version>2.1.2</version> <version>2.1.4</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.1.2</version> <version>2.1.4</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.1.2</version> <version>2.1.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.7</version> <version>1.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.1</version> <version>3.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.3</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build>
<finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
<revisionOnScmFailure>0000</revisionOnScmFailure>
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<failOnError>true</failOnError>
<verbose>true</verbose>
<!-- excludes><exclude>**/*</exclude></excludes -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Version>${buildNumber}</Implementation-Version>
<Implementation-Title>${timestamp}</Implementation-Title>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<!-- To skip tests by default -->
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>create-version-txt</id>
<phase>generate-resources</phase>
<configuration>
<target>
<property name="version_file" value="${project.build.directory}/version.txt" />
<property name="header_line" value="The MovieDb API${line.separator}" />
<property name="build_date_line" value="Build Date: ${timestamp}${line.separator}" />
<property name="version_line" value="Version: ${project.version}${line.separator}" />
<!--<property name="revision_line" value="Revision: r${buildNumber}${line.separator}" />-->
<echo>Writing version file: ${version_file}</echo>
<echo file="${version_file}" append="false">${header_line}</echo>
<echo file="${version_file}" append="true">${build_date_line}</echo>
<echo file="${version_file}" append="true">${version_line}</echo>
<!--<echo file="${version_file}" append="true">${revision_line}</echo>-->
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/resources/bin.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.2</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.2</version>
<reports>
<report>index</report>
<report>scm</report>
<report>issue-tracking</report>
<report>help</report>
<report>dependency-convergence</report>
<report>summary</report>
<report>dependency-management</report>
<report>dependencies</report>
<report>license</report>
<report>modules</report>
</reports>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.4</version>
</extension>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.4</version>
</extension>
<extension>
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
<artifactId>wagon-gitsite</artifactId>
<version>0.3.1</version>
</extension>
</extensions>
</build>
<profiles> <profiles>
<profile> <profile>
<id>release-sign-artifacts</id> <id>release-sign-artifacts</id>
@@ -116,123 +334,4 @@
</profile> </profile>
</profiles> </profiles>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
<revisionOnScmFailure>0000</revisionOnScmFailure>
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<failOnError>true</failOnError>
<verbose>true</verbose>
<!-- excludes><exclude>**/*</exclude></excludes -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Version>${buildNumber}</Implementation-Version>
<Implementation-Title>${timestamp}</Implementation-Title>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!-- To skip tests by default -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.3</version>
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>create-version-txt</id>
<phase>generate-resources</phase>
<configuration>
<target>
<property name="version_file" value="${project.build.directory}/version.txt" />
<property name="header_line" value="The MovieDb API${line.separator}" />
<property name="build_date_line" value="Build Date: ${timestamp}${line.separator}" />
<property name="version_line" value="Version: ${project.version}${line.separator}" />
<property name="revision_line" value="Revision: r${buildNumber}${line.separator}" />
<echo>Writing version file: ${version_file}</echo>
<echo file="${version_file}" append="false">${header_line}</echo>
<echo file="${version_file}" append="true">${build_date_line}</echo>
<echo file="${version_file}" append="true">${version_line}</echo>
<echo file="${version_file}" append="true">${revision_line}</echo>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/resources/bin.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>1.3.1</version>
</plugin>
</plugins>
<finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
<resources>
</resources>
</build>
</project> </project>
-9
View File
@@ -1,9 +0,0 @@
Author: Stuart Boston (Omertron AT Gmail DOT com)
Originally written for use by YetAnotherMovieJukebox (YAMJ) http://code.google.com/p/moviejukebox/
But anyone can feel free to use it for other projects as well.
This uses TheMovieDB.org API as specified here http://api.themoviedb.org/
TheMovieDB.org is an excellent open database for movie and film content. I encourage you to check it
out and contribute to keep it growing.
http://www.themoviedb.org
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -21,10 +21,41 @@ package com.omertron.themoviedbapi;
public class MovieDbException extends Exception { public class MovieDbException extends Exception {
private static final long serialVersionUID = -8952129102483143278L; private static final long serialVersionUID = 1L;
public enum MovieDbExceptionType { public enum MovieDbExceptionType {
UNKNOWN_CAUSE, INVALID_URL, HTTP_404_ERROR, MOVIE_ID_NOT_FOUND, MAPPING_FAILED, CONNECTION_ERROR, INVALID_IMAGE, AUTHORISATION_FAILURE; /*
* Unknown error occured
*/
UNKNOWN_CAUSE,
/*
* URL is invalid
*/
INVALID_URL,
/*
* Page not found
*/
HTTP_404_ERROR,
/*
* The movie id was not found
*/
MOVIE_ID_NOT_FOUND,
/*
* Mapping failed from target to internal onbjects
*/
MAPPING_FAILED,
/*
* Error connecting to the service
*/
CONNECTION_ERROR,
/*
* Image was invalid
*/
INVALID_IMAGE,
/*
* Autorisation rejected
*/
AUTHORISATION_FAILURE;
} }
private final MovieDbExceptionType exceptionType; private final MovieDbExceptionType exceptionType;
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -35,7 +36,7 @@ public class AlternativeTitle implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(AlternativeTitle.class); private static final Logger LOG = LoggerFactory.getLogger(AlternativeTitle.class);
/* /*
* Properties * Properties
*/ */
@@ -75,7 +76,7 @@ public class AlternativeTitle implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* The artwork type information * The artwork type information
@@ -36,7 +37,7 @@ public class Artwork implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(Artwork.class); private static final Logger LOG = LoggerFactory.getLogger(Artwork.class);
/* /*
* Properties * Properties
*/ */
@@ -54,6 +55,8 @@ public class Artwork implements Serializable {
private float voteAverage; private float voteAverage;
@JsonProperty("vote_count") @JsonProperty("vote_count")
private int voteCount; private int voteCount;
@JsonProperty("flag")
private String flag;
private ArtworkType artworkType = ArtworkType.POSTER; private ArtworkType artworkType = ArtworkType.POSTER;
// <editor-fold defaultstate="collapsed" desc="Getter methods"> // <editor-fold defaultstate="collapsed" desc="Getter methods">
@@ -88,6 +91,11 @@ public class Artwork implements Serializable {
public int getVoteCount() { public int getVoteCount() {
return voteCount; return voteCount;
} }
public String getFlag() {
return flag;
}
// </editor-fold> // </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods"> // <editor-fold defaultstate="collapsed" desc="Setter methods">
@@ -122,6 +130,11 @@ public class Artwork implements Serializable {
public void setVoteCount(int voteCount) { public void setVoteCount(int voteCount) {
this.voteCount = voteCount; this.voteCount = voteCount;
} }
public void setFlag(String flag) {
this.flag = flag;
}
// </editor-fold> // </editor-fold>
/** /**
@@ -135,7 +148,7 @@ public class Artwork implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -0,0 +1,122 @@
/*
* 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,128 @@
/*
* 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());
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -24,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -37,7 +38,7 @@ public class Collection implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(Collection.class); private static final Logger LOG = LoggerFactory.getLogger(Collection.class);
/* /*
* Properties * Properties
*/ */
@@ -123,7 +124,7 @@ public class Collection implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -24,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -36,7 +37,7 @@ public class CollectionInfo implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(CollectionInfo.class); private static final Logger LOG = LoggerFactory.getLogger(CollectionInfo.class);
/* /*
* Properties * Properties
*/ */
@@ -106,7 +107,7 @@ public class CollectionInfo implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Company information * Company information
@@ -33,7 +34,7 @@ public class Company implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// Logger // Logger
private static final Logger logger = Logger.getLogger(Company.class); private static final Logger LOG = LoggerFactory.getLogger(Company.class);
private static final String DEFAULT_STRING = ""; private static final String DEFAULT_STRING = "";
// Properties // Properties
@JsonProperty("id") @JsonProperty("id")
@@ -122,7 +123,7 @@ public class Company implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -36,7 +37,7 @@ public class Genre implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(Genre.class); private static final Logger LOG = LoggerFactory.getLogger(Genre.class);
/* /*
* Properties * Properties
*/ */
@@ -76,7 +77,7 @@ public class Genre implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -37,7 +38,7 @@ public class Keyword implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(Keyword.class); private static final Logger LOG = LoggerFactory.getLogger(Keyword.class);
/* /*
* Properties * Properties
*/ */
@@ -77,7 +78,7 @@ public class Keyword implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -0,0 +1,146 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class KeywordMovie implements Serializable {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(KeywordMovie.class);
/*
* Properties
*/
@JsonProperty("id")
private String id;
@JsonProperty("backdrop_path")
private String backdropPath;
@JsonProperty("original_title")
private String originalTitle;
@JsonProperty("release_date")
private String releaseDate;
@JsonProperty("poster_path")
private String posterPath;
@JsonProperty("title")
private String title;
@JsonProperty("vote_average")
private float voteAverage;
@JsonProperty("vote_count")
private double voteCount;
// <editor-fold defaultstate="collapsed" desc="Getter methods">
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getBackdropPath() {
return backdropPath;
}
public String getId() {
return id;
}
public String getOriginalTitle() {
return originalTitle;
}
public String getReleaseDate() {
return releaseDate;
}
public String getPosterPath() {
return posterPath;
}
public String getTitle() {
return title;
}
public float getVoteAverage() {
return voteAverage;
}
public double getVoteCount() {
return voteCount;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdropPath(String backdropPath) {
this.backdropPath = backdropPath;
}
public void setId(String id) {
this.id = id;
}
public void setOriginalTitle(String originalTitle) {
this.originalTitle = originalTitle;
}
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath;
}
public void setTitle(String title) {
this.title = title;
}
public void setVoteAverage(float voteAverage) {
this.voteAverage = voteAverage;
}
public void setVoteCount(double voteCount) {
this.voteCount = voteCount;
}
// </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,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -36,7 +37,7 @@ public class Language implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(Language.class); private static final Logger LOG = LoggerFactory.getLogger(Language.class);
/* /*
* Properties * Properties
*/ */
@@ -76,7 +77,7 @@ public class Language implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class MovieChanges implements Serializable {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("key")
private String key;
@JsonProperty("items")
private List<ChangeItem> items;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public String getKey() {
return key;
}
public List<ChangeItem> getItems() {
return items;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setKey(String key) {
this.key = key;
}
public void setItems(List<ChangeItem> items) {
this.items = items;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +23,8 @@ 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 java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Movie Bean * Movie Bean
@@ -36,23 +37,23 @@ public class MovieDb implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(MovieDb.class); private static final Logger LOG = LoggerFactory.getLogger(MovieDb.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty(("backdrop_path")) @JsonProperty("backdrop_path")
private String backdropPath; private String backdropPath;
@JsonProperty(("id")) @JsonProperty("id")
private int id; private int id;
@JsonProperty(("original_title")) @JsonProperty("original_title")
private String originalTitle; private String originalTitle;
@JsonProperty(("popularity")) @JsonProperty("popularity")
private float popularity; private float popularity;
@JsonProperty(("poster_path")) @JsonProperty("poster_path")
private String posterPath; private String posterPath;
@JsonProperty(("release_date")) @JsonProperty("release_date")
private String releaseDate; private String releaseDate;
@JsonProperty(("title")) @JsonProperty("title")
private String title; private String title;
@JsonProperty("adult") @JsonProperty("adult")
private boolean adult; private boolean adult;
@@ -275,7 +276,6 @@ public class MovieDb implements Serializable {
} }
// </editor-fold> // </editor-fold>
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
* *
@@ -287,7 +287,7 @@ public class MovieDb implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode"> //<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
@@ -0,0 +1,151 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Wrapper for the MovieDbList function
* @author stuart.boston
*/
public class MovieDbList {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieDbList.class);
/*
* Properties
*/
@JsonProperty("id")
private String id;
@JsonProperty("created_by")
private String createdBy;
@JsonProperty("description")
private String description;
@JsonProperty("favorite_count")
private int favoriteCount;
@JsonProperty("items")
private List<MovieDb> items = Collections.EMPTY_LIST;
@JsonProperty("item_count")
private int itemCount;
@JsonProperty("iso_639_1")
private String language;
@JsonProperty("name")
private String name;
@JsonProperty("poster_path")
private String posterPath;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public String getId() {
return id;
}
public String getCreatedBy() {
return createdBy;
}
public String getDescription() {
return description;
}
public int getFavoriteCount() {
return favoriteCount;
}
public List<MovieDb> getItems() {
return items;
}
public int getItemCount() {
return itemCount;
}
public String getLanguage() {
return language;
}
public String getName() {
return name;
}
public String getPosterPath() {
return posterPath;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setId(String id) {
this.id = id;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public void setDescription(String description) {
this.description = description;
}
public void setFavoriteCount(int favoriteCount) {
this.favoriteCount = favoriteCount;
}
public void setItems(List<MovieDb> items) {
this.items = items;
}
public void setItemCount(int itemCount) {
this.itemCount = itemCount;
}
public void setLanguage(String language) {
this.language = language;
}
public void setName(String name) {
this.name = name;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath;
}
//</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,146 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class MovieList implements Serializable {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieList.class);
/*
* Properties
*/
@JsonProperty("description")
private String description;
@JsonProperty("favorite_count")
private int favoriteCount;
@JsonProperty("id")
private String id;
@JsonProperty("item_count")
private int itemCount;
@JsonProperty("iso_639_1")
private String language;
@JsonProperty("name")
private String name;
@JsonProperty("poster_path")
private String posterPath;
@JsonProperty("list_type")
private String listType;
// <editor-fold defaultstate="collapsed" desc="Getter methods">
public String getDescription() {
return description;
}
public int getFavoriteCount() {
return favoriteCount;
}
public String getId() {
return id;
}
public int getItemCount() {
return itemCount;
}
public String getLanguage() {
return language;
}
public String getName() {
return name;
}
public String getPosterPath() {
return posterPath;
}
public String getListType() {
return listType;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods">
public void setDescription(String description) {
this.description = description;
}
public void setFavoriteCount(int favoriteCount) {
this.favoriteCount = favoriteCount;
}
public void setId(String id) {
this.id = id;
}
public void setItemCount(int itemCount) {
this.itemCount = itemCount;
}
public void setLanguage(String language) {
this.language = language;
}
public void setName(String name) {
this.name = name;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath;
}
public void setListType(String listType) {
this.listType = listType;
}
// </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());
}
@Override
public String toString() {
return "MovieList{" + "description=" + description + ", favoriteCount=" + favoriteCount + ", id=" + id + ", itemCount=" + itemCount + ", language=" + language + ", name=" + name + ", posterPath=" + posterPath + '}';
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -24,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -37,7 +38,7 @@ public class Person implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(Person.class); private static final Logger LOG = LoggerFactory.getLogger(Person.class);
/* /*
* Static fields for default cast information * Static fields for default cast information
@@ -73,6 +74,10 @@ public class Person implements Serializable {
private String homepage = DEFAULT_STRING; private String homepage = DEFAULT_STRING;
@JsonProperty("place_of_birth") @JsonProperty("place_of_birth")
private String birthplace = DEFAULT_STRING; private String birthplace = DEFAULT_STRING;
@JsonProperty("imdb_id")
private String imdbId = DEFAULT_STRING;
@JsonProperty("popularity")
private float popularity = 0.0f;
/** /**
* Add a crew member * Add a crew member
@@ -174,6 +179,14 @@ public class Person implements Serializable {
public String getHomepage() { public String getHomepage() {
return homepage; return homepage;
} }
public String getImdbId() {
return imdbId;
}
public float getPopularity() {
return popularity;
}
// </editor-fold> // </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods"> // <editor-fold defaultstate="collapsed" desc="Setter methods">
@@ -236,6 +249,14 @@ public class Person implements Serializable {
public void setHomepage(String homepage) { public void setHomepage(String homepage) {
this.homepage = homepage; this.homepage = homepage;
} }
public void setImdbId(String imdbId) {
this.imdbId = imdbId;
}
public void setPopularity(float popularity) {
this.popularity = popularity;
}
// </editor-fold> // </editor-fold>
/** /**
@@ -249,7 +270,7 @@ public class Person implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -35,7 +36,7 @@ public class PersonCast implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(PersonCast.class); private static final Logger LOG = LoggerFactory.getLogger(PersonCast.class);
/* /*
* Properties * Properties
*/ */
@@ -117,7 +118,7 @@ public class PersonCast implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -35,7 +36,7 @@ public class PersonCredit implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(PersonCredit.class); private static final Logger LOG = LoggerFactory.getLogger(PersonCredit.class);
private static final String DEFAULT_STRING = ""; private static final String DEFAULT_STRING = "";
/* /*
* Properties * Properties
@@ -155,7 +156,7 @@ public class PersonCredit implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -35,7 +36,7 @@ public class PersonCrew implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(PersonCrew.class); private static final Logger LOG = LoggerFactory.getLogger(PersonCrew.class);
/* /*
* Properties * Properties
*/ */
@@ -105,7 +106,7 @@ public class PersonCrew implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -37,7 +38,7 @@ public class ProductionCompany implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(ProductionCompany.class); private static final Logger LOG = LoggerFactory.getLogger(ProductionCompany.class);
/* /*
* Properties * Properties
*/ */
@@ -77,7 +78,7 @@ public class ProductionCompany implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -37,7 +38,7 @@ public class ProductionCountry implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(ProductionCountry.class); private static final Logger LOG = LoggerFactory.getLogger(ProductionCountry.class);
/* /*
* Properties * Properties
*/ */
@@ -77,7 +78,7 @@ public class ProductionCountry implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -35,7 +36,7 @@ public class ReleaseInfo implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(ReleaseInfo.class); private static final Logger LOG = LoggerFactory.getLogger(ReleaseInfo.class);
/* /*
* Properties * Properties
*/ */
@@ -85,7 +86,7 @@ public class ReleaseInfo implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -35,7 +36,7 @@ public class StatusCode implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(StatusCode.class); private static final Logger LOG = LoggerFactory.getLogger(StatusCode.class);
/* /*
* Properties * Properties
*/ */
@@ -75,7 +76,7 @@ public class StatusCode implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -24,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -36,7 +37,7 @@ public class TmdbConfiguration implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(TmdbConfiguration.class); private static final Logger LOG = LoggerFactory.getLogger(TmdbConfiguration.class);
/* /*
* Properties * Properties
*/ */
@@ -122,7 +123,6 @@ public class TmdbConfiguration implements Serializable {
* Check that the poster size is valid * Check that the poster size is valid
* *
* @param posterSize * @param posterSize
* @return
*/ */
public boolean isValidPosterSize(String posterSize) { public boolean isValidPosterSize(String posterSize) {
if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) { if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) {
@@ -135,7 +135,6 @@ public class TmdbConfiguration implements Serializable {
* Check that the backdrop size is valid * Check that the backdrop size is valid
* *
* @param backdropSize * @param backdropSize
* @return
*/ */
public boolean isValidBackdropSize(String backdropSize) { public boolean isValidBackdropSize(String backdropSize) {
if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) { if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) {
@@ -148,7 +147,6 @@ public class TmdbConfiguration implements Serializable {
* Check that the profile size is valid * Check that the profile size is valid
* *
* @param profileSize * @param profileSize
* @return
*/ */
public boolean isValidProfileSize(String profileSize) { public boolean isValidProfileSize(String profileSize) {
if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) { if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) {
@@ -161,7 +159,6 @@ public class TmdbConfiguration implements Serializable {
* Check that the logo size is valid * Check that the logo size is valid
* *
* @param logoSize * @param logoSize
* @return
*/ */
public boolean isValidLogoSize(String logoSize) { public boolean isValidLogoSize(String logoSize) {
if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) { if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) {
@@ -174,7 +171,6 @@ public class TmdbConfiguration implements Serializable {
* Check to see if the size is valid for any of the images types * Check to see if the size is valid for any of the images types
* *
* @param sizeToCheck * @param sizeToCheck
* @return
*/ */
public boolean isValidSize(String sizeToCheck) { public boolean isValidSize(String sizeToCheck) {
return (isValidPosterSize(sizeToCheck) return (isValidPosterSize(sizeToCheck)
@@ -194,7 +190,7 @@ public class TmdbConfiguration implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -21,13 +21,14 @@ 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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TokenAuthorisation { public class TokenAuthorisation {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(TokenAuthorisation.class); private static final Logger LOG = LoggerFactory.getLogger(TokenAuthorisation.class);
/* /*
* Properties * Properties
*/ */
@@ -77,7 +78,7 @@ public class TokenAuthorisation {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -21,13 +21,15 @@ 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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TokenSession { public class TokenSession {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(TokenSession.class);
private static final Logger LOG = LoggerFactory.getLogger(TokenSession.class);
/* /*
* Properties * Properties
*/ */
@@ -39,6 +41,10 @@ public class TokenSession {
private String statusCode; private String statusCode;
@JsonProperty("status_message") @JsonProperty("status_message")
private String statusMessage; private String statusMessage;
@JsonProperty("guest_session_id")
private String guestSessionId;
@JsonProperty("expires_at")
private String expiresAt;
// <editor-fold defaultstate="collapsed" desc="Getter methods"> // <editor-fold defaultstate="collapsed" desc="Getter methods">
public String getSessionId() { public String getSessionId() {
@@ -56,6 +62,14 @@ public class TokenSession {
public String getStatusMessage() { public String getStatusMessage() {
return statusMessage; return statusMessage;
} }
public String getGuestSessionId() {
return guestSessionId;
}
public String getExpiresAt() {
return expiresAt;
}
// </editor-fold> // </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods"> // <editor-fold defaultstate="collapsed" desc="Setter methods">
@@ -74,6 +88,15 @@ public class TokenSession {
public void setStatusMessage(String statusMessage) { public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage; this.statusMessage = statusMessage;
} }
public void setGuestSessionId(String guestSessionId) {
this.guestSessionId = guestSessionId;
}
public void setExpiresAt(String expiresAt) {
this.expiresAt = expiresAt;
}
// </editor-fold> // </editor-fold>
/** /**
@@ -87,12 +110,11 @@ public class TokenSession {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
public String toString() { public String toString() {
return "TokenSession{" + "sessionId=" + sessionId + ", success=" + success + ", statusCode=" + statusCode + ", statusMessage=" + statusMessage + '}'; return "TokenSession{" + "sessionId=" + sessionId + ", success=" + success + ", statusCode=" + statusCode + ", statusMessage=" + statusMessage + ", guestSessionId=" + guestSessionId + ", expiresAt=" + expiresAt + '}';
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -21,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -34,7 +35,7 @@ public class Trailer implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(Trailer.class); private static final Logger LOG = LoggerFactory.getLogger(Trailer.class);
/* /*
* Website sources * Website sources
*/ */
@@ -95,7 +96,7 @@ public class Trailer implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,7 +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.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -35,7 +36,7 @@ public class Translation implements Serializable {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(Translation.class); private static final Logger LOG = LoggerFactory.getLogger(Translation.class);
/* /*
* Properties * Properties
*/ */
@@ -85,7 +86,7 @@ public class Translation implements Serializable {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override @Override
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -26,7 +26,8 @@ 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.log4j.Logger; import org.slf4j.Logger;
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
@@ -38,12 +39,11 @@ public class ApiUrl {
/* /*
* Logger * Logger
*/ */
private static final Logger logger = Logger.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/";
// private static final String TMDB_API_BASE = "http://private-3aa3-themoviedb.apiary.io/3/";
/* /*
* Parameter configuration * Parameter configuration
*/ */
@@ -66,6 +66,7 @@ public class ApiUrl {
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_MOVIE_ID = "movie_id="; // public static final String PARAM_MOVIE_ID = "movie_id=";
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=";
@@ -102,8 +103,6 @@ public class ApiUrl {
/** /**
* Build the URL from the pre-created arguments. * Build the URL from the pre-created arguments.
*
* @return
*/ */
public URL buildUrl() { public URL buildUrl() {
StringBuilder urlString = new StringBuilder(TMDB_API_BASE); StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
@@ -129,7 +128,7 @@ public class ApiUrl {
try { try {
urlString.append(URLEncoder.encode(query, "UTF-8")); urlString.append(URLEncoder.encode(query, "UTF-8"));
} catch (UnsupportedEncodingException ex) { } catch (UnsupportedEncodingException ex) {
logger.trace("Unable to encode query: '" + query + "' trying raw."); LOG.trace("Unable to encode query: '" + query + "' trying raw.");
// If we can't encode it, try it raw // If we can't encode it, try it raw
urlString.append(query); urlString.append(query);
} }
@@ -156,10 +155,10 @@ public class ApiUrl {
} }
try { try {
logger.trace("URL: " + urlString.toString()); LOG.trace("URL: {}", urlString.toString());
return new URL(urlString.toString()); return new URL(urlString.toString());
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
logger.warn("Failed to create URL " + urlString.toString() + " - " + ex.toString()); LOG.warn("Failed to create URL {} - {}", urlString.toString(), ex.toString());
return null; return null;
} finally { } finally {
arguments.clear(); arguments.clear();
@@ -1,75 +0,0 @@
/*
* Copyright (c) 2004-2012 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.tools;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.spi.LoggingEvent;
/**
* Log4J Filtering routine to remove API keys from the output
*
* @author Stuart.Boston
*
*/
public class FilteringLayout extends PatternLayout {
private static final String REPLACEMENT = "[APIKEY]";
private static Pattern replacementPattern = Pattern.compile("DO_NOT_MATCH");
/**
* Add the string to replace in the log output
*
* @param replacementString
*/
public static void addReplacementString(String replacementString) {
replacementPattern = Pattern.compile(replacementString);
}
/**
* Extend the format to remove the API_KEYS from the output
*
* @param event
* @return
*/
@Override
public String format(LoggingEvent event) {
if (event.getMessage() instanceof String) {
String message = event.getRenderedMessage();
Matcher matcher = replacementPattern.matcher(message);
if (matcher.find()) {
String maskedMessage = matcher.replaceAll(REPLACEMENT);
Throwable throwable = event.getThrowableInformation() != null
? event.getThrowableInformation().getThrowable() : null;
LoggingEvent maskedEvent = new LoggingEvent(event.fqnOfCategoryClass,
Logger.getLogger(event.getLoggerName()), event.timeStamp,
event.getLevel(), maskedMessage, throwable);
return super.format(maskedEvent);
}
}
return super.format(event);
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -36,14 +36,15 @@ import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Web browser with simple cookies support * Web browser with simple cookies support
*/ */
public final class WebBrowser { public final class WebBrowser {
private static final Logger logger = Logger.getLogger(WebBrowser.class); private static final Logger LOG = LoggerFactory.getLogger(WebBrowser.class);
private static Map<String, String> browserProperties = new HashMap<String, String>(); private static Map<String, String> browserProperties = new HashMap<String, String>();
private static Map<String, Map<String, String>> cookies = new HashMap<String, Map<String, String>>(); private static Map<String, Map<String, String>> cookies = new HashMap<String, Map<String, String>>();
private static String proxyHost = null; private static String proxyHost = null;
@@ -66,6 +67,7 @@ public final class WebBrowser {
private static void populateBrowserProperties() { private static void populateBrowserProperties() {
if (browserProperties.isEmpty()) { if (browserProperties.isEmpty()) {
browserProperties.put("User-Agent", "Mozilla/5.25 Netscape/5.0 (Windows; I; Win95)"); browserProperties.put("User-Agent", "Mozilla/5.25 Netscape/5.0 (Windows; I; Win95)");
browserProperties.put("Accept", "application/json");
} }
} }
@@ -133,7 +135,7 @@ public final class WebBrowser {
try { try {
content.close(); content.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.debug("Failed to close connection: " + ex.getMessage()); LOG.debug("Failed to close connection: " + ex.getMessage());
} }
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +23,8 @@ 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.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -34,7 +35,7 @@ public class WrapperAlternativeTitles {
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(WrapperAlternativeTitles.class); private static final Logger LOG = LoggerFactory.getLogger(WrapperAlternativeTitles.class);
/* /*
* Properties * Properties
*/ */
@@ -61,6 +62,7 @@ public class WrapperAlternativeTitles {
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
*
* @param key * @param key
* @param value * @param value
*/ */
@@ -69,6 +71,6 @@ public class WrapperAlternativeTitles {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
} }
@@ -0,0 +1,102 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
/**
* Base class for the wrappers
*
* @author Stuart
*/
public class WrapperBase {
/*
* Logger - set by the sub-classes
*/
private Logger log;
/*
* Properties
*/
@JsonProperty("id")
private int id;
@JsonProperty("page")
private int page;
@JsonProperty("total_pages")
private int totalPages;
@JsonProperty("total_results")
private int totalResults;
public WrapperBase(Logger logger) {
this.log = logger;
}
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public int getId() {
return id;
}
public int getPage() {
return page;
}
public int getTotalPages() {
return totalPages;
}
public int getTotalResults() {
return totalResults;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setId(int id) {
this.id = id;
}
public void setPage(int page) {
this.page = page;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
log.trace(sb.toString());
}
}
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieChanges;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperChanges {
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(WrapperChanges.class);
/*
* Properties
*/
@JsonProperty("changes")
private List<MovieChanges> changes;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<MovieChanges> getChanges() {
return changes;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setChanges(List<MovieChanges> changes) {
this.changes = changes;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -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;
import com.omertron.themoviedbapi.model.Collection;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperCollection extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<Collection> results;
public WrapperCollection() {
super(LoggerFactory.getLogger(WrapperCollection.class));
}
public List<Collection> getResults() {
return results;
}
public void setResults(List<Collection> results) {
this.results = results;
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -19,80 +19,32 @@
*/ */
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.Company; import com.omertron.themoviedbapi.model.Company;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* *
* @author stuart.boston * @author stuart.boston
*/ */
public class WrapperCompany { public class WrapperCompany extends WrapperBase {
/*
* Logger
*/
private static final Logger logger = Logger.getLogger(WrapperCompany.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty("page")
private int page;
@JsonProperty("results") @JsonProperty("results")
private List<Company> results; private List<Company> results;
@JsonProperty("total_pages")
private int totalPages;
@JsonProperty("total_results")
private int totalResults;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public WrapperCompany() {
public int getPage() { super(LoggerFactory.getLogger(WrapperCompany.class));
return page;
} }
public List<Company> getResults() { public List<Company> getResults() {
return results; return results;
} }
public int getTotalPages() {
return totalPages;
}
public int getTotalResults() {
return totalResults;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setPage(int page) {
this.page = page;
}
public void setResults(List<Company> results) { public void setResults(List<Company> results) {
this.results = results; this.results = results;
} }
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("'");
logger.trace(sb.toString());
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -19,98 +19,43 @@
*/ */
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.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* *
* @author stuart.boston * @author stuart.boston
*/ */
public class WrapperCompanyMovies { public class WrapperCompanyMovies extends WrapperBase {
// Loggers
private static final Logger logger = Logger.getLogger(WrapperCompanyMovies.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty("id")
private int companyId;
@JsonProperty("page")
private int page;
@JsonProperty("results") @JsonProperty("results")
private List<MovieDb> results; private List<MovieDb> results;
@JsonProperty("total_pages")
private int totalPages;
@JsonProperty("total_results")
private int totalResults;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public WrapperCompanyMovies() {
public int getCompanyId() { super(LoggerFactory.getLogger(WrapperCompanyMovies.class));
return companyId;
}
public int getPage() {
return page;
} }
public List<MovieDb> getResults() { public List<MovieDb> getResults() {
return results; return results;
} }
public int getTotalPages() {
return totalPages;
}
public int getTotalResults() {
return totalResults;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCompanyId(int companyId) {
this.companyId = companyId;
}
public void setPage(int page) {
this.page = page;
}
public void setResults(List<MovieDb> results) { public void setResults(List<MovieDb> results) {
this.results = results; this.results = results;
} }
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("'");
logger.trace(sb.toString());
}
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=["); StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[companyId=").append(companyId); sb.append("[companyId=").append(getId());
sb.append("],[page=").append(page); sb.append("],[page=").append(getPage());
sb.append("],[pageResults=").append(results.size()); sb.append("],[pageResults=").append(getResults().size());
sb.append("],[totalPages=").append(totalPages); sb.append("],[totalPages=").append(getTotalPages());
sb.append("],[totalResults=").append(totalResults); sb.append("],[totalResults=").append(getTotalResults());
sb.append("]]"); sb.append("]]");
return sb.toString(); return sb.toString();
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -24,7 +24,8 @@ 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.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -35,7 +36,7 @@ public class WrapperConfig {
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(WrapperConfig.class); private static final Logger LOG = LoggerFactory.getLogger(WrapperConfig.class);
/* /*
* Properties * Properties
*/ */
@@ -71,6 +72,6 @@ public class WrapperConfig {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +23,8 @@ 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.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Wrapper class for the Genres searches * Wrapper class for the Genres searches
@@ -35,7 +36,7 @@ public class WrapperGenres {
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(WrapperGenres.class); private static final Logger LOG = LoggerFactory.getLogger(WrapperGenres.class);
/* /*
* Properties * Properties
*/ */
@@ -61,6 +62,6 @@ public class WrapperGenres {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -19,27 +19,20 @@
*/ */
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.Artwork; import com.omertron.themoviedbapi.model.Artwork;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* *
* @author Stuart * @author Stuart
*/ */
public class WrapperImages { public class WrapperImages extends WrapperBase {
/*
* Logger
*/
private static final Logger logger = Logger.getLogger(WrapperImages.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty("id")
private int id;
@JsonProperty("backdrops") @JsonProperty("backdrops")
private List<Artwork> backdrops; private List<Artwork> backdrops;
@JsonProperty("posters") @JsonProperty("posters")
@@ -47,11 +40,11 @@ public class WrapperImages {
@JsonProperty("profiles") @JsonProperty("profiles")
private List<Artwork> profiles; private List<Artwork> profiles;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public WrapperImages() {
public int getId() { super(LoggerFactory.getLogger(WrapperImages.class));
return id;
} }
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<Artwork> getBackdrops() { public List<Artwork> getBackdrops() {
return backdrops; return backdrops;
} }
@@ -66,10 +59,6 @@ public class WrapperImages {
//</editor-fold> //</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods"> //<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) {
this.id = id;
}
public void setBackdrops(List<Artwork> backdrops) { public void setBackdrops(List<Artwork> backdrops) {
this.backdrops = backdrops; this.backdrops = backdrops;
} }
@@ -82,18 +71,4 @@ public class WrapperImages {
this.profiles = profiles; this.profiles = profiles;
} }
//</editor-fold> //</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("'");
logger.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;
import com.omertron.themoviedbapi.model.KeywordMovie;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperKeywordMovies extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<KeywordMovie> results;
public WrapperKeywordMovies() {
super(LoggerFactory.getLogger(WrapperKeywordMovies.class));
}
public List<KeywordMovie> getResults() {
return results;
}
public void setResults(List<KeywordMovie> results) {
this.results = results;
}
}
@@ -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;
import com.omertron.themoviedbapi.model.Keyword;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author stuart.boston
*/
public class WrapperKeywords extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<Keyword> results;
public WrapperKeywords() {
super(LoggerFactory.getLogger(WrapperKeywords.class));
}
public List<Keyword> getResults() {
return results;
}
public void setResults(List<Keyword> results) {
this.results = results;
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -19,102 +19,43 @@
*/ */
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.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* *
* @author stuart.boston * @author stuart.boston
*/ */
public class WrapperMovie { public class WrapperMovie extends WrapperBase {
/*
* Logger
*/
private static final Logger logger = Logger.getLogger(WrapperMovie.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty("page")
private int page;
@JsonProperty("results") @JsonProperty("results")
private List<MovieDb> movies; private List<MovieDb> movies;
@JsonProperty("total_pages")
private int totalPages;
@JsonProperty("total_results")
private int totalResults;
@JsonProperty("id")
private int id;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public WrapperMovie() {
public int getPage() { super(LoggerFactory.getLogger(WrapperMovie.class));
return page;
} }
public List<MovieDb> getMovies() { public List<MovieDb> getMovies() {
return movies; return movies;
} }
public int getTotalPages() { public void setMovies(List<MovieDb> movies) {
return totalPages; this.movies = movies;
}
public int getTotalResults() {
return totalResults;
}
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setPage(int page) {
this.page = page;
}
public void setMovies(List<MovieDb> results) {
this.movies = results;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
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("'");
logger.trace(sb.toString());
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=["); StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[page=").append(page); sb.append("[page=").append(getPage());
sb.append("],[pageResults=").append(movies.size()); sb.append("],[pageResults=").append(getMovies().size());
sb.append("],[totalPages=").append(totalPages); sb.append("],[totalPages=").append(getTotalPages());
sb.append("],[totalResults=").append(totalResults); sb.append("],[totalResults=").append(getTotalResults());
sb.append("],[id=").append(id); sb.append("],[id=").append(getId());
sb.append("]]"); sb.append("]]");
return sb.toString(); return sb.toString();
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -24,7 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
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.List;
import org.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -35,7 +36,7 @@ public class WrapperMovieCasts {
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(WrapperMovieCasts.class); private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieCasts.class);
/* /*
* Properties * Properties
*/ */
@@ -76,6 +77,7 @@ public class WrapperMovieCasts {
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
*
* @param key * @param key
* @param value * @param value
*/ */
@@ -84,6 +86,6 @@ public class WrapperMovieCasts {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +23,8 @@ 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.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -34,7 +35,7 @@ public class WrapperMovieKeywords {
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(WrapperMovieKeywords.class); private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieKeywords.class);
/* /*
* Properties * Properties
*/ */
@@ -65,6 +66,7 @@ public class WrapperMovieKeywords {
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
*
* @param key * @param key
* @param value * @param value
*/ */
@@ -73,6 +75,6 @@ public class WrapperMovieKeywords {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); 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;
import com.omertron.themoviedbapi.model.MovieList;
import java.util.List;
import org.slf4j.LoggerFactory;
/**
*
* @author Stuart
*/
public class WrapperMovieList extends WrapperBase {
/*
* Properties
*/
@JsonProperty("results")
private List<MovieList> movieList;
public WrapperMovieList() {
super(LoggerFactory.getLogger(WrapperMovieList.class));
}
public List<MovieList> getMovieList() {
return movieList;
}
public void setMovieList(List<MovieList> movieList) {
this.movieList = movieList;
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -19,80 +19,32 @@
*/ */
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.Person;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* *
* @author stuart.boston * @author stuart.boston
*/ */
public class WrapperPerson { public class WrapperPerson extends WrapperBase {
/*
* Logger
*/
private static final Logger logger = Logger.getLogger(WrapperPerson.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty("page")
private int page;
@JsonProperty("results") @JsonProperty("results")
private List<Person> results; private List<Person> results;
@JsonProperty("total_pages")
private int totalPages;
@JsonProperty("total_results")
private int totalResults;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public WrapperPerson() {
public int getPage() { super(LoggerFactory.getLogger(WrapperPerson.class));
return page;
} }
public List<Person> getResults() { public List<Person> getResults() {
return results; return results;
} }
public int getTotalPages() {
return totalPages;
}
public int getTotalResults() {
return totalResults;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setPage(int page) {
this.page = page;
}
public void setResults(List<Person> results) { public void setResults(List<Person> results) {
this.results = results; this.results = results;
} }
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("'");
logger.trace(sb.toString());
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -19,70 +19,42 @@
*/ */
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.PersonCredit; import com.omertron.themoviedbapi.model.PersonCredit;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* *
* @author stuart.boston * @author stuart.boston
*/ */
public class WrapperPersonCredits { public class WrapperPersonCredits extends WrapperBase {
/*
* Logger
*/
private static final Logger logger = Logger.getLogger(WrapperMovieCasts.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty("id")
private int id;
@JsonProperty("cast") @JsonProperty("cast")
private List<PersonCredit> cast; private List<PersonCredit> cast;
@JsonProperty("crew") @JsonProperty("crew")
private List<PersonCredit> crew; private List<PersonCredit> crew;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public WrapperPersonCredits() {
super(LoggerFactory.getLogger(WrapperMovieCasts.class));
}
public List<PersonCredit> getCast() { public List<PersonCredit> getCast() {
return cast; return cast;
} }
public void setCast(List<PersonCredit> cast) {
this.cast = cast;
}
public List<PersonCredit> getCrew() { public List<PersonCredit> getCrew() {
return crew; return crew;
} }
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCast(List<PersonCredit> cast) {
this.cast = cast;
}
public void setCrew(List<PersonCredit> crew) { public void setCrew(List<PersonCredit> crew) {
this.crew = crew; this.crew = crew;
} }
public void setId(int id) {
this.id = id;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString());
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +23,8 @@ 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.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -34,7 +35,7 @@ public class WrapperReleaseInfo {
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(WrapperReleaseInfo.class); private static final Logger LOG = LoggerFactory.getLogger(WrapperReleaseInfo.class);
/* /*
* Properties * Properties
*/ */
@@ -65,6 +66,7 @@ public class WrapperReleaseInfo {
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
*
* @param key * @param key
* @param value * @param value
*/ */
@@ -73,6 +75,6 @@ public class WrapperReleaseInfo {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,7 +23,8 @@ 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.List; import java.util.List;
import org.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -34,7 +35,7 @@ public class WrapperTrailers {
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(WrapperTrailers.class); private static final Logger LOG = LoggerFactory.getLogger(WrapperTrailers.class);
/* /*
* Properties * Properties
*/ */
@@ -75,6 +76,7 @@ public class WrapperTrailers {
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
*
* @param key * @param key
* @param value * @param value
*/ */
@@ -83,6 +85,6 @@ public class WrapperTrailers {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -20,9 +20,11 @@
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
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.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
@@ -33,11 +35,13 @@ public class WrapperTranslations {
* Logger * Logger
*/ */
private static final Logger logger = Logger.getLogger(WrapperTranslations.class); private static final Logger LOG = LoggerFactory.getLogger(WrapperTranslations.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty("id")
private int id; private int id;
@JsonProperty("translations")
private List<Translation> translations; private List<Translation> translations;
//<editor-fold defaultstate="collapsed" desc="Setter methods"> //<editor-fold defaultstate="collapsed" desc="Setter methods">
@@ -62,6 +66,7 @@ public class WrapperTranslations {
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
*
* @param key * @param key
* @param value * @param value
*/ */
@@ -70,6 +75,6 @@ public class WrapperTranslations {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); LOG.trace(sb.toString());
} }
} }
-7
View File
@@ -1,7 +0,0 @@
log4j.rootLogger=DEBUG, CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=com.omertron.themoviedbapi.tools.FilteringLayout
#log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[TheMovieDB API-%C{1}] %m%n
#log4j.appender.CONSOLE.Threshold=DEBUG
log4j.appender.CONSOLE.Encoding=UTF-8
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of the FanartTV API.
*
* The FanartTV 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.
*
* The FanartTV 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 the FanartTV API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.LogManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TestLogger {
private static final Logger LOG = LoggerFactory.getLogger(TestLogger.class);
private static final String CRLF = "\n";
private TestLogger() {
throw new UnsupportedOperationException("Class can not be instantiated");
}
/**
* Configure the logger with a simple in-memory file for the required log level
*
* @param level The logging level required
* @return True if successful
*/
public static boolean Configure(String level) {
StringBuilder config = new StringBuilder("handlers = java.util.logging.ConsoleHandler\n");
config.append(".level = ").append(level).append(CRLF);
config.append("java.util.logging.ConsoleHandler.level = ").append(level).append(CRLF);
// Only works with Java 7 or later
config.append("java.util.logging.SimpleFormatter.format = [%1$tc %4$s] %2$s - %5$s %6$s%n").append(CRLF);
// Exclude http logging
config.append("sun.net.www.protocol.http.HttpURLConnection.level = OFF").append(CRLF);
InputStream ins = new ByteArrayInputStream(config.toString().getBytes());
try {
LogManager.getLogManager().readConfiguration(ins);
} catch (IOException e) {
LOG.warn("Failed to configure log manager due to an IO problem", e);
return Boolean.FALSE;
}
LOG.debug("Logger initialized to '{}' level", level);
return Boolean.TRUE;
}
/**
* Set the logging level to "ALL"
*
* @return True if successful
*/
public static boolean Configure() {
return Configure("ALL");
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2012 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -21,11 +21,16 @@ 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.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;
import com.omertron.themoviedbapi.model.Genre; import com.omertron.themoviedbapi.model.Genre;
import com.omertron.themoviedbapi.model.Keyword; import com.omertron.themoviedbapi.model.Keyword;
import com.omertron.themoviedbapi.model.KeywordMovie;
import com.omertron.themoviedbapi.model.MovieChanges;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieDbList;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.Person; import com.omertron.themoviedbapi.model.Person;
import com.omertron.themoviedbapi.model.PersonCredit; import com.omertron.themoviedbapi.model.PersonCredit;
import com.omertron.themoviedbapi.model.ReleaseInfo; import com.omertron.themoviedbapi.model.ReleaseInfo;
@@ -34,14 +39,14 @@ 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.tools.FilteringLayout;
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.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.*; import org.junit.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Test cases for TheMovieDbApi API * Test cases for TheMovieDbApi API
@@ -51,7 +56,7 @@ import static org.junit.Assert.*;
public class TheMovieDbApiTest { public class TheMovieDbApiTest {
// Logger // Logger
private static final Logger logger = Logger.getLogger(TheMovieDbApiTest.class); private static final Logger LOG = LoggerFactory.getLogger(TheMovieDbApiTest.class);
// API Key // API Key
private static final String API_KEY = "5a1a77e2eba8984804586122754f969f"; private static final String API_KEY = "5a1a77e2eba8984804586122754f969f";
private static TheMovieDbApi tmdb; private static TheMovieDbApi tmdb;
@@ -62,15 +67,19 @@ public class TheMovieDbApiTest {
private static final int ID_COMPANY_LUCASFILM = 1; private static final int ID_COMPANY_LUCASFILM = 1;
private static final String COMPANY_NAME = "Marvel Studios"; private static final String COMPANY_NAME = "Marvel Studios";
private static final int ID_GENRE_ACTION = 28; private static final int ID_GENRE_ACTION = 28;
private static final String ID_KEYWORD = "1721";
// Languages
private static final String LANGUAGE_DEFAULT = "";
private static final String LANGUAGE_ENGLISH = "en";
private static final String LANGUAGE_RUSSIAN = "ru";
public TheMovieDbApiTest() throws MovieDbException { public TheMovieDbApiTest() throws MovieDbException {
tmdb = new TheMovieDbApi(API_KEY);
} }
@BeforeClass @BeforeClass
public static void setUpClass() throws Exception { public static void setUpClass() throws Exception {
// Set the logger level to TRACE tmdb = new TheMovieDbApi(API_KEY);
Logger.getRootLogger().setLevel(Level.TRACE); TestLogger.Configure();
} }
@AfterClass @AfterClass
@@ -79,8 +88,6 @@ public class TheMovieDbApiTest {
@Before @Before
public void setUp() { public void setUp() {
// Make sure the filter isn't applied to the test output
FilteringLayout.addReplacementString("DO_NOT_MATCH");
} }
@After @After
@@ -92,7 +99,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testConfiguration() throws IOException { public void testConfiguration() throws IOException {
logger.info("Test Configuration"); LOG.info("Test Configuration");
TmdbConfiguration tmdbConfig = tmdb.getConfiguration(); TmdbConfiguration tmdbConfig = tmdb.getConfiguration();
assertNotNull("Configuration failed", tmdbConfig); assertNotNull("Configuration failed", tmdbConfig);
@@ -100,7 +107,7 @@ public class TheMovieDbApiTest {
assertTrue("No backdrop sizes", tmdbConfig.getBackdropSizes().size() > 0); assertTrue("No backdrop sizes", tmdbConfig.getBackdropSizes().size() > 0);
assertTrue("No poster sizes", tmdbConfig.getPosterSizes().size() > 0); assertTrue("No poster sizes", tmdbConfig.getPosterSizes().size() > 0);
assertTrue("No profile sizes", tmdbConfig.getProfileSizes().size() > 0); assertTrue("No profile sizes", tmdbConfig.getProfileSizes().size() > 0);
logger.info(tmdbConfig.toString()); LOG.info(tmdbConfig.toString());
} }
/** /**
@@ -108,7 +115,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testSearchMovie() throws MovieDbException { public void testSearchMovie() throws MovieDbException {
logger.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); List<MovieDb> movieList = tmdb.searchMovie("Blade Runner", 0, "", true, 0);
@@ -116,11 +123,11 @@ public class TheMovieDbApiTest {
assertTrue("No movies found, should be at least 1", movieList.size() > 0); assertTrue("No movies found, should be at least 1", movieList.size() > 0);
// Try a russian langugage movie // Try a russian langugage movie
movieList = tmdb.searchMovie("О чём говорят мужчины", 0, "ru", true, 0); movieList = tmdb.searchMovie("О чём говорят мужчины", 0, LANGUAGE_RUSSIAN, true, 0);
assertTrue("No movies found, should be at least 1", movieList.size() > 0); assertTrue("No 'RU' movies found, should be at least 1", movieList.size() > 0);
// Try a movie with more than 20 results // Try a movie with more than 20 results
movieList = tmdb.searchMovie("Star Wars", 0, "en", 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.size(), movieList.size() >= 15);
} }
@@ -129,9 +136,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetMovieInfo() throws MovieDbException { public void testGetMovieInfo() throws MovieDbException {
logger.info("getMovieInfo"); LOG.info("getMovieInfo");
String language = "en"; MovieDb result = tmdb.getMovieInfo(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH);
MovieDb result = tmdb.getMovieInfo(ID_MOVIE_BLADE_RUNNER, language);
assertEquals("Incorrect movie information", "Blade Runner", result.getOriginalTitle()); assertEquals("Incorrect movie information", "Blade Runner", result.getOriginalTitle());
} }
@@ -140,7 +146,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetMovieAlternativeTitles() throws MovieDbException { public void testGetMovieAlternativeTitles() throws MovieDbException {
logger.info("getMovieAlternativeTitles"); LOG.info("getMovieAlternativeTitles");
String country = ""; String country = "";
List<AlternativeTitle> results = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country); List<AlternativeTitle> results = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country);
assertTrue("No alternative titles found", results.size() > 0); assertTrue("No alternative titles found", results.size() > 0);
@@ -156,7 +162,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetMovieCasts() throws MovieDbException { public void testGetMovieCasts() throws MovieDbException {
logger.info("getMovieCasts"); LOG.info("getMovieCasts");
List<Person> people = tmdb.getMovieCasts(ID_MOVIE_BLADE_RUNNER); List<Person> people = tmdb.getMovieCasts(ID_MOVIE_BLADE_RUNNER);
assertTrue("No cast information", people.size() > 0); assertTrue("No cast information", people.size() > 0);
@@ -183,7 +189,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetMovieImages() throws MovieDbException { public void testGetMovieImages() throws MovieDbException {
logger.info("getMovieImages"); LOG.info("getMovieImages");
String language = ""; String language = "";
List<Artwork> result = tmdb.getMovieImages(ID_MOVIE_BLADE_RUNNER, language); List<Artwork> result = tmdb.getMovieImages(ID_MOVIE_BLADE_RUNNER, language);
assertFalse("No artwork found", result.isEmpty()); assertFalse("No artwork found", result.isEmpty());
@@ -194,7 +200,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetMovieKeywords() throws MovieDbException { public void testGetMovieKeywords() throws MovieDbException {
logger.info("getMovieKeywords"); LOG.info("getMovieKeywords");
List<Keyword> result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER); List<Keyword> result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER);
assertFalse("No keywords found", result.isEmpty()); assertFalse("No keywords found", result.isEmpty());
} }
@@ -204,7 +210,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetMovieReleaseInfo() throws MovieDbException { public void testGetMovieReleaseInfo() throws MovieDbException {
logger.info("getMovieReleaseInfo"); LOG.info("getMovieReleaseInfo");
List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, ""); List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Release information missing", result.isEmpty()); assertFalse("Release information missing", result.isEmpty());
} }
@@ -214,7 +220,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetMovieTrailers() throws MovieDbException { public void testGetMovieTrailers() throws MovieDbException {
logger.info("getMovieTrailers"); LOG.info("getMovieTrailers");
List<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, ""); List<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Movie trailers missing", result.isEmpty()); assertFalse("Movie trailers missing", result.isEmpty());
} }
@@ -224,7 +230,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetMovieTranslations() throws MovieDbException { public void testGetMovieTranslations() throws MovieDbException {
logger.info("getMovieTranslations"); LOG.info("getMovieTranslations");
List<Translation> result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER); List<Translation> result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER);
assertFalse("No translations found", result.isEmpty()); assertFalse("No translations found", result.isEmpty());
} }
@@ -234,7 +240,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetCollectionInfo() throws MovieDbException { public void testGetCollectionInfo() throws MovieDbException {
logger.info("getCollectionInfo"); LOG.info("getCollectionInfo");
String language = ""; String language = "";
CollectionInfo result = tmdb.getCollectionInfo(ID_MOVIE_STAR_WARS_COLLECTION, language); CollectionInfo result = tmdb.getCollectionInfo(ID_MOVIE_STAR_WARS_COLLECTION, language);
assertFalse("No collection information", result.getParts().isEmpty()); assertFalse("No collection information", result.getParts().isEmpty());
@@ -242,11 +248,12 @@ public class TheMovieDbApiTest {
/** /**
* Test of createImageUrl method, of class TheMovieDbApi. * Test of createImageUrl method, of class TheMovieDbApi.
*
* @throws MovieDbException * @throws MovieDbException
*/ */
@Test @Test
public void testCreateImageUrl() throws MovieDbException { public void testCreateImageUrl() throws MovieDbException {
logger.info("createImageUrl"); LOG.info("createImageUrl");
MovieDb movie = tmdb.getMovieInfo(ID_MOVIE_BLADE_RUNNER, ""); MovieDb movie = tmdb.getMovieInfo(ID_MOVIE_BLADE_RUNNER, "");
String result = tmdb.createImageUrl(movie.getPosterPath(), "original").toString(); String result = tmdb.createImageUrl(movie.getPosterPath(), "original").toString();
assertTrue("Error compiling image URL", !result.isEmpty()); assertTrue("Error compiling image URL", !result.isEmpty());
@@ -257,7 +264,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetMovieInfoImdb() throws MovieDbException { public void testGetMovieInfoImdb() throws MovieDbException {
logger.info("getMovieInfoImdb"); LOG.info("getMovieInfoImdb");
MovieDb result = tmdb.getMovieInfoImdb("tt0076759", "en-US"); MovieDb result = tmdb.getMovieInfoImdb("tt0076759", "en-US");
assertTrue("Error getting the movie from IMDB ID", result.getId() == 11); assertTrue("Error getting the movie from IMDB ID", result.getId() == 11);
} }
@@ -291,10 +298,10 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testSearchPeople() throws MovieDbException { public void testSearchPeople() throws MovieDbException {
logger.info("searchPeople"); LOG.info("searchPeople");
String personName = "Bruce Willis"; String personName = "Bruce Willis";
boolean allResults = false; boolean includeAdult = false;
List<Person> result = tmdb.searchPeople(personName, allResults); List<Person> result = tmdb.searchPeople(personName, includeAdult, 0);
assertTrue("Couldn't find the person", result.size() > 0); assertTrue("Couldn't find the person", result.size() > 0);
} }
@@ -303,7 +310,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetPersonInfo() throws MovieDbException { public void testGetPersonInfo() throws MovieDbException {
logger.info("getPersonInfo"); LOG.info("getPersonInfo");
Person result = tmdb.getPersonInfo(ID_PERSON_BRUCE_WILLIS); Person result = tmdb.getPersonInfo(ID_PERSON_BRUCE_WILLIS);
assertTrue("Wrong actor returned", result.getId() == ID_PERSON_BRUCE_WILLIS); assertTrue("Wrong actor returned", result.getId() == ID_PERSON_BRUCE_WILLIS);
} }
@@ -313,7 +320,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetPersonCredits() throws MovieDbException { public void testGetPersonCredits() throws MovieDbException {
logger.info("getPersonCredits"); LOG.info("getPersonCredits");
List<PersonCredit> people = tmdb.getPersonCredits(ID_PERSON_BRUCE_WILLIS); List<PersonCredit> people = tmdb.getPersonCredits(ID_PERSON_BRUCE_WILLIS);
assertTrue("No cast information", people.size() > 0); assertTrue("No cast information", people.size() > 0);
@@ -324,7 +331,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetPersonImages() throws MovieDbException { public void testGetPersonImages() throws MovieDbException {
logger.info("getPersonImages"); LOG.info("getPersonImages");
List<Artwork> artwork = tmdb.getPersonImages(ID_PERSON_BRUCE_WILLIS); List<Artwork> artwork = tmdb.getPersonImages(ID_PERSON_BRUCE_WILLIS);
assertTrue("No cast information", artwork.size() > 0); assertTrue("No cast information", artwork.size() > 0);
@@ -335,7 +342,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetLatestMovie() throws MovieDbException { public void testGetLatestMovie() throws MovieDbException {
logger.info("getLatestMovie"); LOG.info("getLatestMovie");
MovieDb result = tmdb.getLatestMovie(); MovieDb result = tmdb.getLatestMovie();
assertTrue("No latest movie found", result != null); assertTrue("No latest movie found", result != null);
assertTrue("No latest movie found", result.getId() > 0); assertTrue("No latest movie found", result.getId() > 0);
@@ -370,8 +377,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetNowPlayingMovies() throws MovieDbException { public void testGetNowPlayingMovies() throws MovieDbException {
logger.info("getNowPlayingMovies"); LOG.info("getNowPlayingMovies");
List<MovieDb> results = tmdb.getNowPlayingMovies("", true); List<MovieDb> results = tmdb.getNowPlayingMovies(LANGUAGE_DEFAULT, 0);
assertTrue("No now playing movies found", !results.isEmpty()); assertTrue("No now playing movies found", !results.isEmpty());
} }
@@ -380,8 +387,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetPopularMovieList() throws MovieDbException { public void testGetPopularMovieList() throws MovieDbException {
logger.info("getPopularMovieList"); LOG.info("getPopularMovieList");
List<MovieDb> results = tmdb.getPopularMovieList("", true); List<MovieDb> results = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
assertTrue("No popular movies found", !results.isEmpty()); assertTrue("No popular movies found", !results.isEmpty());
} }
@@ -390,8 +397,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetTopRatedMovies() throws MovieDbException { public void testGetTopRatedMovies() throws MovieDbException {
logger.info("getTopRatedMovies"); LOG.info("getTopRatedMovies");
List<MovieDb> results = tmdb.getTopRatedMovies("", true); List<MovieDb> results = tmdb.getTopRatedMovies(LANGUAGE_DEFAULT, 0);
assertTrue("No top rated movies found", !results.isEmpty()); assertTrue("No top rated movies found", !results.isEmpty());
} }
@@ -400,7 +407,7 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetCompanyInfo() throws MovieDbException { public void testGetCompanyInfo() throws MovieDbException {
logger.info("getCompanyInfo"); LOG.info("getCompanyInfo");
Company company = tmdb.getCompanyInfo(ID_COMPANY_LUCASFILM); Company company = tmdb.getCompanyInfo(ID_COMPANY_LUCASFILM);
assertTrue("No company information found", company.getCompanyId() > 0); assertTrue("No company information found", company.getCompanyId() > 0);
} }
@@ -410,8 +417,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetCompanyMovies() throws MovieDbException { public void testGetCompanyMovies() throws MovieDbException {
logger.info("getCompanyMovies"); LOG.info("getCompanyMovies");
List<MovieDb> results = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, "", true); List<MovieDb> results = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, LANGUAGE_DEFAULT, 0);
assertTrue("No company movies found", !results.isEmpty()); assertTrue("No company movies found", !results.isEmpty());
} }
@@ -420,8 +427,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testSearchCompanies() throws MovieDbException { public void testSearchCompanies() throws MovieDbException {
logger.info("searchCompanies"); LOG.info("searchCompanies");
List<Company> results = tmdb.searchCompanies(COMPANY_NAME, "", true); List<Company> results = tmdb.searchCompanies(COMPANY_NAME, 0);
assertTrue("No company information found", !results.isEmpty()); assertTrue("No company information found", !results.isEmpty());
} }
@@ -430,8 +437,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetSimilarMovies() throws MovieDbException { public void testGetSimilarMovies() throws MovieDbException {
logger.info("getSimilarMovies"); LOG.info("getSimilarMovies");
List<MovieDb> results = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, "", true); List<MovieDb> results = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, LANGUAGE_DEFAULT, 0);
assertTrue("No similar movies found", !results.isEmpty()); assertTrue("No similar movies found", !results.isEmpty());
} }
@@ -440,8 +447,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetGenreList() throws MovieDbException { public void testGetGenreList() throws MovieDbException {
logger.info("getGenreList"); LOG.info("getGenreList");
List<Genre> results = tmdb.getGenreList(""); List<Genre> results = tmdb.getGenreList(LANGUAGE_DEFAULT);
assertTrue("No genres found", !results.isEmpty()); assertTrue("No genres found", !results.isEmpty());
} }
@@ -450,8 +457,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetGenreMovies() throws MovieDbException { public void testGetGenreMovies() throws MovieDbException {
logger.info("getGenreMovies"); LOG.info("getGenreMovies");
List<MovieDb> results = tmdb.getGenreMovies(ID_GENRE_ACTION, "", true); List<MovieDb> results = tmdb.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, 0, Boolean.TRUE);
assertTrue("No genre movies found", !results.isEmpty()); assertTrue("No genre movies found", !results.isEmpty());
} }
@@ -460,8 +467,8 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetUpcoming() throws Exception { public void testGetUpcoming() throws Exception {
logger.info("getUpcoming"); LOG.info("getUpcoming");
List<MovieDb> results = tmdb.getUpcoming(""); List<MovieDb> results = tmdb.getUpcoming(LANGUAGE_DEFAULT, 0);
assertTrue("No upcoming movies found", !results.isEmpty()); assertTrue("No upcoming movies found", !results.isEmpty());
} }
@@ -470,38 +477,189 @@ public class TheMovieDbApiTest {
*/ */
@Test @Test
public void testGetCollectionImages() throws Exception { public void testGetCollectionImages() throws Exception {
logger.info("getCollectionImages"); LOG.info("getCollectionImages");
String language = ""; List<Artwork> result = tmdb.getCollectionImages(ID_MOVIE_STAR_WARS_COLLECTION, LANGUAGE_DEFAULT);
List<Artwork> result = tmdb.getCollectionImages(ID_MOVIE_STAR_WARS_COLLECTION, language);
assertFalse("No artwork found", result.isEmpty()); assertFalse("No artwork found", result.isEmpty());
} }
/** /**
* Test of getAuthorisationToken method, of class TheMovieDbApi. * Test of getAuthorisationToken method, of class TheMovieDbApi.
*/ */
// @Test @Test
public void testGetAuthorisationToken() throws Exception { public void testGetAuthorisationToken() throws Exception {
logger.info("getAuthorisationToken"); LOG.info("getAuthorisationToken");
TokenAuthorisation result = tmdb.getAuthorisationToken(); TokenAuthorisation result = tmdb.getAuthorisationToken();
assertFalse("Token is null", result == null); assertFalse("Token is null", result == null);
assertTrue("Token is not valid", result.getSuccess()); assertTrue("Token is not valid", result.getSuccess());
logger.info(result.toString()); LOG.info(result.toString());
} }
/** /**
* Test of getSessionToken method, of class TheMovieDbApi. * Test of getSessionToken method, of class TheMovieDbApi.
*
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
*/ */
// @Test
public void testGetSessionToken() throws Exception { public void testGetSessionToken() throws Exception {
logger.info("getSessionToken"); LOG.info("getSessionToken");
TokenAuthorisation token = tmdb.getAuthorisationToken(); TokenAuthorisation token = tmdb.getAuthorisationToken();
assertFalse("Token is null", token == null); assertFalse("Token is null", token == null);
assertTrue("Token is not valid", token.getSuccess()); assertTrue("Token is not valid", token.getSuccess());
logger.info(token.toString()); LOG.info(token.toString());
TokenSession result = tmdb.getSessionToken(token); TokenSession result = tmdb.getSessionToken(token);
assertFalse("Session token is null", result == null); assertFalse("Session token is null", result == null);
assertTrue("Session token is not valid", result.getSuccess()); assertTrue("Session token is not valid", result.getSuccess());
logger.info(result.toString()); LOG.info(result.toString());
}
/**
* Test of getGuestSessionToken method, of class TheMovieDbApi.
*/
@Test
public void testGetGuestSessionToken() throws Exception {
LOG.info("getGuestSessionToken");
TokenSession result = tmdb.getGuestSessionToken();
assertTrue("Failed to get guest session", result.getSuccess());
}
@Test
public void testGetMovieLists() throws Exception {
LOG.info("getMovieLists");
List<MovieList> results = tmdb.getMovieLists(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, 0);
assertNotNull("No results found", results);
assertTrue("No results found", results.size() > 0);
}
/**
* Test of getMovieChanges method,of class TheMovieDbApi
*
* TODO: Do not test this until it is fixed
*/
public void testGetMovieChanges() throws Exception {
LOG.info("getMovieChanges");
String startDate = "";
String endDate = null;
List<MovieChanges> results = Collections.EMPTY_LIST;
// Get some popular movies
List<MovieDb> movieList = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
for (MovieDb movie : movieList) {
results = tmdb.getMovieChanges(movie.getId(), startDate, endDate);
LOG.info("{} has {} changes.", new Object[]{movie.getTitle(), results.size()});
}
assertNotNull("No results found", results);
assertTrue("No results found", results.size() > 0);
}
@Test
public void testGetPersonLatest() throws Exception {
LOG.info("getPersonLatest");
Person result = tmdb.getPersonLatest();
assertNotNull("No results found", result);
assertTrue("No results found", StringUtils.isNotBlank(result.getName()));
}
/**
* Test of searchCollection method, of class TheMovieDbApi.
*/
@Test
public void testSearchCollection() throws Exception {
LOG.info("searchCollection");
String query = "batman";
int page = 0;
List<Collection> result = tmdb.searchCollection(query, LANGUAGE_DEFAULT, page);
assertFalse("No collections found", result == null);
assertTrue("No collections found", result.size() > 0);
}
/**
* Test of searchList method, of class TheMovieDbApi.
*/
@Test
public void testSearchList() throws Exception {
LOG.info("searchList");
String query = "watch";
int page = 0;
List result = tmdb.searchList(query, LANGUAGE_DEFAULT, page);
assertFalse("No lists found", result == null);
assertTrue("No lists found", result.size() > 0);
}
/**
* Test of searchKeyword method, of class TheMovieDbApi.
*/
@Test
public void testSearchKeyword() throws Exception {
LOG.info("searchKeyword");
String query = "action";
int page = 0;
List<Keyword> result = tmdb.searchKeyword(query, page);
assertFalse("No keywords found", result == null);
assertTrue("No keywords found", result.size() > 0);
}
/**
* Test of postMovieRating method, of class TheMovieDbApi.
*
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
*/
public void testPostMovieRating() throws Exception {
LOG.info("postMovieRating");
String sessionId = "";
String rating = "";
boolean expResult = false;
boolean result = tmdb.postMovieRating(sessionId, rating);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of getPersonChanges method, of class TheMovieDbApi.
*
* TODO: Fix the method before testing
*/
public void testGetPersonChanges() throws Exception {
LOG.info("getPersonChanges");
String startDate = "";
String endDate = "";
tmdb.getPersonChanges(ID_PERSON_BRUCE_WILLIS, startDate, endDate);
}
/**
* Test of getList method, of class TheMovieDbApi.
*/
@Test
public void testGetList() throws Exception {
LOG.info("getList");
String listId = "509ec17b19c2950a0600050d";
MovieDbList result = tmdb.getList(listId);
assertFalse("List not found", result.getItems().isEmpty());
}
/**
* Test of getKeyword method, of class TheMovieDbApi.
*/
@Test
public void testGetKeyword() throws Exception {
LOG.info("getKeyword");
Keyword result = tmdb.getKeyword(ID_KEYWORD);
assertEquals("fight", result.getName());
}
/**
* Test of getKeywordMovies method, of class TheMovieDbApi.
*/
@Test
public void testGetKeywordMovies() throws Exception {
LOG.info("getKeywordMovies");
int page = 0;
List<KeywordMovie> result = tmdb.getKeywordMovies(ID_KEYWORD, LANGUAGE_DEFAULT, page);
assertFalse("No keyword movies found", result.isEmpty());
} }
} }