104 Commits

Author SHA1 Message Date
Omertron 67b4efe77c [maven-release-plugin] prepare release themoviedbapi-3.9 2013-12-22 17:28:15 +01:00
Omertron 917c3bb029 Rollback partial release 2013-12-22 17:26:52 +01:00
Omertron 68cbc9b54b [maven-release-plugin] prepare release themoviedbapi-3.9 2013-12-22 16:29:04 +01:00
Stuart Boston e2f1008d01 Updated POM 2013-12-15 08:23:40 +00:00
Stuart Boston 51b202df2d Fix issue #14
Correct URL for collections
2013-12-14 19:07:37 +00:00
stuart.boston d84582d336 Update error message 2013-12-03 14:25:41 +00:00
Stuart Boston 121838598d Change port to integer 2013-11-27 10:46:17 +00:00
Stuart Boston cd09cf8dfe Add PersonCredit comparator 2013-11-24 17:44:07 +00:00
Stuart Boston 3a53039b3e Updated Results to get the size of the results when not populated by the wrapper 2013-11-22 14:38:50 +00:00
Stuart Boston f7b37a1eb9 Update dependency versions 2013-11-17 19:47:05 +00:00
Stuart Boston 52c19f98d4 Remove inline comments 2013-11-17 19:46:45 +00:00
Omertron 796459b816 [maven-release-plugin] prepare for next development iteration 2013-11-07 11:06:04 +01:00
Omertron eaf5849a43 [maven-release-plugin] prepare release themoviedbapi-3.8 2013-11-07 11:05:57 +01:00
Stuart Boston 231f60624b Tidy up log error messages 2013-11-07 09:52:21 +00:00
Stuart Boston 3b1855d75c Remove unused imports 2013-11-07 09:50:06 +00:00
Stuart Boston 0cfa4d0dd4 Update README.md 2013-11-07 08:44:29 +00:00
Stuart Boston 971ee44375 Remove unused comments 2013-11-01 12:47:52 +00:00
Stuart Boston 359a0d56a3 Added "type" to Trailer 2013-11-01 12:29:55 +00:00
Stuart Boston 8eea8c796a Update handlerUnknown code
Output the class that caused the unknown issue
2013-11-01 12:28:53 +00:00
Stuart Boston 82e9c5b06f Trim test logging message 2013-11-01 12:26:15 +00:00
Stuart Boston 57691ed17f Remove unused imports 2013-10-29 15:56:00 +00:00
Stuart Boston b705a85566 Add badges 2013-10-22 16:04:43 +01:00
Stuart Boston db4f3e6f80 Minor updates 2013-10-22 13:44:42 +01:00
Stuart Boston 9eed62c8d7 Updated javadoc 2013-10-22 12:03:25 +01:00
Stuart Boston 51e5166233 Throw MovieDbException if movie ID not found
Rather than pass a seemingly valid object back to the caller, this
change will throw a "MOVIE_ID_NOT_FOUND" exception to the caller.
Affects getMovieInfo and getMovieInfoImdb methods
Fixes #8
2013-10-02 09:15:50 +01:00
Stuart Boston dd5176d6c6 Add gitattributes file
Update line endings
2013-10-01 14:10:54 +01:00
Stuart Boston 6448542fb4 Merge pull request #7 from fcojean/master
Implemented MovieChangesList
2013-09-26 11:37:19 +01:00
Stuart Boston 1ac805bed3 Add missing Serializable 2013-09-25 09:58:24 +01:00
Stuart Boston 2ef41457d0 Change logging for abstract wrapper 2013-09-25 09:48:47 +01:00
Stuart Boston d3338cc106 Remove unused imports 2013-09-25 09:38:30 +01:00
Stuart Boston 2c5569d53d Add language and country to account information 2013-09-25 09:33:44 +01:00
Stuart Boston 546a1e0d93 Update README.md 2013-09-20 10:43:35 +01:00
Stuart Boston 3b503e78ef Add exceptions for unknown request types 2013-09-08 11:10:21 +01:00
Stuart Boston 4cb0314c56 Use pooling client for requests 2013-09-08 10:36:54 +01:00
Omertron 95b3a4dd36 [maven-release-plugin] prepare for next development iteration 2013-08-23 10:22:03 +02:00
Omertron 8068b9ac45 [maven-release-plugin] prepare release themoviedbapi-3.7 2013-08-23 10:21:30 +02:00
Omertron a25da9aa2f Reset version 2013-08-23 10:18:48 +02:00
Omertron 7a30ab831c Updated POM versions 2013-08-23 10:13:04 +02:00
Stuart Boston f64786e506 Update tests 2013-08-22 21:32:35 +01:00
Stuart Boston a57e7eeb37 Add toString methods 2013-08-22 21:32:26 +01:00
Stuart Boston 00bdfaf6a7 Add missing properties to MovieDbList
Tidy up other code
2013-08-22 13:13:25 +01:00
Stuart Boston 064117e66d Remove unused imports 2013-08-20 21:22:32 +01:00
Stuart Boston a520c75773 Remove duplicate literals 2013-08-20 21:12:26 +01:00
Stuart Boston 259eb81f32 Remove unused fields 2013-08-20 21:12:11 +01:00
Stuart Boston 8bfe7dcc1b WebBrowser: Throw MovieDbException 2013-08-20 21:11:34 +01:00
Stuart Boston ac57816b1d Merge pull request #6 from holgerbrandl/master
"List" and "Account" implemenation
2013-08-20 20:47:24 +01:00
Stuart Boston 073331cddb Close output stream 2013-08-20 13:18:06 +01:00
Stuart Boston 0ef278e19d Merge branch 'master' of https://github.com/Omertron/api-themoviedb 2013-08-20 09:01:28 +01:00
Stuart Boston d6e02bf1df Merge pull request #5 from holgerbrandl/master
implemented method to post movie ratings
2013-08-20 00:51:52 -07:00
holger fbdf744dc6 implemented method to post movie ratings 2013-08-19 14:28:28 +02:00
Stuart Boston 8478865141 Change ToString style to "short prefix" 2013-07-25 12:52:24 +01:00
Stuart Boston a98eac75dc Add dates to the wrapper where needed 2013-07-24 17:06:30 +01:00
Stuart Boston 9a237042f0 Change ToString style to "Simple" 2013-07-24 16:47:50 +01:00
Stuart Boston bb57c16fe8 Trim the string values for person to remove extra spaces 2013-07-22 13:43:54 +01:00
Stuart Boston 72186feaf9 Fixes issue #4 Company parent correctly de-serialised now 2013-07-15 09:16:16 +01:00
Stuart Boston 20349013cc Updated API-Common version 2013-06-26 16:31:47 +01:00
Stuart Boston c8e33abd59 Merge branch 'master' of https://github.com/Omertron/api-themoviedb 2013-06-26 16:30:42 +01:00
Stuart Boston 940b6a007f Revert "Updated API-Common version"
This reverts commit 822ac2a5d2.
2013-06-26 16:29:46 +01:00
Stuart Boston 822ac2a5d2 Updated API-Common version 2013-06-26 16:24:24 +01:00
Omertron f2593b2754 [maven-release-plugin] prepare for next development iteration 2013-06-26 14:31:33 +02:00
Omertron 24f7b507b9 [maven-release-plugin] prepare release themoviedbapi-3.6 2013-06-26 14:31:25 +02:00
Stuart Boston d298faec9a Removed getMovieChanges test 2013-06-26 13:29:24 +01:00
Stuart Boston 486486b753 Removed unused imports 2013-06-26 13:02:23 +01:00
Stuart Boston 159fe23efb Updated POM versions 2013-06-13 21:48:34 +01:00
Stuart Boston fc1e05d0b4 Added HTTP 503 error and message 2013-06-13 07:30:18 +01:00
Stuart Boston dc6f5f07b1 Standardised toString methods 2013-06-09 22:26:16 +01:00
Stuart Boston 4243b5aa81 Catch RuntimeException when 503 error 2013-06-09 18:23:41 +01:00
Stuart Boston 1070abcabc Update README.md 2013-06-04 10:38:46 +02:00
Stuart Boston 9cca4660bc Add adult and popularity to KeywordMovie 2013-06-03 12:13:46 +01:00
Stuart Boston 5f27260f57 Updated api-common dependency 2013-05-31 09:59:05 +01:00
Stuart Boston bec9b24129 Reverted to "com.moviejukebox" for groupId 2013-05-28 20:18:39 +01:00
Stuart Boston 8679b03930 Updated to use API-Common component for HTTPClient functionality 2013-05-28 14:27:00 +01:00
Stuart Boston 845aedf871 Added MovieChange method 2013-05-20 13:05:19 +01:00
Stuart Boston d6adc40215 Fix correct logging class for JobDepartment 2013-05-20 13:03:55 +01:00
Stuart Boston 17815b9ffc Fixed some issues 2013-05-20 10:36:01 +01:00
Stuart Boston 60cb490eca Add appendToResponse to person methods 2013-05-19 18:42:26 +01:00
Stuart Boston f08c78c921 Corrected resultsMap
Removed unused imports
2013-05-19 08:24:24 +01:00
Stuart Boston 0414369327 Removed unused imports and dead variables 2013-05-18 22:22:51 +01:00
Stuart Boston 44ba85aaa8 Changed return values to include page values 2013-05-18 22:08:40 +01:00
Stuart Boston 009e725cb6 Added new classes to return the results 2013-05-18 11:23:44 +01:00
Stuart Boston edf4518f35 Refactored Wrapper classes 2013-05-17 22:15:52 +01:00
Omertron c6248b621e [maven-release-plugin] prepare for next development iteration 2013-05-15 20:34:38 +02:00
Omertron 7900b6d25b [maven-release-plugin] prepare release themoviedbapi-3.5 2013-05-15 20:34:15 +02:00
Omertron 4747c42fc6 Updated POM versions 2013-05-15 20:31:44 +02:00
Stuart Boston 1a96343924 Updated Test class 2013-05-15 18:15:12 +01:00
Stuart Boston 76191c13c0 Add overview to CollectionInfo 2013-05-15 18:14:54 +01:00
Stuart Boston ce533c2b41 removed unused log messages in test class 2013-05-15 18:06:54 +01:00
Stuart Boston de623ff0db Add discover method 2013-05-15 16:24:57 +01:00
Stuart Boston 6745f5f3d5 Fix issue with WrapperImages not having initialised collections 2013-05-15 14:16:15 +01:00
Stuart Boston 955ef0369e Add Job List 2013-05-15 14:09:57 +01:00
Stuart Boston 4c682731b6 Add PopularPerson method 2013-05-15 13:46:59 +01:00
Stuart Boston c99f60f636 Un"ignored" the tests 2013-05-15 13:22:06 +01:00
Stuart Boston 265878d016 Added AppendToResponse for MovieDb (MovieInfo methods) 2013-05-15 13:19:02 +01:00
Stuart Boston 9bf7175ee8 Add "getAll" method to Images and Trailers 2013-05-15 13:18:14 +01:00
Stuart Boston 00063cc85d Add reviews 2013-05-15 13:16:44 +01:00
Stuart Boston 2f7468914c Allow AppendToReponse to contain multiple elements 2013-05-15 11:51:20 +01:00
Stuart Boston 4d9d53421f Add placeholder "append_to_response" parameters 2013-05-14 16:20:27 +01:00
Stuart Boston 9f135c3ca7 Removed reliance on MovieDb object from ApiBuilder 2013-05-14 16:01:25 +01:00
Stuart Boston 7d9552a08c Updated bin.xml to add correct README 2013-04-19 10:03:42 +01:00
Stuart Boston 3acf07b36a Non-functional changes to POM and bin.xml 2013-04-19 09:35:09 +01:00
Stuart Boston f501126b76 Reverted build version to 1.6 2013-04-03 15:05:45 +01:00
Stuart Boston 8ab8699dd5 updated version.txt 2013-03-25 22:08:40 +00:00
Stuart Boston 6c4ba2a492 Updated version.txt 2013-03-25 21:49:50 +00:00
Stuart Boston 44df73f2d1 Updated POM versions and build number 2013-03-25 20:57:44 +00:00
91 changed files with 10801 additions and 9352 deletions
+22
View File
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
+9 -8
View File
@@ -1,8 +1,9 @@
*.class *.class
# Package Files # # Package Files #
*.jar *.jar
*.war *.war
*.ear *.ear
/target/ /target/
/nbactions.xml
+12 -12
View File
@@ -1,12 +1,12 @@
package com.darylbeattie.movies.util; package com.darylbeattie.movies.util;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@Target(value=ElementType.METHOD) @Target(value=ElementType.METHOD)
@Retention(value=RetentionPolicy.RUNTIME) @Retention(value=RetentionPolicy.RUNTIME)
public @interface JsonAnySetter { public @interface JsonAnySetter {
} }
+12 -12
View File
@@ -1,12 +1,12 @@
package com.darylbeattie.movies.util; package com.darylbeattie.movies.util;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface JsonProperty { public @interface JsonProperty {
String value() default ""; String value() default "";
} }
+12 -12
View File
@@ -1,12 +1,12 @@
package com.darylbeattie.movies.util; package com.darylbeattie.movies.util;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface JsonRootName { public @interface JsonRootName {
String value() default ""; String value() default "";
} }
+68 -68
View File
@@ -1,69 +1,69 @@
package com.darylbeattie.movies.util; package com.darylbeattie.movies.util;
import java.io.IOException; import java.io.IOException;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.util.List; import java.util.List;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
public class ObjectMapper { public class ObjectMapper {
/** /**
* This takes a JSON string and creates (and populates) an object of the given class * 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 * 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. * JSON API, so that we don't have to import the jackson library into this application.
* *
* @param jsonString The JSON string to parse. * @param jsonString The JSON string to parse.
* @param objClass The class of object we want to create. * @param objClass The class of object we want to create.
* @return The instantiation of that class, populated with data from the JSON object. * @return The instantiation of that class, populated with data from the JSON object.
* @throws IOException If there was any kind of issue. * @throws IOException If there was any kind of issue.
*/ */
public <T> T readValue(String jsonString, Class<T> objClass) throws IOException { public <T> T readValue(String jsonString, Class<T> objClass) throws IOException {
try { try {
return readValue(new JSONObject(jsonString), objClass); return readValue(new JSONObject(jsonString), objClass);
} }
catch (IOException ioe) { catch (IOException ioe) {
throw ioe; throw ioe;
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new IOException(e); throw new IOException(e);
} }
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T, R> T readValue(JSONObject json, Class<T> objClass) throws IOException { public <T, R> T readValue(JSONObject json, Class<T> objClass) throws IOException {
try { try {
//TODO Iterate through json object values and call the JsonAnySetter method on the unknown ones. //TODO Iterate through json object values and call the JsonAnySetter method on the unknown ones.
T obj = objClass.newInstance(); T obj = objClass.newInstance();
for (Field f : objClass.getFields()) { for (Field f : objClass.getFields()) {
Annotation a = f.getAnnotation(JsonProperty.class); Annotation a = f.getAnnotation(JsonProperty.class);
if (List.class.equals(f.getType()) && (json.optJSONArray(((JsonProperty) a).value()) != null)) { // It's a list. if (List.class.equals(f.getType()) && (json.optJSONArray(((JsonProperty) a).value()) != null)) { // It's a list.
JSONArray jsonArray = json.optJSONArray(((JsonProperty) a).value()); JSONArray jsonArray = json.optJSONArray(((JsonProperty) a).value());
ParameterizedType listType = (ParameterizedType) f.getGenericType(); ParameterizedType listType = (ParameterizedType) f.getGenericType();
Class<?> subObj = (Class<?>) listType.getActualTypeArguments()[0]; Class<?> subObj = (Class<?>) listType.getActualTypeArguments()[0];
List<R> subObjList = ((Class<List<R>>) f.getType()).newInstance(); List<R> subObjList = ((Class<List<R>>) f.getType()).newInstance();
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
subObjList.add((R) readValue(jsonArray.getJSONObject(i), subObj)); subObjList.add((R) readValue(jsonArray.getJSONObject(i), subObj));
} }
f.set(obj, subObjList); f.set(obj, subObjList);
} }
else if (a != null) { else if (a != null) {
f.set(obj, json.opt(((JsonProperty) a).value())); f.set(obj, json.opt(((JsonProperty) a).value()));
} }
} }
return obj; return obj;
} }
catch (IOException ioe) { catch (IOException ioe) {
throw ioe; throw ioe;
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new IOException(e); throw new IOException(e);
} }
} }
} }
+6 -6
View File
@@ -1,6 +1,6 @@
Jackson Library Replacement 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. 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. They are provided without warrantee and if you modify them or find them useful, please let me know.
+648 -648
View File
File diff suppressed because it is too large Load Diff
+29 -6
View File
@@ -3,17 +3,40 @@ The Movie DB API
Author: Stuart Boston (Omertron AT Gmail DOT com) Author: Stuart Boston (Omertron AT Gmail DOT com)
This API uses the TheMovieDB.org API as specified here http://api.themoviedb.org/ This API uses the [TheMovieDB.org API](http://api.themoviedb.org/)
Originally written for use by YetAnotherMovieJukebox (YAMJ) http://code.google.com/p/moviejukebox/ Originally written for use by Yet Another Movie Jukebox [(YAMJ)](http://code.google.com/p/moviejukebox/)
But anyone can feel free to use it for other projects as well.
TheMovieDB.org is an excellent open database for movie and film content. I encourage you to check it out and contribute to keep it growing. But anyone can use it for other projects as well.
http://www.themoviedb.org
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=Omertron&url=https://github.com/Omertron/api-themoviedb&title=TheMovieDB API&language=&tags=github&category=software)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/Omertron/api-themoviedb/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
***
TMDB TV Support
===============
TheMovieDb has recently added TV shows to their site.
I am working on an update to this API to support that, but it will require a re-write of the API to support the new models and ensure that it is simple to understand.
Therefore TV support will be added to *v4.0* of the API, major version change because of the large change to the API. I will release a stable version of 3.9 in the next week before releaseing 4.0 SNAPSHOT.
If you are interested in the current level of TV support checkout the `tv` branch where all the changes are being done.
***
### TheMovieDB.org
This is an excellent open database for movie and film content.
I *strongly* encourage you to check it out and contribute to keep it growing.
### http://www.themoviedb.org
***
Project Logging Project Logging
--------------- ---------------
This project uses SLF4J (http://www.slf4j.org) to abstract the logging in the project. This project uses [SLF4J](http://www.slf4j.org) to abstract the logging in the project.
To use the logging in your own project you should add one of the bindings listed [HERE](http://www.slf4j.org/manual.html#swapping) To use the logging in your own project you should add one of the bindings listed [HERE](http://www.slf4j.org/manual.html#swapping)
Project Documentation Project Documentation
+46 -30
View File
@@ -13,7 +13,7 @@
<groupId>com.omertron</groupId> <groupId>com.omertron</groupId>
<artifactId>themoviedbapi</artifactId> <artifactId>themoviedbapi</artifactId>
<version>3.5-SNAPSHOT</version> <version>3.9</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>API-The MovieDB</name> <name>API-The MovieDB</name>
@@ -62,7 +62,7 @@
</issueManagement> </issueManagement>
<ciManagement> <ciManagement>
<system>Hudson CI</system> <system>Jenkins CI</system>
<url>http://jenkins.omertron.com/job/API-TheMovieDb/</url> <url>http://jenkins.omertron.com/job/API-TheMovieDb/</url>
</ciManagement> </ciManagement>
@@ -71,64 +71,67 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<distribution.format>zip</distribution.format> <distribution.format>zip</distribution.format>
<version.jackson>2.3.0</version.jackson>
<version.slf4j>1.7.5</version.slf4j>
</properties> </properties>
<dependencies> <dependencies>
<!--TESTING-->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.11</version> <version>4.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!--JSON-->
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId> <artifactId>jackson-core</artifactId>
<version>2.1.4</version> <version>${version.jackson}</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.4</version> <version>${version.jackson}</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.4</version> <version>${version.jackson}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency> </dependency>
<!--LOGGING-->
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.3</version> <version>${version.slf4j}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId> <artifactId>slf4j-jdk14</artifactId>
<version>1.7.3</version> <version>${version.slf4j}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!--COMMON HTTP TOOLS-->
<dependency>
<groupId>org.yamj</groupId>
<artifactId>api-common</artifactId>
<version>1.1</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName> <finalName>${project.artifactId}-${project.version}-${buildNumber}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId> <artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version> <version>1.2</version>
<configuration> <configuration>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce> <shortRevisionLength>10</shortRevisionLength>
<revisionOnScmFailure>0000</revisionOnScmFailure> <doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat> <timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
</configuration> </configuration>
<executions> <executions>
@@ -140,10 +143,11 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version> <version>3.1</version>
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
@@ -152,6 +156,7 @@
<!-- excludes><exclude>**/*</exclude></excludes --> <!-- excludes><exclude>**/*</exclude></excludes -->
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
@@ -167,15 +172,17 @@
</archive> </archive>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version> <version>2.16</version>
<configuration> <configuration>
<!-- To skip tests by default --> <!-- To skip tests by default -->
<skipTests>${skipTests}</skipTests> <skipTests>${skipTests}</skipTests>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
@@ -190,12 +197,12 @@
<property name="header_line" value="The MovieDb API${line.separator}" /> <property name="header_line" value="The MovieDb API${line.separator}" />
<property name="build_date_line" value="Build Date: ${timestamp}${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="version_line" value="Version: ${project.version}${line.separator}" />
<!--<property name="revision_line" value="Revision: r${buildNumber}${line.separator}" />--> <property name="buildnumber_line" value="Git-SHA: ${buildNumber}${line.separator}" />
<echo>Writing version file: ${version_file}</echo> <echo>Writing version file: ${version_file}</echo>
<echo file="${version_file}" append="false">${header_line}</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">${build_date_line}</echo>
<echo file="${version_file}" append="true">${version_line}</echo> <echo file="${version_file}" append="true">${version_line}</echo>
<!--<echo file="${version_file}" append="true">${revision_line}</echo>--> <echo file="${version_file}" append="true">${buildnumber_line}</echo>
</target> </target>
</configuration> </configuration>
<goals> <goals>
@@ -204,6 +211,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
@@ -223,15 +231,17 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId> <artifactId>versions-maven-plugin</artifactId>
<version>2.0</version> <version>2.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
<version>3.2</version> <version>3.3</version>
<configuration> <configuration>
<reportPlugins> <reportPlugins>
<plugin> <plugin>
@@ -259,43 +269,49 @@
</reportPlugins> </reportPlugins>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId> <artifactId>maven-clean-plugin</artifactId>
<version>2.5</version> <version>2.5</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version> <version>2.8.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version> <version>1.4</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId> <artifactId>maven-install-plugin</artifactId>
<version>2.4</version> <version>2.5.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>2.6</version> <version>2.6</version>
</plugin> </plugin>
</plugins> </plugins>
<extensions> <extensions>
<extension> <extension>
<groupId>org.apache.maven.scm</groupId> <groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId> <artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.4</version> <version>1.8.1</version>
</extension> </extension>
<extension> <extension>
<groupId>org.apache.maven.scm</groupId> <groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId> <artifactId>maven-scm-manager-plexus</artifactId>
<version>1.4</version> <version>1.8.1</version>
</extension> </extension>
<extension> <extension>
<groupId>org.kathrynhuxtable.maven.wagon</groupId> <groupId>org.kathrynhuxtable.maven.wagon</groupId>
@@ -1,83 +1,87 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi; package com.omertron.themoviedbapi;
public class MovieDbException extends Exception { public class MovieDbException extends Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum MovieDbExceptionType { public enum MovieDbExceptionType {
/* /*
* Unknown error occured * Unknown error occured
*/ */
UNKNOWN_CAUSE, UNKNOWN_CAUSE,
/* /*
* URL is invalid * URL is invalid
*/ */
INVALID_URL, INVALID_URL,
/* /*
* Page not found * Page not found
*/ */
HTTP_404_ERROR, HTTP_404_ERROR,
/* /*
* The movie id was not found * The movie id was not found
*/ */
MOVIE_ID_NOT_FOUND, MOVIE_ID_NOT_FOUND,
/* /*
* Mapping failed from target to internal onbjects * Mapping failed from target to internal onbjects
*/ */
MAPPING_FAILED, MAPPING_FAILED,
/* /*
* Error connecting to the service * Error connecting to the service
*/ */
CONNECTION_ERROR, CONNECTION_ERROR,
/* /*
* Image was invalid * Image was invalid
*/ */
INVALID_IMAGE, INVALID_IMAGE,
/* /*
* Autorisation rejected * Autorisation rejected
*/ */
AUTHORISATION_FAILURE; AUTHORISATION_FAILURE,
} /*
* Service Unavailable, usually temporary
private final MovieDbExceptionType exceptionType; */
private final String response; HTTP_503_ERROR;
}
public MovieDbException(final MovieDbExceptionType exceptionType, final String response) {
super(); private final MovieDbExceptionType exceptionType;
this.exceptionType = exceptionType; private final String response;
this.response = response;
} public MovieDbException(final MovieDbExceptionType exceptionType, final String response) {
super();
public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final Throwable cause) { this.exceptionType = exceptionType;
super(cause); this.response = response;
this.exceptionType = exceptionType; }
this.response = response;
} public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final Throwable cause) {
super(cause);
public MovieDbExceptionType getExceptionType() { this.exceptionType = exceptionType;
return exceptionType; this.response = response;
} }
public String getResponse() { public MovieDbExceptionType getExceptionType() {
return response; return exceptionType;
} }
}
public String getResponse() {
return response;
}
}
File diff suppressed because it is too large Load Diff
@@ -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;private either version 3 of the License;private or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful;private
* 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;private see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
/**
* Abstract class to handle any unknown properties by outputting a log message
*
* @author stuart.boston
*/
public abstract class AbstractJsonMapping implements Serializable {
private Logger log = null;
/**
* Return the current logger.
*
* @return
*/
private Logger getLogger() {
if (log == null) {
log = LoggerFactory.getLogger(this.getClass());
}
return log;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
protected void handleUnknown(String key, Object value) {
StringBuilder unknown = new StringBuilder(this.getClass().getSimpleName());
unknown.append(": Unknown property='").append(key);
unknown.append("' value='").append(value).append("'");
getLogger().trace(unknown.toString());
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
@@ -0,0 +1,86 @@
/*
* 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;private either version 3 of the License;private or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful;private
* 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;private see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Account extends AbstractJsonMapping {
@JsonProperty("id")
private int id;
@JsonProperty("name")
private String name;
@JsonProperty("username")
private String userName;
@JsonProperty("include_adult")
private boolean includeAdult;
@JsonProperty("iso_639_1")
private String language;
@JsonProperty("iso_3166_1")
private String country;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isIncludeAdult() {
return includeAdult;
}
public void setIncludeAdult(boolean includeAdult) {
this.includeAdult = includeAdult;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
}
@@ -1,116 +1,86 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
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.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
* @author Stuart
/** */
* public class AlternativeTitle implements Serializable {
* @author Stuart
*/ private static final long serialVersionUID = 1L;
public class AlternativeTitle implements Serializable {
/*
private static final long serialVersionUID = 1L; * Properties
*/
/* @JsonProperty("iso_3166_1")
* Logger private String country;
*/ @JsonProperty("title")
private static final Logger LOG = LoggerFactory.getLogger(AlternativeTitle.class); private String title;
/*
* Properties // <editor-fold defaultstate="collapsed" desc="Getter methods">
*/ public String getCountry() {
@JsonProperty("iso_3166_1") return country;
private String country; }
@JsonProperty("title")
private String title; public String getTitle() {
return title;
// <editor-fold defaultstate="collapsed" desc="Getter methods"> }
public String getCountry() { // </editor-fold>
return country;
} // <editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCountry(String country) {
public String getTitle() { this.country = country;
return title; }
}
// </editor-fold> public void setTitle(String title) {
this.title = title;
// <editor-fold defaultstate="collapsed" desc="Setter methods"> }
public void setCountry(String country) { // </editor-fold>
this.country = country;
} @Override
public boolean equals(Object obj) {
public void setTitle(String title) { if (obj == null) {
this.title = title; return false;
} }
// </editor-fold> if (getClass() != obj.getClass()) {
return false;
/** }
* Handle unknown properties and print a message final AlternativeTitle other = (AlternativeTitle) obj;
* if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
* @param key return false;
* @param value }
*/ if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
@JsonAnySetter return false;
public void handleUnknown(String key, Object value) { }
StringBuilder sb = new StringBuilder(); return true;
sb.append("Unknown property: '").append(key); }
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString()); @Override
} public int hashCode() {
int hash = 7;
@Override hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
public boolean equals(Object obj) { hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0);
if (obj == null) { return hash;
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)) {
return false;
}
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[AlternativeTitle=");
sb.append("[country=").append(country);
sb.append("],[title=").append(title);
sb.append("]]");
return sb.toString();
}
}
@@ -1,208 +1,164 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; /**
import org.slf4j.Logger; * The artwork type information
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* The artwork type information public class Artwork extends AbstractJsonMapping {
*
* @author Stuart private static final long serialVersionUID = 1L;
*/
public class Artwork implements Serializable { @JsonProperty("aspect_ratio")
private float aspectRatio;
private static final long serialVersionUID = 1L; @JsonProperty("file_path")
private String filePath;
/* @JsonProperty("height")
* Logger private int height;
*/ @JsonProperty("iso_639_1")
private static final Logger LOG = LoggerFactory.getLogger(Artwork.class); private String language;
/* @JsonProperty("width")
* Properties private int width;
*/ @JsonProperty("vote_average")
@JsonProperty("aspect_ratio") private float voteAverage;
private float aspectRatio; @JsonProperty("vote_count")
@JsonProperty("file_path") private int voteCount;
private String filePath; @JsonProperty("flag")
@JsonProperty("height") private String flag;
private int height; private ArtworkType artworkType = ArtworkType.POSTER;
@JsonProperty("iso_639_1")
private String language; public ArtworkType getArtworkType() {
@JsonProperty("width") return artworkType;
private int width; }
@JsonProperty("vote_average")
private float voteAverage; public float getAspectRatio() {
@JsonProperty("vote_count") return aspectRatio;
private int voteCount; }
@JsonProperty("flag")
private String flag; public String getFilePath() {
private ArtworkType artworkType = ArtworkType.POSTER; return filePath;
}
// <editor-fold defaultstate="collapsed" desc="Getter methods">
public ArtworkType getArtworkType() { public int getHeight() {
return artworkType; return height;
} }
public float getAspectRatio() { public String getLanguage() {
return aspectRatio; return language;
} }
public String getFilePath() { public int getWidth() {
return filePath; return width;
} }
public int getHeight() { public float getVoteAverage() {
return height; return voteAverage;
} }
public String getLanguage() { public int getVoteCount() {
return language; return voteCount;
} }
public int getWidth() { public String getFlag() {
return width; return flag;
} }
public float getVoteAverage() { public void setArtworkType(ArtworkType artworkType) {
return voteAverage; this.artworkType = artworkType;
} }
public int getVoteCount() { public void setAspectRatio(float aspectRatio) {
return voteCount; this.aspectRatio = aspectRatio;
} }
public String getFlag() { public void setFilePath(String filePath) {
return flag; this.filePath = filePath;
} }
// </editor-fold> public void setHeight(int height) {
this.height = height;
// <editor-fold defaultstate="collapsed" desc="Setter methods"> }
public void setArtworkType(ArtworkType artworkType) {
this.artworkType = artworkType; public void setLanguage(String language) {
} this.language = language;
}
public void setAspectRatio(float aspectRatio) {
this.aspectRatio = aspectRatio; public void setWidth(int width) {
} this.width = width;
}
public void setFilePath(String filePath) {
this.filePath = filePath; public void setVoteAverage(float voteAverage) {
} this.voteAverage = voteAverage;
}
public void setHeight(int height) {
this.height = height; public void setVoteCount(int voteCount) {
} this.voteCount = voteCount;
}
public void setLanguage(String language) {
this.language = language; public void setFlag(String flag) {
} this.flag = flag;
}
public void setWidth(int width) {
this.width = width; @Override
} public boolean equals(Object obj) {
if (obj == null) {
public void setVoteAverage(float voteAverage) { return false;
this.voteAverage = voteAverage; }
} if (getClass() != obj.getClass()) {
return false;
public void setVoteCount(int voteCount) { }
this.voteCount = voteCount; final Artwork other = (Artwork) obj;
} if (Float.floatToIntBits(this.aspectRatio) != Float.floatToIntBits(other.aspectRatio)) {
return false;
public void setFlag(String flag) { }
this.flag = flag; if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
} return false;
}
// </editor-fold> if (this.height != other.height) {
return false;
/** }
* Handle unknown properties and print a message if ((this.language == null) ? (other.language != null) : !this.language.equals(other.language)) {
* return false;
* @param key }
* @param value if (this.width != other.width) {
*/ return false;
@JsonAnySetter }
public void handleUnknown(String key, Object value) { if (this.artworkType != other.artworkType) {
StringBuilder sb = new StringBuilder(); return false;
sb.append("Unknown property: '").append(key); }
sb.append("' value: '").append(value).append("'"); return true;
LOG.trace(sb.toString()); }
}
@Override
@Override public int hashCode() {
public boolean equals(Object obj) { int hash = 3;
if (obj == null) { hash = 71 * hash + Float.floatToIntBits(this.aspectRatio);
return false; hash = 71 * hash + (this.filePath != null ? this.filePath.hashCode() : 0);
} hash = 71 * hash + this.height;
if (getClass() != obj.getClass()) { hash = 71 * hash + (this.language != null ? this.language.hashCode() : 0);
return false; hash = 71 * hash + this.width;
} hash = 71 * hash + (this.artworkType != null ? this.artworkType.hashCode() : 0);
final Artwork other = (Artwork) obj; return hash;
if (Float.floatToIntBits(this.aspectRatio) != Float.floatToIntBits(other.aspectRatio)) { }
return false; }
}
if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
return false;
}
if (this.height != other.height) {
return false;
}
if ((this.language == null) ? (other.language != null) : !this.language.equals(other.language)) {
return false;
}
if (this.width != other.width) {
return false;
}
if (this.artworkType != other.artworkType) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
hash = 71 * hash + Float.floatToIntBits(this.aspectRatio);
hash = 71 * hash + (this.filePath != null ? this.filePath.hashCode() : 0);
hash = 71 * hash + this.height;
hash = 71 * hash + (this.language != null ? this.language.hashCode() : 0);
hash = 71 * hash + this.width;
hash = 71 * hash + (this.artworkType != null ? this.artworkType.hashCode() : 0);
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,30 +1,33 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
/** /**
* ArtworkType enum List of the artwork types that are available * ArtworkType enum List of the artwork types that are available
*/ */
public enum ArtworkType { public enum ArtworkType {
POSTER, // Poster artwork // Poster artwork
BACKDROP, // Fanart/backdrop POSTER,
PROFILE // Person image // Fanart/backdrop
} BACKDROP,
// Person image
PROFILE
}
@@ -1,122 +0,0 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ChangeItem {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("id")
private String id;
@JsonProperty("action")
private String action;
@JsonProperty("time")
private String time;
@JsonProperty("value")
private ChangeValue value;
@JsonProperty("original_value")
private ChangeValue originalValue;
@JsonProperty("iso_639_1")
private String language;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public String getId() {
return id;
}
public String getAction() {
return action;
}
public String getTime() {
return time;
}
public ChangeValue getValue() {
return value;
}
public ChangeValue getOriginalValue() {
return originalValue;
}
public String getLanguage() {
return language;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setId(String id) {
this.id = id;
}
public void setAction(String action) {
this.action = action;
}
public void setTime(String time) {
this.time = time;
}
public void setValue(ChangeValue value) {
this.value = value;
}
public void setOriginalValue(ChangeValue originalValue) {
this.originalValue = originalValue;
}
public void setLanguage(String language) {
this.language = language;
}
//</editor-fold>
@Override
public String toString() {
return "ChangeItem{" + "id=" + id + ", action=" + action + ", time=" + time + ", value=" + value + '}';
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -0,0 +1,46 @@
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ChangeKeyItem {
private static final long serialVersionUID = 1L;
@JsonProperty("key")
private String key;
@JsonProperty("items")
private List<ChangedItem> changedItems = new ArrayList<ChangedItem>();
private final Map<String, Object> newItems = new HashMap<String, Object>();
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public List<ChangedItem> getChangedItems() {
return changedItems;
}
public void setChangedItems(List<ChangedItem> changes) {
this.changedItems = changes;
}
@JsonAnyGetter
public Map<String, Object> getNewItems() {
return this.newItems;
}
@JsonAnySetter
public void setNewItems(String name, Object value) {
this.newItems.put(name, value);
}
}
@@ -1,128 +0,0 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ChangeValue {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("poster")
private Artwork poster;
@JsonProperty("backdrop")
private Artwork backdrop;
@JsonProperty("title")
private String title;
@JsonProperty("iso_3166_1")
private String language;
@JsonProperty("site")
private String site;
@JsonProperty("name")
private String name;
@JsonProperty("id")
private int id;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public Artwork getPoster() {
return poster;
}
public Artwork getBackdrop() {
return backdrop;
}
public String getTitle() {
return title;
}
public String getLanguage() {
return language;
}
public String getSite() {
return site;
}
public String getName() {
return name;
}
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setPoster(Artwork poster) {
this.poster = poster;
}
public void setBackdrop(Artwork backdrop) {
this.backdrop = backdrop;
backdrop.setArtworkType(ArtworkType.BACKDROP);
}
public void setTitle(String title) {
this.title = title;
}
public void setLanguage(String language) {
this.language = language;
}
public void setSite(String site) {
this.site = site;
}
public void setName(String name) {
this.name = name;
}
public void setId(int id) {
this.id = id;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -0,0 +1,74 @@
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashMap;
import java.util.Map;
public class ChangedItem extends AbstractJsonMapping {
private static final long serialVersionUID = 1L;
@JsonProperty("id")
private String id;
@JsonProperty("action")
private String action;
@JsonProperty("time")
private String time;
@JsonProperty("iso_639_1")
private String language;
@JsonProperty("value")
private Object value;
private final Map<String, Object> newItems = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
@JsonAnyGetter
public Map<String, Object> getNewItems() {
return this.newItems;
}
@JsonAnySetter
public void setNewItems(String name, Object value) {
this.newItems.put(name, value);
}
}
@@ -0,0 +1,48 @@
/*
* 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.JsonProperty;
public class ChangedMovie extends AbstractJsonMapping {
private static final long serialVersionUID = 1L;
@JsonProperty("id")
private String id;
@JsonProperty("adult")
private boolean adult;
public String getId() {
return id;
}
public boolean isAdult() {
return adult;
}
public void setId(String id) {
this.id = id;
}
public void setAdult(boolean adult) {
this.adult = adult;
}
}
@@ -1,178 +1,139 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
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 org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import org.apache.commons.lang3.StringUtils; /**
import org.slf4j.Logger; * @author stuart.boston
import org.slf4j.LoggerFactory; */
@JsonRootName("collection")
/** public class Collection extends AbstractJsonMapping {
*
* @author stuart.boston private static final long serialVersionUID = 1L;
*/
@JsonRootName("collection") /*
public class Collection implements Serializable { * Properties
*/
private static final long serialVersionUID = 1L; @JsonProperty("id")
/* private int id;
* Logger @JsonProperty("title")
*/ private String title;
private static final Logger LOG = LoggerFactory.getLogger(Collection.class); @JsonProperty("name")
/* private String name;
* Properties @JsonProperty("poster_path")
*/ private String posterPath;
@JsonProperty("id") @JsonProperty("backdrop_path")
private int id; private String backdropPath;
@JsonProperty("title") @JsonProperty("release_date")
private String title; private String releaseDate;
@JsonProperty("name")
private String name; public String getBackdropPath() {
@JsonProperty("poster_path") return backdropPath;
private String posterPath; }
@JsonProperty("backdrop_path")
private String backdropPath; public int getId() {
@JsonProperty("release_date") return id;
private String releaseDate; }
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public String getPosterPath() {
public String getBackdropPath() { return posterPath;
return backdropPath; }
}
public String getReleaseDate() {
public int getId() { return releaseDate;
return id; }
}
public String getTitle() {
public String getPosterPath() { if (StringUtils.isBlank(title)) {
return posterPath; return name;
} }
return title;
public String getReleaseDate() { }
return releaseDate;
} public String getName() {
if (StringUtils.isBlank(name)) {
public String getTitle() { return title;
if (StringUtils.isBlank(title)) { }
return name; return name;
} }
return title;
} public void setBackdropPath(String backdropPath) {
this.backdropPath = backdropPath;
public String getName() { }
if (StringUtils.isBlank(name)) {
return title; public void setId(int id) {
} this.id = id;
return name; }
}
//</editor-fold> public void setPosterPath(String posterPath) {
this.posterPath = posterPath;
//<editor-fold defaultstate="collapsed" desc="Setter methods"> }
public void setBackdropPath(String backdropPath) {
this.backdropPath = backdropPath; public void setReleaseDate(String releaseDate) {
} this.releaseDate = releaseDate;
}
public void setId(int id) {
this.id = id; public void setTitle(String title) {
} this.title = title;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath; public void setName(String name) {
} this.name = name;
}
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate; @Override
} public boolean equals(Object obj) {
if (obj == null) {
public void setTitle(String title) { return false;
this.title = title; }
} if (getClass() != obj.getClass()) {
return false;
public void setName(String name) { }
this.name = name; final Collection other = (Collection) obj;
} if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) {
//</editor-fold> return false;
}
/** if (this.id != other.id) {
* Handle unknown properties and print a message return false;
* }
* @param key if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
* @param value return false;
*/ }
@JsonAnySetter if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
public void handleUnknown(String key, Object value) { return false;
StringBuilder sb = new StringBuilder(); }
sb.append("Unknown property: '").append(key); return true;
sb.append("' value: '").append(value).append("'"); }
LOG.trace(sb.toString());
} @Override
public int hashCode() {
@Override int hash = 7;
public boolean equals(Object obj) { hash = 19 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
if (obj == null) { hash = 19 * hash + this.id;
return false; hash = 19 * hash + (this.title != null ? this.title.hashCode() : 0);
} hash = 19 * hash + (this.name != null ? this.name.hashCode() : 0);
if (getClass() != obj.getClass()) { hash = 19 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
return false; hash = 19 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
} return hash;
final Collection other = (Collection) obj; }
if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) { }
return false;
}
if (this.id != other.id) {
return false;
}
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
return false;
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 19 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
hash = 19 * hash + this.id;
hash = 19 * hash + (this.title != null ? this.title.hashCode() : 0);
hash = 19 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 19 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
hash = 19 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Collection=");
sb.append("[id=").append(id);
sb.append("],[title=").append(title);
sb.append("],[name=").append(name);
sb.append("],[posterPath=").append(posterPath);
sb.append("],[backdropPath=").append(backdropPath);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("]]");
return sb.toString();
}
}
@@ -1,124 +1,97 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.util.ArrayList;
import java.util.ArrayList; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; * @author Stuart
*/
/** public class CollectionInfo extends AbstractJsonMapping {
*
* @author Stuart private static final long serialVersionUID = 1L;
*/
public class CollectionInfo implements Serializable { /*
* Properties
private static final long serialVersionUID = 1L; */
/* @JsonProperty("id")
* Logger private int id;
*/ @JsonProperty("name")
private static final Logger LOG = LoggerFactory.getLogger(CollectionInfo.class); private String name;
/* @JsonProperty("overview")
* Properties private String overview;
*/ @JsonProperty("poster_path")
@JsonProperty("id") private String posterPath;
private int id; @JsonProperty("backdrop_path")
@JsonProperty("name") private String backdropPath;
private String name; @JsonProperty("parts")
@JsonProperty("poster_path") private List<Collection> parts = new ArrayList<Collection>();
private String posterPath;
@JsonProperty("backdrop_path") public String getBackdropPath() {
private String backdropPath; return backdropPath;
@JsonProperty("parts") }
private List<Collection> parts = new ArrayList<Collection>();
public int getId() {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> return id;
public String getBackdropPath() { }
return backdropPath;
} public String getName() {
return name;
public int getId() { }
return id;
} public String getOverview() {
return overview;
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;
} public void setBackdropPath(String backdropPath) {
//</editor-fold> this.backdropPath = backdropPath;
}
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdropPath(String backdropPath) { public void setId(int id) {
this.backdropPath = backdropPath; this.id = id;
} }
public void setId(int id) { public void setName(String name) {
this.id = id; this.name = name;
} }
public void setName(String name) { public void setOverview(String overview) {
this.name = name; this.overview = overview;
} }
public void setParts(List<Collection> parts) { public void setParts(List<Collection> parts) {
this.parts = parts; this.parts = parts;
} }
public void setPosterPath(String posterPath) { public void setPosterPath(String posterPath) {
this.posterPath = 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());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[CollectionInfo=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("],[posterPath=").append(posterPath);
sb.append("],[backdropPath=").append(backdropPath);
sb.append("],[# of parts=").append(parts.size());
sb.append("]]");
return sb.toString();
}
}
@@ -1,133 +1,112 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; /**
import org.slf4j.Logger; * Company information
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* Company information public class Company extends AbstractJsonMapping {
*
* @author Stuart private static final long serialVersionUID = 1L;
*/ private static final String DEFAULT_STRING = "";
public class Company implements Serializable { // Properties
@JsonProperty("id")
private static final long serialVersionUID = 1L; private int companyId = 0;
// Logger @JsonProperty("name")
private static final Logger LOG = LoggerFactory.getLogger(Company.class); private String name = DEFAULT_STRING;
private static final String DEFAULT_STRING = ""; @JsonProperty("description")
// Properties private String description = DEFAULT_STRING;
@JsonProperty("id") @JsonProperty("headquarters")
private int companyId = 0; private String headquarters = DEFAULT_STRING;
@JsonProperty("name") @JsonProperty("homepage")
private String name = DEFAULT_STRING; private String homepage = DEFAULT_STRING;
@JsonProperty("description") @JsonProperty("logo_path")
private String description = DEFAULT_STRING; private String logoPath = DEFAULT_STRING;
@JsonProperty("headquarters") @JsonProperty("parent_company")
private String headquarters = DEFAULT_STRING; private Company parentCompany = null;
@JsonProperty("homepage")
private String homepage = DEFAULT_STRING; public int getCompanyId() {
@JsonProperty("logo_path") return companyId;
private String logoPath = DEFAULT_STRING; }
@JsonProperty("parent_company")
private String parentCompany = DEFAULT_STRING; public String getDescription() {
return description;
//<editor-fold defaultstate="collapsed" desc="Getter Methods"> }
public int getCompanyId() {
return companyId; public String getHeadquarters() {
} return headquarters;
}
public String getDescription() {
return description; public String getHomepage() {
} return homepage;
}
public String getHeadquarters() {
return headquarters; public String getLogoPath() {
} return logoPath;
}
public String getHomepage() {
return homepage; public String getName() {
} return name;
}
public String getLogoPath() {
return logoPath; public Company getParentCompany() {
} return parentCompany;
}
public String getName() {
return name; public void setCompanyId(int companyId) {
} this.companyId = companyId;
}
public String getParentCompany() {
return parentCompany; public void setDescription(String description) {
} this.description = description;
//</editor-fold> }
//<editor-fold defaultstate="collapsed" desc="Setter Methods"> public void setHeadquarters(String headquarters) {
public void setCompanyId(int companyId) { this.headquarters = headquarters;
this.companyId = companyId; }
}
public void setHomepage(String homepage) {
public void setDescription(String description) { this.homepage = homepage;
this.description = description; }
}
public void setLogoPath(String logoPath) {
public void setHeadquarters(String headquarters) { this.logoPath = logoPath;
this.headquarters = headquarters; }
}
public void setName(String name) {
public void setHomepage(String homepage) { this.name = name;
this.homepage = homepage; }
}
public void setParentCompany(Company parentCompany) {
public void setLogoPath(String logoPath) { this.parentCompany = parentCompany;
this.logoPath = logoPath; }
}
public void setParentCompany(int id, String name, String logoPath) {
public void setName(String name) { Company parent = new Company();
this.name = name; parent.setCompanyId(companyId);
} parent.setName(name);
parent.setLogoPath(logoPath);
public void setParentCompany(String parentCompany) { this.parentCompany = parent;
this.parentCompany = parentCompany; }
} }
//</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 "Company{" + "companyId=" + companyId + ", name=" + name + ", description=" + description + ", headquarters=" + headquarters + ", homepage=" + homepage + ", logoPath=" + logoPath + ", parentCompany=" + parentCompany + '}';
}
}
@@ -0,0 +1,278 @@
/*
* 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;private either version 3 of the License;private or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful;private
* 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;private see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
import static com.omertron.themoviedbapi.tools.ApiUrl.*;
/**
* Generate a discover object for use in the MovieDbApi
* <p/>
* This allows you to just add the search components you are concerned with
*
* @author stuart.boston
*/
public class Discover {
private final Map<String, String> params = new HashMap<String, String>();
private static final String PARAM_PRIMARY_RELEASE_YEAR = "primary_release_year=";
private static final String PARAM_VOTE_COUNT_GTE = "vote_count.gte=";
private static final String PARAM_VOTE_AVERAGE_GTE = "vote_average.gte=";
private static final String PARAM_WITH_GENRES = "with_genres=";
private static final String PARAM_RELEASE_DATE_GTE = "release_date.gte=";
private static final String PARAM_RELEASE_DATE_LTE = "release_date.lte=";
private static final String PARAM_CERTIFICATION_COUNTRY = "certification_country=";
private static final String PARAM_CERTIFICATION_LTE = "certification.lte=";
private static final String PARAM_WITH_COMPANIES = "with_companies=";
private static final String PARAM_SORT_BY = "sort_by=";
private static final int YEAR_MIN = 1900;
private static final int YEAR_MAX = 2100;
/**
* Get the parameters
* <p/>
* This will be used to construct the URL in the API
*
* @return
*/
public Map<String, String> getParams() {
return params;
}
/**
* Minimum value is 1 if included.
*
* @param page
* @return
*/
public Discover page(int page) {
if (page > 0) {
params.put(PARAM_PAGE, String.valueOf(page));
}
return this;
}
/**
* ISO 639-1 code
*
* @param language
* @return
*/
public Discover language(String language) {
if (StringUtils.isNotBlank(language)) {
params.put(PARAM_LANGUAGE, language);
}
return this;
}
/**
* Available options are <br>
* vote_average.desc<br>
* vote_average.asc<br>
* release_date.desc<br>
* release_date.asc<br>
* popularity.desc<br>
* popularity.asc
*
* @param sortBy
* @return
*/
public Discover sortBy(String sortBy) {
if (StringUtils.isNotBlank(sortBy)) {
params.put(PARAM_SORT_BY, sortBy);
}
return this;
}
/**
* Toggle the inclusion of adult titles
*
* @param includeAdult
* @return
*/
public Discover includeAdult(boolean includeAdult) {
params.put(PARAM_ADULT, String.valueOf(includeAdult));
return this;
}
/**
* Filter the results release dates to matches that include this value.
*
* @param year
* @return
*/
public Discover year(int year) {
if (checkYear(year)) {
params.put(PARAM_YEAR, String.valueOf(year));
}
return this;
}
/**
* Filter the results so that only the primary release date year has this value
*
* @param primaryReleaseYear
* @return
*/
public Discover primaryReleaseYear(int primaryReleaseYear) {
if (checkYear(primaryReleaseYear)) {
params.put(PARAM_PRIMARY_RELEASE_YEAR, String.valueOf(primaryReleaseYear));
}
return this;
}
/**
* Only include movies that are equal to, or have a vote count higher than this value
*
* @param voteCountGte
* @return
*/
public Discover voteCountGte(int voteCountGte) {
if (voteCountGte > 0) {
params.put(PARAM_VOTE_COUNT_GTE, String.valueOf(voteCountGte));
}
return this;
}
/**
* Only include movies that are equal to, or have a higher average rating than this value
*
* @param voteAverageGte
* @return
*/
public Discover voteAverageGte(float voteAverageGte) {
if (voteAverageGte > 0) {
params.put(PARAM_VOTE_AVERAGE_GTE, String.valueOf(voteAverageGte));
}
return this;
}
/**
* Only include movies with the specified genres.
* <p/>
* Expected value is an integer (the id of a genre).
* <p/>
* Multiple values can be specified.
* <p/>
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'
*
* @param withGenres
* @return
*/
public Discover withGenres(String withGenres) {
if (StringUtils.isNotBlank(withGenres)) {
params.put(PARAM_WITH_GENRES, withGenres);
}
return this;
}
/**
* The minimum release to include.
* <p/>
* Expected format is YYYY-MM-DD.
*
* @param releaseDateGte
* @return
*/
public Discover releaseDateGte(String releaseDateGte) {
if (StringUtils.isNotBlank(releaseDateGte)) {
params.put(PARAM_RELEASE_DATE_GTE, releaseDateGte);
}
return this;
}
/**
* The maximum release to include.
* <p/>
* Expected format is YYYY-MM-DD.
*
* @param releaseDateLte
* @return
*/
public Discover releaseDateLte(String releaseDateLte) {
if (StringUtils.isNotBlank(releaseDateLte)) {
params.put(PARAM_RELEASE_DATE_LTE, releaseDateLte);
}
return this;
}
/**
* Only include movies with certifications for a specific country.
* <p/>
* When this value is specified, 'certificationLte' is required.
* <p/>
* A ISO 3166-1 is expected
*
* @param certificationCountry
* @return
*/
public Discover certificationCountry(String certificationCountry) {
if (StringUtils.isNotBlank(certificationCountry)) {
params.put(PARAM_CERTIFICATION_COUNTRY, certificationCountry);
}
return this;
}
/**
* Only include movies with this certification and lower.
* <p/>
* Expected value is a valid certification for the specified 'certificationCountry'.
*
* @param certificationLte
* @return
*/
public Discover certificationLte(String certificationLte) {
if (StringUtils.isNotBlank(certificationLte)) {
params.put(PARAM_CERTIFICATION_LTE, certificationLte);
}
return this;
}
/**
* Filter movies to include a specific company.
* <p/>
* Expected value is an integer (the id of a company).
* <p/>
* They can be comma separated to indicate an 'AND' query
*
* @param withCompanies
* @return
*/
public Discover withCompanies(String withCompanies) {
if (StringUtils.isNotBlank(withCompanies)) {
params.put(PARAM_WITH_COMPANIES, withCompanies);
}
return this;
}
/**
* check the year is between the min and max
*
* @param year
* @return
*/
private boolean checkYear(int year) {
return (year >= YEAR_MIN && year <= YEAR_MAX);
}
}
@@ -1,117 +1,81 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
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 org.slf4j.Logger; * @author stuart.boston
import org.slf4j.LoggerFactory; */
@JsonRootName("genre")
/** public class Genre extends AbstractJsonMapping {
*
* @author stuart.boston private static final long serialVersionUID = 1L;
*/ /*
@JsonRootName("genre") * Properties
public class Genre implements Serializable { */
@JsonProperty("id")
private static final long serialVersionUID = 1L; private int id;
/* @JsonProperty("name")
* Logger private String name;
*/
private static final Logger LOG = LoggerFactory.getLogger(Genre.class); public int getId() {
/* return id;
* Properties }
*/
@JsonProperty("id") public String getName() {
private int id; return name;
@JsonProperty("name") }
private String name;
public void setId(int id) {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> this.id = id;
public int getId() { }
return id;
} public void setName(String name) {
this.name = name;
public String getName() { }
return name;
} @Override
//</editor-fold> public boolean equals(Object obj) {
if (obj == null) {
//<editor-fold defaultstate="collapsed" desc="Setter methods"> return false;
public void setId(int id) { }
this.id = id; if (getClass() != obj.getClass()) {
} return false;
}
public void setName(String name) { final Genre other = (Genre) obj;
this.name = name; if (this.id != other.id) {
} return false;
//</editor-fold> }
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
/** return false;
* Handle unknown properties and print a message }
* return true;
* @param key }
* @param value
*/ @Override
@JsonAnySetter public int hashCode() {
public void handleUnknown(String key, Object value) { int hash = 5;
StringBuilder sb = new StringBuilder(); hash = 53 * hash + this.id;
sb.append("Unknown property: '").append(key); hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
sb.append("' value: '").append(value).append("'"); return hash;
LOG.trace(sb.toString()); }
} }
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Genre other = (Genre) obj;
if (this.id != other.id) {
return false;
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 53 * hash + this.id;
hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Genre=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return 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.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class JobDepartment extends AbstractJsonMapping {
private static final long serialVersionUID = 1L;
// Properties
@JsonProperty("department")
private String department;
@JsonProperty("job_list")
private List<String> jobs;
public String getDepartment() {
return department;
}
public List<String> getJobs() {
return jobs;
}
public void setDepartment(String department) {
this.department = department;
}
public void setJobs(List<String> jobs) {
this.jobs = jobs;
}
}
@@ -1,118 +1,82 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
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 org.slf4j.Logger; * @author stuart.boston
import org.slf4j.LoggerFactory; */
@JsonRootName("keyword")
/** public class Keyword extends AbstractJsonMapping {
*
* @author stuart.boston private static final long serialVersionUID = 1L;
*/
@JsonRootName("keyword") /*
public class Keyword implements Serializable { * Properties
*/
private static final long serialVersionUID = 1L; @JsonProperty("id")
private int id;
/* @JsonProperty("name")
* Logger private String name;
*/
private static final Logger LOG = LoggerFactory.getLogger(Keyword.class); public int getId() {
/* return id;
* Properties }
*/
@JsonProperty("id") public String getName() {
private int id; return name;
@JsonProperty("name") }
private String name;
public void setId(int id) {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> this.id = id;
public int getId() { }
return id;
} public void setName(String name) {
this.name = name;
public String getName() { }
return name;
} @Override
//</editor-fold> public boolean equals(Object obj) {
if (obj == null) {
//<editor-fold defaultstate="collapsed" desc="Setter methods"> return false;
public void setId(int id) { }
this.id = id; if (getClass() != obj.getClass()) {
} return false;
}
public void setName(String name) { final Keyword other = (Keyword) obj;
this.name = name; if (this.id != other.id) {
} return false;
//</editor-fold> }
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
/** return false;
* Handle unknown properties and print a message }
* return true;
* @param key }
* @param value
*/ @Override
@JsonAnySetter public int hashCode() {
public void handleUnknown(String key, Object value) { int hash = 3;
StringBuilder sb = new StringBuilder(); hash = 83 * hash + this.id;
sb.append("Unknown property: '").append(key); hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0);
sb.append("' value: '").append(value).append("'"); return hash;
LOG.trace(sb.toString()); }
} }
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Keyword other = (Keyword) obj;
if (this.id != other.id) {
return false;
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
hash = 83 * hash + this.id;
hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Keyword=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
}
}
@@ -1,146 +1,138 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; /**
import org.slf4j.Logger; * @author Stuart
import org.slf4j.LoggerFactory; */
public class KeywordMovie extends AbstractJsonMapping {
/**
* private static final long serialVersionUID = 1L;
* @author Stuart
*/ /*
public class KeywordMovie implements Serializable { * Properties
*/
private static final long serialVersionUID = 1L; @JsonProperty("id")
private String id;
/* @JsonProperty("backdrop_path")
* Logger private String backdropPath;
*/ @JsonProperty("original_title")
private static final Logger LOG = LoggerFactory.getLogger(KeywordMovie.class); private String originalTitle;
/* @JsonProperty("release_date")
* Properties private String releaseDate;
*/ @JsonProperty("poster_path")
@JsonProperty("id") private String posterPath;
private String id; @JsonProperty("title")
@JsonProperty("backdrop_path") private String title;
private String backdropPath; @JsonProperty("vote_average")
@JsonProperty("original_title") private float voteAverage;
private String originalTitle; @JsonProperty("vote_count")
@JsonProperty("release_date") private double voteCount;
private String releaseDate; @JsonProperty("adult")
@JsonProperty("poster_path") private boolean adult;
private String posterPath; @JsonProperty("popularity")
@JsonProperty("title") private float popularity;
private String title;
@JsonProperty("vote_average") public static long getSerialVersionUID() {
private float voteAverage; return serialVersionUID;
@JsonProperty("vote_count") }
private double voteCount;
public String getBackdropPath() {
// <editor-fold defaultstate="collapsed" desc="Getter methods"> return backdropPath;
public static long getSerialVersionUID() { }
return serialVersionUID;
} public String getId() {
return id;
public String getBackdropPath() { }
return backdropPath;
} public String getOriginalTitle() {
return originalTitle;
public String getId() { }
return id;
} public String getReleaseDate() {
return releaseDate;
public String getOriginalTitle() { }
return originalTitle;
} public String getPosterPath() {
return posterPath;
public String getReleaseDate() { }
return releaseDate;
} public String getTitle() {
return title;
public String getPosterPath() { }
return posterPath;
} public float getVoteAverage() {
return voteAverage;
public String getTitle() { }
return title;
} public double getVoteCount() {
return voteCount;
public float getVoteAverage() { }
return voteAverage;
} public boolean isAdult() {
return adult;
public double getVoteCount() { }
return voteCount;
} public float getPopularity() {
// </editor-fold> return popularity;
}
// <editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdropPath(String backdropPath) { public void setBackdropPath(String backdropPath) {
this.backdropPath = backdropPath; this.backdropPath = backdropPath;
} }
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
public void setOriginalTitle(String originalTitle) { public void setOriginalTitle(String originalTitle) {
this.originalTitle = originalTitle; this.originalTitle = originalTitle;
} }
public void setReleaseDate(String releaseDate) { public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate; this.releaseDate = releaseDate;
} }
public void setPosterPath(String posterPath) { public void setPosterPath(String posterPath) {
this.posterPath = posterPath; this.posterPath = posterPath;
} }
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
public void setVoteAverage(float voteAverage) { public void setVoteAverage(float voteAverage) {
this.voteAverage = voteAverage; this.voteAverage = voteAverage;
} }
public void setVoteCount(double voteCount) { public void setVoteCount(double voteCount) {
this.voteCount = voteCount; this.voteCount = voteCount;
} }
// </editor-fold>
public void setAdult(boolean adult) {
/** this.adult = adult;
* Handle unknown properties and print a message }
*
* @param key public void setPopularity(float popularity) {
* @param value this.popularity = popularity;
*/ }
@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,117 +1,81 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
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 org.slf4j.Logger; * @author stuart.boston
import org.slf4j.LoggerFactory; */
@JsonRootName("spoken_language")
/** public class Language extends AbstractJsonMapping {
*
* @author stuart.boston private static final long serialVersionUID = 1L;
*/ /*
@JsonRootName("spoken_language") * Properties
public class Language implements Serializable { */
@JsonProperty("iso_639_1")
private static final long serialVersionUID = 1L; private String isoCode;
/* @JsonProperty("name")
* Logger private String name;
*/
private static final Logger LOG = LoggerFactory.getLogger(Language.class); public String getIsoCode() {
/* return isoCode;
* Properties }
*/
@JsonProperty("iso_639_1") public String getName() {
private String isoCode; return name;
@JsonProperty("name") }
private String name;
public void setIsoCode(String isoCode) {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> this.isoCode = isoCode;
public String getIsoCode() { }
return isoCode;
} public void setName(String name) {
this.name = name;
public String getName() { }
return name;
} @Override
//</editor-fold> public boolean equals(Object obj) {
if (obj == null) {
//<editor-fold defaultstate="collapsed" desc="Setter methods"> return false;
public void setIsoCode(String isoCode) { }
this.isoCode = isoCode; if (getClass() != obj.getClass()) {
} return false;
}
public void setName(String name) { final Language other = (Language) obj;
this.name = name; if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
} return false;
//</editor-fold> }
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
/** return false;
* Handle unknown properties and print a message }
* return true;
* @param key }
* @param value
*/ @Override
@JsonAnySetter public int hashCode() {
public void handleUnknown(String key, Object value) { int hash = 7;
StringBuilder sb = new StringBuilder(); hash = 71 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
sb.append("Unknown property: '").append(key); hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0);
sb.append("' value: '").append(value).append("'"); return hash;
LOG.trace(sb.toString()); }
} }
@Override
public boolean equals(Object obj) {
if (obj == null) {
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)) {
return false;
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 71 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Language=");
sb.append("isoCode=").append(isoCode);
sb.append(", name=").append(name);
sb.append("]]");
return sb.toString();
}
}
@@ -0,0 +1,51 @@
/*
* 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.JsonProperty;
/**
* @author Holger Brandl
*/
public class ListItemStatus extends AbstractJsonMapping {
private static final long serialVersionUID = 1L;
@JsonProperty("status_code")
private int statusCode;
@JsonProperty("item_present")
private boolean itemPresent;
public int getStatusCode() {
return statusCode;
}
public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}
public boolean isItemPresent() {
return itemPresent;
}
public void setItemPresent(boolean itemPresent) {
this.itemPresent = itemPresent;
}
}
@@ -1,354 +1,420 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.wrapper.*;
import java.io.Serializable;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
* Movie Bean
/** *
* Movie Bean * @author stuart.boston
* */
* @author stuart.boston public class MovieDb extends AbstractJsonMapping {
*/
public class MovieDb implements Serializable { private static final long serialVersionUID = 1L;
@JsonProperty("backdrop_path")
private static final long serialVersionUID = 1L; private String backdropPath;
/* @JsonProperty("id")
* Logger private int id;
*/ @JsonProperty("original_title")
private static final Logger LOG = LoggerFactory.getLogger(MovieDb.class); private String originalTitle;
/* @JsonProperty("popularity")
* Properties private float popularity;
*/ @JsonProperty("poster_path")
@JsonProperty("backdrop_path") private String posterPath;
private String backdropPath; @JsonProperty("release_date")
@JsonProperty("id") private String releaseDate;
private int id; @JsonProperty("title")
@JsonProperty("original_title") private String title;
private String originalTitle; @JsonProperty("adult")
@JsonProperty("popularity") private boolean adult;
private float popularity; @JsonProperty("belongs_to_collection")
@JsonProperty("poster_path") private Collection belongsToCollection;
private String posterPath; @JsonProperty("budget")
@JsonProperty("release_date") private long budget;
private String releaseDate; @JsonProperty("genres")
@JsonProperty("title") private List<Genre> genres;
private String title; @JsonProperty("homepage")
@JsonProperty("adult") private String homepage;
private boolean adult; @JsonProperty("imdb_id")
@JsonProperty("belongs_to_collection") private String imdbID;
private Collection belongsToCollection; @JsonProperty("overview")
@JsonProperty("budget") private String overview;
private long budget; @JsonProperty("production_companies")
@JsonProperty("genres") private List<ProductionCompany> productionCompanies;
private List<Genre> genres; @JsonProperty("production_countries")
@JsonProperty("homepage") private List<ProductionCountry> productionCountries;
private String homepage; @JsonProperty("revenue")
@JsonProperty("imdb_id") private long revenue;
private String imdbID; @JsonProperty("runtime")
@JsonProperty("overview") private int runtime;
private String overview; @JsonProperty("spoken_languages")
@JsonProperty("production_companies") private List<Language> spokenLanguages;
private List<ProductionCompany> productionCompanies; @JsonProperty("tagline")
@JsonProperty("production_countries") private String tagline;
private List<ProductionCountry> productionCountries; @JsonProperty("rating")
@JsonProperty("revenue") private float userRating;
private long revenue; @JsonProperty("vote_average")
@JsonProperty("runtime") private float voteAverage;
private int runtime; @JsonProperty("vote_count")
@JsonProperty("spoken_languages") private int voteCount;
private List<Language> spokenLanguages; @JsonProperty("status")
@JsonProperty("tagline") private String status;
private String tagline; // AppendToResponse Properties
@JsonProperty("vote_average") @JsonProperty("alternative_titles")
private float voteAverage; private WrapperAlternativeTitles alternativeTitles;
@JsonProperty("vote_count") @JsonProperty("casts")
private int voteCount; private WrapperMovieCasts casts;
@JsonProperty("status") @JsonProperty("images")
private String status; private WrapperImages images;
@JsonProperty("keywords")
// <editor-fold defaultstate="collapsed" desc="Getter methods"> private WrapperMovieKeywords keywords;
public String getBackdropPath() { @JsonProperty("releases")
return backdropPath; private WrapperReleaseInfo releases;
} @JsonProperty("trailers")
private WrapperTrailers trailers;
public int getId() { @JsonProperty("translations")
return id; private WrapperTranslations translations;
} @JsonProperty("similar_movies")
private WrapperMovie similarMovies;
public String getOriginalTitle() { @JsonProperty("reviews")
return originalTitle; private WrapperReviews reviews;
} @JsonProperty("lists")
private WrapperMovieList lists;
public float getPopularity() {
return popularity; // <editor-fold defaultstate="collapsed" desc="Getter methods">
} public String getBackdropPath() {
return backdropPath;
public String getPosterPath() { }
return posterPath;
} public int getId() {
return id;
public String getReleaseDate() { }
return releaseDate;
} public String getOriginalTitle() {
return originalTitle;
public String getTitle() { }
return title;
} public float getPopularity() {
return popularity;
public boolean isAdult() { }
return adult;
} public String getPosterPath() {
return posterPath;
public Collection getBelongsToCollection() { }
return belongsToCollection;
} public String getReleaseDate() {
return releaseDate;
public long getBudget() { }
return budget;
} public String getTitle() {
return title;
public List<Genre> getGenres() { }
return genres;
} public boolean isAdult() {
return adult;
public String getHomepage() { }
return homepage;
} public Collection getBelongsToCollection() {
return belongsToCollection;
public String getImdbID() { }
return imdbID;
} public long getBudget() {
return budget;
public String getOverview() { }
return overview;
} public List<Genre> getGenres() {
return genres;
public List<ProductionCompany> getProductionCompanies() { }
return productionCompanies;
} public String getHomepage() {
return homepage;
public List<ProductionCountry> getProductionCountries() { }
return productionCountries;
} public String getImdbID() {
return imdbID;
public long getRevenue() { }
return revenue;
} public String getOverview() {
return overview;
public int getRuntime() { }
return runtime;
} public List<ProductionCompany> getProductionCompanies() {
return productionCompanies;
public List<Language> getSpokenLanguages() { }
return spokenLanguages;
} public List<ProductionCountry> getProductionCountries() {
return productionCountries;
public String getTagline() { }
return tagline;
} public long getRevenue() {
return revenue;
public float getVoteAverage() { }
return voteAverage;
} public int getRuntime() {
return runtime;
public int getVoteCount() { }
return voteCount;
} public List<Language> getSpokenLanguages() {
return spokenLanguages;
public String getStatus() { }
return status;
} public String getTagline() {
// </editor-fold> return tagline;
}
// <editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdropPath(String backdropPath) { public float getVoteAverage() {
this.backdropPath = backdropPath; return voteAverage;
} }
public void setId(int id) { public int getVoteCount() {
this.id = id; return voteCount;
} }
public void setOriginalTitle(String originalTitle) { public String getStatus() {
this.originalTitle = originalTitle; return status;
} }
public void setPopularity(float popularity) { public float getUserRating() {
this.popularity = popularity; return userRating;
} }
// </editor-fold>
public void setPosterPath(String posterPath) {
this.posterPath = posterPath; // <editor-fold defaultstate="collapsed" desc="Setter methods">
} public void setBackdropPath(String backdropPath) {
this.backdropPath = backdropPath;
public void setReleaseDate(String releaseDate) { }
this.releaseDate = releaseDate;
} public void setId(int id) {
this.id = id;
public void setTitle(String title) { }
this.title = title;
} public void setOriginalTitle(String originalTitle) {
this.originalTitle = originalTitle;
public void setAdult(boolean adult) { }
this.adult = adult;
} public void setPopularity(float popularity) {
this.popularity = popularity;
public void setBelongsToCollection(Collection belongsToCollection) { }
this.belongsToCollection = belongsToCollection;
} public void setPosterPath(String posterPath) {
this.posterPath = posterPath;
public void setBudget(long budget) { }
this.budget = budget;
} public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
public void setGenres(List<Genre> genres) { }
this.genres = genres;
} public void setTitle(String title) {
this.title = title;
public void setHomepage(String homepage) { }
this.homepage = homepage;
} public void setAdult(boolean adult) {
this.adult = adult;
public void setImdbID(String imdbID) { }
this.imdbID = imdbID;
} public void setBelongsToCollection(Collection belongsToCollection) {
this.belongsToCollection = belongsToCollection;
public void setOverview(String overview) { }
this.overview = overview;
} public void setBudget(long budget) {
this.budget = budget;
public void setProductionCompanies(List<ProductionCompany> productionCompanies) { }
this.productionCompanies = productionCompanies;
} public void setGenres(List<Genre> genres) {
this.genres = genres;
public void setProductionCountries(List<ProductionCountry> productionCountries) { }
this.productionCountries = productionCountries;
} public void setHomepage(String homepage) {
this.homepage = homepage;
public void setRevenue(long revenue) { }
this.revenue = revenue;
} public void setImdbID(String imdbID) {
this.imdbID = imdbID;
public void setRuntime(int runtime) { }
this.runtime = runtime;
} public void setOverview(String overview) {
this.overview = overview;
public void setSpokenLanguages(List<Language> spokenLanguages) { }
this.spokenLanguages = spokenLanguages;
} public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
this.productionCompanies = productionCompanies;
public void setTagline(String tagline) { }
this.tagline = tagline;
} public void setProductionCountries(List<ProductionCountry> productionCountries) {
this.productionCountries = productionCountries;
public void setVoteAverage(float voteAverage) { }
this.voteAverage = voteAverage;
} public void setRevenue(long revenue) {
this.revenue = revenue;
public void setVoteCount(int voteCount) { }
this.voteCount = voteCount;
} public void setRuntime(int runtime) {
this.runtime = runtime;
public void setStatus(String status) { }
this.status = status;
} public void setSpokenLanguages(List<Language> spokenLanguages) {
this.spokenLanguages = spokenLanguages;
// </editor-fold> }
/**
* Handle unknown properties and print a message public void setTagline(String tagline) {
* this.tagline = tagline;
* @param key }
* @param value
*/ public void setVoteAverage(float voteAverage) {
@JsonAnySetter this.voteAverage = voteAverage;
public void handleUnknown(String key, Object value) { }
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); public void setVoteCount(int voteCount) {
sb.append("' value: '").append(value).append("'"); this.voteCount = voteCount;
LOG.trace(sb.toString()); }
}
public void setStatus(String status) {
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode"> this.status = status;
@Override }
public boolean equals(Object obj) {
if (obj == null) { public void setUserRating(float userRating) {
return false; this.userRating = userRating;
} }
if (getClass() != obj.getClass()) { // </editor-fold>
return false;
} //<editor-fold defaultstate="collapsed" desc="AppendToResponse Getters">
final MovieDb other = (MovieDb) obj; public List<AlternativeTitle> getAlternativeTitles() {
if (this.id != other.id) { return alternativeTitles.getTitles();
return false; }
}
if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) { public List<PersonCast> getCast() {
return false; return casts.getCast();
} }
if (this.runtime != other.runtime) {
return false; public List<PersonCrew> getCrew() {
} return casts.getCrew();
return true; }
}
public List<Artwork> getImages() {
@Override return images.getAll();
public int hashCode() { }
int hash = 5;
hash = 89 * hash + this.id; public List<Keyword> getKeywords() {
hash = 89 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0); return keywords.getKeywords();
hash = 89 * hash + this.runtime; }
return hash;
} public List<ReleaseInfo> getReleases() {
//</editor-fold> return releases.getCountries();
}
@Override
public String toString() { public List<Trailer> getTrailers() {
StringBuilder sb = new StringBuilder("[MovieDB="); return trailers.getAll();
sb.append("[backdropPath=").append(backdropPath); }
sb.append("],[id=").append(id);
sb.append("],[originalTitle=").append(originalTitle); public List<Translation> getTranslations() {
sb.append("],[popularity=").append(popularity); return translations.getTranslations();
sb.append("],[posterPath=").append(posterPath); }
sb.append("],[releaseDate=").append(releaseDate);
sb.append("],[title=").append(title); public List<MovieDb> getSimilarMovies() {
sb.append("],[adult=").append(adult); return similarMovies.getMovies();
sb.append("],[belongsToCollection=").append(belongsToCollection); }
sb.append("],[budget=").append(budget);
sb.append("],[genres=").append(genres); public List<MovieList> getLists() {
sb.append("],[homepage=").append(homepage); return lists.getMovieList();
sb.append("],[imdbID=").append(imdbID); }
sb.append("],[overview=").append(overview);
sb.append("],[productionCompanies=").append(productionCompanies); public List<Reviews> getReviews() {
sb.append("],[productionCountries=").append(productionCountries); return reviews.getReviews();
sb.append("],[revenue=").append(revenue); }
sb.append("],[runtime=").append(runtime); // </editor-fold>
sb.append("],[spokenLanguages=").append(spokenLanguages);
sb.append("],[tagline=").append(tagline); //<editor-fold defaultstate="collapsed" desc="AppendToResponse Setters">
sb.append("],[voteAverage=").append(voteAverage); public void setAlternativeTitles(WrapperAlternativeTitles alternativeTitles) {
sb.append("],[voteCount=").append(voteCount); this.alternativeTitles = alternativeTitles;
sb.append("],[status=").append(status); }
sb.append("]]");
return sb.toString(); public void setCasts(WrapperMovieCasts casts) {
} this.casts = casts;
} }
public void setImages(WrapperImages images) {
this.images = images;
}
public void setKeywords(WrapperMovieKeywords keywords) {
this.keywords = keywords;
}
public void setReleases(WrapperReleaseInfo releases) {
this.releases = releases;
}
public void setTrailers(WrapperTrailers trailers) {
this.trailers = trailers;
}
public void setTranslations(WrapperTranslations translations) {
this.translations = translations;
}
public void setSimilarMovies(WrapperMovie similarMovies) {
this.similarMovies = similarMovies;
}
public void setLists(WrapperMovieList lists) {
this.lists = lists;
}
public void setReviews(WrapperReviews reviews) {
this.reviews = reviews;
}
// </editor-fold>
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final MovieDb other = (MovieDb) obj;
if (this.id != other.id) {
return false;
}
if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) {
return false;
}
if (this.runtime != other.runtime) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 89 * hash + this.id;
hash = 89 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0);
hash = 89 * hash + this.runtime;
return hash;
}
// </editor-fold>
}
@@ -1,151 +1,144 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
* Wrapper for the MovieDbList function
/** *
* Wrapper for the MovieDbList function * @author stuart.boston
* @author stuart.boston */
*/ public class MovieDbList extends AbstractJsonMapping {
public class MovieDbList {
/* @JsonProperty("id")
* Logger private String id;
*/ @JsonProperty("created_by")
private String createdBy;
private static final Logger LOG = LoggerFactory.getLogger(MovieDbList.class); @JsonProperty("description")
/* private String description;
* Properties @JsonProperty("favorite_count")
*/ private int favoriteCount;
@JsonProperty("id") @JsonProperty("items")
private String id; private List<MovieDb> items = Collections.EMPTY_LIST;
@JsonProperty("created_by") @JsonProperty("item_count")
private String createdBy; private int itemCount;
@JsonProperty("description") @JsonProperty("iso_639_1")
private String description; private String language;
@JsonProperty("favorite_count") @JsonProperty("name")
private int favoriteCount; private String name;
@JsonProperty("items") @JsonProperty("poster_path")
private List<MovieDb> items = Collections.EMPTY_LIST; private String posterPath;
@JsonProperty("item_count") @JsonProperty("status_code")
private int itemCount; private String statusCode;
@JsonProperty("iso_639_1") @JsonProperty("status_message")
private String language; private String statusMessage;
@JsonProperty("name")
private String name; public String getId() {
@JsonProperty("poster_path") return id;
private String posterPath; }
//<editor-fold defaultstate="collapsed" desc="Getter Methods"> public String getCreatedBy() {
public String getId() { return createdBy;
return id; }
}
public String getDescription() {
public String getCreatedBy() { return description;
return createdBy; }
}
public int getFavoriteCount() {
public String getDescription() { return favoriteCount;
return description; }
}
public List<MovieDb> getItems() {
public int getFavoriteCount() { return items;
return favoriteCount; }
}
public int getItemCount() {
public List<MovieDb> getItems() { return itemCount;
return items; }
}
public String getLanguage() {
public int getItemCount() { return language;
return itemCount; }
}
public String getName() {
public String getLanguage() { return name;
return language; }
}
public String getPosterPath() {
public String getName() { return posterPath;
return name; }
}
public String getStatusCode() {
public String getPosterPath() { return statusCode;
return posterPath; }
}
//</editor-fold> public String getStatusMessage() {
return statusMessage;
//<editor-fold defaultstate="collapsed" desc="Setter Methods"> }
public void setId(String id) {
this.id = id; public void setId(String id) {
} this.id = id;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy; public void setCreatedBy(String createdBy) {
} this.createdBy = createdBy;
}
public void setDescription(String description) {
this.description = description; public void setDescription(String description) {
} this.description = description;
}
public void setFavoriteCount(int favoriteCount) {
this.favoriteCount = favoriteCount; public void setFavoriteCount(int favoriteCount) {
} this.favoriteCount = favoriteCount;
}
public void setItems(List<MovieDb> items) {
this.items = items; public void setItems(List<MovieDb> items) {
} this.items = items;
}
public void setItemCount(int itemCount) {
this.itemCount = itemCount; public void setItemCount(int itemCount) {
} this.itemCount = itemCount;
}
public void setLanguage(String language) {
this.language = language; public void setLanguage(String language) {
} this.language = language;
}
public void setName(String name) {
this.name = name; public void setName(String name) {
} this.name = name;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath; public void setPosterPath(String posterPath) {
} this.posterPath = posterPath;
//</editor-fold> }
/** public void setStatusCode(String statusCode) {
* Handle unknown properties and print a message this.statusCode = statusCode;
* }
* @param key
* @param value public void setStatusMessage(String statusMessage) {
*/ this.statusMessage = statusMessage;
@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,36 @@
/*
* 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;private either version 3 of the License;private or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful;private
* 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;private see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class MovieDbListStatus extends StatusCode {
@JsonProperty("list_id")
private String listId;
public String getListId() {
return listId;
}
public void setListId(String listId) {
this.listId = listId;
}
}
@@ -1,146 +1,111 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; /**
import org.slf4j.Logger; * @author Stuart
import org.slf4j.LoggerFactory; */
public class MovieList extends AbstractJsonMapping {
/**
* private static final long serialVersionUID = 1L;
* @author Stuart
*/ @JsonProperty("description")
public class MovieList implements Serializable { private String description;
@JsonProperty("favorite_count")
private static final long serialVersionUID = 1L; private int favoriteCount;
@JsonProperty("id")
/* private String id;
* Logger @JsonProperty("item_count")
*/ private int itemCount;
private static final Logger LOG = LoggerFactory.getLogger(MovieList.class); @JsonProperty("iso_639_1")
/* private String language;
* Properties @JsonProperty("name")
*/ private String name;
@JsonProperty("description") @JsonProperty("poster_path")
private String description; private String posterPath;
@JsonProperty("favorite_count") @JsonProperty("list_type")
private int favoriteCount; private String listType;
@JsonProperty("id")
private String id; public String getDescription() {
@JsonProperty("item_count") return description;
private int itemCount; }
@JsonProperty("iso_639_1")
private String language; public int getFavoriteCount() {
@JsonProperty("name") return favoriteCount;
private String name; }
@JsonProperty("poster_path")
private String posterPath; public String getId() {
@JsonProperty("list_type") return id;
private String listType; }
// <editor-fold defaultstate="collapsed" desc="Getter methods"> public int getItemCount() {
public String getDescription() { return itemCount;
return description; }
}
public String getLanguage() {
public int getFavoriteCount() { return language;
return favoriteCount; }
}
public String getName() {
public String getId() { return name;
return id; }
}
public String getPosterPath() {
public int getItemCount() { return posterPath;
return itemCount; }
}
public String getListType() {
public String getLanguage() { return listType;
return language; }
}
public void setDescription(String description) {
public String getName() { this.description = description;
return name; }
}
public void setFavoriteCount(int favoriteCount) {
public String getPosterPath() { this.favoriteCount = favoriteCount;
return posterPath; }
}
public void setId(String id) {
public String getListType() { this.id = id;
return listType; }
}
// </editor-fold> public void setItemCount(int itemCount) {
this.itemCount = itemCount;
// <editor-fold defaultstate="collapsed" desc="Setter methods"> }
public void setDescription(String description) {
this.description = description; public void setLanguage(String language) {
} this.language = language;
}
public void setFavoriteCount(int favoriteCount) {
this.favoriteCount = favoriteCount; public void setName(String name) {
} this.name = name;
}
public void setId(String id) {
this.id = id; public void setPosterPath(String posterPath) {
} this.posterPath = posterPath;
}
public void setItemCount(int itemCount) {
this.itemCount = itemCount; public void setListType(String listType) {
} this.listType = listType;
}
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,343 +1,300 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
* @author stuart.boston
/** */
* public class Person extends AbstractJsonMapping {
* @author stuart.boston
*/ private static final long serialVersionUID = 1L;
public class Person implements Serializable {
/*
private static final long serialVersionUID = 1L; * Static fields for default cast information
*/
/* private static final String CAST_DEPARTMENT = "acting";
* Logger private static final String CAST_JOB = "actor";
*/ private static final String DEFAULT_STRING = "";
private static final Logger LOG = LoggerFactory.getLogger(Person.class); /*
* Properties
/* */
* Static fields for default cast information @JsonProperty("id")
*/ private int id = -1;
private static final String CAST_DEPARTMENT = "acting"; @JsonProperty("name")
private static final String CAST_JOB = "actor"; private String name = "";
private static final String DEFAULT_STRING = ""; @JsonProperty("profile_path")
/* private String profilePath = DEFAULT_STRING;
* Properties private PersonType personType = PersonType.PERSON;
*/ // Crew
@JsonProperty("id") private String department = DEFAULT_STRING;
private int id = -1; // Crew
@JsonProperty("name") private String job = DEFAULT_STRING;
private String name = ""; // Cast
@JsonProperty("profile_path") private String character = DEFAULT_STRING;
private String profilePath = DEFAULT_STRING; // Cast
private PersonType personType = PersonType.PERSON; private int order = -1;
private String department = DEFAULT_STRING; // Crew @JsonProperty("adult")
private String job = DEFAULT_STRING; // Crew // Person info
private String character = DEFAULT_STRING; // Cast private boolean adult = false;
private int order = -1; // Cast @JsonProperty("also_known_as")
@JsonProperty("adult") private List<String> aka = new ArrayList<String>();
private boolean adult = false; // Person info @JsonProperty("biography")
@JsonProperty("also_known_as") private String biography = DEFAULT_STRING;
private List<String> aka = new ArrayList<String>(); @JsonProperty("birthday")
@JsonProperty("biography") private String birthday = DEFAULT_STRING;
private String biography = DEFAULT_STRING; @JsonProperty("deathday")
@JsonProperty("birthday") private String deathday = DEFAULT_STRING;
private String birthday = DEFAULT_STRING; @JsonProperty("homepage")
@JsonProperty("deathday") private String homepage = DEFAULT_STRING;
private String deathday = DEFAULT_STRING; @JsonProperty("place_of_birth")
@JsonProperty("homepage") private String birthplace = DEFAULT_STRING;
private String homepage = DEFAULT_STRING; @JsonProperty("imdb_id")
@JsonProperty("place_of_birth") private String imdbId = DEFAULT_STRING;
private String birthplace = DEFAULT_STRING; @JsonProperty("popularity")
@JsonProperty("imdb_id") private float popularity = 0.0f;
private String imdbId = DEFAULT_STRING;
@JsonProperty("popularity") /**
private float popularity = 0.0f; * Add a crew member
*
/** * @param id
* Add a crew member * @param name
* * @param profilePath
* @param id * @param department
* @param name * @param job
* @param profilePath */
* @param department public void addCrew(int id, String name, String profilePath, String department, String job) {
* @param job setPersonType(PersonType.CREW);
*/ setId(id);
public void addCrew(int id, String name, String profilePath, String department, String job) { setName(name);
this.personType = PersonType.CREW; setProfilePath(profilePath);
this.id = id; setDepartment(department);
this.name = name; setJob(job);
this.profilePath = profilePath; setCharacter("");
this.department = department; setOrder(-1);
this.job = job; }
this.character = "";
this.order = -1; /**
} * Add a cast member
*
/** * @param id
* Add a cast member * @param name
* * @param profilePath
* @param id * @param character
* @param name * @param order
* @param profilePath */
* @param character public void addCast(int id, String name, String profilePath, String character, int order) {
* @param order setPersonType(PersonType.CAST);
*/ setId(id);
public void addCast(int id, String name, String profilePath, String character, int order) { setName(name);
this.personType = PersonType.CAST; setProfilePath(profilePath);
this.id = id; setCharacter(character);
this.name = name; setOrder(order);
this.profilePath = profilePath; setDepartment(CAST_DEPARTMENT);
this.character = character; setJob(CAST_JOB);
this.order = order; }
this.department = CAST_DEPARTMENT;
this.job = CAST_JOB; public String getCharacter() {
} return character;
}
// <editor-fold defaultstate="collapsed" desc="Getter methods">
public String getCharacter() { public String getDepartment() {
return character; return department;
} }
public String getDepartment() { public int getId() {
return department; return id;
} }
public int getId() { public String getJob() {
return id; return job;
} }
public String getJob() { public String getName() {
return job; return name;
} }
public String getName() { public int getOrder() {
return name; return order;
} }
public int getOrder() { public PersonType getPersonType() {
return order; return personType;
} }
public PersonType getPersonType() { public String getProfilePath() {
return personType; return profilePath;
} }
public String getProfilePath() { public boolean isAdult() {
return profilePath; return adult;
} }
public boolean isAdult() { public List<String> getAka() {
return adult; return aka;
} }
public List<String> getAka() { public String getBiography() {
return aka; return biography;
} }
public String getBiography() { public String getBirthday() {
return biography; return birthday;
} }
public String getBirthday() { public String getBirthplace() {
return birthday; return birthplace;
} }
public String getBirthplace() { public String getDeathday() {
return birthplace; return deathday;
} }
public String getDeathday() { public String getHomepage() {
return deathday; return homepage;
} }
public String getHomepage() { public String getImdbId() {
return homepage; return imdbId;
} }
public String getImdbId() { public float getPopularity() {
return imdbId; return popularity;
} }
public float getPopularity() { public void setCharacter(String character) {
return popularity; this.character = character;
} }
// </editor-fold>
public void setDepartment(String department) {
// <editor-fold defaultstate="collapsed" desc="Setter methods"> this.department = department;
public void setCharacter(String character) { }
this.character = character;
} public void setId(int id) {
this.id = id;
public void setDepartment(String department) { }
this.department = department;
} public void setJob(String job) {
this.job = StringUtils.trimToEmpty(job);
public void setId(int id) { }
this.id = id;
} public void setName(String name) {
this.name = StringUtils.trimToEmpty(name);
public void setJob(String job) { }
this.job = job;
} public void setOrder(int order) {
this.order = order;
public void setName(String name) { }
this.name = name;
} public void setPersonType(PersonType personType) {
this.personType = personType;
public void setOrder(int order) { }
this.order = order;
} public void setProfilePath(String profilePath) {
this.profilePath = StringUtils.trimToEmpty(profilePath);
public void setPersonType(PersonType personType) { }
this.personType = personType;
} public void setAdult(boolean adult) {
this.adult = adult;
public void setProfilePath(String profilePath) { }
this.profilePath = profilePath;
} public void setAka(List<String> aka) {
this.aka = aka;
public void setAdult(boolean adult) { }
this.adult = adult;
} public void setBiography(String biography) {
this.biography = StringUtils.trimToEmpty(biography);
public void setAka(List<String> aka) { }
this.aka = aka;
} public void setBirthday(String birthday) {
this.birthday = StringUtils.trimToEmpty(birthday);
public void setBiography(String biography) { }
this.biography = biography;
} public void setBirthplace(String birthplace) {
this.birthplace = StringUtils.trimToEmpty(birthplace);
public void setBirthday(String birthday) { }
this.birthday = birthday;
} public void setDeathday(String deathday) {
this.deathday = StringUtils.trimToEmpty(deathday);
public void setBirthplace(String birthplace) { }
this.birthplace = birthplace;
} public void setHomepage(String homepage) {
this.homepage = StringUtils.trimToEmpty(homepage);
public void setDeathday(String deathday) { }
this.deathday = deathday;
} public void setImdbId(String imdbId) {
this.imdbId = StringUtils.trimToEmpty(imdbId);
public void setHomepage(String homepage) { }
this.homepage = homepage;
} public void setPopularity(float popularity) {
this.popularity = popularity;
public void setImdbId(String imdbId) { }
this.imdbId = imdbId;
} @Override
public boolean equals(Object obj) {
public void setPopularity(float popularity) { if (obj == null) {
this.popularity = popularity; return false;
} }
// </editor-fold> if (getClass() != obj.getClass()) {
return false;
/** }
* Handle unknown properties and print a message final Person other = (Person) obj;
* if (this.id != other.id) {
* @param key return false;
* @param value }
*/ if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
@JsonAnySetter return false;
public void handleUnknown(String key, Object value) { }
StringBuilder sb = new StringBuilder(); if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
sb.append("Unknown property: '").append(key); return false;
sb.append("' value: '").append(value).append("'"); }
LOG.trace(sb.toString()); if (this.personType != other.personType) {
} return false;
}
@Override if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
public boolean equals(Object obj) { return false;
if (obj == null) { }
return false; if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
} return false;
if (getClass() != obj.getClass()) { }
return false; if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
} return false;
final Person other = (Person) obj; }
if (this.id != other.id) { return true;
return false; }
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { @Override
return false; public int hashCode() {
} int hash = 3;
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) { hash = 37 * hash + this.id;
return false; hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
} hash = 37 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
if (this.personType != other.personType) { hash = 37 * hash + (this.personType != null ? this.personType.hashCode() : 0);
return false; hash = 37 * hash + (this.department != null ? this.department.hashCode() : 0);
} hash = 37 * hash + (this.job != null ? this.job.hashCode() : 0);
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) { hash = 37 * hash + (this.character != null ? this.character.hashCode() : 0);
return false; return hash;
} }
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) { }
return false;
}
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
hash = 37 * hash + this.id;
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 37 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
hash = 37 * hash + (this.personType != null ? this.personType.hashCode() : 0);
hash = 37 * hash + (this.department != null ? this.department.hashCode() : 0);
hash = 37 * hash + (this.job != null ? this.job.hashCode() : 0);
hash = 37 * hash + (this.character != null ? this.character.hashCode() : 0);
return hash;
}
@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,173 +1,133 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; * @author Stuart
*/
/** public class PersonCast extends AbstractJsonMapping {
*
* @author Stuart private static final long serialVersionUID = 1L;
*/
public class PersonCast implements Serializable { /*
* Properties
private static final long serialVersionUID = 1L; */
@JsonProperty("id")
/* private int id;
* Logger @JsonProperty("character")
*/ private String character;
private static final Logger LOG = LoggerFactory.getLogger(PersonCast.class); @JsonProperty("name")
/* private String name;
* Properties @JsonProperty("order")
*/ private int order;
@JsonProperty("id") @JsonProperty("profile_path")
private int id; private String profilePath;
@JsonProperty("character") @JsonProperty("cast_id")
private String character; private int castId;
@JsonProperty("name")
private String name; public String getCharacter() {
@JsonProperty("order") return character;
private int order; }
@JsonProperty("profile_path")
private String profilePath; public int getId() {
@JsonProperty("cast_id") return id;
private int castId; }
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public String getName() {
public String getCharacter() { return name;
return character; }
}
public int getOrder() {
public int getId() { return order;
return id; }
}
public String getProfilePath() {
public String getName() { return profilePath;
return name; }
}
public int getCastId() {
public int getOrder() { return castId;
return order; }
}
public void setCharacter(String character) {
public String getProfilePath() { this.character = StringUtils.trimToEmpty(character);
return profilePath; }
}
public void setId(int id) {
public int getCastId() { this.id = id;
return castId; }
}
public void setName(String name) {
//</editor-fold> this.name = StringUtils.trimToEmpty(name);
}
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCharacter(String character) { public void setOrder(int order) {
this.character = character; this.order = order;
} }
public void setId(int id) { public void setProfilePath(String profilePath) {
this.id = id; this.profilePath = StringUtils.trimToEmpty(profilePath);
} }
public void setName(String name) { public void setCastId(int castId) {
this.name = name; this.castId = castId;
} }
public void setOrder(int order) { @Override
this.order = order; public boolean equals(Object obj) {
} if (obj == null) {
return false;
public void setProfilePath(String profilePath) { }
this.profilePath = profilePath; if (getClass() != obj.getClass()) {
} return false;
}
public void setCastId(int castId) { final PersonCast other = (PersonCast) obj;
this.castId = castId; if (this.id != other.id) {
} return false;
}
//</editor-fold> if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
return false;
/** }
* Handle unknown properties and print a message if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
* return false;
* @param key }
* @param value if (this.order != other.order) {
*/ 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("'"); return true;
LOG.trace(sb.toString()); }
}
@Override
@Override public int hashCode() {
public boolean equals(Object obj) { int hash = 7;
if (obj == null) { hash = 41 * hash + this.id;
return false; hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0);
} hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
if (getClass() != obj.getClass()) { hash = 41 * hash + this.order;
return false; hash = 41 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
} return hash;
final PersonCast other = (PersonCast) obj; }
if (this.id != other.id) { }
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.order != other.order) {
return false;
}
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 41 * hash + this.id;
hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0);
hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 41 * hash + this.order;
hash = 41 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[PersonCast=");
sb.append("id=").append(id);
sb.append("],[character=").append(character);
sb.append("],[name=").append(name);
sb.append("],[order=").append(order);
sb.append("],[profilePath=").append(profilePath);
sb.append("]]");
return sb.toString();
}
}
@@ -1,178 +1,134 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; * @author stuart.boston
*/
/** public class PersonCredit extends AbstractJsonMapping {
*
* @author stuart.boston private static final long serialVersionUID = 1L;
*/ private static final String DEFAULT_STRING = "";
public class PersonCredit implements Serializable { /*
* Properties
private static final long serialVersionUID = 1L; */
@JsonProperty("id")
/* private int movieId = 0;
* Logger @JsonProperty("character")
*/ private String character = DEFAULT_STRING;
private static final Logger LOG = LoggerFactory.getLogger(PersonCredit.class); @JsonProperty("original_title")
private static final String DEFAULT_STRING = ""; private String movieOriginalTitle = DEFAULT_STRING;
/* @JsonProperty("poster_path")
* Properties private String posterPath = DEFAULT_STRING;
*/ @JsonProperty("release_date")
@JsonProperty("id") private String releaseDate = DEFAULT_STRING;
private int movieId = 0; @JsonProperty("title")
@JsonProperty("character") private String movieTitle = DEFAULT_STRING;
private String character = DEFAULT_STRING; @JsonProperty("department")
@JsonProperty("original_title") private String department = DEFAULT_STRING;
private String movieOriginalTitle = DEFAULT_STRING; @JsonProperty("job")
@JsonProperty("poster_path") private String job = DEFAULT_STRING;
private String posterPath = DEFAULT_STRING; @JsonProperty("adult")
@JsonProperty("release_date") private String adult = DEFAULT_STRING;
private String releaseDate = DEFAULT_STRING; private PersonType personType = PersonType.PERSON;
@JsonProperty("title")
private String movieTitle = DEFAULT_STRING; public String getCharacter() {
@JsonProperty("department") return character;
private String department = DEFAULT_STRING; }
@JsonProperty("job")
private String job = DEFAULT_STRING; public String getDepartment() {
@JsonProperty("adult") return department;
private String adult = DEFAULT_STRING; }
private PersonType personType = PersonType.PERSON;
public String getJob() {
//<editor-fold defaultstate="collapsed" desc="Getter Methods"> return job;
public String getCharacter() { }
return character;
} public int getMovieId() {
return movieId;
public String getDepartment() { }
return department;
} public String getMovieOriginalTitle() {
return movieOriginalTitle;
public String getJob() { }
return job;
} public String getMovieTitle() {
return movieTitle;
public int getMovieId() { }
return movieId;
} public PersonType getPersonType() {
return personType;
public String getMovieOriginalTitle() { }
return movieOriginalTitle;
} public String getPosterPath() {
return posterPath;
public String getMovieTitle() { }
return movieTitle;
} public String getReleaseDate() {
return releaseDate;
public PersonType getPersonType() { }
return personType;
} public String getAdult() {
return adult;
public String getPosterPath() { }
return posterPath;
} public void setCharacter(String character) {
this.character = StringUtils.trimToEmpty(character);
public String getReleaseDate() { }
return releaseDate;
} public void setDepartment(String department) {
this.department = StringUtils.trimToEmpty(department);
public String getAdult() { }
return adult;
} public void setJob(String job) {
//</editor-fold> this.job = StringUtils.trimToEmpty(job);
}
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setCharacter(String character) { public void setMovieId(int movieId) {
this.character = character; this.movieId = movieId;
} }
public void setDepartment(String department) { public void setMovieOriginalTitle(String movieOriginalTitle) {
this.department = department; this.movieOriginalTitle = StringUtils.trimToEmpty(movieOriginalTitle);
} }
public void setJob(String job) { public void setMovieTitle(String movieTitle) {
this.job = job; this.movieTitle = StringUtils.trimToEmpty(movieTitle);
} }
public void setMovieId(int movieId) { public void setPersonType(PersonType personType) {
this.movieId = movieId; this.personType = personType;
} }
public void setMovieOriginalTitle(String movieOriginalTitle) { public void setPosterPath(String posterPath) {
this.movieOriginalTitle = movieOriginalTitle; this.posterPath = StringUtils.trimToEmpty(posterPath);
} }
public void setMovieTitle(String movieTitle) { public void setReleaseDate(String releaseDate) {
this.movieTitle = movieTitle; this.releaseDate = StringUtils.trimToEmpty(releaseDate);
} }
public void setPersonType(PersonType personType) { public void setAdult(String adult) {
this.personType = personType; this.adult = StringUtils.trimToEmpty(adult);
} }
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath;
}
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
}
public void setAdult(String adult) {
this.adult = adult;
}
//</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() {
StringBuilder sb = new StringBuilder("[PersonCredit=");
sb.append("[movieId=").append(movieId);
sb.append("],[personType=").append(personType);
sb.append("],[originalTitle=").append(movieOriginalTitle);
sb.append("],[movieTitle=").append(movieTitle);
sb.append("],[posterPath=").append(posterPath);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("],[character=").append(character);
sb.append("],[department=").append(department);
sb.append("],[job=").append(job);
sb.append("],[adult=").append(adult);
sb.append("]]");
return sb.toString();
}
}
@@ -1,158 +1,120 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; * @author Stuart
*/
/** public class PersonCrew extends AbstractJsonMapping {
*
* @author Stuart private static final long serialVersionUID = 1L;
*/
public class PersonCrew implements Serializable { /*
* Properties
private static final long serialVersionUID = 1L; */
@JsonProperty("id")
/* private int id;
* Logger @JsonProperty("department")
*/ private String department;
private static final Logger LOG = LoggerFactory.getLogger(PersonCrew.class); @JsonProperty("job")
/* private String job;
* Properties @JsonProperty("name")
*/ private String name;
@JsonProperty("id") @JsonProperty("profile_path")
private int id; private String profilePath;
@JsonProperty("department")
private String department; public String getDepartment() {
@JsonProperty("job") return department;
private String job; }
@JsonProperty("name")
private String name; public int getId() {
@JsonProperty("profile_path") return id;
private String profilePath; }
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public String getJob() {
public String getDepartment() { return job;
return department; }
}
public String getName() {
public int getId() { return name;
return id; }
}
public String getProfilePath() {
public String getJob() { return profilePath;
return job; }
}
public void setDepartment(String department) {
public String getName() { this.department = StringUtils.trimToEmpty(department);
return name; }
}
public void setId(int id) {
public String getProfilePath() { this.id = id;
return profilePath; }
}
//</editor-fold> public void setJob(String job) {
this.job = StringUtils.trimToEmpty(job);
//<editor-fold defaultstate="collapsed" desc="Setter methods"> }
public void setDepartment(String department) {
this.department = department; public void setName(String name) {
} this.name = StringUtils.trimToEmpty(name);
}
public void setId(int id) {
this.id = id; public void setProfilePath(String profilePath) {
} this.profilePath = StringUtils.trimToEmpty(profilePath);
}
public void setJob(String job) {
this.job = job; @Override
} public boolean equals(Object obj) {
if (obj == null) {
public void setName(String name) { return false;
this.name = name; }
} if (getClass() != obj.getClass()) {
return false;
public void setProfilePath(String profilePath) { }
this.profilePath = profilePath; final PersonCrew other = (PersonCrew) obj;
} if (this.id != other.id) {
//</editor-fold> return false;
}
/** if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
* Handle unknown properties and print a message return false;
* }
* @param key if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
* @param value return false;
*/ }
@JsonAnySetter if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
public void handleUnknown(String key, Object value) { return false;
StringBuilder sb = new StringBuilder(); }
sb.append("Unknown property: '").append(key); return true;
sb.append("' value: '").append(value).append("'"); }
LOG.trace(sb.toString());
} @Override
public int hashCode() {
@Override int hash = 7;
public boolean equals(Object obj) { hash = 59 * hash + this.id;
if (obj == null) { hash = 59 * hash + (this.department != null ? this.department.hashCode() : 0);
return false; hash = 59 * hash + (this.job != null ? this.job.hashCode() : 0);
} hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
if (getClass() != obj.getClass()) { hash = 59 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
return false; return hash;
} }
final PersonCrew other = (PersonCrew) obj; }
if (this.id != other.id) {
return false;
}
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
return false;
}
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
return false;
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 59 * hash + this.id;
hash = 59 * hash + (this.department != null ? this.department.hashCode() : 0);
hash = 59 * hash + (this.job != null ? this.job.hashCode() : 0);
hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 59 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[PersonCrew=");
sb.append("id=").append(id);
sb.append("],[department=").append(department);
sb.append("],[job=").append(job);
sb.append("],[name=").append(name);
sb.append("],[profilePath=").append(profilePath);
sb.append("]]");
return sb.toString();
}
}
@@ -1,31 +1,33 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
/** /**
* * @author stuart.boston
* @author stuart.boston */
*/ public enum PersonType {
public enum PersonType {
// A member of the cast
CAST, // A member of the cast CAST,
CREW, // A member of the crew // A member of the crew
PERSON // No specific type CREW,
} // No specific type
PERSON
}
@@ -1,118 +1,82 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
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 org.slf4j.Logger; * @author stuart.boston
import org.slf4j.LoggerFactory; */
@JsonRootName("production_company")
/** public class ProductionCompany extends AbstractJsonMapping {
*
* @author stuart.boston private static final long serialVersionUID = 1L;
*/
@JsonRootName("production_company") /*
public class ProductionCompany implements Serializable { * Properties
*/
private static final long serialVersionUID = 1L; @JsonProperty("id")
private int id;
/* @JsonProperty("name")
* Logger private String name;
*/
private static final Logger LOG = LoggerFactory.getLogger(ProductionCompany.class); public int getId() {
/* return id;
* Properties }
*/
@JsonProperty("id") public String getName() {
private int id; return name;
@JsonProperty("name") }
private String name;
public void setId(int id) {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> this.id = id;
public int getId() { }
return id;
} public void setName(String name) {
this.name = name;
public String getName() { }
return name;
} @Override
//</editor-fold> public boolean equals(Object obj) {
if (obj == null) {
//<editor-fold defaultstate="collapsed" desc="Setter methods"> return false;
public void setId(int id) { }
this.id = id; if (getClass() != obj.getClass()) {
} return false;
}
public void setName(String name) { final ProductionCompany other = (ProductionCompany) obj;
this.name = name; if (this.id != other.id) {
} return false;
//</editor-fold> }
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
/** return false;
* Handle unknown properties and print a message }
* return true;
* @param key }
* @param value
*/ @Override
@JsonAnySetter public int hashCode() {
public void handleUnknown(String key, Object value) { int hash = 5;
StringBuilder sb = new StringBuilder(); hash = 37 * hash + this.id;
sb.append("Unknown property: '").append(key); hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
sb.append("' value: '").append(value).append("'"); return hash;
LOG.trace(sb.toString()); }
} }
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ProductionCompany other = (ProductionCompany) obj;
if (this.id != other.id) {
return false;
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 37 * hash + this.id;
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ProductionCompany=");
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
}
}
@@ -1,118 +1,82 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
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 org.slf4j.Logger; * @author stuart.boston
import org.slf4j.LoggerFactory; */
@JsonRootName("production_country")
/** public class ProductionCountry extends AbstractJsonMapping {
*
* @author stuart.boston private static final long serialVersionUID = 1L;
*/
@JsonRootName("production_country") /*
public class ProductionCountry implements Serializable { * Properties
*/
private static final long serialVersionUID = 1L; @JsonProperty("iso_3166_1")
private String isoCode;
/* @JsonProperty("name")
* Logger private String name;
*/
private static final Logger LOG = LoggerFactory.getLogger(ProductionCountry.class); public String getIsoCode() {
/* return isoCode;
* Properties }
*/
@JsonProperty("iso_3166_1") public String getName() {
private String isoCode; return name;
@JsonProperty("name") }
private String name;
public void setIsoCode(String isoCode) {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> this.isoCode = isoCode;
public String getIsoCode() { }
return isoCode;
} public void setName(String name) {
this.name = name;
public String getName() { }
return name;
} @Override
//</editor-fold> public boolean equals(Object obj) {
if (obj == null) {
//<editor-fold defaultstate="collapsed" desc="Setter methods"> return false;
public void setIsoCode(String isoCode) { }
this.isoCode = isoCode; if (getClass() != obj.getClass()) {
} return false;
}
public void setName(String name) { final ProductionCountry other = (ProductionCountry) obj;
this.name = name; if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
} return false;
//</editor-fold> }
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
/** return false;
* Handle unknown properties and print a message }
* return true;
* @param key }
* @param value
*/ @Override
@JsonAnySetter public int hashCode() {
public void handleUnknown(String key, Object value) { int hash = 7;
StringBuilder sb = new StringBuilder(); hash = 47 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
sb.append("Unknown property: '").append(key); hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
sb.append("' value: '").append(value).append("'"); return hash;
LOG.trace(sb.toString()); }
} }
@Override
public boolean equals(Object obj) {
if (obj == null) {
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)) {
return false;
}
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 47 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ProductionCountry=");
sb.append("[isoCode=").append(isoCode);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
}
}
@@ -1,131 +1,94 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; /**
import org.slf4j.Logger; * @author Stuart
import org.slf4j.LoggerFactory; */
public class ReleaseInfo extends AbstractJsonMapping {
/**
* private static final long serialVersionUID = 1L;
* @author Stuart
*/ /*
public class ReleaseInfo implements Serializable { * Properties
*/
private static final long serialVersionUID = 1L; @JsonProperty("iso_3166_1")
private String country;
/* @JsonProperty("certification")
* Logger private String certification;
*/ @JsonProperty("release_date")
private static final Logger LOG = LoggerFactory.getLogger(ReleaseInfo.class); private String releaseDate;
/*
* Properties public String getCertification() {
*/ return certification;
@JsonProperty("iso_3166_1") }
private String country;
@JsonProperty("certification") public String getCountry() {
private String certification; return country;
@JsonProperty("release_date") }
private String releaseDate;
public String getReleaseDate() {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> return releaseDate;
public String getCertification() { }
return certification;
} public void setCertification(String certification) {
this.certification = certification;
public String getCountry() { }
return country;
} public void setCountry(String country) {
this.country = country;
public String getReleaseDate() { }
return releaseDate;
} public void setReleaseDate(String releaseDate) {
//</editor-fold> this.releaseDate = releaseDate;
}
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCertification(String certification) { @Override
this.certification = certification; public boolean equals(Object obj) {
} if (obj == null) {
return false;
public void setCountry(String country) { }
this.country = country; if (getClass() != obj.getClass()) {
} return false;
}
public void setReleaseDate(String releaseDate) { final ReleaseInfo other = (ReleaseInfo) obj;
this.releaseDate = releaseDate; if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
} return false;
//</editor-fold> }
if ((this.certification == null) ? (other.certification != null) : !this.certification.equals(other.certification)) {
/** return false;
* Handle unknown properties and print a message }
* if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
* @param key return false;
* @param value }
*/ return true;
@JsonAnySetter }
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder(); @Override
sb.append("Unknown property: '").append(key); public int hashCode() {
sb.append("' value: '").append(value).append("'"); int hash = 3;
LOG.trace(sb.toString()); hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
} hash = 89 * hash + (this.certification != null ? this.certification.hashCode() : 0);
hash = 89 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
@Override return hash;
public boolean equals(Object obj) { }
if (obj == null) { }
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)) {
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;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
hash = 89 * hash + (this.certification != null ? this.certification.hashCode() : 0);
hash = 89 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ReleaseInfo=");
sb.append("[country=").append(country);
sb.append("],[certification=").append(certification);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("]]");
return sb.toString();
}
}
@@ -0,0 +1,74 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* @author Stuart
*/
public class Reviews extends AbstractJsonMapping {
private static final long serialVersionUID = 1L;
/*
* Properties
*/
@JsonProperty("id")
private String id;
@JsonProperty("author")
private String author;
@JsonProperty("content")
private String content;
@JsonProperty("url")
private String url;
public String getId() {
return id;
}
public String getAuthor() {
return author;
}
public String getContent() {
return content;
}
public String getUrl() {
return url;
}
public void setId(String id) {
this.id = id;
}
public void setAuthor(String author) {
this.author = author;
}
public void setContent(String content) {
this.content = content;
}
public void setUrl(String url) {
this.url = url;
}
}
@@ -1,89 +1,54 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; /**
import org.slf4j.Logger; * @author Stuart
import org.slf4j.LoggerFactory; */
public class StatusCode extends AbstractJsonMapping {
/**
* private static final long serialVersionUID = 1L;
* @author Stuart
*/ /*
public class StatusCode implements Serializable { * Properties
*/
private static final long serialVersionUID = 1L; @JsonProperty("status_code")
private int statusCode;
/* @JsonProperty("status_message")
* Logger private String statusMessage;
*/
private static final Logger LOG = LoggerFactory.getLogger(StatusCode.class); public int getStatusCode() {
/* return statusCode;
* Properties }
*/
@JsonProperty("status_code") public void setStatusCode(int statusCode) {
private int statusCode; this.statusCode = statusCode;
@JsonProperty("status_message") }
private String statusMessage;
public String getStatusMessage() {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> return statusMessage;
public int getStatusCode() { }
return statusCode;
} public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
public void setStatusCode(int statusCode) { }
this.statusCode = statusCode; }
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public String getStatusMessage() {
return statusMessage;
}
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
}
//</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() {
StringBuilder sb = new StringBuilder();
sb.append("Status Code: ").append(statusCode);
sb.append(", Message: ").append(statusMessage);
return sb.toString();
}
}
@@ -1,207 +1,174 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; * @author stuart.boston
*/
/** public class TmdbConfiguration extends AbstractJsonMapping {
*
* @author stuart.boston private static final long serialVersionUID = 1L;
*/ /*
public class TmdbConfiguration implements Serializable { * Properties
*/
private static final long serialVersionUID = 1L; @JsonProperty("base_url")
/* private String baseUrl;
* Logger @JsonProperty("secure_base_url")
*/ private String secureBaseUrl;
private static final Logger LOG = LoggerFactory.getLogger(TmdbConfiguration.class); @JsonProperty("poster_sizes")
/* private List<String> posterSizes;
* Properties @JsonProperty("backdrop_sizes")
*/ private List<String> backdropSizes;
@JsonProperty("base_url") @JsonProperty("profile_sizes")
private String baseUrl; private List<String> profileSizes;
@JsonProperty("secure_base_url") @JsonProperty("logo_sizes")
private String secureBaseUrl; private List<String> logoSizes;
@JsonProperty("poster_sizes")
private List<String> posterSizes; public List<String> getBackdropSizes() {
@JsonProperty("backdrop_sizes") return backdropSizes;
private List<String> backdropSizes; }
@JsonProperty("profile_sizes")
private List<String> profileSizes; public String getBaseUrl() {
@JsonProperty("logo_sizes") return baseUrl;
private List<String> logoSizes; }
// <editor-fold defaultstate="collapsed" desc="Getter methods">//GEN-BEGIN:getterMethods public List<String> getPosterSizes() {
public List<String> getBackdropSizes() { return posterSizes;
return backdropSizes; }
}
public List<String> getProfileSizes() {
public String getBaseUrl() { return profileSizes;
return baseUrl; }
}
public List<String> getLogoSizes() {
public List<String> getPosterSizes() { return logoSizes;
return posterSizes; }
}
public String getSecureBaseUrl() {
public List<String> getProfileSizes() { return secureBaseUrl;
return profileSizes; }
}
public void setBackdropSizes(List<String> backdropSizes) {
public List<String> getLogoSizes() { this.backdropSizes = backdropSizes;
return logoSizes; }
}
public void setBaseUrl(String baseUrl) {
public String getSecureBaseUrl() { this.baseUrl = baseUrl;
return secureBaseUrl; }
}
public void setPosterSizes(List<String> posterSizes) {
// </editor-fold> this.posterSizes = posterSizes;
// <editor-fold defaultstate="collapsed" desc="Setter methods">//GEN-BEGIN:setterMethods }
public void setBackdropSizes(List<String> backdropSizes) {
this.backdropSizes = backdropSizes; public void setProfileSizes(List<String> profileSizes) {
} this.profileSizes = profileSizes;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl; public void setLogoSizes(List<String> logoSizes) {
} this.logoSizes = logoSizes;
}
public void setPosterSizes(List<String> posterSizes) {
this.posterSizes = posterSizes; public void setSecureBaseUrl(String secureBaseUrl) {
} this.secureBaseUrl = secureBaseUrl;
}
public void setProfileSizes(List<String> profileSizes) {
this.profileSizes = profileSizes; /**
} * Copy the data from the passed object to this one
*
public void setLogoSizes(List<String> logoSizes) { * @param config
this.logoSizes = logoSizes; */
} public void clone(TmdbConfiguration config) {
backdropSizes = config.getBackdropSizes();
public void setSecureBaseUrl(String secureBaseUrl) { baseUrl = config.getBaseUrl();
this.secureBaseUrl = secureBaseUrl; posterSizes = config.getPosterSizes();
} profileSizes = config.getProfileSizes();
// </editor-fold> logoSizes = config.getLogoSizes();
}
/**
* Copy the data from the passed object to this one /**
* * Check that the poster size is valid
* @param config *
*/ * @param posterSize
public void clone(TmdbConfiguration config) { * @return
backdropSizes = config.getBackdropSizes(); */
baseUrl = config.getBaseUrl(); public boolean isValidPosterSize(String posterSize) {
posterSizes = config.getPosterSizes(); if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) {
profileSizes = config.getProfileSizes(); return false;
logoSizes = config.getLogoSizes(); }
} return posterSizes.contains(posterSize);
}
/**
* Check that the poster size is valid /**
* * Check that the backdrop size is valid
* @param posterSize *
*/ * @param backdropSize
public boolean isValidPosterSize(String posterSize) { * @return
if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) { */
return false; public boolean isValidBackdropSize(String backdropSize) {
} if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) {
return posterSizes.contains(posterSize); return false;
} }
return backdropSizes.contains(backdropSize);
/** }
* Check that the backdrop size is valid
* /**
* @param backdropSize * Check that the profile size is valid
*/ *
public boolean isValidBackdropSize(String backdropSize) { * @param profileSize
if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) { * @return
return false; */
} public boolean isValidProfileSize(String profileSize) {
return backdropSizes.contains(backdropSize); if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) {
} return false;
}
/** return profileSizes.contains(profileSize);
* Check that the profile size is valid }
*
* @param profileSize /**
*/ * Check that the logo size is valid
public boolean isValidProfileSize(String profileSize) { *
if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) { * @param logoSize
return false; * @return
} */
return profileSizes.contains(profileSize); public boolean isValidLogoSize(String logoSize) {
} if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) {
return false;
/** }
* Check that the logo size is valid return logoSizes.contains(logoSize);
* }
* @param logoSize
*/ /**
public boolean isValidLogoSize(String logoSize) { * Check to see if the size is valid for any of the images types
if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) { *
return false; * @param sizeToCheck
} * @return
return logoSizes.contains(logoSize); */
} public boolean isValidSize(String sizeToCheck) {
return (isValidPosterSize(sizeToCheck)
/** || isValidBackdropSize(sizeToCheck)
* Check to see if the size is valid for any of the images types || isValidProfileSize(sizeToCheck)
* || isValidLogoSize(sizeToCheck));
* @param sizeToCheck }
*/ }
public boolean isValidSize(String sizeToCheck) {
return (isValidPosterSize(sizeToCheck)
|| isValidBackdropSize(sizeToCheck)
|| isValidProfileSize(sizeToCheck)
|| isValidLogoSize(sizeToCheck));
}
/**
* 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() {
StringBuilder sb = new StringBuilder("[ImageConfiguration=");
sb.append("[baseUrl=").append(baseUrl);
sb.append("],[posterSizes=").append(posterSizes.toString());
sb.append("],[backdropSizes=").append(backdropSizes.toString());
sb.append("],[profileSizes=").append(profileSizes.toString());
sb.append("],[logoSizes=").append(logoSizes.toString());
sb.append(("]]"));
return sb.toString();
}
}
@@ -1,89 +1,59 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger; public class TokenAuthorisation extends AbstractJsonMapping {
import org.slf4j.LoggerFactory;
/*
public class TokenAuthorisation { * Properties
/* */
* Logger @JsonProperty("expires_at")
*/ private String expires;
private static final Logger LOG = LoggerFactory.getLogger(TokenAuthorisation.class); @JsonProperty("request_token")
/* private String requestToken;
* Properties @JsonProperty("success")
*/ private Boolean success;
@JsonProperty("expires_at")
private String expires; public String getExpires() {
@JsonProperty("request_token") return expires;
private String requestToken; }
@JsonProperty("success")
private Boolean success; public String getRequestToken() {
return requestToken;
// <editor-fold defaultstate="collapsed" desc="Getter methods"> }
public String getExpires() {
return expires; public Boolean getSuccess() {
} return success;
}
public String getRequestToken() {
return requestToken; public void setExpires(String expires) {
} this.expires = expires;
}
public Boolean getSuccess() {
return success; public void setRequestToken(String requestToken) {
} this.requestToken = requestToken;
// </editor-fold> }
// <editor-fold defaultstate="collapsed" desc="Setter methods"> public void setSuccess(Boolean success) {
public void setExpires(String expires) { this.success = success;
this.expires = expires; }
} }
public void setRequestToken(String requestToken) {
this.requestToken = requestToken;
}
public void setSuccess(Boolean success) {
this.success = success;
}
// </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 "TokenAuthorisation{" + "expires=" + expires + ", requestToken=" + requestToken + ", success=" + success + '}';
}
}
@@ -1,120 +1,89 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger; public class TokenSession extends AbstractJsonMapping {
import org.slf4j.LoggerFactory;
/*
public class TokenSession { * Properties
/* */
* Logger @JsonProperty("session_id")
*/ private String sessionId;
@JsonProperty("success")
private static final Logger LOG = LoggerFactory.getLogger(TokenSession.class); private Boolean success;
/* @JsonProperty("status_code")
* Properties private String statusCode;
*/ @JsonProperty("status_message")
@JsonProperty("session_id") private String statusMessage;
private String sessionId; @JsonProperty("guest_session_id")
@JsonProperty("success") private String guestSessionId;
private Boolean success; @JsonProperty("expires_at")
@JsonProperty("status_code") private String expiresAt;
private String statusCode;
@JsonProperty("status_message") public String getSessionId() {
private String statusMessage; return sessionId;
@JsonProperty("guest_session_id") }
private String guestSessionId;
@JsonProperty("expires_at") public Boolean getSuccess() {
private String expiresAt; return success;
}
// <editor-fold defaultstate="collapsed" desc="Getter methods">
public String getSessionId() { public String getStatusCode() {
return sessionId; return statusCode;
} }
public Boolean getSuccess() { public String getStatusMessage() {
return success; return statusMessage;
} }
public String getStatusCode() { public String getGuestSessionId() {
return statusCode; return guestSessionId;
} }
public String getStatusMessage() { public String getExpiresAt() {
return statusMessage; return expiresAt;
} }
public String getGuestSessionId() { public void setSessionId(String sessionId) {
return guestSessionId; this.sessionId = sessionId;
} }
public String getExpiresAt() { public void setSuccess(Boolean success) {
return expiresAt; this.success = success;
} }
// </editor-fold>
public void setStatusCode(String statusCode) {
// <editor-fold defaultstate="collapsed" desc="Setter methods"> this.statusCode = statusCode;
public void setSessionId(String sessionId) { }
this.sessionId = sessionId;
} public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
public void setSuccess(Boolean success) { }
this.success = success;
} public void setGuestSessionId(String guestSessionId) {
this.guestSessionId = guestSessionId;
public void setStatusCode(String statusCode) { }
this.statusCode = statusCode;
} public void setExpiresAt(String expiresAt) {
this.expiresAt = expiresAt;
public void setStatusMessage(String statusMessage) { }
this.statusMessage = statusMessage; }
}
public void setGuestSessionId(String guestSessionId) {
this.guestSessionId = guestSessionId;
}
public void setExpiresAt(String expiresAt) {
this.expiresAt = expiresAt;
}
// </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 "TokenSession{" + "sessionId=" + sessionId + ", success=" + success + ", statusCode=" + statusCode + ", statusMessage=" + statusMessage + ", guestSessionId=" + guestSessionId + ", expiresAt=" + expiresAt + '}';
}
}
@@ -1,143 +1,114 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; /**
import java.io.Serializable; * @author Stuart
import org.slf4j.Logger; */
import org.slf4j.LoggerFactory; public class Trailer extends AbstractJsonMapping {
/** private static final long serialVersionUID = 1L;
*
* @author Stuart /*
*/ * Website sources
public class Trailer implements Serializable { */
public static final String WEBSITE_YOUTUBE = "youtube";
private static final long serialVersionUID = 1L; public static final String WEBSITE_QUICKTIME = "quicktime";
/*
/* * Properties
* Logger */
*/ private String name;
private static final Logger LOG = LoggerFactory.getLogger(Trailer.class); private String size;
/* private String source;
* Website sources // The website of the trailer
*/ private String website;
public static final String WEBSITE_YOUTUBE = "youtube"; private String type;
public static final String WEBSITE_QUICKTIME = "quicktime";
/* public String getName() {
* Properties return name;
*/ }
private String name;
private String size; public String getSize() {
private String source; return size;
private String website; // The website of the trailer }
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public String getSource() {
public String getName() { return source;
return name; }
}
public String getWebsite() {
public String getSize() { return website;
return size; }
}
public String getType() {
public String getSource() { return type;
return source; }
}
public void setName(String name) {
public String getWebsite() { this.name = name;
return website; }
}
//</editor-fold> public void setSize(String size) {
this.size = size;
//<editor-fold defaultstate="collapsed" desc="Setter methods"> }
public void setName(String name) {
this.name = name; public void setSource(String source) {
} this.source = source;
}
public void setSize(String size) {
this.size = size; public void setWebsite(String website) {
} this.website = website;
}
public void setSource(String source) {
this.source = source; public void setType(String type) {
} this.type = type;
}
public void setWebsite(String website) {
this.website = website; @Override
} public boolean equals(Object obj) {
//</editor-fold> if (obj == null) {
return false;
/** }
* Handle unknown properties and print a message if (getClass() != obj.getClass()) {
* return false;
* @param key }
* @param value final Trailer other = (Trailer) obj;
*/ if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
@JsonAnySetter return false;
public void handleUnknown(String key, Object value) { }
StringBuilder sb = new StringBuilder(); if ((this.size == null) ? (other.size != null) : !this.size.equals(other.size)) {
sb.append("Unknown property: '").append(key); return false;
sb.append("' value: '").append(value).append("'"); }
LOG.trace(sb.toString()); if ((this.source == null) ? (other.source != null) : !this.source.equals(other.source)) {
} return false;
}
@Override return true;
public boolean equals(Object obj) { }
if (obj == null) {
return false; @Override
} public int hashCode() {
if (getClass() != obj.getClass()) { int hash = 7;
return false; hash = 61 * hash + (this.name != null ? this.name.hashCode() : 0);
} hash = 61 * hash + (this.size != null ? this.size.hashCode() : 0);
final Trailer other = (Trailer) obj; hash = 61 * hash + (this.source != null ? this.source.hashCode() : 0);
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { hash = 61 * hash + (this.website != null ? this.website.hashCode() : 0);
return false; return hash;
} }
if ((this.size == null) ? (other.size != null) : !this.size.equals(other.size)) { }
return false;
}
if ((this.source == null) ? (other.source != null) : !this.source.equals(other.source)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 61 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 61 * hash + (this.size != null ? this.size.hashCode() : 0);
hash = 61 * hash + (this.source != null ? this.source.hashCode() : 0);
hash = 61 * hash + (this.website != null ? this.website.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Trailer=");
sb.append("name=").append(name);
sb.append("],[size=").append(size);
sb.append("],[source=").append(source);
sb.append("],[website=").append(website);
sb.append("]]");
return sb.toString();
}
}
@@ -1,131 +1,101 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.builder.ToStringBuilder;
import java.io.Serializable; import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
* @author Stuart
/** */
* public class Translation extends AbstractJsonMapping {
* @author Stuart
*/ private static final long serialVersionUID = 1L;
public class Translation implements Serializable {
/*
private static final long serialVersionUID = 1L; * Properties
*/
/* @JsonProperty("english_name")
* Logger private String englishName;
*/ @JsonProperty("iso_639_1")
private static final Logger LOG = LoggerFactory.getLogger(Translation.class); private String isoCode;
/* @JsonProperty("name")
* Properties private String name;
*/
@JsonProperty("english_name") public String getEnglishName() {
private String englishName; return englishName;
@JsonProperty("iso_639_1") }
private String isoCode;
@JsonProperty("name") public String getIsoCode() {
private String name; return isoCode;
}
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getEnglishName() { public String getName() {
return englishName; return name;
} }
public String getIsoCode() { public void setEnglishName(String englishName) {
return isoCode; this.englishName = englishName;
} }
public String getName() { public void setIsoCode(String isoCode) {
return name; this.isoCode = isoCode;
} }
//</editor-fold>
public void setName(String name) {
//<editor-fold defaultstate="collapsed" desc="Setter methods"> this.name = name;
public void setEnglishName(String englishName) { }
this.englishName = englishName;
} @Override
public boolean equals(Object obj) {
public void setIsoCode(String isoCode) { if (obj == null) {
this.isoCode = isoCode; return false;
} }
if (getClass() != obj.getClass()) {
public void setName(String name) { return false;
this.name = name; }
} final Translation other = (Translation) obj;
//</editor-fold> if ((this.englishName == null) ? (other.englishName != null) : !this.englishName.equals(other.englishName)) {
return false;
/** }
* Handle unknown properties and print a message if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
* 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) { return true;
StringBuilder sb = new StringBuilder(); }
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); @Override
LOG.trace(sb.toString()); public int hashCode() {
} int hash = 3;
hash = 29 * hash + (this.englishName != null ? this.englishName.hashCode() : 0);
@Override hash = 29 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
public boolean equals(Object obj) { hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0);
if (obj == null) { return hash;
return false; }
}
if (getClass() != obj.getClass()) { @Override
return false; public String toString() {
} return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
final Translation other = (Translation) obj; }
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.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
hash = 29 * hash + (this.englishName != null ? this.englishName.hashCode() : 0);
hash = 29 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[Translation=");
sb.append("[englishName=").append(englishName);
sb.append("],[isoCode=").append(isoCode);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
}
}
@@ -0,0 +1,98 @@
/*
* 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;private either version 3 of the License;private or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful;private
* 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;private see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model.comparator;
import com.omertron.themoviedbapi.model.PersonCredit;
import java.io.Serializable;
import java.util.Comparator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
/**
* Compare two PersonCredits by date
*
* @author stuart.boston
*/
public class PersonCreditDateComparator implements Comparator<PersonCredit>, Serializable {
private static final long serialVersionUID = 1L;
private static final Pattern YEAR_PATTERN = Pattern.compile("(?:.*?)(\\d{4})(?:.*?)");
private final boolean ascending;
public PersonCreditDateComparator() {
this.ascending = Boolean.FALSE;
}
public PersonCreditDateComparator(boolean ascending) {
this.ascending = ascending;
}
@Override
public int compare(PersonCredit pc1, PersonCredit pc2) {
return compare(pc1, pc2, ascending);
}
/**
* Compare two PersonCredits based on the respective years
*
* @param pc1
* @param pc2
* @param ascending
* @return
*/
public int compare(PersonCredit pc1, PersonCredit pc2, boolean ascending) {
boolean valid1 = StringUtils.isNotBlank(pc1.getReleaseDate());
boolean valid2 = StringUtils.isNotBlank(pc2.getReleaseDate());
if (!valid1 && !valid2) {
return 0;
}
if (!valid1) {
return ascending ? -1 : 1;
}
if (!valid2) {
return ascending ? 1 : -1;
}
int year1 = extractYear(pc1.getReleaseDate());
int year2 = extractYear(pc2.getReleaseDate());
return ascending ? (year1 - year2) : (year2 - year1);
}
/**
* locate a 4 digit year in a date string
*
* @param date
* @return
*/
private static int extractYear(String date) {
int year = 0;
Matcher m = YEAR_PATTERN.matcher(date);
if (m.find()) {
year = Integer.valueOf(m.group(1)).intValue();
}
// Give up and return 0
return year;
}
}
@@ -0,0 +1,105 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.results;
import com.omertron.themoviedbapi.wrapper.AbstractWrapper;
import com.omertron.themoviedbapi.wrapper.AbstractWrapperAll;
import com.omertron.themoviedbapi.wrapper.AbstractWrapperId;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* Abstract class to return the results and the id/page info
*
* @author Stuart
*/
public abstract class AbstractResults {
private int id = 0;
private int page = 0;
private int totalPages = 0;
private int totalResults = 0;
//<editor-fold defaultstate="collapsed" desc="Getters">
public int getId() {
return id;
}
public int getPage() {
return page;
}
public int getTotalPages() {
return totalPages;
}
public int getTotalResults() {
return totalResults;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setters">
public void setId(int id) {
this.id = id;
}
public void setPage(int page) {
this.page = page;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
//</editor-fold>
public void copyWrapper(AbstractWrapper wrapper) {
// These results have nothing to copy, so this is just a placeholder
}
/**
* Copy the Id from the wrapper
*
* @param wrapper
*/
public void copyWrapper(AbstractWrapperId wrapper) {
this.id = wrapper.getId();
}
/**
* Copy the Id and pages from the wrapper
*
* @param wrapper
*/
public void copyWrapper(AbstractWrapperAll wrapper) {
this.id = wrapper.getId();
this.page = wrapper.getPage();
this.totalPages = wrapper.getTotalPages();
this.totalResults = wrapper.getTotalResults();
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.results;
import java.util.ArrayList;
import java.util.List;
/**
* List of the results from TheMovieDb
*
* @author Stuart
* @param <T>
*/
public final class TmdbResultsList<T> extends AbstractResults {
private List<T> results;
public TmdbResultsList(List<T> resultList) {
if (resultList != null) {
results = new ArrayList<T>(resultList);
} else {
results = new ArrayList<T>(0);
}
}
public List<T> getResults() {
return results;
}
public void setResults(List<T> results) {
this.results = results;
}
@Override
public int getTotalResults() {
if (super.getTotalResults() == 0) {
return results.size();
} else {
return super.getTotalResults();
}
}
}
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.results;
import java.util.HashMap;
import java.util.Map;
/**
* Map of the results from TheMovieDb
*
* @author Stuart
* @param <K>
* @param <V>
*/
public final class TmdbResultsMap<K, V> extends AbstractResults {
private Map<K, V> results;
public TmdbResultsMap(Map<K, V> resultsMap) {
results = new HashMap<K, V>(resultsMap);
}
public Map<K, V> getResults() {
return results;
}
public void setResults(Map<K, V> results) {
this.results = results;
}
@Override
public int getTotalResults() {
if (super.getTotalResults() == 0) {
return results.size();
} else {
return super.getTotalResults();
}
}
}
@@ -1,213 +1,257 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.tools; package com.omertron.themoviedbapi.tools;
import com.omertron.themoviedbapi.TheMovieDbApi; import java.io.UnsupportedEncodingException;
import java.io.UnsupportedEncodingException; import java.net.MalformedURLException;
import java.net.MalformedURLException; import java.net.URL;
import java.net.URL; import java.net.URLEncoder;
import java.net.URLEncoder; import java.util.HashMap;
import java.util.HashMap; import java.util.Map;
import java.util.Map; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* The API URL that is used to construct the API call * The API URL that is used to construct the API call
* *
* @author Stuart * @author Stuart
*/ */
public class ApiUrl { public class ApiUrl {
/* /*
* Logger * Logger
*/ */
private static final Logger LOG = LoggerFactory.getLogger(ApiUrl.class); private static final Logger LOG = LoggerFactory.getLogger(ApiUrl.class);
/* /*
* TheMovieDbApi API Base URL * TheMovieDbApi API Base URL
*/ */
private static final String TMDB_API_BASE = "http://api.themoviedb.org/3/"; private static final String TMDB_API_BASE = "http://api.themoviedb.org/3/";
/* /*
* Parameter configuration * Parameter configuration
*/ */
private static final String DELIMITER_FIRST = "?"; private static final String DELIMITER_FIRST = "?";
private static final String DELIMITER_SUBSEQUENT = "&"; private static final String DELIMITER_SUBSEQUENT = "&";
private static final String DEFAULT_STRING = ""; private static final String DEFAULT_STRING = "";
/* /*
* Properties * Properties
*/ */
private TheMovieDbApi tmdb; private final String apiKey;
private String method; private final String method;
private String submethod; private final String submethod;
private Map<String, String> arguments = new HashMap<String, String>(); private final Map<String, String> arguments = new HashMap<String, String>();
/* /*
* API Parameters * API Parameters
*/ */
public static final String PARAM_ADULT = "include_adult="; public static final String PARAM_ADULT = "include_adult=";
public static final String PARAM_API_KEY = "api_key="; public static final String PARAM_API_KEY = "api_key=";
public static final String PARAM_COUNTRY = "country="; public static final String PARAM_COUNTRY = "country=";
public static final String PARAM_FAVORITE = "favorite="; public static final String PARAM_FAVORITE = "favorite=";
public static final String PARAM_ID = "id="; public static final String PARAM_ID = "id=";
public static final String PARAM_LANGUAGE = "language="; public static final String PARAM_LANGUAGE = "language=";
public static final String PARAM_INCLUDE_ALL_MOVIES = "include_all_movies="; public static final String PARAM_INCLUDE_ALL_MOVIES = "include_all_movies=";
// public static final String PARAM_MOVIE_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="; public static final String PARAM_QUERY = "query=";
public static final String PARAM_QUERY = "query="; public static final String PARAM_SESSION = "session_id=";
public static final String PARAM_SESSION = "session_id="; public static final String PARAM_TOKEN = "request_token=";
public static final String PARAM_TOKEN = "request_token="; public static final String PARAM_VALUE = "value=";
public static final String PARAM_VALUE = "value="; public static final String PARAM_YEAR = "year=";
public static final String PARAM_YEAR = "year="; public static final String PARAM_START_DATE = "start_date=";
public static final String PARAM_END_DATE = "end_date=";
//<editor-fold defaultstate="collapsed" desc="Constructor Methods"> private static final String APPEND_TO_RESPONSE = "append_to_response=";
/**
* Constructor for the simple API URL method without a sub-method //<editor-fold defaultstate="collapsed" desc="Constructor Methods">
* /**
* @param method * Constructor for the simple API URL method without a sub-method
*/ *
public ApiUrl(TheMovieDbApi tmdb, String method) { * @param apiKey
this.tmdb = tmdb; * @param method
this.method = method; */
this.submethod = DEFAULT_STRING; public ApiUrl(String apiKey, String method) {
} this.apiKey = apiKey;
this.method = method;
/** this.submethod = DEFAULT_STRING;
* Constructor for the API URL with a sub-method }
*
* @param method /**
* @param submethod * Constructor for the API URL with a sub-method
*/ *
public ApiUrl(TheMovieDbApi tmdb, String method, String submethod) { * @param apiKey
this.tmdb = tmdb; * @param method
this.method = method; * @param submethod
this.submethod = submethod; */
} public ApiUrl(String apiKey, String method, String submethod) {
//</editor-fold> this.apiKey = apiKey;
this.method = method;
/** this.submethod = submethod;
* Build the URL from the pre-created arguments. }
*/ //</editor-fold>
public URL buildUrl() {
StringBuilder urlString = new StringBuilder(TMDB_API_BASE); /**
* Build the URL from the pre-created arguments.
// Get the start of the URL *
urlString.append(method); * @return
*/
// We have either a queury, or a direct request public URL buildUrl() {
if (arguments.containsKey(PARAM_QUERY)) { StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
// Append the suffix of the API URL
urlString.append(submethod); // Get the start of the URL
urlString.append(method);
// Append the key information
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY); // We have either a queury, or a direct request
urlString.append(tmdb.getApiKey()); if (arguments.containsKey(PARAM_QUERY)) {
// Append the suffix of the API URL
// Append the search term if (StringUtils.endsWith(urlString, "/") && submethod.startsWith("/")) {
urlString.append(DELIMITER_SUBSEQUENT); urlString.deleteCharAt(urlString.length() - 1);
urlString.append(PARAM_QUERY); }
urlString.append(submethod);
String query = arguments.get(PARAM_QUERY);
// Append the key information
try { urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
urlString.append(URLEncoder.encode(query, "UTF-8")); urlString.append(apiKey);
} catch (UnsupportedEncodingException ex) {
LOG.trace("Unable to encode query: '" + query + "' trying raw."); // Append the search term
// If we can't encode it, try it raw urlString.append(DELIMITER_SUBSEQUENT);
urlString.append(query); urlString.append(PARAM_QUERY);
}
String query = arguments.get(PARAM_QUERY);
arguments.remove(PARAM_QUERY);
} else { try {
// Append the ID if provided urlString.append(URLEncoder.encode(query, "UTF-8"));
if (arguments.containsKey(PARAM_ID)) { } catch (UnsupportedEncodingException ex) {
urlString.append(arguments.get(PARAM_ID)); LOG.trace("Unable to encode query: '{}' trying raw.", query);
arguments.remove(PARAM_ID); // If we can't encode it, try it raw
} urlString.append(query);
}
// Append the suffix of the API URL
urlString.append(submethod); // Remove the query from the arguments so it is not added later
arguments.remove(PARAM_QUERY);
// Append the key information } else {
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY); // Append the ID if provided
urlString.append(tmdb.getApiKey()); if (arguments.containsKey(PARAM_ID)) {
} urlString.append(arguments.get(PARAM_ID));
arguments.remove(PARAM_ID);
for (Map.Entry<String, String> argEntry : arguments.entrySet()) { }
urlString.append(DELIMITER_SUBSEQUENT).append(argEntry.getKey());
urlString.append(argEntry.getValue()); // Append the suffix of the API URL
} if (StringUtils.endsWith(urlString, "/") && submethod.startsWith("/")) {
urlString.deleteCharAt(urlString.length() - 1);
try { }
LOG.trace("URL: {}", urlString.toString()); urlString.append(submethod);
return new URL(urlString.toString());
} catch (MalformedURLException ex) { // Append the key information
LOG.warn("Failed to create URL {} - {}", urlString.toString(), ex.toString()); urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
return null; urlString.append(apiKey);
} finally { }
arguments.clear();
} for (Map.Entry<String, String> argEntry : arguments.entrySet()) {
} urlString.append(DELIMITER_SUBSEQUENT).append(argEntry.getKey());
urlString.append(argEntry.getValue());
/** }
* Add arguments individually
* try {
* @param key LOG.trace("URL: {}", urlString.toString());
* @param value return new URL(urlString.toString());
*/ } catch (MalformedURLException ex) {
public void addArgument(String key, String value) { LOG.warn("Failed to create URL {} - {}", urlString.toString(), ex.toString());
arguments.put(key, value); return null;
} } finally {
arguments.clear();
/** }
* Add arguments individually }
*
* @param key /**
* @param value * Add arguments individually
*/ *
public void addArgument(String key, int value) { * @param key
arguments.put(key, Integer.toString(value)); * @param value
} */
public void addArgument(String key, String value) {
/** arguments.put(key, value);
* Add arguments individually }
*
* @param key /**
* @param value * Add arguments individually
*/ *
public void addArgument(String key, boolean value) { * @param key
arguments.put(key, Boolean.toString(value)); * @param value
} */
public void addArgument(String key, int value) {
/** arguments.put(key, Integer.toString(value));
* Clear the arguments }
*/
public void clearArguments() { /**
arguments.clear(); * Add arguments individually
} *
* @param key
/** * @param value
* Set the arguments directly */
* public void addArgument(String key, boolean value) {
* @param args arguments.put(key, Boolean.toString(value));
*/ }
public void setArguments(Map<String, String> args) {
arguments.putAll(args); /**
} * Add arguments individually
} *
* @param key
* @param value
*/
public void addArgument(String key, float value) {
arguments.put(key, Float.toString(value));
}
/**
* Clear the arguments
*/
public void clearArguments() {
arguments.clear();
}
/**
* Set the arguments directly
*
* @param args
*/
public void setArguments(Map<String, String> args) {
arguments.putAll(args);
}
/**
* Append any optional parameters to the URL
*
* @param appendToResponse
*/
public void appendToResponse(String[] appendToResponse) {
if (appendToResponse.length > 0) {
StringBuilder sb = new StringBuilder();
boolean first = Boolean.TRUE;
for (String append : appendToResponse) {
if (first) {
first = Boolean.FALSE;
} else {
sb.append(",");
}
sb.append(append);
}
addArgument(APPEND_TO_RESPONSE, sb.toString());
}
}
}
@@ -1,289 +1,325 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.tools; package com.omertron.themoviedbapi.tools;
import com.omertron.themoviedbapi.MovieDbException; import com.omertron.themoviedbapi.MovieDbException;
import java.io.BufferedReader; import org.apache.commons.codec.binary.Base64;
import java.io.IOException; import org.slf4j.Logger;
import java.io.InputStreamReader; import org.slf4j.LoggerFactory;
import java.io.StringWriter;
import java.net.HttpURLConnection; import java.io.*;
import java.net.MalformedURLException; import java.net.HttpURLConnection;
import java.net.URL; import java.net.MalformedURLException;
import java.net.URLConnection; import java.net.URL;
import java.nio.charset.Charset; import java.net.URLConnection;
import java.nio.charset.UnsupportedCharsetException; import java.nio.charset.Charset;
import java.util.HashMap; import java.nio.charset.UnsupportedCharsetException;
import java.util.List; import java.util.HashMap;
import java.util.Map; import java.util.List;
import java.util.regex.Matcher; import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Matcher;
import org.apache.commons.codec.binary.Base64; import java.util.regex.Pattern;
import org.slf4j.Logger; import org.apache.commons.lang3.StringUtils;
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 LOG = LoggerFactory.getLogger(WebBrowser.class);
private static final Logger LOG = LoggerFactory.getLogger(WebBrowser.class); private static final Map<String, String> BROWSER_PROPERTIES = new HashMap<String, String>();
private static Map<String, String> browserProperties = new HashMap<String, String>(); private static final 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; private static int proxyPort = 0;
private static String proxyPort = null; private static String proxyUsername = null;
private static String proxyUsername = null; private static String proxyPassword = null;
private static String proxyPassword = null; private static String proxyEncodedPassword = null;
private static String proxyEncodedPassword = null; // 25 second timeout
private static int webTimeoutConnect = 25000; // 25 second timeout private static int webTimeoutConnect = 25000;
private static int webTimeoutRead = 90000; // 90 second timeout // 90 second timeout
private static int webTimeoutRead = 90000;
// Hide the constructor
protected WebBrowser() { // Hide the constructor
// prevents calls from subclass protected WebBrowser() {
throw new UnsupportedOperationException(); // prevents calls from subclass
} throw new UnsupportedOperationException();
}
/**
* Populate the browser properties /**
*/ * Populate the browser properties
private static void populateBrowserProperties() { */
if (browserProperties.isEmpty()) { private static void populateBrowserProperties() {
browserProperties.put("User-Agent", "Mozilla/5.25 Netscape/5.0 (Windows; I; Win95)"); if (BROWSER_PROPERTIES.isEmpty()) {
browserProperties.put("Accept", "application/json"); BROWSER_PROPERTIES.put("User-Agent", "Mozilla/5.25 Netscape/5.0 (Windows; I; Win95)");
} BROWSER_PROPERTIES.put("Accept", "application/json");
} BROWSER_PROPERTIES.put("Content-type", "application/json");
}
public static String request(String url) throws MovieDbException { }
try {
return request(new URL(url)); public static String request(String url) throws MovieDbException {
} catch (MalformedURLException ex) { try {
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex); return request(new URL(url));
} } catch (MalformedURLException ex) {
} throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex);
}
public static URLConnection openProxiedConnection(URL url) throws MovieDbException { }
try {
if (proxyHost != null) { public static URLConnection openProxiedConnection(URL url) throws MovieDbException {
System.getProperties().put("proxySet", "true"); try {
System.getProperties().put("proxyHost", proxyHost); if (proxyHost != null) {
System.getProperties().put("proxyPort", proxyPort); System.getProperties().put("proxySet", "true");
} System.getProperties().put("proxyHost", proxyHost);
System.getProperties().put("proxyPort", proxyPort);
URLConnection cnx = url.openConnection(); }
if (proxyUsername != null) { URLConnection cnx = url.openConnection();
cnx.setRequestProperty("Proxy-Authorization", proxyEncodedPassword);
} if (proxyUsername != null) {
cnx.setRequestProperty("Proxy-Authorization", proxyEncodedPassword);
return cnx; }
} catch (IOException ex) {
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex); return cnx;
} } catch (IOException ex) {
} throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex);
}
public static String request(URL url) throws MovieDbException { }
StringWriter content = null;
public static String request(URL url) throws MovieDbException {
try { return request(url, null, Boolean.FALSE);
content = new StringWriter(); }
BufferedReader in = null; public static String request(URL url, String jsonBody) throws MovieDbException {
URLConnection cnx = null; return request(url, jsonBody, Boolean.FALSE);
try { }
cnx = openProxiedConnection(url);
public static String request(URL url, String jsonBody, boolean isDeleteRequest) throws MovieDbException {
sendHeader(cnx);
readHeader(cnx); StringWriter content = null;
in = new BufferedReader(new InputStreamReader(cnx.getInputStream(), getCharset(cnx))); try {
String line; content = new StringWriter();
while ((line = in.readLine()) != null) {
content.write(line); BufferedReader in = null;
} HttpURLConnection cnx = null;
} finally { OutputStreamWriter wr = null;
if (in != null) { try {
in.close(); cnx = (HttpURLConnection) openProxiedConnection(url);
}
if (isDeleteRequest) {
if (cnx instanceof HttpURLConnection) { cnx.setDoOutput(true);
((HttpURLConnection) cnx).disconnect(); cnx.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
} cnx.setRequestMethod("DELETE");
} }
return content.toString();
} catch (IOException ex) { sendHeader(cnx);
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, ex);
} finally { if (StringUtils.isNotBlank(jsonBody)) {
if (content != null) { cnx.setDoOutput(true);
try { wr = new OutputStreamWriter(cnx.getOutputStream());
content.close(); wr.write(jsonBody);
} catch (IOException ex) { }
LOG.debug("Failed to close connection: " + ex.getMessage());
} readHeader(cnx);
}
} // http://stackoverflow.com/questions/4633048/httpurlconnection-reading-response-content-on-403-error
} if (cnx.getResponseCode() >= 400) {
in = new BufferedReader(new InputStreamReader(cnx.getErrorStream(), getCharset(cnx)));
private static void sendHeader(URLConnection cnx) { } else {
populateBrowserProperties(); in = new BufferedReader(new InputStreamReader(cnx.getInputStream(), getCharset(cnx)));
}
// send browser properties
for (Map.Entry<String, String> browserProperty : browserProperties.entrySet()) { String line;
cnx.setRequestProperty(browserProperty.getKey(), browserProperty.getValue()); while ((line = in.readLine()) != null) {
} content.write(line);
// send cookies }
String cookieHeader = createCookieHeader(cnx); } finally {
if (!cookieHeader.isEmpty()) { if (wr != null) {
cnx.setRequestProperty("Cookie", cookieHeader); wr.flush();
} wr.close();
} }
private static String createCookieHeader(URLConnection cnx) { if (in != null) {
String host = cnx.getURL().getHost(); in.close();
StringBuilder cookiesHeader = new StringBuilder(); }
for (Map.Entry<String, Map<String, String>> domainCookies : cookies.entrySet()) {
if (host.endsWith(domainCookies.getKey())) { if (cnx instanceof HttpURLConnection) {
for (Map.Entry<String, String> cookie : domainCookies.getValue().entrySet()) { ((HttpURLConnection) cnx).disconnect();
cookiesHeader.append(cookie.getKey()); }
cookiesHeader.append("="); }
cookiesHeader.append(cookie.getValue()); return content.toString();
cookiesHeader.append(";"); } catch (IOException ex) {
} throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, ex);
} } finally {
} if (content != null) {
if (cookiesHeader.length() > 0) { try {
// remove last ; char content.close();
cookiesHeader.deleteCharAt(cookiesHeader.length() - 1); } catch (IOException ex) {
} LOG.debug("Failed to close connection: " + ex.getMessage());
return cookiesHeader.toString(); }
} }
}
private static void readHeader(URLConnection cnx) { }
// read new cookies and update our cookies
for (Map.Entry<String, List<String>> header : cnx.getHeaderFields().entrySet()) { private static void sendHeader(URLConnection cnx) {
if ("Set-Cookie".equals(header.getKey())) { populateBrowserProperties();
for (String cookieHeader : header.getValue()) {
String[] cookieElements = cookieHeader.split(" *; *"); // send browser properties
if (cookieElements.length >= 1) { for (Map.Entry<String, String> browserProperty : BROWSER_PROPERTIES.entrySet()) {
String[] firstElem = cookieElements[0].split(" *= *"); cnx.setRequestProperty(browserProperty.getKey(), browserProperty.getValue());
String cookieName = firstElem[0]; }
String cookieValue = firstElem.length > 1 ? firstElem[1] : null; // send cookies
String cookieDomain = null; String cookieHeader = createCookieHeader(cnx);
// find cookie domain if (!cookieHeader.isEmpty()) {
for (int i = 1; i < cookieElements.length; i++) { cnx.setRequestProperty("Cookie", cookieHeader);
String[] cookieElement = cookieElements[i].split(" *= *"); }
if ("domain".equals(cookieElement[0])) { }
cookieDomain = cookieElement.length > 1 ? cookieElement[1] : null;
break; private static String createCookieHeader(URLConnection cnx) {
} String host = cnx.getURL().getHost();
} StringBuilder cookiesHeader = new StringBuilder();
if (cookieDomain == null) { for (Map.Entry<String, Map<String, String>> domainCookies : COOKIES.entrySet()) {
// if domain isn't set take current host if (host.endsWith(domainCookies.getKey())) {
cookieDomain = cnx.getURL().getHost(); for (Map.Entry<String, String> cookie : domainCookies.getValue().entrySet()) {
} cookiesHeader.append(cookie.getKey());
Map<String, String> domainCookies = cookies.get(cookieDomain); cookiesHeader.append("=");
if (domainCookies == null) { cookiesHeader.append(cookie.getValue());
domainCookies = new HashMap<String, String>(); cookiesHeader.append(";");
cookies.put(cookieDomain, domainCookies); }
} }
// add or replace cookie }
domainCookies.put(cookieName, cookieValue); if (cookiesHeader.length() > 0) {
} // remove last ; char
} cookiesHeader.deleteCharAt(cookiesHeader.length() - 1);
} }
} return cookiesHeader.toString();
} }
private static Charset getCharset(URLConnection cnx) { private static void readHeader(URLConnection cnx) {
Charset charset = null; // read new cookies and update our cookies
// content type will be string like "text/html; charset=UTF-8" or "text/html" for (Map.Entry<String, List<String>> header : cnx.getHeaderFields().entrySet()) {
String contentType = cnx.getContentType(); if ("Set-Cookie".equals(header.getKey())) {
if (contentType != null) { for (String cookieHeader : header.getValue()) {
// changed 'charset' to 'harset' in regexp because some sites send 'Charset' String[] cookieElements = cookieHeader.split(" *; *");
Matcher m = Pattern.compile("harset *=[ '\"]*([^ ;'\"]+)[ ;'\"]*").matcher(contentType); if (cookieElements.length >= 1) {
if (m.find()) { String[] firstElem = cookieElements[0].split(" *= *");
String encoding = m.group(1); String cookieName = firstElem[0];
try { String cookieValue = firstElem.length > 1 ? firstElem[1] : null;
charset = Charset.forName(encoding); String cookieDomain = null;
} catch (UnsupportedCharsetException e) { // find cookie domain
// there will be used default charset for (int i = 1; i < cookieElements.length; i++) {
} String[] cookieElement = cookieElements[i].split(" *= *");
} if ("domain".equals(cookieElement[0])) {
} cookieDomain = cookieElement.length > 1 ? cookieElement[1] : null;
if (charset == null) { break;
charset = Charset.defaultCharset(); }
} }
if (cookieDomain == null) {
return charset; // if domain isn't set take current host
} cookieDomain = cnx.getURL().getHost();
}
public static String getProxyHost() { Map<String, String> domainCookies = COOKIES.get(cookieDomain);
return proxyHost; if (domainCookies == null) {
} domainCookies = new HashMap<String, String>();
COOKIES.put(cookieDomain, domainCookies);
public static void setProxyHost(String myProxyHost) { }
WebBrowser.proxyHost = myProxyHost; // add or replace cookie
} domainCookies.put(cookieName, cookieValue);
}
public static String getProxyPort() { }
return proxyPort; }
} }
}
public static void setProxyPort(String myProxyPort) {
WebBrowser.proxyPort = myProxyPort; private static Charset getCharset(URLConnection cnx) {
} Charset charset = null;
// content type will be string like "text/html; charset=UTF-8" or "text/html"
public static String getProxyUsername() { String contentType = cnx.getContentType();
return proxyUsername; if (contentType != null) {
} // changed 'charset' to 'harset' in regexp because some sites send 'Charset'
Matcher m = Pattern.compile("harset *=[ '\"]*([^ ;'\"]+)[ ;'\"]*").matcher(contentType);
public static void setProxyUsername(String myProxyUsername) { if (m.find()) {
WebBrowser.proxyUsername = myProxyUsername; String encoding = m.group(1);
} try {
charset = Charset.forName(encoding);
public static String getProxyPassword() { } catch (UnsupportedCharsetException e) {
return proxyPassword; // there will be used default charset
} }
}
public static void setProxyPassword(String myProxyPassword) { }
WebBrowser.proxyPassword = myProxyPassword; if (charset == null) {
charset = Charset.defaultCharset();
if (proxyUsername != null) { }
proxyEncodedPassword = proxyUsername + ":" + proxyPassword;
proxyEncodedPassword = "Basic " + new String(Base64.encodeBase64((proxyUsername + ":" + proxyPassword).getBytes())); return charset;
} }
}
public static String getProxyHost() {
public static int getWebTimeoutConnect() { return proxyHost;
return webTimeoutConnect; }
}
public static void setProxyHost(String myProxyHost) {
public static int getWebTimeoutRead() { WebBrowser.proxyHost = myProxyHost;
return webTimeoutRead; }
}
public static int getProxyPort() {
public static void setWebTimeoutConnect(int webTimeoutConnect) { return proxyPort;
WebBrowser.webTimeoutConnect = webTimeoutConnect; }
}
public static void setProxyPort(int myProxyPort) {
public static void setWebTimeoutRead(int webTimeoutRead) { WebBrowser.proxyPort = myProxyPort;
WebBrowser.webTimeoutRead = webTimeoutRead; }
}
} public static String getProxyUsername() {
return proxyUsername;
}
public static void setProxyUsername(String myProxyUsername) {
WebBrowser.proxyUsername = myProxyUsername;
}
public static String getProxyPassword() {
return proxyPassword;
}
public static void setProxyPassword(String myProxyPassword) {
WebBrowser.proxyPassword = myProxyPassword;
if (proxyUsername != null) {
proxyEncodedPassword = proxyUsername + ":" + proxyPassword;
proxyEncodedPassword = "Basic " + new String(Base64.encodeBase64((proxyUsername + ":" + proxyPassword).getBytes()));
}
}
public static int getWebTimeoutConnect() {
return webTimeoutConnect;
}
public static int getWebTimeoutRead() {
return webTimeoutRead;
}
public static void setWebTimeoutConnect(int webTimeoutConnect) {
WebBrowser.webTimeoutConnect = webTimeoutConnect;
}
public static void setWebTimeoutRead(int webTimeoutRead) {
WebBrowser.webTimeoutRead = webTimeoutRead;
}
}
@@ -0,0 +1,48 @@
/*
* 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.omertron.themoviedbapi.model.AbstractJsonMapping;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
public abstract class AbstractWrapper extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Get a list of the enums passed
*
* @param <E>
* @param clz Class of the enum
* @param typeList Array of the enums
* @return
*/
public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) {
if (typeList.length > 0) {
return new ArrayList<E>(Arrays.asList(typeList));
} else {
return new ArrayList<E>(EnumSet.allOf(clz));
}
}
}
@@ -1,102 +1,79 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger; /**
* Base class for the wrappers
/** *
* Base class for the wrappers * @author Stuart
* */
* @author Stuart public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, IWrapperPages, IWrapperDates {
*/
public class WrapperBase { @JsonProperty("page")
/* private int page;
* Logger - set by the sub-classes @JsonProperty("total_pages")
*/ private int totalPages;
@JsonProperty("total_results")
private Logger log; private int totalResults;
/* @JsonProperty("dates")
* Properties private ResultDates dates = new ResultDates();
*/
@JsonProperty("id") @Override
private int id; public int getPage() {
@JsonProperty("page") return page;
private int page; }
@JsonProperty("total_pages")
private int totalPages; @Override
@JsonProperty("total_results") public int getTotalPages() {
private int totalResults; return totalPages;
}
public WrapperBase(Logger logger) {
this.log = logger; @Override
} public int getTotalResults() {
return totalResults;
//<editor-fold defaultstate="collapsed" desc="Getter Methods"> }
public int getId() {
return id; @Override
} public ResultDates getDates() {
return dates;
public int getPage() { }
return page;
} @Override
public void setPage(int page) {
public int getTotalPages() { this.page = page;
return totalPages; }
}
@Override
public int getTotalResults() { public void setTotalPages(int totalPages) {
return totalResults; this.totalPages = totalPages;
} }
//</editor-fold>
@Override
//<editor-fold defaultstate="collapsed" desc="Setter Methods"> public void setTotalResults(int totalResults) {
public void setId(int id) { this.totalResults = totalResults;
this.id = id; }
}
@Override
public void setPage(int page) { public void setDates(ResultDates dates) {
this.page = page; this.dates = dates;
} }
}
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,44 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Base class for the wrappers
*
* @author Stuart
*/
public class AbstractWrapperId extends AbstractWrapper implements IWrapperId {
private static final long serialVersionUID = 1L;
@JsonProperty("id")
private int id;
@Override
public int getId() {
return id;
}
@Override
public void setId(int id) {
this.id = id;
}
}
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
public interface IWrapperDates {
ResultDates getDates();
void setDates(ResultDates dates);
}
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
public interface IWrapperId {
int getId();
void setId(int id);
}
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
public interface IWrapperPages {
int getPage();
void setPage(int page);
int getTotalPages();
void setTotalPages(int totalPages);
int getTotalResults();
void setTotalResults(int totalResults);
}
@@ -1,82 +1,88 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.model; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.slf4j.Logger; import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.LoggerFactory; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* /**
* @author Stuart *
*/ * @author Stuart
public class MovieChanges implements Serializable { */
public class ResultDates implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/*
* Logger /*
*/ * Logger
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class); */
/* private static final Logger LOG = LoggerFactory.getLogger(ResultDates.class);
* Properties /*
*/ * Properties
@JsonProperty("key") */
private String key; @JsonProperty("minimum")
@JsonProperty("items") private String minimum = "";
private List<ChangeItem> items; @JsonProperty("maximum")
private String maximum = "";
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public String getKey() { // <editor-fold defaultstate="collapsed" desc="Getter methods">
return key; public String getMinimum() {
} return minimum;
}
public List<ChangeItem> getItems() {
return items; public String getMaximum() {
} return maximum;
//</editor-fold> }
// </editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setKey(String key) { // <editor-fold defaultstate="collapsed" desc="Setter methods">
this.key = key; public void setMinimum(String minimum) {
} this.minimum = minimum;
}
public void setItems(List<ChangeItem> items) {
this.items = items; public void setMaximum(String maximum) {
} this.maximum = maximum;
//</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);
LOG.trace(sb.toString()); sb.append("' value: '").append(value).append("'");
} LOG.trace(sb.toString());
} }
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
}
}
@@ -1,76 +1,44 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model.AlternativeTitle; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
*
/** * @author Stuart
* */
* @author Stuart public class WrapperAlternativeTitles extends AbstractWrapperId implements Serializable {
*/
public class WrapperAlternativeTitles { private static final long serialVersionUID = 1L;
/* @JsonProperty("titles")
* Logger private List<AlternativeTitle> titles;
*/
public List<AlternativeTitle> getTitles() {
private static final Logger LOG = LoggerFactory.getLogger(WrapperAlternativeTitles.class); return titles;
/* }
* Properties
*/ public void setTitles(List<AlternativeTitle> titles) {
@JsonProperty("id") this.titles = titles;
private int id; }
@JsonProperty("titles") }
private List<AlternativeTitle> titles;
public int getId() {
return id;
}
public List<AlternativeTitle> getTitles() {
return titles;
}
public void setId(int id) {
this.id = id;
}
public void setTitles(List<AlternativeTitle> titles) {
this.titles = titles;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,70 +1,42 @@
/* package com.omertron.themoviedbapi.wrapper;
* Copyright (c) 2004-2013 Stuart Boston
* import java.util.ArrayList;
* This file is part of TheMovieDB API. import java.util.HashMap;
* import java.util.List;
* TheMovieDB API is free software: you can redistribute it and/or modify import java.util.Map;
* it under the terms of the GNU General Public License as published by import com.fasterxml.jackson.annotation.JsonAnyGetter;
* the Free Software Foundation, either version 3 of the License, or import com.fasterxml.jackson.annotation.JsonAnySetter;
* any later version. import com.fasterxml.jackson.annotation.JsonProperty;
* import com.omertron.themoviedbapi.model.ChangeKeyItem;
* TheMovieDB API is distributed in the hope that it will be useful, import org.apache.commons.lang3.builder.ToStringBuilder;
* but WITHOUT ANY WARRANTY; without even the implied warranty of import org.apache.commons.lang3.builder.ToStringStyle;
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. public class WrapperChanges {
*
* You should have received a copy of the GNU General Public License @JsonProperty("changes")
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. private List<ChangeKeyItem> changedItems = new ArrayList<ChangeKeyItem>();
* private final Map<String, Object> newItems = new HashMap<String, Object>();
*/
package com.omertron.themoviedbapi.wrapper; public List<ChangeKeyItem> getChangedItems() {
return changedItems;
import com.fasterxml.jackson.annotation.JsonAnySetter; }
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieChanges; public void setChangedItems(List<ChangeKeyItem> changes) {
import java.util.List; this.changedItems = changes;
import org.slf4j.Logger; }
import org.slf4j.LoggerFactory;
@JsonAnyGetter
/** public Map<String, Object> getNewItems() {
* return this.newItems;
* @author stuart.boston }
*/
public class WrapperChanges { @JsonAnySetter
/* public void setNewItems(String name, Object value) {
* Logger this.newItems.put(name, value);
*/ }
private static final Logger LOG = LoggerFactory.getLogger(WrapperChanges.class); @Override
/* public String toString() {
* Properties return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
*/ }
@JsonProperty("changes") }
private List<MovieChanges> changes;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<MovieChanges> getChanges() {
return changes;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setChanges(List<MovieChanges> changes) {
this.changes = changes;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,50 +1,42 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Collection; import com.omertron.themoviedbapi.model.Collection;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCollection extends AbstractWrapperAll {
public class WrapperCollection extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Collection> results;
*/
public List<Collection> getResults() {
@JsonProperty("results") return results;
private List<Collection> results; }
public WrapperCollection() { public void setResults(List<Collection> results) {
super(LoggerFactory.getLogger(WrapperCollection.class)); this.results = results;
} }
}
public List<Collection> getResults() {
return results;
}
public void setResults(List<Collection> results) {
this.results = results;
}
}
@@ -1,50 +1,42 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Company; import com.omertron.themoviedbapi.model.Company;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCompany extends AbstractWrapperAll {
public class WrapperCompany extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Company> results;
*/
public List<Company> getResults() {
@JsonProperty("results") return results;
private List<Company> results; }
public WrapperCompany() { public void setResults(List<Company> results) {
super(LoggerFactory.getLogger(WrapperCompany.class)); this.results = results;
} }
}
public List<Company> getResults() {
return results;
}
public void setResults(List<Company> results) {
this.results = results;
}
}
@@ -1,62 +1,42 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCompanyMovies extends AbstractWrapperAll {
public class WrapperCompanyMovies extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<MovieDb> results;
*/
public List<MovieDb> getResults() {
@JsonProperty("results") return results;
private List<MovieDb> results; }
public WrapperCompanyMovies() { public void setResults(List<MovieDb> results) {
super(LoggerFactory.getLogger(WrapperCompanyMovies.class)); this.results = results;
} }
}
public List<MovieDb> getResults() {
return results;
}
public void setResults(List<MovieDb> results) {
this.results = results;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[companyId=").append(getId());
sb.append("],[page=").append(getPage());
sb.append("],[pageResults=").append(getResults().size());
sb.append("],[totalPages=").append(getTotalPages());
sb.append("],[totalResults=").append(getTotalResults());
sb.append("]]");
return sb.toString();
}
}
@@ -1,77 +1,53 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.TmdbConfiguration;
import com.omertron.themoviedbapi.model.TmdbConfiguration; import java.util.Collections;
import java.util.Collections; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperConfig extends AbstractWrapper {
* @author Stuart
*/ @JsonProperty("images")
public class WrapperConfig { private TmdbConfiguration tmdbConfiguration;
/* @JsonProperty("change_keys")
* Logger private List<String> changeKeys = Collections.EMPTY_LIST;
*/
public TmdbConfiguration getTmdbConfiguration() {
private static final Logger LOG = LoggerFactory.getLogger(WrapperConfig.class); return tmdbConfiguration;
/* }
* Properties
*/ public void setTmdbConfiguration(TmdbConfiguration tmdbConfiguration) {
@JsonProperty("images") this.tmdbConfiguration = tmdbConfiguration;
private TmdbConfiguration tmdbConfiguration; }
@JsonProperty("change_keys")
private List<String> changeKeys = Collections.EMPTY_LIST; public List<String> getChangeKeys() {
return changeKeys;
public TmdbConfiguration getTmdbConfiguration() { }
return tmdbConfiguration;
} public void setChangeKeys(List<String> changeKeys) {
this.changeKeys = changeKeys;
public void setTmdbConfiguration(TmdbConfiguration tmdbConfiguration) { }
this.tmdbConfiguration = tmdbConfiguration; }
}
public List<String> getChangeKeys() {
return changeKeys;
}
public void setChangeKeys(List<String> changeKeys) {
this.changeKeys = changeKeys;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,67 +1,43 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Genre;
import com.omertron.themoviedbapi.model.Genre; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; * Wrapper class for the Genres searches
*
/** * @author Stuart
* Wrapper class for the Genres searches */
* public class WrapperGenres extends AbstractWrapper {
* @author Stuart
*/ @JsonProperty("genres")
public class WrapperGenres { private List<Genre> genres;
/*
* Logger public List<Genre> getGenres() {
*/ return genres;
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperGenres.class);
/* public void setGenres(List<Genre> genres) {
* Properties this.genres = genres;
*/ }
@JsonProperty("genres") }
private List<Genre> genres;
public List<Genre> getGenres() {
return genres;
}
public void setGenres(List<Genre> genres) {
this.genres = genres;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,74 +1,119 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Artwork; import com.omertron.themoviedbapi.model.Artwork;
import java.util.List; import com.omertron.themoviedbapi.model.ArtworkType;
import org.slf4j.LoggerFactory; import java.io.Serializable;
import java.util.ArrayList;
/** import java.util.Arrays;
* import java.util.Collections;
* @author Stuart import java.util.List;
*/
public class WrapperImages extends WrapperBase { /**
/* *
* Properties * @author Stuart
*/ */
public class WrapperImages extends AbstractWrapperAll implements Serializable {
@JsonProperty("backdrops")
private List<Artwork> backdrops; private static final long serialVersionUID = 1L;
@JsonProperty("posters") @JsonProperty("backdrops")
private List<Artwork> posters; private List<Artwork> backdrops = Collections.EMPTY_LIST;
@JsonProperty("profiles") @JsonProperty("posters")
private List<Artwork> profiles; private List<Artwork> posters = Collections.EMPTY_LIST;
@JsonProperty("profiles")
public WrapperImages() { private List<Artwork> profiles = Collections.EMPTY_LIST;
super(LoggerFactory.getLogger(WrapperImages.class));
} public List<Artwork> getBackdrops() {
return backdrops;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> }
public List<Artwork> getBackdrops() {
return backdrops; public List<Artwork> getPosters() {
} return posters;
}
public List<Artwork> getPosters() {
return posters; public List<Artwork> getProfiles() {
} return profiles;
}
public List<Artwork> getProfiles() {
return profiles; public void setBackdrops(List<Artwork> backdrops) {
} this.backdrops = backdrops;
//</editor-fold> }
//<editor-fold defaultstate="collapsed" desc="Setter methods"> public void setPosters(List<Artwork> posters) {
public void setBackdrops(List<Artwork> backdrops) { this.posters = posters;
this.backdrops = backdrops; }
}
public void setProfiles(List<Artwork> profiles) {
public void setPosters(List<Artwork> posters) { this.profiles = profiles;
this.posters = posters; }
}
/**
public void setProfiles(List<Artwork> profiles) { * Return a list of all the artwork with their types.
this.profiles = profiles; *
} * Leaving the parameters blank will return all types
//</editor-fold> *
} * @param artworkList
* @return
*/
public List<Artwork> getAll(ArtworkType... artworkList) {
List<Artwork> artwork = new ArrayList<Artwork>();
List<ArtworkType> types;
if (artworkList.length > 0) {
types = new ArrayList<ArtworkType>(Arrays.asList(artworkList));
} else {
types = new ArrayList<ArtworkType>(Arrays.asList(ArtworkType.values()));
}
// Add all the posters to the list
if (types.contains(ArtworkType.POSTER)) {
updateArtworkType(posters, ArtworkType.POSTER);
artwork.addAll(posters);
}
// Add all the backdrops to the list
if (types.contains(ArtworkType.BACKDROP)) {
updateArtworkType(backdrops, ArtworkType.BACKDROP);
artwork.addAll(backdrops);
}
// Add all the backdrops to the list
if (types.contains(ArtworkType.PROFILE)) {
updateArtworkType(profiles, ArtworkType.PROFILE);
artwork.addAll(profiles);
}
return artwork;
}
/**
* Update the artwork type for the artwork list
*
* @param artworkList
* @param type
*/
private void updateArtworkType(List<Artwork> artworkList, ArtworkType type) {
for (Artwork artwork : artworkList) {
artwork.setArtworkType(type);
}
}
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.JobDepartment;
import java.util.List;
/**
*
* @author Stuart
*/
public class WrapperJobList extends AbstractWrapper {
@JsonProperty("jobs")
private List<JobDepartment> jobs;
public List<JobDepartment> getJobs() {
return jobs;
}
public void setJobs(List<JobDepartment> jobs) {
this.jobs = jobs;
}
}
@@ -1,50 +1,42 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.KeywordMovie; import com.omertron.themoviedbapi.model.KeywordMovie;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperKeywordMovies extends AbstractWrapperAll {
public class WrapperKeywordMovies extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<KeywordMovie> results;
*/
public List<KeywordMovie> getResults() {
@JsonProperty("results") return results;
private List<KeywordMovie> results; }
public WrapperKeywordMovies() { public void setResults(List<KeywordMovie> results) {
super(LoggerFactory.getLogger(WrapperKeywordMovies.class)); this.results = results;
} }
}
public List<KeywordMovie> getResults() {
return results;
}
public void setResults(List<KeywordMovie> results) {
this.results = results;
}
}
@@ -1,50 +1,42 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Keyword; import com.omertron.themoviedbapi.model.Keyword;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperKeywords extends AbstractWrapperAll {
public class WrapperKeywords extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Keyword> results;
*/
public List<Keyword> getResults() {
@JsonProperty("results") return results;
private List<Keyword> results; }
public WrapperKeywords() { public void setResults(List<Keyword> results) {
super(LoggerFactory.getLogger(WrapperKeywords.class)); this.results = results;
} }
}
public List<Keyword> getResults() {
return results;
}
public void setResults(List<Keyword> results) {
this.results = results;
}
}
@@ -1,62 +1,44 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import java.util.List; import java.io.Serializable;
import org.slf4j.LoggerFactory; import java.util.List;
/** /**
* *
* @author stuart.boston * @author stuart.boston
*/ */
public class WrapperMovie extends WrapperBase { public class WrapperMovie extends AbstractWrapperAll implements Serializable {
/*
* Properties private static final long serialVersionUID = 1L;
*/ @JsonProperty("results")
private List<MovieDb> movies;
@JsonProperty("results")
private List<MovieDb> movies; public List<MovieDb> getMovies() {
return movies;
public WrapperMovie() { }
super(LoggerFactory.getLogger(WrapperMovie.class));
} public void setMovies(List<MovieDb> movies) {
this.movies = movies;
public List<MovieDb> getMovies() { }
return movies; }
}
public void setMovies(List<MovieDb> movies) {
this.movies = movies;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[page=").append(getPage());
sb.append("],[pageResults=").append(getMovies().size());
sb.append("],[totalPages=").append(getTotalPages());
sb.append("],[totalResults=").append(getTotalResults());
sb.append("],[id=").append(getId());
sb.append("]]");
return sb.toString();
}
}
@@ -1,91 +1,77 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Person;
import com.omertron.themoviedbapi.model.PersonCast; import com.omertron.themoviedbapi.model.PersonCast;
import com.omertron.themoviedbapi.model.PersonCrew; import com.omertron.themoviedbapi.model.PersonCrew;
import java.util.List; import java.io.Serializable;
import org.slf4j.Logger; import java.util.ArrayList;
import org.slf4j.LoggerFactory; import java.util.List;
/** /**
* *
* @author Stuart * @author Stuart
*/ */
public class WrapperMovieCasts { public class WrapperMovieCasts extends AbstractWrapperId implements Serializable {
/*
* Logger private static final long serialVersionUID = 1L;
*/ @JsonProperty("cast")
private List<PersonCast> cast;
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieCasts.class); @JsonProperty("crew")
/* private List<PersonCrew> crew;
* Properties
*/ public List<PersonCast> getCast() {
@JsonProperty("id") return cast;
private int id; }
@JsonProperty("cast")
private List<PersonCast> cast; public List<PersonCrew> getCrew() {
@JsonProperty("crew") return crew;
private List<PersonCrew> crew; }
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public void setCast(List<PersonCast> cast) {
public List<PersonCast> getCast() { this.cast = cast;
return cast; }
}
public void setCrew(List<PersonCrew> crew) {
public List<PersonCrew> getCrew() { this.crew = crew;
return crew; }
}
public List<Person> getAll() {
public int getId() { List<Person> people = new ArrayList<Person>();
return id;
} // Add a cast member
//</editor-fold> for (PersonCast member : cast) {
Person person = new Person();
//<editor-fold defaultstate="collapsed" desc="Setter methods"> person.addCast(member.getId(), member.getName(), member.getProfilePath(), member.getCharacter(), member.getOrder());
public void setCast(List<PersonCast> cast) { people.add(person);
this.cast = cast; }
}
// Add a crew member
public void setCrew(List<PersonCrew> crew) { for (PersonCrew member : crew) {
this.crew = crew; Person person = new Person();
} person.addCrew(member.getId(), member.getName(), member.getProfilePath(), member.getDepartment(), member.getJob());
people.add(person);
public void setId(int id) { }
this.id = id;
} return people;
//</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,39 @@
/*
* 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 java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.ChangedMovie;
public class WrapperMovieChanges extends AbstractWrapperAll {
@JsonProperty("results")
private List<ChangedMovie> results;
public List<ChangedMovie> getResults() {
return results;
}
public void setResults(List<ChangedMovie> results) {
this.results = results;
}
}
@@ -0,0 +1,21 @@
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieDbList;
import java.util.List;
public class WrapperMovieDbList extends AbstractWrapperAll {
@JsonProperty("results")
private List<MovieDbList> lists;
public List<MovieDbList> getLists() {
return lists;
}
public void setLists(List<MovieDbList> lists) {
this.lists = lists;
}
}
@@ -1,80 +1,44 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Keyword;
import com.omertron.themoviedbapi.model.Keyword; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
*
/** * @author Stuart
* */
* @author Stuart public class WrapperMovieKeywords extends AbstractWrapperId implements Serializable {
*/
public class WrapperMovieKeywords { private static final long serialVersionUID = 1L;
/* @JsonProperty("keywords")
* Logger private List<Keyword> keywords;
*/
public List<Keyword> getKeywords() {
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieKeywords.class); return keywords;
/* }
* Properties
*/ public void setKeywords(List<Keyword> keywords) {
@JsonProperty("id") this.keywords = keywords;
private int id; }
@JsonProperty("keywords") }
private List<Keyword> keywords;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() {
return id;
}
public List<Keyword> getKeywords() {
return keywords;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) {
this.id = id;
}
public void setKeywords(List<Keyword> keywords) {
this.keywords = keywords;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,50 +1,44 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieList; import com.omertron.themoviedbapi.model.MovieList;
import java.util.List; import java.io.Serializable;
import org.slf4j.LoggerFactory; import java.util.List;
/** /**
* *
* @author Stuart * @author Stuart
*/ */
public class WrapperMovieList extends WrapperBase { public class WrapperMovieList extends AbstractWrapperAll implements Serializable {
/*
* Properties private static final long serialVersionUID = 1L;
*/ @JsonProperty("results")
private List<MovieList> movieList;
@JsonProperty("results")
private List<MovieList> movieList; public List<MovieList> getMovieList() {
return movieList;
public WrapperMovieList() { }
super(LoggerFactory.getLogger(WrapperMovieList.class));
} public void setMovieList(List<MovieList> movieList) {
this.movieList = movieList;
public List<MovieList> getMovieList() { }
return movieList; }
}
public void setMovieList(List<MovieList> movieList) {
this.movieList = movieList;
}
}
@@ -1,50 +1,42 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Person; import com.omertron.themoviedbapi.model.Person;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperPerson extends AbstractWrapperAll {
public class WrapperPerson extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Person> results;
*/
public List<Person> getResults() {
@JsonProperty("results") return results;
private List<Person> results; }
public WrapperPerson() { public void setResults(List<Person> results) {
super(LoggerFactory.getLogger(WrapperPerson.class)); this.results = results;
} }
}
public List<Person> getResults() {
return results;
}
public void setResults(List<Person> results) {
this.results = results;
}
}
@@ -1,60 +1,77 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.PersonCredit; import com.omertron.themoviedbapi.model.PersonCredit;
import java.util.List; import com.omertron.themoviedbapi.model.PersonType;
import org.slf4j.LoggerFactory; import java.util.ArrayList;
import java.util.List;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
public class WrapperPersonCredits extends WrapperBase { */
/* public class WrapperPersonCredits extends AbstractWrapperAll {
* Properties
*/ @JsonProperty("cast")
private List<PersonCredit> cast;
@JsonProperty("cast") @JsonProperty("crew")
private List<PersonCredit> cast; private List<PersonCredit> crew;
@JsonProperty("crew")
private List<PersonCredit> crew; public List<PersonCredit> getCast() {
return cast;
public WrapperPersonCredits() { }
super(LoggerFactory.getLogger(WrapperMovieCasts.class));
} public void setCast(List<PersonCredit> cast) {
this.cast = cast;
public List<PersonCredit> getCast() { }
return cast;
} public List<PersonCredit> getCrew() {
return crew;
public void setCast(List<PersonCredit> cast) { }
this.cast = cast;
} public void setCrew(List<PersonCredit> crew) {
this.crew = crew;
public List<PersonCredit> getCrew() { }
return crew;
} public List<PersonCredit> getAll(PersonType... typeList) {
List<PersonCredit> personCredits = new ArrayList<PersonCredit>();
public void setCrew(List<PersonCredit> crew) { List<PersonType> types = getTypeList(PersonType.class, typeList);
this.crew = crew;
} // Add a cast member
} if (types.contains(PersonType.CAST)) {
for (PersonCredit member : cast) {
member.setPersonType(PersonType.CAST);
personCredits.add(member);
}
}
// Add a crew member
if (types.contains(PersonType.CREW)) {
for (PersonCredit member : crew) {
member.setPersonType(PersonType.CREW);
personCredits.add(member);
}
}
return personCredits;
}
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Person;
import java.util.List;
/**
*
* @author Stuart
*/
public class WrapperPersonList extends AbstractWrapperAll {
@JsonProperty("results")
private List<Person> personList;
public List<Person> getPersonList() {
return personList;
}
public void setPersonList(List<Person> personList) {
this.personList = personList;
}
}
@@ -1,80 +1,44 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model.ReleaseInfo; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
*
/** * @author Stuart
* */
* @author Stuart public class WrapperReleaseInfo extends AbstractWrapperId implements Serializable {
*/
public class WrapperReleaseInfo { private static final long serialVersionUID = 1L;
/* @JsonProperty("countries")
* Logger private List<ReleaseInfo> countries;
*/
public List<ReleaseInfo> getCountries() {
private static final Logger LOG = LoggerFactory.getLogger(WrapperReleaseInfo.class); return countries;
/* }
* Properties
*/ public void setCountries(List<ReleaseInfo> countries) {
@JsonProperty("id") this.countries = countries;
private int id; }
@JsonProperty("countries") }
private List<ReleaseInfo> countries;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<ReleaseInfo> getCountries() {
return countries;
}
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCountries(List<ReleaseInfo> countries) {
this.countries = countries;
}
public void setId(int id) {
this.id = id;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -0,0 +1,44 @@
/*
* 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.Reviews;
import java.io.Serializable;
import java.util.List;
/**
*
* @author stuart.boston
*/
public class WrapperReviews extends AbstractWrapperAll implements Serializable {
private static final long serialVersionUID = 1L;
@JsonProperty("results")
private List<Reviews> reviews;
public List<Reviews> getReviews() {
return reviews;
}
public void setReviews(List<Reviews> reviews) {
this.reviews = reviews;
}
}
@@ -1,90 +1,77 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Trailer;
import com.omertron.themoviedbapi.model.Trailer; import java.io.Serializable;
import java.util.List; import java.util.ArrayList;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author Stuart
* @author Stuart */
*/ public class WrapperTrailers extends AbstractWrapperId implements Serializable {
public class WrapperTrailers {
/* private static final long serialVersionUID = 1L;
* Logger @JsonProperty("quicktime")
*/ private List<Trailer> quicktime;
@JsonProperty("youtube")
private static final Logger LOG = LoggerFactory.getLogger(WrapperTrailers.class); private List<Trailer> youtube;
/*
* Properties public List<Trailer> getQuicktime() {
*/ return quicktime;
@JsonProperty("id") }
private int id;
@JsonProperty("quicktime") public List<Trailer> getYoutube() {
private List<Trailer> quicktime; return youtube;
@JsonProperty("youtube") }
private List<Trailer> youtube;
public void setQuicktime(List<Trailer> quicktime) {
//<editor-fold defaultstate="collapsed" desc="Getter methods"> this.quicktime = quicktime;
public int getId() { }
return id;
} public void setYoutube(List<Trailer> youtube) {
this.youtube = youtube;
public List<Trailer> getQuicktime() { }
return quicktime;
} /**
* Get a combined list of the trailers with their source website
public List<Trailer> getYoutube() { *
return youtube; * @return
} */
//</editor-fold> public List<Trailer> getAll() {
List<Trailer> trailers = new ArrayList<Trailer>();
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) { // Add the trailer to the return list along with it's source
this.id = id; for (Trailer trailer : quicktime) {
} trailer.setWebsite(Trailer.WEBSITE_QUICKTIME);
trailers.add(trailer);
public void setQuicktime(List<Trailer> quicktime) { }
this.quicktime = quicktime; // Add the trailer to the return list along with it's source
} for (Trailer trailer : youtube) {
trailer.setWebsite(Trailer.WEBSITE_YOUTUBE);
public void setYoutube(List<Trailer> youtube) { trailers.add(trailer);
this.youtube = youtube; }
}
//</editor-fold> return trailers;
}
/** }
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,80 +1,44 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model.Translation; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
*
/** * @author Stuart
* */
* @author Stuart public class WrapperTranslations extends AbstractWrapperId implements Serializable {
*/
public class WrapperTranslations { private static final long serialVersionUID = 1L;
/* @JsonProperty("translations")
* Logger private List<Translation> translations;
*/
public void setTranslations(List<Translation> translations) {
private static final Logger LOG = LoggerFactory.getLogger(WrapperTranslations.class); this.translations = translations;
/* }
* Properties
*/ public List<Translation> getTranslations() {
@JsonProperty("id") return translations;
private int id; }
@JsonProperty("translations") }
private List<Translation> translations;
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) {
this.id = id;
}
public void setTranslations(List<Translation> translations) {
this.translations = translations;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() {
return id;
}
public List<Translation> getTranslations() {
return translations;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
+36 -36
View File
@@ -1,39 +1,39 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>bin</id> <id>bin</id>
<formats> <formats>
<format>${distribution.format}</format> <format>${distribution.format}</format>
</formats> </formats>
<includeBaseDirectory>false</includeBaseDirectory> <includeBaseDirectory>false</includeBaseDirectory>
<fileSets> <fileSets>
<!-- add version.txt file --> <!-- add version.txt file -->
<fileSet> <fileSet>
<directory>${project.build.directory}</directory> <directory>${project.build.directory}</directory>
<outputDirectory></outputDirectory> <outputDirectory></outputDirectory>
<includes> <includes>
<include>version.txt</include> <include>version.txt</include>
</includes> </includes>
</fileSet> </fileSet>
<!-- add readme.txt file --> <!-- add readme.txt file -->
<fileSet> <fileSet>
<directory>${basedir}</directory> <directory>${basedir}</directory>
<outputDirectory></outputDirectory> <outputDirectory></outputDirectory>
<includes> <includes>
<include>readme.txt</include> <include>README.md</include>
</includes> </includes>
</fileSet> </fileSet>
<!-- add jar files --> <!-- add jar files -->
<fileSet> <fileSet>
<directory>${project.build.directory}</directory> <directory>${project.build.directory}</directory>
<outputDirectory></outputDirectory> <outputDirectory></outputDirectory>
<includes> <includes>
<include>**/*.jar</include> <include>**/*.jar</include>
</includes> </includes>
</fileSet> </fileSet>
</fileSets> </fileSets>
</assembly> </assembly>
@@ -1,72 +1,72 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of the FanartTV API. * This file is part of the FanartTV API.
* *
* The FanartTV API is free software: you can redistribute it and/or modify * 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 * 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.
* *
* The FanartTV API is distributed in the hope that it will be useful, * The FanartTV 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 the FanartTV API. If not, see <http://www.gnu.org/licenses/>. * along with the FanartTV API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi; package com.omertron.themoviedbapi;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.logging.LogManager; import java.util.logging.LogManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class TestLogger { public class TestLogger {
private static final Logger LOG = LoggerFactory.getLogger(TestLogger.class); private static final Logger LOG = LoggerFactory.getLogger(TestLogger.class);
private static final String CRLF = "\n"; private static final String CRLF = "\n";
private TestLogger() { private TestLogger() {
throw new UnsupportedOperationException("Class can not be instantiated"); throw new UnsupportedOperationException("Class can not be instantiated");
} }
/** /**
* Configure the logger with a simple in-memory file for the required log level * Configure the logger with a simple in-memory file for the required log level
* *
* @param level The logging level required * @param level The logging level required
* @return True if successful * @return True if successful
*/ */
public static boolean Configure(String level) { public static boolean Configure(String level) {
StringBuilder config = new StringBuilder("handlers = java.util.logging.ConsoleHandler\n"); StringBuilder config = new StringBuilder("handlers = java.util.logging.ConsoleHandler\n");
config.append(".level = ").append(level).append(CRLF); config.append(".level = ").append(level).append(CRLF);
config.append("java.util.logging.ConsoleHandler.level = ").append(level).append(CRLF); config.append("java.util.logging.ConsoleHandler.level = ").append(level).append(CRLF);
// Only works with Java 7 or later // 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); config.append("java.util.logging.SimpleFormatter.format = [%1$tH:%1$tM:%1$tS %4$6s] %2$s - %5$s %6$s%n").append(CRLF);
// Exclude http logging // Exclude http logging
config.append("sun.net.www.protocol.http.HttpURLConnection.level = OFF").append(CRLF); config.append("sun.net.www.protocol.http.HttpURLConnection.level = OFF").append(CRLF);
InputStream ins = new ByteArrayInputStream(config.toString().getBytes()); InputStream ins = new ByteArrayInputStream(config.toString().getBytes());
try { try {
LogManager.getLogManager().readConfiguration(ins); LogManager.getLogManager().readConfiguration(ins);
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Failed to configure log manager due to an IO problem", e); LOG.warn("Failed to configure log manager due to an IO problem", e);
return Boolean.FALSE; return Boolean.FALSE;
} }
LOG.debug("Logger initialized to '{}' level", level); LOG.debug("Logger initialized to '{}' level", level);
return Boolean.TRUE; return Boolean.TRUE;
} }
/** /**
* Set the logging level to "ALL" * Set the logging level to "ALL"
* *
* @return True if successful * @return True if successful
*/ */
public static boolean Configure() { public static boolean Configure() {
return Configure("ALL"); return Configure("ALL");
} }
} }
File diff suppressed because it is too large Load Diff