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,115 +1,116 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class AlternativeTitle implements Serializable { */
public class AlternativeTitle implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(AlternativeTitle.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(AlternativeTitle.class);
* Properties /*
*/ * Properties
@JsonProperty("iso_3166_1") */
private String country; @JsonProperty("iso_3166_1")
@JsonProperty("title") private String country;
private String title; @JsonProperty("title")
private String title;
// <editor-fold defaultstate="collapsed" desc="Getter methods">
public String getCountry() { // <editor-fold defaultstate="collapsed" desc="Getter methods">
return country; public String getCountry() {
} return country;
}
public String getTitle() {
return title; public String getTitle() {
} return title;
// </editor-fold> }
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCountry(String country) { // <editor-fold defaultstate="collapsed" desc="Setter methods">
this.country = country; public void setCountry(String country) {
} this.country = country;
}
public void setTitle(String title) {
this.title = title; public void setTitle(String title) {
} this.title = title;
// </editor-fold> }
// </editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public boolean equals(Object obj) { @Override
if (obj == null) { public boolean equals(Object obj) {
return false; if (obj == null) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if (getClass() != obj.getClass()) {
} return false;
final AlternativeTitle other = (AlternativeTitle) obj; }
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) { final AlternativeTitle other = (AlternativeTitle) obj;
return false; if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
} return false;
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) { }
return false; if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
} return false;
return true; }
} return true;
}
@Override
public int hashCode() { @Override
int hash = 7; public int hashCode() {
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0); int hash = 7;
hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0); hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
return hash; hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0);
} return hash;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[AlternativeTitle="); public String toString() {
sb.append("[country=").append(country); StringBuilder sb = new StringBuilder("[AlternativeTitle=");
sb.append("],[title=").append(title); sb.append("[country=").append(country);
sb.append("]]"); sb.append("],[title=").append(title);
return sb.toString(); sb.append("]]");
} return sb.toString();
} }
}
@@ -1,195 +1,208 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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
* @author Stuart *
*/ * @author Stuart
public class Artwork implements Serializable { */
public class Artwork implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(Artwork.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(Artwork.class);
* Properties /*
*/ * Properties
@JsonProperty("aspect_ratio") */
private float aspectRatio; @JsonProperty("aspect_ratio")
@JsonProperty("file_path") private float aspectRatio;
private String filePath; @JsonProperty("file_path")
@JsonProperty("height") private String filePath;
private int height; @JsonProperty("height")
@JsonProperty("iso_639_1") private int height;
private String language; @JsonProperty("iso_639_1")
@JsonProperty("width") private String language;
private int width; @JsonProperty("width")
@JsonProperty("vote_average") private int width;
private float voteAverage; @JsonProperty("vote_average")
@JsonProperty("vote_count") private float voteAverage;
private int voteCount; @JsonProperty("vote_count")
private ArtworkType artworkType = ArtworkType.POSTER; private int voteCount;
@JsonProperty("flag")
// <editor-fold defaultstate="collapsed" desc="Getter methods"> private String flag;
public ArtworkType getArtworkType() { private ArtworkType artworkType = ArtworkType.POSTER;
return artworkType;
} // <editor-fold defaultstate="collapsed" desc="Getter methods">
public ArtworkType getArtworkType() {
public float getAspectRatio() { return artworkType;
return aspectRatio; }
}
public float getAspectRatio() {
public String getFilePath() { return aspectRatio;
return filePath; }
}
public String getFilePath() {
public int getHeight() { return filePath;
return height; }
}
public int getHeight() {
public String getLanguage() { return height;
return language; }
}
public String getLanguage() {
public int getWidth() { return language;
return width; }
}
public int getWidth() {
public float getVoteAverage() { return width;
return voteAverage; }
}
public float getVoteAverage() {
public int getVoteCount() { return voteAverage;
return voteCount; }
}
// </editor-fold> public int getVoteCount() {
return voteCount;
// <editor-fold defaultstate="collapsed" desc="Setter methods"> }
public void setArtworkType(ArtworkType artworkType) {
this.artworkType = artworkType; public String getFlag() {
} return flag;
}
public void setAspectRatio(float aspectRatio) {
this.aspectRatio = aspectRatio; // </editor-fold>
}
// <editor-fold defaultstate="collapsed" desc="Setter methods">
public void setFilePath(String filePath) { public void setArtworkType(ArtworkType artworkType) {
this.filePath = filePath; this.artworkType = artworkType;
} }
public void setHeight(int height) { public void setAspectRatio(float aspectRatio) {
this.height = height; this.aspectRatio = aspectRatio;
} }
public void setLanguage(String language) { public void setFilePath(String filePath) {
this.language = language; this.filePath = filePath;
} }
public void setWidth(int width) { public void setHeight(int height) {
this.width = width; this.height = height;
} }
public void setVoteAverage(float voteAverage) { public void setLanguage(String language) {
this.voteAverage = voteAverage; this.language = language;
} }
public void setVoteCount(int voteCount) { public void setWidth(int width) {
this.voteCount = voteCount; this.width = width;
} }
// </editor-fold>
public void setVoteAverage(float voteAverage) {
/** this.voteAverage = voteAverage;
* Handle unknown properties and print a message }
*
* @param key public void setVoteCount(int voteCount) {
* @param value this.voteCount = voteCount;
*/ }
@JsonAnySetter
public void handleUnknown(String key, Object value) { public void setFlag(String flag) {
StringBuilder sb = new StringBuilder(); this.flag = flag;
sb.append("Unknown property: '").append(key); }
sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString()); // </editor-fold>
}
/**
@Override * Handle unknown properties and print a message
public boolean equals(Object obj) { *
if (obj == null) { * @param key
return false; * @param value
} */
if (getClass() != obj.getClass()) { @JsonAnySetter
return false; public void handleUnknown(String key, Object value) {
} StringBuilder sb = new StringBuilder();
final Artwork other = (Artwork) obj; sb.append("Unknown property: '").append(key);
if (Float.floatToIntBits(this.aspectRatio) != Float.floatToIntBits(other.aspectRatio)) { sb.append("' value: '").append(value).append("'");
return false; LOG.trace(sb.toString());
} }
if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
return false; @Override
} public boolean equals(Object obj) {
if (this.height != other.height) { if (obj == null) {
return false; return false;
} }
if ((this.language == null) ? (other.language != null) : !this.language.equals(other.language)) { if (getClass() != obj.getClass()) {
return false; return false;
} }
if (this.width != other.width) { final Artwork other = (Artwork) obj;
return false; if (Float.floatToIntBits(this.aspectRatio) != Float.floatToIntBits(other.aspectRatio)) {
} return false;
if (this.artworkType != other.artworkType) { }
return false; if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
} return false;
return true; }
} if (this.height != other.height) {
return false;
@Override }
public int hashCode() { if ((this.language == null) ? (other.language != null) : !this.language.equals(other.language)) {
int hash = 3; return false;
hash = 71 * hash + Float.floatToIntBits(this.aspectRatio); }
hash = 71 * hash + (this.filePath != null ? this.filePath.hashCode() : 0); if (this.width != other.width) {
hash = 71 * hash + this.height; return false;
hash = 71 * hash + (this.language != null ? this.language.hashCode() : 0); }
hash = 71 * hash + this.width; if (this.artworkType != other.artworkType) {
hash = 71 * hash + (this.artworkType != null ? this.artworkType.hashCode() : 0); return false;
return hash; }
} return true;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[Artwork="); public int hashCode() {
sb.append("[aspectRatio=").append(aspectRatio); int hash = 3;
sb.append("],[filePath=").append(filePath); hash = 71 * hash + Float.floatToIntBits(this.aspectRatio);
sb.append("],[height=").append(height); hash = 71 * hash + (this.filePath != null ? this.filePath.hashCode() : 0);
sb.append("],[language=").append(language); hash = 71 * hash + this.height;
sb.append("],[width=").append(width); hash = 71 * hash + (this.language != null ? this.language.hashCode() : 0);
sb.append("],[artworkType=").append(artworkType); hash = 71 * hash + this.width;
sb.append("]]"); hash = 71 * hash + (this.artworkType != null ? this.artworkType.hashCode() : 0);
return sb.toString(); return hash;
} }
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Artwork=");
sb.append("[aspectRatio=").append(aspectRatio);
sb.append("],[filePath=").append(filePath);
sb.append("],[height=").append(height);
sb.append("],[language=").append(language);
sb.append("],[width=").append(width);
sb.append("],[artworkType=").append(artworkType);
sb.append("]]");
return sb.toString();
}
}
@@ -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,123 +1,124 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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 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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class CollectionInfo implements Serializable { */
public class CollectionInfo implements Serializable {
private static final long serialVersionUID = 1L;
/* private static final long serialVersionUID = 1L;
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(CollectionInfo.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(CollectionInfo.class);
* Properties /*
*/ * Properties
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("name") private int id;
private String name; @JsonProperty("name")
@JsonProperty("poster_path") private String name;
private String posterPath; @JsonProperty("poster_path")
@JsonProperty("backdrop_path") private String posterPath;
private String backdropPath; @JsonProperty("backdrop_path")
@JsonProperty("parts") private String backdropPath;
private List<Collection> parts = new ArrayList<Collection>(); @JsonProperty("parts")
private List<Collection> parts = new ArrayList<Collection>();
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getBackdropPath() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return backdropPath; public String getBackdropPath() {
} return backdropPath;
}
public int getId() {
return id; public int getId() {
} return id;
}
public String getName() {
return name; public String getName() {
} return name;
}
public List<Collection> getParts() {
return parts; public List<Collection> getParts() {
} return parts;
}
public String getPosterPath() {
return posterPath; public String getPosterPath() {
} return posterPath;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdropPath(String backdropPath) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.backdropPath = backdropPath; public void setBackdropPath(String backdropPath) {
} this.backdropPath = backdropPath;
}
public void setId(int id) {
this.id = id; public void setId(int id) {
} this.id = id;
}
public void setName(String name) {
this.name = name; public void setName(String name) {
} this.name = name;
}
public void setParts(List<Collection> parts) {
this.parts = parts; public void setParts(List<Collection> parts) {
} this.parts = parts;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath; public void setPosterPath(String posterPath) {
} this.posterPath = posterPath;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[CollectionInfo="); public String toString() {
sb.append("[id=").append(id); StringBuilder sb = new StringBuilder("[CollectionInfo=");
sb.append("],[name=").append(name); sb.append("[id=").append(id);
sb.append("],[posterPath=").append(posterPath); sb.append("],[name=").append(name);
sb.append("],[backdropPath=").append(backdropPath); sb.append("],[posterPath=").append(posterPath);
sb.append("],[# of parts=").append(parts.size()); sb.append("],[backdropPath=").append(backdropPath);
sb.append("]]"); sb.append("],[# of parts=").append(parts.size());
return sb.toString(); sb.append("]]");
} 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.
* *
@@ -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,116 +1,117 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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 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;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
@JsonRootName("genre") */
public class Genre implements Serializable { @JsonRootName("genre")
public class Genre implements Serializable {
private static final long serialVersionUID = 1L;
/* private static final long serialVersionUID = 1L;
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(Genre.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(Genre.class);
* Properties /*
*/ * Properties
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("name") private int id;
private String name; @JsonProperty("name")
private String name;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return id; public int getId() {
} return id;
}
public String getName() {
return name; public String getName() {
} return name;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.id = id; public void setId(int id) {
} this.id = id;
}
public void setName(String name) {
this.name = name; public void setName(String name) {
} this.name = name;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public boolean equals(Object obj) { @Override
if (obj == null) { public boolean equals(Object obj) {
return false; if (obj == null) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if (getClass() != obj.getClass()) {
} return false;
final Genre other = (Genre) obj; }
if (this.id != other.id) { final Genre other = (Genre) obj;
return false; if (this.id != other.id) {
} return false;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { }
return false; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
} return false;
return true; }
} return true;
}
@Override
public int hashCode() { @Override
int hash = 5; public int hashCode() {
hash = 53 * hash + this.id; int hash = 5;
hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 53 * hash + this.id;
return hash; hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
} return hash;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[Genre="); public String toString() {
sb.append("[id=").append(id); StringBuilder sb = new StringBuilder("[Genre=");
sb.append("],[name=").append(name); sb.append("[id=").append(id);
sb.append("]]"); sb.append("],[name=").append(name);
return sb.toString(); sb.append("]]");
} return sb.toString();
} }
}
@@ -1,117 +1,118 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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 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;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
@JsonRootName("keyword") */
public class Keyword implements Serializable { @JsonRootName("keyword")
public class Keyword implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(Keyword.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(Keyword.class);
* Properties /*
*/ * Properties
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("name") private int id;
private String name; @JsonProperty("name")
private String name;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return id; public int getId() {
} return id;
}
public String getName() {
return name; public String getName() {
} return name;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.id = id; public void setId(int id) {
} this.id = id;
}
public void setName(String name) {
this.name = name; public void setName(String name) {
} this.name = name;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public boolean equals(Object obj) { @Override
if (obj == null) { public boolean equals(Object obj) {
return false; if (obj == null) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if (getClass() != obj.getClass()) {
} return false;
final Keyword other = (Keyword) obj; }
if (this.id != other.id) { final Keyword other = (Keyword) obj;
return false; if (this.id != other.id) {
} return false;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { }
return false; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
} return false;
return true; }
} return true;
}
@Override
public int hashCode() { @Override
int hash = 3; public int hashCode() {
hash = 83 * hash + this.id; int hash = 3;
hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 83 * hash + this.id;
return hash; hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0);
} return hash;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[Keyword="); public String toString() {
sb.append("[id=").append(id); StringBuilder sb = new StringBuilder("[Keyword=");
sb.append("],[name=").append(name); sb.append("[id=").append(id);
sb.append("]]"); sb.append("],[name=").append(name);
return sb.toString(); sb.append("]]");
} return 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 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,116 +1,117 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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 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;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
@JsonRootName("spoken_language") */
public class Language implements Serializable { @JsonRootName("spoken_language")
public class Language implements Serializable {
private static final long serialVersionUID = 1L;
/* private static final long serialVersionUID = 1L;
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(Language.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(Language.class);
* Properties /*
*/ * Properties
@JsonProperty("iso_639_1") */
private String isoCode; @JsonProperty("iso_639_1")
@JsonProperty("name") private String isoCode;
private String name; @JsonProperty("name")
private String name;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getIsoCode() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return isoCode; public String getIsoCode() {
} return isoCode;
}
public String getName() {
return name; public String getName() {
} return name;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setIsoCode(String isoCode) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.isoCode = isoCode; public void setIsoCode(String isoCode) {
} this.isoCode = isoCode;
}
public void setName(String name) {
this.name = name; public void setName(String name) {
} this.name = name;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public boolean equals(Object obj) { @Override
if (obj == null) { public boolean equals(Object obj) {
return false; if (obj == null) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if (getClass() != obj.getClass()) {
} return false;
final Language other = (Language) obj; }
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) { final Language other = (Language) obj;
return false; if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
} return false;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { }
return false; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
} return false;
return true; }
} return true;
}
@Override
public int hashCode() { @Override
int hash = 7; public int hashCode() {
hash = 71 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0); int hash = 7;
hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 71 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
return hash; hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0);
} return hash;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[Language="); public String toString() {
sb.append("isoCode=").append(isoCode); StringBuilder sb = new StringBuilder("[Language=");
sb.append(", name=").append(name); sb.append("isoCode=").append(isoCode);
sb.append("]]"); sb.append(", name=").append(name);
return sb.toString(); sb.append("]]");
} return sb.toString();
} }
}
@@ -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,354 +1,354 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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 java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Movie Bean /**
* * Movie Bean
* @author stuart.boston *
*/ * @author stuart.boston
public class MovieDb implements Serializable { */
public class MovieDb implements Serializable {
private static final long serialVersionUID = 1L;
/* private static final long serialVersionUID = 1L;
* 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")) */
private String backdropPath; @JsonProperty("backdrop_path")
@JsonProperty(("id")) private String backdropPath;
private int id; @JsonProperty("id")
@JsonProperty(("original_title")) private int id;
private String originalTitle; @JsonProperty("original_title")
@JsonProperty(("popularity")) private String originalTitle;
private float popularity; @JsonProperty("popularity")
@JsonProperty(("poster_path")) private float popularity;
private String posterPath; @JsonProperty("poster_path")
@JsonProperty(("release_date")) private String posterPath;
private String releaseDate; @JsonProperty("release_date")
@JsonProperty(("title")) private String releaseDate;
private String title; @JsonProperty("title")
@JsonProperty("adult") private String title;
private boolean adult; @JsonProperty("adult")
@JsonProperty("belongs_to_collection") private boolean adult;
private Collection belongsToCollection; @JsonProperty("belongs_to_collection")
@JsonProperty("budget") private Collection belongsToCollection;
private long budget; @JsonProperty("budget")
@JsonProperty("genres") private long budget;
private List<Genre> genres; @JsonProperty("genres")
@JsonProperty("homepage") private List<Genre> genres;
private String homepage; @JsonProperty("homepage")
@JsonProperty("imdb_id") private String homepage;
private String imdbID; @JsonProperty("imdb_id")
@JsonProperty("overview") private String imdbID;
private String overview; @JsonProperty("overview")
@JsonProperty("production_companies") private String overview;
private List<ProductionCompany> productionCompanies; @JsonProperty("production_companies")
@JsonProperty("production_countries") private List<ProductionCompany> productionCompanies;
private List<ProductionCountry> productionCountries; @JsonProperty("production_countries")
@JsonProperty("revenue") private List<ProductionCountry> productionCountries;
private long revenue; @JsonProperty("revenue")
@JsonProperty("runtime") private long revenue;
private int runtime; @JsonProperty("runtime")
@JsonProperty("spoken_languages") private int runtime;
private List<Language> spokenLanguages; @JsonProperty("spoken_languages")
@JsonProperty("tagline") private List<Language> spokenLanguages;
private String tagline; @JsonProperty("tagline")
@JsonProperty("vote_average") private String tagline;
private float voteAverage; @JsonProperty("vote_average")
@JsonProperty("vote_count") private float voteAverage;
private int voteCount; @JsonProperty("vote_count")
@JsonProperty("status") private int voteCount;
private String status; @JsonProperty("status")
private String status;
// <editor-fold defaultstate="collapsed" desc="Getter methods">
public String getBackdropPath() { // <editor-fold defaultstate="collapsed" desc="Getter methods">
return backdropPath; public String getBackdropPath() {
} return backdropPath;
}
public int getId() {
return id; public int getId() {
} return id;
}
public String getOriginalTitle() {
return originalTitle; public String getOriginalTitle() {
} return originalTitle;
}
public float getPopularity() {
return popularity; public float getPopularity() {
} return popularity;
}
public String getPosterPath() {
return posterPath; public String getPosterPath() {
} return posterPath;
}
public String getReleaseDate() {
return releaseDate; public String getReleaseDate() {
} return releaseDate;
}
public String getTitle() {
return title; public String getTitle() {
} return title;
}
public boolean isAdult() {
return adult; public boolean isAdult() {
} return adult;
}
public Collection getBelongsToCollection() {
return belongsToCollection; public Collection getBelongsToCollection() {
} return belongsToCollection;
}
public long getBudget() {
return budget; public long getBudget() {
} return budget;
}
public List<Genre> getGenres() {
return genres; public List<Genre> getGenres() {
} return genres;
}
public String getHomepage() {
return homepage; public String getHomepage() {
} return homepage;
}
public String getImdbID() {
return imdbID; public String getImdbID() {
} return imdbID;
}
public String getOverview() {
return overview; public String getOverview() {
} return overview;
}
public List<ProductionCompany> getProductionCompanies() {
return productionCompanies; public List<ProductionCompany> getProductionCompanies() {
} return productionCompanies;
}
public List<ProductionCountry> getProductionCountries() {
return productionCountries; public List<ProductionCountry> getProductionCountries() {
} return productionCountries;
}
public long getRevenue() {
return revenue; public long getRevenue() {
} return revenue;
}
public int getRuntime() {
return runtime; public int getRuntime() {
} return runtime;
}
public List<Language> getSpokenLanguages() {
return spokenLanguages; public List<Language> getSpokenLanguages() {
} return spokenLanguages;
}
public String getTagline() {
return tagline; public String getTagline() {
} return tagline;
}
public float getVoteAverage() {
return voteAverage; public float getVoteAverage() {
} return voteAverage;
}
public int getVoteCount() {
return voteCount; public int getVoteCount() {
} return voteCount;
}
public String getStatus() {
return status; public String getStatus() {
} return status;
// </editor-fold> }
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdropPath(String backdropPath) { // <editor-fold defaultstate="collapsed" desc="Setter methods">
this.backdropPath = backdropPath; public void setBackdropPath(String backdropPath) {
} this.backdropPath = backdropPath;
}
public void setId(int id) {
this.id = id; public void setId(int id) {
} this.id = id;
}
public void setOriginalTitle(String originalTitle) {
this.originalTitle = originalTitle; public void setOriginalTitle(String originalTitle) {
} this.originalTitle = originalTitle;
}
public void setPopularity(float popularity) {
this.popularity = popularity; public void setPopularity(float popularity) {
} this.popularity = popularity;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath; public void setPosterPath(String posterPath) {
} this.posterPath = posterPath;
}
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate; public void setReleaseDate(String releaseDate) {
} this.releaseDate = releaseDate;
}
public void setTitle(String title) {
this.title = title; public void setTitle(String title) {
} this.title = title;
}
public void setAdult(boolean adult) {
this.adult = adult; public void setAdult(boolean adult) {
} this.adult = adult;
}
public void setBelongsToCollection(Collection belongsToCollection) {
this.belongsToCollection = belongsToCollection; public void setBelongsToCollection(Collection belongsToCollection) {
} this.belongsToCollection = belongsToCollection;
}
public void setBudget(long budget) {
this.budget = budget; public void setBudget(long budget) {
} this.budget = budget;
}
public void setGenres(List<Genre> genres) {
this.genres = genres; public void setGenres(List<Genre> genres) {
} this.genres = genres;
}
public void setHomepage(String homepage) {
this.homepage = homepage; public void setHomepage(String homepage) {
} this.homepage = homepage;
}
public void setImdbID(String imdbID) {
this.imdbID = imdbID; public void setImdbID(String imdbID) {
} this.imdbID = imdbID;
}
public void setOverview(String overview) {
this.overview = overview; public void setOverview(String overview) {
} this.overview = overview;
}
public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
this.productionCompanies = productionCompanies; public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
} this.productionCompanies = productionCompanies;
}
public void setProductionCountries(List<ProductionCountry> productionCountries) {
this.productionCountries = productionCountries; public void setProductionCountries(List<ProductionCountry> productionCountries) {
} this.productionCountries = productionCountries;
}
public void setRevenue(long revenue) {
this.revenue = revenue; public void setRevenue(long revenue) {
} this.revenue = revenue;
}
public void setRuntime(int runtime) {
this.runtime = runtime; public void setRuntime(int runtime) {
} this.runtime = runtime;
}
public void setSpokenLanguages(List<Language> spokenLanguages) {
this.spokenLanguages = spokenLanguages; public void setSpokenLanguages(List<Language> spokenLanguages) {
} this.spokenLanguages = spokenLanguages;
}
public void setTagline(String tagline) {
this.tagline = tagline; public void setTagline(String tagline) {
} this.tagline = tagline;
}
public void setVoteAverage(float voteAverage) {
this.voteAverage = voteAverage; public void setVoteAverage(float voteAverage) {
} this.voteAverage = voteAverage;
}
public void setVoteCount(int voteCount) {
this.voteCount = voteCount; public void setVoteCount(int voteCount) {
} this.voteCount = voteCount;
}
public void setStatus(String status) {
this.status = status; public void setStatus(String status) {
} this.status = status;
}
// </editor-fold>
// </editor-fold>
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
* *
* @param key * @param key
* @param value * @param value
*/ */
@JsonAnySetter @JsonAnySetter
public void handleUnknown(String key, Object value) { public void handleUnknown(String key, Object value) {
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">
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
final MovieDb other = (MovieDb) obj; final MovieDb other = (MovieDb) obj;
if (this.id != other.id) { if (this.id != other.id) {
return false; return false;
} }
if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) { if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) {
return false; return false;
} }
if (this.runtime != other.runtime) { if (this.runtime != other.runtime) {
return false; return false;
} }
return true; return true;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 5; int hash = 5;
hash = 89 * hash + this.id; hash = 89 * hash + this.id;
hash = 89 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0); hash = 89 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0);
hash = 89 * hash + this.runtime; hash = 89 * hash + this.runtime;
return hash; return hash;
} }
//</editor-fold> //</editor-fold>
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[MovieDB="); StringBuilder sb = new StringBuilder("[MovieDB=");
sb.append("[backdropPath=").append(backdropPath); sb.append("[backdropPath=").append(backdropPath);
sb.append("],[id=").append(id); sb.append("],[id=").append(id);
sb.append("],[originalTitle=").append(originalTitle); sb.append("],[originalTitle=").append(originalTitle);
sb.append("],[popularity=").append(popularity); sb.append("],[popularity=").append(popularity);
sb.append("],[posterPath=").append(posterPath); sb.append("],[posterPath=").append(posterPath);
sb.append("],[releaseDate=").append(releaseDate); sb.append("],[releaseDate=").append(releaseDate);
sb.append("],[title=").append(title); sb.append("],[title=").append(title);
sb.append("],[adult=").append(adult); sb.append("],[adult=").append(adult);
sb.append("],[belongsToCollection=").append(belongsToCollection); sb.append("],[belongsToCollection=").append(belongsToCollection);
sb.append("],[budget=").append(budget); sb.append("],[budget=").append(budget);
sb.append("],[genres=").append(genres); sb.append("],[genres=").append(genres);
sb.append("],[homepage=").append(homepage); sb.append("],[homepage=").append(homepage);
sb.append("],[imdbID=").append(imdbID); sb.append("],[imdbID=").append(imdbID);
sb.append("],[overview=").append(overview); sb.append("],[overview=").append(overview);
sb.append("],[productionCompanies=").append(productionCompanies); sb.append("],[productionCompanies=").append(productionCompanies);
sb.append("],[productionCountries=").append(productionCountries); sb.append("],[productionCountries=").append(productionCountries);
sb.append("],[revenue=").append(revenue); sb.append("],[revenue=").append(revenue);
sb.append("],[runtime=").append(runtime); sb.append("],[runtime=").append(runtime);
sb.append("],[spokenLanguages=").append(spokenLanguages); sb.append("],[spokenLanguages=").append(spokenLanguages);
sb.append("],[tagline=").append(tagline); sb.append("],[tagline=").append(tagline);
sb.append("],[voteAverage=").append(voteAverage); sb.append("],[voteAverage=").append(voteAverage);
sb.append("],[voteCount=").append(voteCount); sb.append("],[voteCount=").append(voteCount);
sb.append("],[status=").append(status); sb.append("],[status=").append(status);
sb.append("]]"); sb.append("]]");
return sb.toString(); return sb.toString();
} }
} }
@@ -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,322 +1,343 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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 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;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
public class Person implements Serializable { */
public class Person implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* 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
private static final String CAST_DEPARTMENT = "acting"; */
private static final String CAST_JOB = "actor"; private static final String CAST_DEPARTMENT = "acting";
private static final String DEFAULT_STRING = ""; private static final String CAST_JOB = "actor";
/* private static final String DEFAULT_STRING = "";
* Properties /*
*/ * Properties
@JsonProperty("id") */
private int id = -1; @JsonProperty("id")
@JsonProperty("name") private int id = -1;
private String name = ""; @JsonProperty("name")
@JsonProperty("profile_path") private String name = "";
private String profilePath = DEFAULT_STRING; @JsonProperty("profile_path")
private PersonType personType = PersonType.PERSON; private String profilePath = DEFAULT_STRING;
private String department = DEFAULT_STRING; // Crew private PersonType personType = PersonType.PERSON;
private String job = DEFAULT_STRING; // Crew private String department = DEFAULT_STRING; // Crew
private String character = DEFAULT_STRING; // Cast private String job = DEFAULT_STRING; // Crew
private int order = -1; // Cast private String character = DEFAULT_STRING; // Cast
@JsonProperty("adult") private int order = -1; // Cast
private boolean adult = false; // Person info @JsonProperty("adult")
@JsonProperty("also_known_as") private boolean adult = false; // Person info
private List<String> aka = new ArrayList<String>(); @JsonProperty("also_known_as")
@JsonProperty("biography") private List<String> aka = new ArrayList<String>();
private String biography = DEFAULT_STRING; @JsonProperty("biography")
@JsonProperty("birthday") private String biography = DEFAULT_STRING;
private String birthday = DEFAULT_STRING; @JsonProperty("birthday")
@JsonProperty("deathday") private String birthday = DEFAULT_STRING;
private String deathday = DEFAULT_STRING; @JsonProperty("deathday")
@JsonProperty("homepage") private String deathday = DEFAULT_STRING;
private String homepage = DEFAULT_STRING; @JsonProperty("homepage")
@JsonProperty("place_of_birth") private String homepage = DEFAULT_STRING;
private String birthplace = DEFAULT_STRING; @JsonProperty("place_of_birth")
private String birthplace = DEFAULT_STRING;
/** @JsonProperty("imdb_id")
* Add a crew member private String imdbId = DEFAULT_STRING;
* @JsonProperty("popularity")
* @param id private float popularity = 0.0f;
* @param name
* @param profilePath /**
* @param department * Add a crew member
* @param job *
*/ * @param id
public void addCrew(int id, String name, String profilePath, String department, String job) { * @param name
this.personType = PersonType.CREW; * @param profilePath
this.id = id; * @param department
this.name = name; * @param job
this.profilePath = profilePath; */
this.department = department; public void addCrew(int id, String name, String profilePath, String department, String job) {
this.job = job; this.personType = PersonType.CREW;
this.character = ""; this.id = id;
this.order = -1; this.name = name;
} this.profilePath = profilePath;
this.department = department;
/** this.job = job;
* Add a cast member this.character = "";
* this.order = -1;
* @param id }
* @param name
* @param profilePath /**
* @param character * Add a cast member
* @param order *
*/ * @param id
public void addCast(int id, String name, String profilePath, String character, int order) { * @param name
this.personType = PersonType.CAST; * @param profilePath
this.id = id; * @param character
this.name = name; * @param order
this.profilePath = profilePath; */
this.character = character; public void addCast(int id, String name, String profilePath, String character, int order) {
this.order = order; this.personType = PersonType.CAST;
this.department = CAST_DEPARTMENT; this.id = id;
this.job = CAST_JOB; this.name = name;
} this.profilePath = profilePath;
this.character = character;
// <editor-fold defaultstate="collapsed" desc="Getter methods"> this.order = order;
public String getCharacter() { this.department = CAST_DEPARTMENT;
return character; this.job = CAST_JOB;
} }
public String getDepartment() { // <editor-fold defaultstate="collapsed" desc="Getter methods">
return department; public String getCharacter() {
} return character;
}
public int getId() {
return id; public String getDepartment() {
} return department;
}
public String getJob() {
return job; public int getId() {
} return id;
}
public String getName() {
return name; public String getJob() {
} return job;
}
public int getOrder() {
return order; public String getName() {
} return name;
}
public PersonType getPersonType() {
return personType; public int getOrder() {
} return order;
}
public String getProfilePath() {
return profilePath; public PersonType getPersonType() {
} return personType;
}
public boolean isAdult() {
return adult; public String getProfilePath() {
} return profilePath;
}
public List<String> getAka() {
return aka; public boolean isAdult() {
} return adult;
}
public String getBiography() {
return biography; public List<String> getAka() {
} return aka;
}
public String getBirthday() {
return birthday; public String getBiography() {
} return biography;
}
public String getBirthplace() {
return birthplace; public String getBirthday() {
} return birthday;
}
public String getDeathday() {
return deathday; public String getBirthplace() {
} return birthplace;
}
public String getHomepage() {
return homepage; public String getDeathday() {
} return deathday;
// </editor-fold> }
// <editor-fold defaultstate="collapsed" desc="Setter methods"> public String getHomepage() {
public void setCharacter(String character) { return homepage;
this.character = character; }
}
public String getImdbId() {
public void setDepartment(String department) { return imdbId;
this.department = department; }
}
public float getPopularity() {
public void setId(int id) { return popularity;
this.id = id; }
} // </editor-fold>
public void setJob(String job) { // <editor-fold defaultstate="collapsed" desc="Setter methods">
this.job = job; public void setCharacter(String character) {
} this.character = character;
}
public void setName(String name) {
this.name = name; public void setDepartment(String department) {
} this.department = department;
}
public void setOrder(int order) {
this.order = order; public void setId(int id) {
} this.id = id;
}
public void setPersonType(PersonType personType) {
this.personType = personType; public void setJob(String job) {
} this.job = job;
}
public void setProfilePath(String profilePath) {
this.profilePath = profilePath; public void setName(String name) {
} this.name = name;
}
public void setAdult(boolean adult) {
this.adult = adult; public void setOrder(int order) {
} this.order = order;
}
public void setAka(List<String> aka) {
this.aka = aka; public void setPersonType(PersonType personType) {
} this.personType = personType;
}
public void setBiography(String biography) {
this.biography = biography; public void setProfilePath(String profilePath) {
} this.profilePath = profilePath;
}
public void setBirthday(String birthday) {
this.birthday = birthday; public void setAdult(boolean adult) {
} this.adult = adult;
}
public void setBirthplace(String birthplace) {
this.birthplace = birthplace; public void setAka(List<String> aka) {
} this.aka = aka;
}
public void setDeathday(String deathday) {
this.deathday = deathday; public void setBiography(String biography) {
} this.biography = biography;
}
public void setHomepage(String homepage) {
this.homepage = homepage; public void setBirthday(String birthday) {
} this.birthday = birthday;
// </editor-fold> }
/** public void setBirthplace(String birthplace) {
* Handle unknown properties and print a message this.birthplace = birthplace;
* }
* @param key
* @param value public void setDeathday(String deathday) {
*/ this.deathday = deathday;
@JsonAnySetter }
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder(); public void setHomepage(String homepage) {
sb.append("Unknown property: '").append(key); this.homepage = homepage;
sb.append("' value: '").append(value).append("'"); }
logger.trace(sb.toString());
} public void setImdbId(String imdbId) {
this.imdbId = imdbId;
@Override }
public boolean equals(Object obj) {
if (obj == null) { public void setPopularity(float popularity) {
return false; this.popularity = popularity;
} }
if (getClass() != obj.getClass()) { // </editor-fold>
return false;
} /**
final Person other = (Person) obj; * Handle unknown properties and print a message
if (this.id != other.id) { *
return false; * @param key
} * @param value
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { */
return false; @JsonAnySetter
} public void handleUnknown(String key, Object value) {
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) { StringBuilder sb = new StringBuilder();
return false; sb.append("Unknown property: '").append(key);
} sb.append("' value: '").append(value).append("'");
if (this.personType != other.personType) { LOG.trace(sb.toString());
return false; }
}
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) { @Override
return false; public boolean equals(Object obj) {
} if (obj == null) {
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) { return false;
return false; }
} if (getClass() != obj.getClass()) {
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) { return false;
return false; }
} final Person other = (Person) obj;
return true; if (this.id != other.id) {
} return false;
}
@Override if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
public int hashCode() { return false;
int hash = 3; }
hash = 37 * hash + this.id; if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0); return false;
hash = 37 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0); }
hash = 37 * hash + (this.personType != null ? this.personType.hashCode() : 0); if (this.personType != other.personType) {
hash = 37 * hash + (this.department != null ? this.department.hashCode() : 0); return false;
hash = 37 * hash + (this.job != null ? this.job.hashCode() : 0); }
hash = 37 * hash + (this.character != null ? this.character.hashCode() : 0); if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
return hash; return false;
} }
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
@Override return false;
public String toString() { }
StringBuilder sb = new StringBuilder("[Person="); if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
sb.append("[id=").append(id); return false;
sb.append("],[name=").append(name); }
sb.append("],[profilePath=").append(profilePath); return true;
sb.append("],[personType=").append(personType); }
sb.append("],[department=").append(department);
sb.append("],[job=").append(job); @Override
sb.append("],[character=").append(character); public int hashCode() {
sb.append("],[order=").append(order); int hash = 3;
sb.append("],[adult=").append(adult); hash = 37 * hash + this.id;
sb.append("],[=aka").append(aka.toString()); hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
sb.append("],[biography=").append(biography); hash = 37 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
sb.append("],[birthday=").append(birthday); hash = 37 * hash + (this.personType != null ? this.personType.hashCode() : 0);
sb.append("],[deathday=").append(deathday); hash = 37 * hash + (this.department != null ? this.department.hashCode() : 0);
sb.append("],[homepage=").append(homepage); hash = 37 * hash + (this.job != null ? this.job.hashCode() : 0);
sb.append("],[birthplace=").append(birthplace); hash = 37 * hash + (this.character != null ? this.character.hashCode() : 0);
sb.append("]]"); return hash;
return sb.toString(); }
}
} @Override
public String toString() {
StringBuilder sb = new StringBuilder("[Person=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("],[profilePath=").append(profilePath);
sb.append("],[personType=").append(personType);
sb.append("],[department=").append(department);
sb.append("],[job=").append(job);
sb.append("],[character=").append(character);
sb.append("],[order=").append(order);
sb.append("],[adult=").append(adult);
sb.append("],[=aka").append(aka.toString());
sb.append("],[biography=").append(biography);
sb.append("],[birthday=").append(birthday);
sb.append("],[deathday=").append(deathday);
sb.append("],[homepage=").append(homepage);
sb.append("],[birthplace=").append(birthplace);
sb.append("]]");
return sb.toString();
}
}
@@ -1,172 +1,173 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class PersonCast implements Serializable { */
public class PersonCast implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(PersonCast.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(PersonCast.class);
* Properties /*
*/ * Properties
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("character") private int id;
private String character; @JsonProperty("character")
@JsonProperty("name") private String character;
private String name; @JsonProperty("name")
@JsonProperty("order") private String name;
private int order; @JsonProperty("order")
@JsonProperty("profile_path") private int order;
private String profilePath; @JsonProperty("profile_path")
@JsonProperty("cast_id") private String profilePath;
private int castId; @JsonProperty("cast_id")
private int castId;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getCharacter() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return character; public String getCharacter() {
} return character;
}
public int getId() {
return id; public int getId() {
} return id;
}
public String getName() {
return name; public String getName() {
} return name;
}
public int getOrder() {
return order; public int getOrder() {
} return order;
}
public String getProfilePath() {
return profilePath; public String getProfilePath() {
} return profilePath;
}
public int getCastId() {
return castId; public int getCastId() {
} return castId;
}
//</editor-fold>
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCharacter(String character) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.character = character; public void setCharacter(String character) {
} this.character = character;
}
public void setId(int id) {
this.id = id; public void setId(int id) {
} this.id = id;
}
public void setName(String name) {
this.name = name; public void setName(String name) {
} this.name = name;
}
public void setOrder(int order) {
this.order = order; public void setOrder(int order) {
} this.order = order;
}
public void setProfilePath(String profilePath) {
this.profilePath = profilePath; public void setProfilePath(String profilePath) {
} this.profilePath = profilePath;
}
public void setCastId(int castId) {
this.castId = castId; public void setCastId(int castId) {
} this.castId = castId;
}
//</editor-fold>
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public boolean equals(Object obj) { @Override
if (obj == null) { public boolean equals(Object obj) {
return false; if (obj == null) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if (getClass() != obj.getClass()) {
} return false;
final PersonCast other = (PersonCast) obj; }
if (this.id != other.id) { final PersonCast other = (PersonCast) obj;
return false; if (this.id != other.id) {
} return false;
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) { }
return false; if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
} return false;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { }
return false; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
} return false;
if (this.order != other.order) { }
return false; if (this.order != other.order) {
} return false;
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) { }
return false; if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
} return false;
return true; }
} return true;
}
@Override
public int hashCode() { @Override
int hash = 7; public int hashCode() {
hash = 41 * hash + this.id; int hash = 7;
hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0); hash = 41 * hash + this.id;
hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0);
hash = 41 * hash + this.order; hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 41 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0); hash = 41 * hash + this.order;
return hash; hash = 41 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
} return hash;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[PersonCast="); public String toString() {
sb.append("id=").append(id); StringBuilder sb = new StringBuilder("[PersonCast=");
sb.append("],[character=").append(character); sb.append("id=").append(id);
sb.append("],[name=").append(name); sb.append("],[character=").append(character);
sb.append("],[order=").append(order); sb.append("],[name=").append(name);
sb.append("],[profilePath=").append(profilePath); sb.append("],[order=").append(order);
sb.append("]]"); sb.append("],[profilePath=").append(profilePath);
return sb.toString(); sb.append("]]");
} 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.
* *
@@ -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,117 +1,118 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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 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;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
@JsonRootName("production_company") */
public class ProductionCompany implements Serializable { @JsonRootName("production_company")
public class ProductionCompany implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(ProductionCompany.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(ProductionCompany.class);
* Properties /*
*/ * Properties
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("name") private int id;
private String name; @JsonProperty("name")
private String name;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return id; public int getId() {
} return id;
}
public String getName() {
return name; public String getName() {
} return name;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.id = id; public void setId(int id) {
} this.id = id;
}
public void setName(String name) {
this.name = name; public void setName(String name) {
} this.name = name;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public boolean equals(Object obj) { @Override
if (obj == null) { public boolean equals(Object obj) {
return false; if (obj == null) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if (getClass() != obj.getClass()) {
} return false;
final ProductionCompany other = (ProductionCompany) obj; }
if (this.id != other.id) { final ProductionCompany other = (ProductionCompany) obj;
return false; if (this.id != other.id) {
} return false;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { }
return false; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
} return false;
return true; }
} return true;
}
@Override
public int hashCode() { @Override
int hash = 5; public int hashCode() {
hash = 37 * hash + this.id; int hash = 5;
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 37 * hash + this.id;
return hash; hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
} return hash;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[ProductionCompany="); public String toString() {
sb.append("[id=").append(id); StringBuilder sb = new StringBuilder("[ProductionCompany=");
sb.append("],[name=").append(name); sb.append("[id=").append(id);
sb.append("]]"); sb.append("],[name=").append(name);
return sb.toString(); sb.append("]]");
} return sb.toString();
} }
}
@@ -1,117 +1,118 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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 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;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
@JsonRootName("production_country") */
public class ProductionCountry implements Serializable { @JsonRootName("production_country")
public class ProductionCountry implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(ProductionCountry.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(ProductionCountry.class);
* Properties /*
*/ * Properties
@JsonProperty("iso_3166_1") */
private String isoCode; @JsonProperty("iso_3166_1")
@JsonProperty("name") private String isoCode;
private String name; @JsonProperty("name")
private String name;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getIsoCode() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return isoCode; public String getIsoCode() {
} return isoCode;
}
public String getName() {
return name; public String getName() {
} return name;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setIsoCode(String isoCode) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.isoCode = isoCode; public void setIsoCode(String isoCode) {
} this.isoCode = isoCode;
}
public void setName(String name) {
this.name = name; public void setName(String name) {
} this.name = name;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public boolean equals(Object obj) { @Override
if (obj == null) { public boolean equals(Object obj) {
return false; if (obj == null) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if (getClass() != obj.getClass()) {
} return false;
final ProductionCountry other = (ProductionCountry) obj; }
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) { final ProductionCountry other = (ProductionCountry) obj;
return false; if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
} return false;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { }
return false; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
} return false;
return true; }
} return true;
}
@Override
public int hashCode() { @Override
int hash = 7; public int hashCode() {
hash = 47 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0); int hash = 7;
hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 47 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
return hash; hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
} return hash;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[ProductionCountry="); public String toString() {
sb.append("[isoCode=").append(isoCode); StringBuilder sb = new StringBuilder("[ProductionCountry=");
sb.append("],[name=").append(name); sb.append("[isoCode=").append(isoCode);
sb.append("]]"); sb.append("],[name=").append(name);
return sb.toString(); sb.append("]]");
} return sb.toString();
} }
}
@@ -1,130 +1,131 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class ReleaseInfo implements Serializable { */
public class ReleaseInfo implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(ReleaseInfo.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(ReleaseInfo.class);
* Properties /*
*/ * Properties
@JsonProperty("iso_3166_1") */
private String country; @JsonProperty("iso_3166_1")
@JsonProperty("certification") private String country;
private String certification; @JsonProperty("certification")
@JsonProperty("release_date") private String certification;
private String releaseDate; @JsonProperty("release_date")
private String releaseDate;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getCertification() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return certification; public String getCertification() {
} return certification;
}
public String getCountry() {
return country; public String getCountry() {
} return country;
}
public String getReleaseDate() {
return releaseDate; public String getReleaseDate() {
} return releaseDate;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCertification(String certification) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.certification = certification; public void setCertification(String certification) {
} this.certification = certification;
}
public void setCountry(String country) {
this.country = country; public void setCountry(String country) {
} this.country = country;
}
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate; public void setReleaseDate(String releaseDate) {
} this.releaseDate = releaseDate;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public boolean equals(Object obj) { @Override
if (obj == null) { public boolean equals(Object obj) {
return false; if (obj == null) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if (getClass() != obj.getClass()) {
} return false;
final ReleaseInfo other = (ReleaseInfo) obj; }
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) { final ReleaseInfo other = (ReleaseInfo) obj;
return false; if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
} return false;
if ((this.certification == null) ? (other.certification != null) : !this.certification.equals(other.certification)) { }
return false; if ((this.certification == null) ? (other.certification != null) : !this.certification.equals(other.certification)) {
} return false;
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) { }
return false; if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
} return false;
return true; }
} return true;
}
@Override
public int hashCode() { @Override
int hash = 3; public int hashCode() {
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0); int hash = 3;
hash = 89 * hash + (this.certification != null ? this.certification.hashCode() : 0); hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
hash = 89 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0); hash = 89 * hash + (this.certification != null ? this.certification.hashCode() : 0);
return hash; hash = 89 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
} return hash;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[ReleaseInfo="); public String toString() {
sb.append("[country=").append(country); StringBuilder sb = new StringBuilder("[ReleaseInfo=");
sb.append("],[certification=").append(certification); sb.append("[country=").append(country);
sb.append("],[releaseDate=").append(releaseDate); sb.append("],[certification=").append(certification);
sb.append("]]"); sb.append("],[releaseDate=").append(releaseDate);
return sb.toString(); sb.append("]]");
} return sb.toString();
} }
}
@@ -1,88 +1,89 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class StatusCode implements Serializable { */
public class StatusCode implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(StatusCode.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(StatusCode.class);
* Properties /*
*/ * Properties
@JsonProperty("status_code") */
private int statusCode; @JsonProperty("status_code")
@JsonProperty("status_message") private int statusCode;
private String statusMessage; @JsonProperty("status_message")
private String statusMessage;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getStatusCode() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return statusCode; public int getStatusCode() {
} return statusCode;
}
public void setStatusCode(int statusCode) {
this.statusCode = statusCode; public void setStatusCode(int statusCode) {
} this.statusCode = statusCode;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public String getStatusMessage() { //<editor-fold defaultstate="collapsed" desc="Setter methods">
return statusMessage; public String getStatusMessage() {
} return statusMessage;
}
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage; public void setStatusMessage(String statusMessage) {
} this.statusMessage = statusMessage;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder(); public String toString() {
sb.append("Status Code: ").append(statusCode); StringBuilder sb = new StringBuilder();
sb.append(", Message: ").append(statusMessage); sb.append("Status Code: ").append(statusCode);
return sb.toString(); sb.append(", Message: ").append(statusMessage);
} return sb.toString();
} }
}
@@ -1,211 +1,207 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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 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;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
public class TmdbConfiguration implements Serializable { */
public class TmdbConfiguration implements Serializable {
private static final long serialVersionUID = 1L;
/* private static final long serialVersionUID = 1L;
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(TmdbConfiguration.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(TmdbConfiguration.class);
* Properties /*
*/ * Properties
@JsonProperty("base_url") */
private String baseUrl; @JsonProperty("base_url")
@JsonProperty("secure_base_url") private String baseUrl;
private String secureBaseUrl; @JsonProperty("secure_base_url")
@JsonProperty("poster_sizes") private String secureBaseUrl;
private List<String> posterSizes; @JsonProperty("poster_sizes")
@JsonProperty("backdrop_sizes") private List<String> posterSizes;
private List<String> backdropSizes; @JsonProperty("backdrop_sizes")
@JsonProperty("profile_sizes") private List<String> backdropSizes;
private List<String> profileSizes; @JsonProperty("profile_sizes")
@JsonProperty("logo_sizes") private List<String> profileSizes;
private List<String> logoSizes; @JsonProperty("logo_sizes")
private List<String> logoSizes;
// <editor-fold defaultstate="collapsed" desc="Getter methods">//GEN-BEGIN:getterMethods
public List<String> getBackdropSizes() { // <editor-fold defaultstate="collapsed" desc="Getter methods">//GEN-BEGIN:getterMethods
return backdropSizes; public List<String> getBackdropSizes() {
} return backdropSizes;
}
public String getBaseUrl() {
return baseUrl; public String getBaseUrl() {
} return baseUrl;
}
public List<String> getPosterSizes() {
return posterSizes; public List<String> getPosterSizes() {
} return posterSizes;
}
public List<String> getProfileSizes() {
return profileSizes; public List<String> getProfileSizes() {
} return profileSizes;
}
public List<String> getLogoSizes() {
return logoSizes; public List<String> getLogoSizes() {
} return logoSizes;
}
public String getSecureBaseUrl() {
return secureBaseUrl; public String getSecureBaseUrl() {
} return secureBaseUrl;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods">//GEN-BEGIN:setterMethods // </editor-fold>
public void setBackdropSizes(List<String> backdropSizes) { // <editor-fold defaultstate="collapsed" desc="Setter methods">//GEN-BEGIN:setterMethods
this.backdropSizes = backdropSizes; public void setBackdropSizes(List<String> backdropSizes) {
} this.backdropSizes = backdropSizes;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl; public void setBaseUrl(String baseUrl) {
} this.baseUrl = baseUrl;
}
public void setPosterSizes(List<String> posterSizes) {
this.posterSizes = posterSizes; public void setPosterSizes(List<String> posterSizes) {
} this.posterSizes = posterSizes;
}
public void setProfileSizes(List<String> profileSizes) {
this.profileSizes = profileSizes; public void setProfileSizes(List<String> profileSizes) {
} this.profileSizes = profileSizes;
}
public void setLogoSizes(List<String> logoSizes) {
this.logoSizes = logoSizes; public void setLogoSizes(List<String> logoSizes) {
} this.logoSizes = logoSizes;
}
public void setSecureBaseUrl(String secureBaseUrl) {
this.secureBaseUrl = secureBaseUrl; public void setSecureBaseUrl(String secureBaseUrl) {
} this.secureBaseUrl = secureBaseUrl;
// </editor-fold> }
// </editor-fold>
/**
* Copy the data from the passed object to this one /**
* * Copy the data from the passed object to this one
* @param config *
*/ * @param config
public void clone(TmdbConfiguration config) { */
backdropSizes = config.getBackdropSizes(); public void clone(TmdbConfiguration config) {
baseUrl = config.getBaseUrl(); backdropSizes = config.getBackdropSizes();
posterSizes = config.getPosterSizes(); baseUrl = config.getBaseUrl();
profileSizes = config.getProfileSizes(); posterSizes = config.getPosterSizes();
logoSizes = config.getLogoSizes(); profileSizes = config.getProfileSizes();
} logoSizes = config.getLogoSizes();
}
/**
* Check that the poster size is valid /**
* * Check that the poster size is valid
* @param posterSize *
* @return * @param posterSize
*/ */
public boolean isValidPosterSize(String posterSize) { public boolean isValidPosterSize(String posterSize) {
if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) { if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) {
return false; return false;
} }
return posterSizes.contains(posterSize); return posterSizes.contains(posterSize);
} }
/** /**
* 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()) { return false;
return false; }
} return backdropSizes.contains(backdropSize);
return backdropSizes.contains(backdropSize); }
}
/**
/** * Check that the profile size is valid
* Check that the profile size is valid *
* * @param profileSize
* @param profileSize */
* @return public boolean isValidProfileSize(String profileSize) {
*/ if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) {
public boolean isValidProfileSize(String profileSize) { return false;
if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) { }
return false; return profileSizes.contains(profileSize);
} }
return profileSizes.contains(profileSize);
} /**
* Check that the logo size is valid
/** *
* Check that the logo size is valid * @param logoSize
* */
* @param logoSize public boolean isValidLogoSize(String logoSize) {
* @return if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) {
*/ return false;
public boolean isValidLogoSize(String logoSize) { }
if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) { return logoSizes.contains(logoSize);
return false; }
}
return logoSizes.contains(logoSize); /**
} * Check to see if the size is valid for any of the images types
*
/** * @param sizeToCheck
* Check to see if the size is valid for any of the images types */
* public boolean isValidSize(String sizeToCheck) {
* @param sizeToCheck return (isValidPosterSize(sizeToCheck)
* @return || isValidBackdropSize(sizeToCheck)
*/ || isValidProfileSize(sizeToCheck)
public boolean isValidSize(String sizeToCheck) { || isValidLogoSize(sizeToCheck));
return (isValidPosterSize(sizeToCheck) }
|| isValidBackdropSize(sizeToCheck)
|| isValidProfileSize(sizeToCheck) /**
|| isValidLogoSize(sizeToCheck)); * Handle unknown properties and print a message
} *
* @param key
/** * @param value
* Handle unknown properties and print a message */
* @JsonAnySetter
* @param key public void handleUnknown(String key, Object value) {
* @param value StringBuilder sb = new StringBuilder();
*/ sb.append("Unknown property: '").append(key);
@JsonAnySetter sb.append("' value: '").append(value).append("'");
public void handleUnknown(String key, Object value) { LOG.trace(sb.toString());
StringBuilder sb = new StringBuilder(); }
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); @Override
logger.trace(sb.toString()); public String toString() {
} StringBuilder sb = new StringBuilder("[ImageConfiguration=");
sb.append("[baseUrl=").append(baseUrl);
@Override sb.append("],[posterSizes=").append(posterSizes.toString());
public String toString() { sb.append("],[backdropSizes=").append(backdropSizes.toString());
StringBuilder sb = new StringBuilder("[ImageConfiguration="); sb.append("],[profileSizes=").append(profileSizes.toString());
sb.append("[baseUrl=").append(baseUrl); sb.append("],[logoSizes=").append(logoSizes.toString());
sb.append("],[posterSizes=").append(posterSizes.toString()); sb.append(("]]"));
sb.append("],[backdropSizes=").append(backdropSizes.toString()); return sb.toString();
sb.append("],[profileSizes=").append(profileSizes.toString()); }
sb.append("],[logoSizes=").append(logoSizes.toString()); }
sb.append(("]]"));
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.
* *
@@ -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,130 +1,131 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class Translation implements Serializable { */
public class Translation implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger logger = Logger.getLogger(Translation.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(Translation.class);
* Properties /*
*/ * Properties
@JsonProperty("english_name") */
private String englishName; @JsonProperty("english_name")
@JsonProperty("iso_639_1") private String englishName;
private String isoCode; @JsonProperty("iso_639_1")
@JsonProperty("name") private String isoCode;
private String name; @JsonProperty("name")
private String name;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getEnglishName() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return englishName; public String getEnglishName() {
} return englishName;
}
public String getIsoCode() {
return isoCode; public String getIsoCode() {
} return isoCode;
}
public String getName() {
return name; public String getName() {
} return name;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setEnglishName(String englishName) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.englishName = englishName; public void setEnglishName(String englishName) {
} this.englishName = englishName;
}
public void setIsoCode(String isoCode) {
this.isoCode = isoCode; public void setIsoCode(String isoCode) {
} this.isoCode = isoCode;
}
public void setName(String name) {
this.name = name; public void setName(String name) {
} this.name = name;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
@Override
public boolean equals(Object obj) { @Override
if (obj == null) { public boolean equals(Object obj) {
return false; if (obj == null) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if (getClass() != obj.getClass()) {
} return false;
final Translation other = (Translation) obj; }
if ((this.englishName == null) ? (other.englishName != null) : !this.englishName.equals(other.englishName)) { final Translation other = (Translation) obj;
return false; if ((this.englishName == null) ? (other.englishName != null) : !this.englishName.equals(other.englishName)) {
} return false;
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) { }
return false; if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
} return false;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { }
return false; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
} return false;
return true; }
} return true;
}
@Override
public int hashCode() { @Override
int hash = 3; public int hashCode() {
hash = 29 * hash + (this.englishName != null ? this.englishName.hashCode() : 0); int hash = 3;
hash = 29 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0); hash = 29 * hash + (this.englishName != null ? this.englishName.hashCode() : 0);
hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 29 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
return hash; hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0);
} return hash;
}
@Override
public String toString() { @Override
StringBuilder sb = new StringBuilder("[Translation="); public String toString() {
sb.append("[englishName=").append(englishName); StringBuilder sb = new StringBuilder("[Translation=");
sb.append("],[isoCode=").append(isoCode); sb.append("[englishName=").append(englishName);
sb.append("],[name=").append(name); sb.append("],[isoCode=").append(isoCode);
sb.append("]]"); sb.append("],[name=").append(name);
return sb.toString(); sb.append("]]");
} 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.
* *
@@ -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,74 +1,76 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class WrapperAlternativeTitles { */
/* 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
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("titles") private int id;
private List<AlternativeTitle> titles; @JsonProperty("titles")
private List<AlternativeTitle> titles;
public int getId() {
return id; public int getId() {
} return id;
}
public List<AlternativeTitle> getTitles() {
return titles; public List<AlternativeTitle> getTitles() {
} return titles;
}
public void setId(int id) {
this.id = id; public void setId(int id) {
} this.id = id;
}
public void setTitles(List<AlternativeTitle> titles) {
this.titles = titles; public void setTitles(List<AlternativeTitle> titles) {
} this.titles = titles;
}
/**
* Handle unknown properties and print a message /**
* @param key * Handle unknown properties and print a message
* @param value *
*/ * @param key
@JsonAnySetter * @param value
public void handleUnknown(String key, Object value) { */
StringBuilder sb = new StringBuilder(); @JsonAnySetter
sb.append("Unknown property: '").append(key); public void handleUnknown(String key, Object value) {
sb.append("' value: '").append(value).append("'"); StringBuilder sb = new StringBuilder();
logger.trace(sb.toString()); sb.append("Unknown property: '").append(key);
} sb.append("' value: '").append(value).append("'");
} 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,117 +1,62 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieDb; import java.util.List;
import java.util.List; import org.slf4j.LoggerFactory;
import org.apache.log4j.Logger;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCompanyMovies extends WrapperBase {
public class WrapperCompanyMovies { /*
// Loggers * Properties
private static final Logger logger = Logger.getLogger(WrapperCompanyMovies.class); */
/*
* Properties @JsonProperty("results")
*/ private List<MovieDb> results;
@JsonProperty("id")
private int companyId; public WrapperCompanyMovies() {
@JsonProperty("page") super(LoggerFactory.getLogger(WrapperCompanyMovies.class));
private int page; }
@JsonProperty("results")
private List<MovieDb> results; public List<MovieDb> getResults() {
@JsonProperty("total_pages") return results;
private int totalPages; }
@JsonProperty("total_results")
private int totalResults; public void setResults(List<MovieDb> results) {
this.results = results;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> }
public int getCompanyId() {
return companyId; @Override
} public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=[");
public int getPage() { sb.append("[companyId=").append(getId());
return page; sb.append("],[page=").append(getPage());
} sb.append("],[pageResults=").append(getResults().size());
sb.append("],[totalPages=").append(getTotalPages());
public List<MovieDb> getResults() { sb.append("],[totalResults=").append(getTotalResults());
return results; sb.append("]]");
} return sb.toString();
}
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) {
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
public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[companyId=").append(companyId);
sb.append("],[page=").append(page);
sb.append("],[pageResults=").append(results.size());
sb.append("],[totalPages=").append(totalPages);
sb.append("],[totalResults=").append(totalResults);
sb.append("]]");
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,66 +1,67 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.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
* @author Stuart *
*/ * @author Stuart
public class WrapperGenres { */
/* 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
@JsonProperty("genres") */
private List<Genre> genres; @JsonProperty("genres")
private List<Genre> genres;
public List<Genre> getGenres() {
return genres; public List<Genre> getGenres() {
} return genres;
}
public void setGenres(List<Genre> genres) {
this.genres = genres; public void setGenres(List<Genre> genres) {
} this.genres = genres;
}
/**
* Handle unknown properties and print a message /**
* * Handle unknown properties and print a message
* @param key *
* @param value * @param key
*/ * @param value
@JsonAnySetter */
public void handleUnknown(String key, Object value) { @JsonAnySetter
StringBuilder sb = new StringBuilder(); public void handleUnknown(String key, Object value) {
sb.append("Unknown property: '").append(key); StringBuilder sb = new StringBuilder();
sb.append("' value: '").append(value).append("'"); sb.append("Unknown property: '").append(key);
logger.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
} }
}
@@ -1,99 +1,74 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Artwork;
import com.omertron.themoviedbapi.model.Artwork; import java.util.List;
import java.util.List; import org.slf4j.LoggerFactory;
import org.apache.log4j.Logger;
/**
/** *
* * @author Stuart
* @author Stuart */
*/ public class WrapperImages extends WrapperBase {
public class WrapperImages { /*
/* * Properties
* Logger */
*/
@JsonProperty("backdrops")
private static final Logger logger = Logger.getLogger(WrapperImages.class); private List<Artwork> backdrops;
/* @JsonProperty("posters")
* Properties private List<Artwork> posters;
*/ @JsonProperty("profiles")
@JsonProperty("id") private List<Artwork> profiles;
private int id;
@JsonProperty("backdrops") public WrapperImages() {
private List<Artwork> backdrops; super(LoggerFactory.getLogger(WrapperImages.class));
@JsonProperty("posters") }
private List<Artwork> posters;
@JsonProperty("profiles") //<editor-fold defaultstate="collapsed" desc="Getter methods">
private List<Artwork> profiles; public List<Artwork> getBackdrops() {
return backdrops;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> }
public int getId() {
return id; public List<Artwork> getPosters() {
} return posters;
}
public List<Artwork> getBackdrops() {
return backdrops; public List<Artwork> getProfiles() {
} return profiles;
}
public List<Artwork> getPosters() { //</editor-fold>
return posters;
} //<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdrops(List<Artwork> backdrops) {
public List<Artwork> getProfiles() { this.backdrops = backdrops;
return profiles; }
}
//</editor-fold> public void setPosters(List<Artwork> posters) {
this.posters = posters;
//<editor-fold defaultstate="collapsed" desc="Setter methods"> }
public void setId(int id) {
this.id = id; public void setProfiles(List<Artwork> profiles) {
} this.profiles = profiles;
}
public void setBackdrops(List<Artwork> backdrops) { //</editor-fold>
this.backdrops = backdrops; }
}
public void setPosters(List<Artwork> posters) {
this.posters = posters;
}
public void setProfiles(List<Artwork> profiles) {
this.profiles = profiles;
}
//</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,121 +1,62 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieDb; import java.util.List;
import java.util.List; import org.slf4j.LoggerFactory;
import org.apache.log4j.Logger;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperMovie extends WrapperBase {
public class WrapperMovie { /*
/* * Properties
* Logger */
*/
@JsonProperty("results")
private static final Logger logger = Logger.getLogger(WrapperMovie.class); private List<MovieDb> movies;
/*
* Properties public WrapperMovie() {
*/ super(LoggerFactory.getLogger(WrapperMovie.class));
@JsonProperty("page") }
private int page;
@JsonProperty("results") public List<MovieDb> getMovies() {
private List<MovieDb> movies; return movies;
@JsonProperty("total_pages") }
private int totalPages;
@JsonProperty("total_results") public void setMovies(List<MovieDb> movies) {
private int totalResults; this.movies = movies;
@JsonProperty("id") }
private int id;
@Override
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public String toString() {
public int getPage() { StringBuilder sb = new StringBuilder("[ResultList=[");
return page; sb.append("[page=").append(getPage());
} sb.append("],[pageResults=").append(getMovies().size());
sb.append("],[totalPages=").append(getTotalPages());
public List<MovieDb> getMovies() { sb.append("],[totalResults=").append(getTotalResults());
return movies; sb.append("],[id=").append(getId());
} sb.append("]]");
return sb.toString();
public int getTotalPages() { }
return totalPages; }
}
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
public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[page=").append(page);
sb.append("],[pageResults=").append(movies.size());
sb.append("],[totalPages=").append(totalPages);
sb.append("],[totalResults=").append(totalResults);
sb.append("],[id=").append(id);
sb.append("]]");
return sb.toString();
}
}
@@ -1,89 +1,91 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; 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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class WrapperMovieCasts { */
/* 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
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("cast") private int id;
private List<PersonCast> cast; @JsonProperty("cast")
@JsonProperty("crew") private List<PersonCast> cast;
private List<PersonCrew> crew; @JsonProperty("crew")
private List<PersonCrew> crew;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<PersonCast> getCast() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return cast; public List<PersonCast> getCast() {
} return cast;
}
public List<PersonCrew> getCrew() {
return crew; public List<PersonCrew> getCrew() {
} return crew;
}
public int getId() {
return id; public int getId() {
} return id;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCast(List<PersonCast> cast) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.cast = cast; public void setCast(List<PersonCast> cast) {
} this.cast = cast;
}
public void setCrew(List<PersonCrew> crew) {
this.crew = crew; public void setCrew(List<PersonCrew> crew) {
} this.crew = crew;
}
public void setId(int id) {
this.id = id; public void setId(int id) {
} this.id = id;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* @param key * Handle unknown properties and print a message
* @param value *
*/ * @param key
@JsonAnySetter * @param value
public void handleUnknown(String key, Object value) { */
StringBuilder sb = new StringBuilder(); @JsonAnySetter
sb.append("Unknown property: '").append(key); public void handleUnknown(String key, Object value) {
sb.append("' value: '").append(value).append("'"); StringBuilder sb = new StringBuilder();
logger.trace(sb.toString()); sb.append("Unknown property: '").append(key);
} sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
}
@@ -1,78 +1,80 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class WrapperMovieKeywords { */
/* 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
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("keywords") private int id;
private List<Keyword> keywords; @JsonProperty("keywords")
private List<Keyword> keywords;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return id; public int getId() {
} return id;
}
public List<Keyword> getKeywords() {
return keywords; public List<Keyword> getKeywords() {
} return keywords;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.id = id; public void setId(int id) {
} this.id = id;
}
public void setKeywords(List<Keyword> keywords) {
this.keywords = keywords; public void setKeywords(List<Keyword> keywords) {
} this.keywords = keywords;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* @param key * Handle unknown properties and print a message
* @param value *
*/ * @param key
@JsonAnySetter * @param value
public void handleUnknown(String key, Object value) { */
StringBuilder sb = new StringBuilder(); @JsonAnySetter
sb.append("Unknown property: '").append(key); public void handleUnknown(String key, Object value) {
sb.append("' value: '").append(value).append("'"); StringBuilder sb = new StringBuilder();
logger.trace(sb.toString()); 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.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,78 +1,80 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class WrapperReleaseInfo { */
/* 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
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("countries") private int id;
private List<ReleaseInfo> countries; @JsonProperty("countries")
private List<ReleaseInfo> countries;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<ReleaseInfo> getCountries() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return countries; public List<ReleaseInfo> getCountries() {
} return countries;
}
public int getId() {
return id; public int getId() {
} return id;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCountries(List<ReleaseInfo> countries) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.countries = countries; public void setCountries(List<ReleaseInfo> countries) {
} this.countries = countries;
}
public void setId(int id) {
this.id = id; public void setId(int id) {
} this.id = id;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* @param key * Handle unknown properties and print a message
* @param value *
*/ * @param key
@JsonAnySetter * @param value
public void handleUnknown(String key, Object value) { */
StringBuilder sb = new StringBuilder(); @JsonAnySetter
sb.append("Unknown property: '").append(key); public void handleUnknown(String key, Object value) {
sb.append("' value: '").append(value).append("'"); StringBuilder sb = new StringBuilder();
logger.trace(sb.toString()); sb.append("Unknown property: '").append(key);
} sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
}
@@ -1,88 +1,90 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.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;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class WrapperTrailers { */
/* 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
@JsonProperty("id") */
private int id; @JsonProperty("id")
@JsonProperty("quicktime") private int id;
private List<Trailer> quicktime; @JsonProperty("quicktime")
@JsonProperty("youtube") private List<Trailer> quicktime;
private List<Trailer> youtube; @JsonProperty("youtube")
private List<Trailer> youtube;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() { //<editor-fold defaultstate="collapsed" desc="Getter methods">
return id; public int getId() {
} return id;
}
public List<Trailer> getQuicktime() {
return quicktime; public List<Trailer> getQuicktime() {
} return quicktime;
}
public List<Trailer> getYoutube() {
return youtube; public List<Trailer> getYoutube() {
} return youtube;
//</editor-fold> }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) { //<editor-fold defaultstate="collapsed" desc="Setter methods">
this.id = id; public void setId(int id) {
} this.id = id;
}
public void setQuicktime(List<Trailer> quicktime) {
this.quicktime = quicktime; public void setQuicktime(List<Trailer> quicktime) {
} this.quicktime = quicktime;
}
public void setYoutube(List<Trailer> youtube) {
this.youtube = youtube; public void setYoutube(List<Trailer> youtube) {
} this.youtube = youtube;
//</editor-fold> }
//</editor-fold>
/**
* Handle unknown properties and print a message /**
* @param key * Handle unknown properties and print a message
* @param value *
*/ * @param key
@JsonAnySetter * @param value
public void handleUnknown(String key, Object value) { */
StringBuilder sb = new StringBuilder(); @JsonAnySetter
sb.append("Unknown property: '").append(key); public void handleUnknown(String key, Object value) {
sb.append("' value: '").append(value).append("'"); StringBuilder sb = new StringBuilder();
logger.trace(sb.toString()); sb.append("Unknown property: '").append(key);
} sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
}
}
@@ -1,75 +1,80 @@
/* /*
* 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.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.omertron.themoviedbapi.model.Translation; import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List; import com.omertron.themoviedbapi.model.Translation;
import org.apache.log4j.Logger; import java.util.List;
import org.slf4j.Logger;
/** import org.slf4j.LoggerFactory;
*
* @author Stuart /**
*/ *
public class WrapperTranslations { * @author Stuart
/* */
* Logger public class WrapperTranslations {
*/ /*
* Logger
private static final Logger logger = Logger.getLogger(WrapperTranslations.class); */
/*
* Properties private static final Logger LOG = LoggerFactory.getLogger(WrapperTranslations.class);
*/ /*
private int id; * Properties
private List<Translation> translations; */
@JsonProperty("id")
//<editor-fold defaultstate="collapsed" desc="Setter methods"> private int id;
public void setId(int id) { @JsonProperty("translations")
this.id = id; private List<Translation> translations;
}
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setTranslations(List<Translation> translations) { public void setId(int id) {
this.translations = translations; this.id = id;
} }
//</editor-fold>
public void setTranslations(List<Translation> translations) {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> this.translations = translations;
public int getId() { }
return id; //</editor-fold>
}
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<Translation> getTranslations() { public int getId() {
return translations; return id;
} }
//</editor-fold>
public List<Translation> getTranslations() {
/** return translations;
* Handle unknown properties and print a message }
* @param key //</editor-fold>
* @param value
*/ /**
@JsonAnySetter * Handle unknown properties and print a message
public void handleUnknown(String key, Object value) { *
StringBuilder sb = new StringBuilder(); * @param key
sb.append("Unknown property: '").append(key); * @param value
sb.append("' value: '").append(value).append("'"); */
logger.trace(sb.toString()); @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());
}
}
-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());
} }
} }