44 Commits

Author SHA1 Message Date
Omertron 24f7b507b9 [maven-release-plugin] prepare release themoviedbapi-3.6 2013-06-26 14:31:25 +02:00
Stuart Boston d298faec9a Removed getMovieChanges test 2013-06-26 13:29:24 +01:00
Stuart Boston 486486b753 Removed unused imports 2013-06-26 13:02:23 +01:00
Stuart Boston 159fe23efb Updated POM versions 2013-06-13 21:48:34 +01:00
Stuart Boston fc1e05d0b4 Added HTTP 503 error and message 2013-06-13 07:30:18 +01:00
Stuart Boston dc6f5f07b1 Standardised toString methods 2013-06-09 22:26:16 +01:00
Stuart Boston 4243b5aa81 Catch RuntimeException when 503 error 2013-06-09 18:23:41 +01:00
Stuart Boston 1070abcabc Update README.md 2013-06-04 10:38:46 +02:00
Stuart Boston 9cca4660bc Add adult and popularity to KeywordMovie 2013-06-03 12:13:46 +01:00
Stuart Boston 5f27260f57 Updated api-common dependency 2013-05-31 09:59:05 +01:00
Stuart Boston bec9b24129 Reverted to "com.moviejukebox" for groupId 2013-05-28 20:18:39 +01:00
Stuart Boston 8679b03930 Updated to use API-Common component for HTTPClient functionality 2013-05-28 14:27:00 +01:00
Stuart Boston 845aedf871 Added MovieChange method 2013-05-20 13:05:19 +01:00
Stuart Boston d6adc40215 Fix correct logging class for JobDepartment 2013-05-20 13:03:55 +01:00
Stuart Boston 17815b9ffc Fixed some issues 2013-05-20 10:36:01 +01:00
Stuart Boston 60cb490eca Add appendToResponse to person methods 2013-05-19 18:42:26 +01:00
Stuart Boston f08c78c921 Corrected resultsMap
Removed unused imports
2013-05-19 08:24:24 +01:00
Stuart Boston 0414369327 Removed unused imports and dead variables 2013-05-18 22:22:51 +01:00
Stuart Boston 44ba85aaa8 Changed return values to include page values 2013-05-18 22:08:40 +01:00
Stuart Boston 009e725cb6 Added new classes to return the results 2013-05-18 11:23:44 +01:00
Stuart Boston edf4518f35 Refactored Wrapper classes 2013-05-17 22:15:52 +01:00
Omertron c6248b621e [maven-release-plugin] prepare for next development iteration 2013-05-15 20:34:38 +02:00
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
69 changed files with 4307 additions and 3325 deletions
+2 -1
View File
@@ -5,4 +5,5 @@
*.war *.war
*.ear *.ear
/target/ /target/
/nbactions.xml
+12 -6
View File
@@ -3,17 +3,23 @@ The Movie DB API
Author: Stuart Boston (Omertron AT Gmail DOT com) Author: Stuart Boston (Omertron AT Gmail DOT com)
This API uses the TheMovieDB.org API as specified here http://api.themoviedb.org/ This API uses the [TheMovieDB.org API](http://api.themoviedb.org/)
Originally written for use by YetAnotherMovieJukebox (YAMJ) http://code.google.com/p/moviejukebox/ Originally written for use by Yet Another Movie Jukebox [(YAMJ)](http://code.google.com/p/moviejukebox/)
But anyone can feel free to use it for other projects as well.
TheMovieDB.org is an excellent open database for movie and film content. I encourage you to check it out and contribute to keep it growing. But anyone can use it for other projects as well.
http://www.themoviedb.org ***
### TheMovieDB.org
This is an excellent open database for movie and film content.
I *strongly* encourage you to check it out and contribute to keep it growing.
### http://www.themoviedb.org
***
Project Logging Project Logging
--------------- ---------------
This project uses SLF4J (http://www.slf4j.org) to abstract the logging in the project. This project uses [SLF4J](http://www.slf4j.org) to abstract the logging in the project.
To use the logging in your own project you should add one of the bindings listed [HERE](http://www.slf4j.org/manual.html#swapping) To use the logging in your own project you should add one of the bindings listed [HERE](http://www.slf4j.org/manual.html#swapping)
Project Documentation Project Documentation
+41 -27
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.6</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>
@@ -74,61 +74,62 @@
</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>2.2.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
<version>2.1.4</version> <version>2.2.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.1.4</version> <version>2.2.2</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>1.7.5</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>1.7.5</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!--COMMON HTTP TOOLS-->
<dependency>
<groupId>org.yamj</groupId>
<artifactId>api-common</artifactId>
<version>1.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}-${project.version}-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 +141,11 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version> <version>3.1</version>
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
@@ -152,6 +154,7 @@
<!-- excludes><exclude>**/*</exclude></excludes --> <!-- excludes><exclude>**/*</exclude></excludes -->
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
@@ -167,15 +170,17 @@
</archive> </archive>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version> <version>2.14.1</version>
<configuration> <configuration>
<!-- To skip tests by default --> <!-- To skip tests by default -->
<skipTests>${skipTests}</skipTests> <skipTests>${skipTests}</skipTests>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
@@ -190,12 +195,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 +209,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
@@ -223,15 +229,17 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId> <artifactId>versions-maven-plugin</artifactId>
<version>2.0</version> <version>2.0</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
<version>3.2</version> <version>3.3</version>
<configuration> <configuration>
<reportPlugins> <reportPlugins>
<plugin> <plugin>
@@ -259,43 +267,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.7</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version> <version>1.4</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId> <artifactId>maven-install-plugin</artifactId>
<version>2.4</version> <version>2.4</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>2.6</version> <version>2.6</version>
</plugin> </plugin>
</plugins> </plugins>
<extensions> <extensions>
<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>
@@ -55,7 +55,11 @@ public class MovieDbException extends Exception {
/* /*
* Autorisation rejected * Autorisation rejected
*/ */
AUTHORISATION_FAILURE; AUTHORISATION_FAILURE,
/*
* Service Unavailable, usually temporary
*/
HTTP_503_ERROR;
} }
private final MovieDbExceptionType exceptionType; private final MovieDbExceptionType exceptionType;
File diff suppressed because it is too large Load Diff
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -107,10 +109,6 @@ public class AlternativeTitle implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[AlternativeTitle="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[country=").append(country);
sb.append("],[title=").append(title);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -195,14 +197,6 @@ public class Artwork implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Artwork="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[aspectRatio=").append(aspectRatio);
sb.append("],[filePath=").append(filePath);
sb.append("],[height=").append(height);
sb.append("],[language=").append(language);
sb.append("],[width=").append(width);
sb.append("],[artworkType=").append(artworkType);
sb.append("]]");
return sb.toString();
} }
} }
@@ -0,0 +1,52 @@
package com.omertron.themoviedbapi.model;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class ChangeKeyItem {
private static final long serialVersionUID = 1L;
@JsonProperty("key")
private String key;
@JsonProperty("items")
private List<ChangedItem> changedItems = new ArrayList<ChangedItem>();
private Map<String, Object> newItems = new HashMap<String, Object>();
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public List<ChangedItem> getChangedItems() {
return changedItems;
}
public void setChangedItems(List<ChangedItem> changes) {
this.changedItems = changes;
}
@JsonAnyGetter
public Map<String, Object> getNewItems() {
return this.newItems;
}
@JsonAnySetter
public void setNewItems(String name, Object value) {
this.newItems.put(name, value);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -1,128 +0,0 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ChangeValue {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("poster")
private Artwork poster;
@JsonProperty("backdrop")
private Artwork backdrop;
@JsonProperty("title")
private String title;
@JsonProperty("iso_3166_1")
private String language;
@JsonProperty("site")
private String site;
@JsonProperty("name")
private String name;
@JsonProperty("id")
private int id;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public Artwork getPoster() {
return poster;
}
public Artwork getBackdrop() {
return backdrop;
}
public String getTitle() {
return title;
}
public String getLanguage() {
return language;
}
public String getSite() {
return site;
}
public String getName() {
return name;
}
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setPoster(Artwork poster) {
this.poster = poster;
}
public void setBackdrop(Artwork backdrop) {
this.backdrop = backdrop;
backdrop.setArtworkType(ArtworkType.BACKDROP);
}
public void setTitle(String title) {
this.title = title;
}
public void setLanguage(String language) {
this.language = language;
}
public void setSite(String site) {
this.site = site;
}
public void setName(String name) {
this.name = name;
}
public void setId(int id) {
this.id = id;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -0,0 +1,80 @@
package com.omertron.themoviedbapi.model;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class ChangedItem {
private static final long serialVersionUID = 1L;
@JsonProperty("id")
private String id;
@JsonProperty("action")
private String action;
@JsonProperty("time")
private String time;
@JsonProperty("iso_639_1")
private String language;
@JsonProperty("value")
private Object value;
private Map<String, Object> newItems = new HashMap<String, Object>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
@JsonAnyGetter
public Map<String, Object> getNewItems() {
return this.newItems;
}
@JsonAnySetter
public void setNewItems(String name, Object value) {
this.newItems.put(name, value);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -165,14 +167,6 @@ public class Collection implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Collection="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[id=").append(id);
sb.append("],[title=").append(title);
sb.append("],[name=").append(name);
sb.append("],[posterPath=").append(posterPath);
sb.append("],[backdropPath=").append(backdropPath);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("]]");
return sb.toString();
} }
} }
@@ -1,124 +1,129 @@
/* /*
* 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.slf4j.Logger; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.slf4j.LoggerFactory; import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
/** import org.slf4j.LoggerFactory;
*
* @author Stuart /**
*/ *
public class CollectionInfo implements Serializable { * @author Stuart
*/
private static final long serialVersionUID = 1L; public class CollectionInfo implements Serializable {
/*
* Logger private static final long serialVersionUID = 1L;
*/ /*
private static final Logger LOG = LoggerFactory.getLogger(CollectionInfo.class); * Logger
/* */
* Properties private static final Logger LOG = LoggerFactory.getLogger(CollectionInfo.class);
*/ /*
@JsonProperty("id") * Properties
private int id; */
@JsonProperty("name") @JsonProperty("id")
private String name; private int id;
@JsonProperty("poster_path") @JsonProperty("name")
private String posterPath; private String name;
@JsonProperty("backdrop_path") @JsonProperty("overview")
private String backdropPath; private String overview;
@JsonProperty("parts") @JsonProperty("poster_path")
private List<Collection> parts = new ArrayList<Collection>(); private String posterPath;
@JsonProperty("backdrop_path")
//<editor-fold defaultstate="collapsed" desc="Getter methods"> private String backdropPath;
public String getBackdropPath() { @JsonProperty("parts")
return backdropPath; private List<Collection> parts = new ArrayList<Collection>();
}
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() { public String getBackdropPath() {
return id; return backdropPath;
} }
public String getName() { public int getId() {
return name; return id;
} }
public List<Collection> getParts() { public String getName() {
return parts; return name;
} }
public String getPosterPath() { public String getOverview() {
return posterPath; return overview;
} }
//</editor-fold>
public List<Collection> getParts() {
//<editor-fold defaultstate="collapsed" desc="Setter methods"> return parts;
public void setBackdropPath(String backdropPath) { }
this.backdropPath = backdropPath;
} public String getPosterPath() {
return posterPath;
public void setId(int id) { }
this.id = id; //</editor-fold>
}
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setName(String name) { public void setBackdropPath(String backdropPath) {
this.name = name; this.backdropPath = backdropPath;
} }
public void setParts(List<Collection> parts) { public void setId(int id) {
this.parts = parts; this.id = id;
} }
public void setPosterPath(String posterPath) { public void setName(String name) {
this.posterPath = posterPath; this.name = name;
} }
//</editor-fold>
public void setOverview(String overview) {
/** this.overview = overview;
* Handle unknown properties and print a message }
*
* @param key public void setParts(List<Collection> parts) {
* @param value this.parts = parts;
*/ }
@JsonAnySetter
public void handleUnknown(String key, Object value) { public void setPosterPath(String posterPath) {
StringBuilder sb = new StringBuilder(); this.posterPath = posterPath;
sb.append("Unknown property: '").append(key); }
sb.append("' value: '").append(value).append("'"); //</editor-fold>
LOG.trace(sb.toString());
} /**
* Handle unknown properties and print a message
@Override *
public String toString() { * @param key
StringBuilder sb = new StringBuilder("[CollectionInfo="); * @param value
sb.append("[id=").append(id); */
sb.append("],[name=").append(name); @JsonAnySetter
sb.append("],[posterPath=").append(posterPath); public void handleUnknown(String key, Object value) {
sb.append("],[backdropPath=").append(backdropPath); StringBuilder sb = new StringBuilder();
sb.append("],[# of parts=").append(parts.size()); sb.append("Unknown property: '").append(key);
sb.append("]]"); sb.append("' value: '").append(value).append("'");
return sb.toString(); LOG.trace(sb.toString());
} }
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -128,6 +130,6 @@ public class Company implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "Company{" + "companyId=" + companyId + ", name=" + name + ", description=" + description + ", headquarters=" + headquarters + ", homepage=" + homepage + ", logoPath=" + logoPath + ", parentCompany=" + parentCompany + '}'; return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
} }
} }
@@ -0,0 +1,262 @@
/*
* 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 java.util.HashMap;
import java.util.Map;
import static com.omertron.themoviedbapi.tools.ApiUrl.*;
import org.apache.commons.lang3.StringUtils;
/**
* Generate a discover object for use in the MovieDbApi
*
* This allows you to just add the search components you are concerned with
*
* @author stuart.boston
*/
public class Discover {
private 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
*
* 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
*/
public Discover page(int page) {
if (page > 0) {
params.put(PARAM_PAGE, String.valueOf(page));
}
return this;
}
/**
* ISO 639-1 code
*
* @param language
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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.
*
* Expected value is an integer (the id of a genre).
*
* Multiple values can be specified.
*
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'
*
* @param withGenres
*/
public Discover withGenres(String withGenres) {
if (StringUtils.isNotBlank(withGenres)) {
params.put(PARAM_WITH_GENRES, withGenres);
}
return this;
}
/**
* The minimum release to include.
*
* Expected format is YYYY-MM-DD.
*
* @param releaseDateGte
*/
public Discover releaseDateGte(String releaseDateGte) {
if (StringUtils.isNotBlank(releaseDateGte)) {
params.put(PARAM_RELEASE_DATE_GTE, releaseDateGte);
}
return this;
}
/**
* The maximum release to include.
*
* Expected format is YYYY-MM-DD.
*
* @param releaseDateLte
*/
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.
*
* When this value is specified, 'certificationLte' is required.
*
* A ISO 3166-1 is expected
*
* @param certificationCountry
*/
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.
*
* Expected value is a valid certification for the specified 'certificationCountry'.
*
* @param certificationLte
*/
public Discover certificationLte(String certificationLte) {
if (StringUtils.isNotBlank(certificationLte)) {
params.put(PARAM_CERTIFICATION_LTE, certificationLte);
}
return this;
}
/**
* Filter movies to include a specific company.
*
* Expected value is an integer (the id of a company).
*
* They can be comma separated to indicate an 'AND' query
*
* @param withCompanies
*/
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);
}
}
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -108,10 +110,6 @@ public class Genre implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Genre="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -1,82 +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.model; package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.util.List;
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;
/**
* public class JobDepartment {
* @author Stuart
*/ private static final long serialVersionUID = 1L;
public class MovieChanges implements Serializable { // Logger
private static final Logger LOG = LoggerFactory.getLogger(JobDepartment.class);
private static final long serialVersionUID = 1L; // Properties
@JsonProperty("department")
/* private String department;
* Logger @JsonProperty("job_list")
*/ private List<String> jobs;
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
/* //<editor-fold defaultstate="collapsed" desc="Getters">
* Properties public String getDepartment() {
*/ return department;
@JsonProperty("key") }
private String key;
@JsonProperty("items") public List<String> getJobs() {
private List<ChangeItem> items; return jobs;
}
//<editor-fold defaultstate="collapsed" desc="Getter Methods"> //</editor-fold>
public String getKey() {
return key; //<editor-fold defaultstate="collapsed" desc="Setters">
} public void setDepartment(String department) {
this.department = department;
public List<ChangeItem> getItems() { }
return items;
} public void setJobs(List<String> jobs) {
//</editor-fold> this.jobs = jobs;
}
//<editor-fold defaultstate="collapsed" desc="Setter Methods"> //</editor-fold>
public void setKey(String key) {
this.key = key; /**
} * Handle unknown properties and print a message
*
public void setItems(List<ChangeItem> items) { * @param key
this.items = items; * @param value
} */
//</editor-fold> @JsonAnySetter
public void handleUnknown(String key, Object value) {
/** StringBuilder sb = new StringBuilder();
* Handle unknown properties and print a message sb.append("Unknown property: '").append(key);
* sb.append("' value: '").append(value).append("'");
* @param key LOG.trace(sb.toString());
* @param value }
*/
@JsonAnySetter @Override
public void handleUnknown(String key, Object value) { public String toString() {
StringBuilder sb = new StringBuilder(); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("Unknown property: '").append(key); }
sb.append("' value: '").append(value).append("'"); }
LOG.trace(sb.toString());
}
}
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -109,10 +111,6 @@ public class Keyword implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Keyword="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -56,6 +58,10 @@ public class KeywordMovie implements Serializable {
private float voteAverage; private float voteAverage;
@JsonProperty("vote_count") @JsonProperty("vote_count")
private double voteCount; private double voteCount;
@JsonProperty("adult")
private boolean adult;
@JsonProperty("popularity")
private float popularity;
// <editor-fold defaultstate="collapsed" desc="Getter methods"> // <editor-fold defaultstate="collapsed" desc="Getter methods">
public static long getSerialVersionUID() { public static long getSerialVersionUID() {
@@ -93,6 +99,14 @@ public class KeywordMovie implements Serializable {
public double getVoteCount() { public double getVoteCount() {
return voteCount; return voteCount;
} }
public boolean isAdult() {
return adult;
}
public float getPopularity() {
return popularity;
}
// </editor-fold> // </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods"> // <editor-fold defaultstate="collapsed" desc="Setter methods">
@@ -127,6 +141,14 @@ public class KeywordMovie implements Serializable {
public void setVoteCount(double voteCount) { public void setVoteCount(double voteCount) {
this.voteCount = voteCount; this.voteCount = voteCount;
} }
public void setAdult(boolean adult) {
this.adult = adult;
}
public void setPopularity(float popularity) {
this.popularity = popularity;
}
// </editor-fold> // </editor-fold>
/** /**
@@ -143,4 +165,8 @@ public class KeywordMovie implements Serializable {
LOG.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
} }
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -108,10 +110,6 @@ public class Language implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Language="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("isoCode=").append(isoCode);
sb.append(", name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -1,354 +1,452 @@
/* /*
* 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles;
import java.util.List; import com.omertron.themoviedbapi.wrapper.WrapperImages;
import org.slf4j.Logger; import com.omertron.themoviedbapi.wrapper.WrapperMovie;
import org.slf4j.LoggerFactory; import com.omertron.themoviedbapi.wrapper.WrapperMovieCasts;
import com.omertron.themoviedbapi.wrapper.WrapperMovieKeywords;
/** import com.omertron.themoviedbapi.wrapper.WrapperMovieList;
* Movie Bean import com.omertron.themoviedbapi.wrapper.WrapperReleaseInfo;
* import com.omertron.themoviedbapi.wrapper.WrapperReviews;
* @author stuart.boston import com.omertron.themoviedbapi.wrapper.WrapperTrailers;
*/ import com.omertron.themoviedbapi.wrapper.WrapperTranslations;
public class MovieDb implements Serializable { import java.io.Serializable;
import java.util.List;
private static final long serialVersionUID = 1L; import org.apache.commons.lang3.builder.ToStringBuilder;
/* import org.apache.commons.lang3.builder.ToStringStyle;
* Logger import org.slf4j.Logger;
*/ import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(MovieDb.class);
/* /**
* Properties * Movie Bean
*/ *
@JsonProperty("backdrop_path") * @author stuart.boston
private String backdropPath; */
@JsonProperty("id") public class MovieDb implements Serializable {
private int id;
@JsonProperty("original_title") private static final long serialVersionUID = 1L;
private String originalTitle; /*
@JsonProperty("popularity") * Logger
private float popularity; */
@JsonProperty("poster_path") private static final Logger LOG = LoggerFactory.getLogger(MovieDb.class);
private String posterPath; /*
@JsonProperty("release_date") * Properties
private String releaseDate; */
@JsonProperty("title") @JsonProperty("backdrop_path")
private String title; private String backdropPath;
@JsonProperty("adult") @JsonProperty("id")
private boolean adult; private int id;
@JsonProperty("belongs_to_collection") @JsonProperty("original_title")
private Collection belongsToCollection; private String originalTitle;
@JsonProperty("budget") @JsonProperty("popularity")
private long budget; private float popularity;
@JsonProperty("genres") @JsonProperty("poster_path")
private List<Genre> genres; private String posterPath;
@JsonProperty("homepage") @JsonProperty("release_date")
private String homepage; private String releaseDate;
@JsonProperty("imdb_id") @JsonProperty("title")
private String imdbID; private String title;
@JsonProperty("overview") @JsonProperty("adult")
private String overview; private boolean adult;
@JsonProperty("production_companies") @JsonProperty("belongs_to_collection")
private List<ProductionCompany> productionCompanies; private Collection belongsToCollection;
@JsonProperty("production_countries") @JsonProperty("budget")
private List<ProductionCountry> productionCountries; private long budget;
@JsonProperty("revenue") @JsonProperty("genres")
private long revenue; private List<Genre> genres;
@JsonProperty("runtime") @JsonProperty("homepage")
private int runtime; private String homepage;
@JsonProperty("spoken_languages") @JsonProperty("imdb_id")
private List<Language> spokenLanguages; private String imdbID;
@JsonProperty("tagline") @JsonProperty("overview")
private String tagline; private String overview;
@JsonProperty("vote_average") @JsonProperty("production_companies")
private float voteAverage; private List<ProductionCompany> productionCompanies;
@JsonProperty("vote_count") @JsonProperty("production_countries")
private int voteCount; private List<ProductionCountry> productionCountries;
@JsonProperty("status") @JsonProperty("revenue")
private String status; private long revenue;
@JsonProperty("runtime")
// <editor-fold defaultstate="collapsed" desc="Getter methods"> private int runtime;
public String getBackdropPath() { @JsonProperty("spoken_languages")
return backdropPath; private List<Language> spokenLanguages;
} @JsonProperty("tagline")
private String tagline;
public int getId() { @JsonProperty("vote_average")
return id; private float voteAverage;
} @JsonProperty("vote_count")
private int voteCount;
public String getOriginalTitle() { @JsonProperty("status")
return originalTitle; private String status;
} // AppendToResponse Properties
@JsonProperty("alternative_titles")
public float getPopularity() { private WrapperAlternativeTitles alternativeTitles;
return popularity; @JsonProperty("casts")
} private WrapperMovieCasts casts;
@JsonProperty("images")
public String getPosterPath() { private WrapperImages images;
return posterPath; @JsonProperty("keywords")
} private WrapperMovieKeywords keywords;
@JsonProperty("releases")
public String getReleaseDate() { private WrapperReleaseInfo releases;
return releaseDate; @JsonProperty("trailers")
} private WrapperTrailers trailers;
@JsonProperty("translations")
public String getTitle() { private WrapperTranslations translations;
return title; @JsonProperty("similar_movies")
} private WrapperMovie similarMovies;
@JsonProperty("reviews")
public boolean isAdult() { private WrapperReviews reviews;
return adult; @JsonProperty("lists")
} private WrapperMovieList lists;
public Collection getBelongsToCollection() { // <editor-fold defaultstate="collapsed" desc="Getter methods">
return belongsToCollection; public String getBackdropPath() {
} return backdropPath;
}
public long getBudget() {
return budget; public int getId() {
} return id;
}
public List<Genre> getGenres() {
return genres; public String getOriginalTitle() {
} return originalTitle;
}
public String getHomepage() {
return homepage; public float getPopularity() {
} return popularity;
}
public String getImdbID() {
return imdbID; public String getPosterPath() {
} return posterPath;
}
public String getOverview() {
return overview; public String getReleaseDate() {
} return releaseDate;
}
public List<ProductionCompany> getProductionCompanies() {
return productionCompanies; public String getTitle() {
} return title;
}
public List<ProductionCountry> getProductionCountries() {
return productionCountries; public boolean isAdult() {
} return adult;
}
public long getRevenue() {
return revenue; public Collection getBelongsToCollection() {
} return belongsToCollection;
}
public int getRuntime() {
return runtime; public long getBudget() {
} return budget;
}
public List<Language> getSpokenLanguages() {
return spokenLanguages; public List<Genre> getGenres() {
} return genres;
}
public String getTagline() {
return tagline; public String getHomepage() {
} return homepage;
}
public float getVoteAverage() {
return voteAverage; public String getImdbID() {
} return imdbID;
}
public int getVoteCount() {
return voteCount; public String getOverview() {
} return overview;
}
public String getStatus() {
return status; public List<ProductionCompany> getProductionCompanies() {
} return productionCompanies;
// </editor-fold> }
// <editor-fold defaultstate="collapsed" desc="Setter methods"> public List<ProductionCountry> getProductionCountries() {
public void setBackdropPath(String backdropPath) { return productionCountries;
this.backdropPath = backdropPath; }
}
public long getRevenue() {
public void setId(int id) { return revenue;
this.id = id; }
}
public int getRuntime() {
public void setOriginalTitle(String originalTitle) { return runtime;
this.originalTitle = originalTitle; }
}
public List<Language> getSpokenLanguages() {
public void setPopularity(float popularity) { return spokenLanguages;
this.popularity = popularity; }
}
public String getTagline() {
public void setPosterPath(String posterPath) { return tagline;
this.posterPath = posterPath; }
}
public float getVoteAverage() {
public void setReleaseDate(String releaseDate) { return voteAverage;
this.releaseDate = releaseDate; }
}
public int getVoteCount() {
public void setTitle(String title) { return voteCount;
this.title = title; }
}
public String getStatus() {
public void setAdult(boolean adult) { return status;
this.adult = adult; }
} // </editor-fold>
public void setBelongsToCollection(Collection belongsToCollection) { // <editor-fold defaultstate="collapsed" desc="Setter methods">
this.belongsToCollection = belongsToCollection; public void setBackdropPath(String backdropPath) {
} this.backdropPath = backdropPath;
}
public void setBudget(long budget) {
this.budget = budget; public void setId(int id) {
} this.id = id;
}
public void setGenres(List<Genre> genres) {
this.genres = genres; public void setOriginalTitle(String originalTitle) {
} this.originalTitle = originalTitle;
}
public void setHomepage(String homepage) {
this.homepage = homepage; public void setPopularity(float popularity) {
} this.popularity = popularity;
}
public void setImdbID(String imdbID) {
this.imdbID = imdbID; public void setPosterPath(String posterPath) {
} this.posterPath = posterPath;
}
public void setOverview(String overview) {
this.overview = overview; public void setReleaseDate(String releaseDate) {
} this.releaseDate = releaseDate;
}
public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
this.productionCompanies = productionCompanies; public void setTitle(String title) {
} this.title = title;
}
public void setProductionCountries(List<ProductionCountry> productionCountries) {
this.productionCountries = productionCountries; public void setAdult(boolean adult) {
} this.adult = adult;
}
public void setRevenue(long revenue) {
this.revenue = revenue; public void setBelongsToCollection(Collection belongsToCollection) {
} this.belongsToCollection = belongsToCollection;
}
public void setRuntime(int runtime) {
this.runtime = runtime; public void setBudget(long budget) {
} this.budget = budget;
}
public void setSpokenLanguages(List<Language> spokenLanguages) {
this.spokenLanguages = spokenLanguages; public void setGenres(List<Genre> genres) {
} this.genres = genres;
}
public void setTagline(String tagline) {
this.tagline = tagline; public void setHomepage(String homepage) {
} this.homepage = homepage;
}
public void setVoteAverage(float voteAverage) {
this.voteAverage = voteAverage; public void setImdbID(String imdbID) {
} this.imdbID = imdbID;
}
public void setVoteCount(int voteCount) {
this.voteCount = voteCount; public void setOverview(String overview) {
} this.overview = overview;
}
public void setStatus(String status) {
this.status = status; public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
} this.productionCompanies = productionCompanies;
}
// </editor-fold>
/** public void setProductionCountries(List<ProductionCountry> productionCountries) {
* Handle unknown properties and print a message this.productionCountries = productionCountries;
* }
* @param key
* @param value public void setRevenue(long revenue) {
*/ this.revenue = revenue;
@JsonAnySetter }
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder(); public void setRuntime(int runtime) {
sb.append("Unknown property: '").append(key); this.runtime = runtime;
sb.append("' value: '").append(value).append("'"); }
LOG.trace(sb.toString());
} public void setSpokenLanguages(List<Language> spokenLanguages) {
this.spokenLanguages = spokenLanguages;
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode"> }
@Override
public boolean equals(Object obj) { public void setTagline(String tagline) {
if (obj == null) { this.tagline = tagline;
return false; }
}
if (getClass() != obj.getClass()) { public void setVoteAverage(float voteAverage) {
return false; this.voteAverage = voteAverage;
} }
final MovieDb other = (MovieDb) obj;
if (this.id != other.id) { public void setVoteCount(int voteCount) {
return false; this.voteCount = voteCount;
} }
if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) {
return false; public void setStatus(String status) {
} this.status = status;
if (this.runtime != other.runtime) { }
return false;
} // </editor-fold>
return true;
} //<editor-fold defaultstate="collapsed" desc="AppendToResponse Getters">
public List<AlternativeTitle> getAlternativeTitles() {
@Override return alternativeTitles.getTitles();
public int hashCode() { }
int hash = 5;
hash = 89 * hash + this.id; public List<PersonCast> getCast() {
hash = 89 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0); return casts.getCast();
hash = 89 * hash + this.runtime; }
return hash;
} public List<PersonCrew> getCrew() {
//</editor-fold> return casts.getCrew();
}
@Override
public String toString() { public List<Artwork> getImages() {
StringBuilder sb = new StringBuilder("[MovieDB="); return images.getAll();
sb.append("[backdropPath=").append(backdropPath); }
sb.append("],[id=").append(id);
sb.append("],[originalTitle=").append(originalTitle); public List<Keyword> getKeywords() {
sb.append("],[popularity=").append(popularity); return keywords.getKeywords();
sb.append("],[posterPath=").append(posterPath); }
sb.append("],[releaseDate=").append(releaseDate);
sb.append("],[title=").append(title); public List<ReleaseInfo> getReleases() {
sb.append("],[adult=").append(adult); return releases.getCountries();
sb.append("],[belongsToCollection=").append(belongsToCollection); }
sb.append("],[budget=").append(budget);
sb.append("],[genres=").append(genres); public List<Trailer> getTrailers() {
sb.append("],[homepage=").append(homepage); return trailers.getAll();
sb.append("],[imdbID=").append(imdbID); }
sb.append("],[overview=").append(overview);
sb.append("],[productionCompanies=").append(productionCompanies); public List<Translation> getTranslations() {
sb.append("],[productionCountries=").append(productionCountries); return translations.getTranslations();
sb.append("],[revenue=").append(revenue); }
sb.append("],[runtime=").append(runtime);
sb.append("],[spokenLanguages=").append(spokenLanguages); public List<MovieDb> getSimilarMovies() {
sb.append("],[tagline=").append(tagline); return similarMovies.getMovies();
sb.append("],[voteAverage=").append(voteAverage); }
sb.append("],[voteCount=").append(voteCount);
sb.append("],[status=").append(status); public List<MovieList> getLists() {
sb.append("]]"); return lists.getMovieList();
return sb.toString(); }
}
} public List<Reviews> getReviews() {
return reviews.getReviews();
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="AppendToResponse Setters">
public void setAlternativeTitles(WrapperAlternativeTitles alternativeTitles) {
this.alternativeTitles = alternativeTitles;
}
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>
/**
* 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());
}
//<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>
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -23,11 +23,14 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Wrapper for the MovieDbList function * Wrapper for the MovieDbList function
*
* @author stuart.boston * @author stuart.boston
*/ */
public class MovieDbList { public class MovieDbList {
@@ -148,4 +151,8 @@ public class MovieDbList {
LOG.trace(sb.toString()); LOG.trace(sb.toString());
} }
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -141,6 +143,6 @@ public class MovieList implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "MovieList{" + "description=" + description + ", favoriteCount=" + favoriteCount + ", id=" + id + ", itemCount=" + itemCount + ", language=" + language + ", name=" + name + ", posterPath=" + posterPath + '}'; return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
} }
} }
@@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -321,23 +323,6 @@ public class Person implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Person="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("],[profilePath=").append(profilePath);
sb.append("],[personType=").append(personType);
sb.append("],[department=").append(department);
sb.append("],[job=").append(job);
sb.append("],[character=").append(character);
sb.append("],[order=").append(order);
sb.append("],[adult=").append(adult);
sb.append("],[=aka").append(aka.toString());
sb.append("],[biography=").append(biography);
sb.append("],[birthday=").append(birthday);
sb.append("],[deathday=").append(deathday);
sb.append("],[homepage=").append(homepage);
sb.append("],[birthplace=").append(birthplace);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -161,13 +163,6 @@ public class PersonCast implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[PersonCast="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("id=").append(id);
sb.append("],[character=").append(character);
sb.append("],[name=").append(name);
sb.append("],[order=").append(order);
sb.append("],[profilePath=").append(profilePath);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -161,18 +163,6 @@ public class PersonCredit implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[PersonCredit="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[movieId=").append(movieId);
sb.append("],[personType=").append(personType);
sb.append("],[originalTitle=").append(movieOriginalTitle);
sb.append("],[movieTitle=").append(movieTitle);
sb.append("],[posterPath=").append(posterPath);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("],[character=").append(character);
sb.append("],[department=").append(department);
sb.append("],[job=").append(job);
sb.append("],[adult=").append(adult);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -146,13 +148,6 @@ public class PersonCrew implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[PersonCrew="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("id=").append(id);
sb.append("],[department=").append(department);
sb.append("],[job=").append(job);
sb.append("],[name=").append(name);
sb.append("],[profilePath=").append(profilePath);
sb.append("]]");
return sb.toString();
} }
} }
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -109,10 +111,6 @@ public class ProductionCompany implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ProductionCompany="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[id=").append(id);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -109,10 +111,6 @@ public class ProductionCountry implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ProductionCountry="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[isoCode=").append(isoCode);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -121,11 +123,6 @@ public class ReleaseInfo implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ReleaseInfo="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[country=").append(country);
sb.append("],[certification=").append(certification);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("]]");
return sb.toString();
} }
} }
@@ -1,122 +1,108 @@
/* /*
* 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.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger; import java.io.Serializable;
import org.slf4j.LoggerFactory; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class ChangeItem { import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final long serialVersionUID = 1L;
/**
/* *
* Logger * @author Stuart
*/ */
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class); public class Reviews implements Serializable {
/*
* Properties private static final long serialVersionUID = 1L;
*/
@JsonProperty("id") /*
private String id; * Logger
@JsonProperty("action") */
private String action; private static final Logger LOG = LoggerFactory.getLogger(Reviews.class);
@JsonProperty("time") /*
private String time; * Properties
@JsonProperty("value") */
private ChangeValue value; @JsonProperty("id")
@JsonProperty("original_value") private String id;
private ChangeValue originalValue; @JsonProperty("author")
@JsonProperty("iso_639_1") private String author;
private String language; @JsonProperty("content")
private String content;
//<editor-fold defaultstate="collapsed" desc="Getter Methods"> @JsonProperty("url")
public String getId() { private String url;
return id;
} // <editor-fold defaultstate="collapsed" desc="Getter methods">
public String getId() {
public String getAction() { return id;
return action; }
}
public String getAuthor() {
public String getTime() { return author;
return time; }
}
public String getContent() {
public ChangeValue getValue() { return content;
return value; }
}
public String getUrl() {
public ChangeValue getOriginalValue() { return url;
return originalValue; }
} // </editor-fold>
public String getLanguage() { // <editor-fold defaultstate="collapsed" desc="Setter methods">
return language; public void setId(String id) {
} this.id = id;
//</editor-fold> }
//<editor-fold defaultstate="collapsed" desc="Setter Methods"> public void setAuthor(String author) {
public void setId(String id) { this.author = author;
this.id = id; }
}
public void setContent(String content) {
public void setAction(String action) { this.content = content;
this.action = action; }
}
public void setUrl(String url) {
public void setTime(String time) { this.url = url;
this.time = time; }
} // </editor-fold>
public void setValue(ChangeValue value) { /**
this.value = value; * Handle unknown properties and print a message
} *
* @param key
public void setOriginalValue(ChangeValue originalValue) { * @param value
this.originalValue = originalValue; */
} @JsonAnySetter
public void handleUnknown(String key, Object value) {
public void setLanguage(String language) { StringBuilder sb = new StringBuilder();
this.language = language; sb.append("Unknown property: '").append(key);
} sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
//</editor-fold> }
@Override @Override
public String toString() { public String toString() {
return "ChangeItem{" + "id=" + id + ", action=" + action + ", time=" + time + ", value=" + value + '}'; return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
} }
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -81,9 +83,6 @@ public class StatusCode implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("Status Code: ").append(statusCode);
sb.append(", Message: ").append(statusMessage);
return sb.toString();
} }
} }
@@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -195,13 +197,6 @@ public class TmdbConfiguration implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[ImageConfiguration="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[baseUrl=").append(baseUrl);
sb.append("],[posterSizes=").append(posterSizes.toString());
sb.append("],[backdropSizes=").append(backdropSizes.toString());
sb.append("],[profileSizes=").append(profileSizes.toString());
sb.append("],[logoSizes=").append(logoSizes.toString());
sb.append(("]]"));
return sb.toString();
} }
} }
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -83,7 +85,7 @@ public class TokenAuthorisation {
@Override @Override
public String toString() { public String toString() {
return "TokenAuthorisation{" + "expires=" + expires + ", requestToken=" + requestToken + ", success=" + success + '}'; return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
} }
} }
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -115,6 +117,6 @@ public class TokenSession {
@Override @Override
public String toString() { public String toString() {
return "TokenSession{" + "sessionId=" + sessionId + ", success=" + success + ", statusCode=" + statusCode + ", statusMessage=" + statusMessage + ", guestSessionId=" + guestSessionId + ", expiresAt=" + expiresAt + '}'; return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
} }
} }
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -132,12 +134,6 @@ public class Trailer implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Trailer="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("name=").append(name);
sb.append("],[size=").append(size);
sb.append("],[source=").append(source);
sb.append("],[website=").append(website);
sb.append("]]");
return sb.toString();
} }
} }
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable; import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -121,11 +123,6 @@ public class Translation implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("[Translation="); return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
sb.append("[englishName=").append(englishName); }
sb.append("],[isoCode=").append(isoCode);
sb.append("],[name=").append(name);
sb.append("]]");
return sb.toString();
}
} }
@@ -0,0 +1,105 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.results;
import com.omertron.themoviedbapi.wrapper.AbstractWrapper;
import com.omertron.themoviedbapi.wrapper.AbstractWrapperAll;
import com.omertron.themoviedbapi.wrapper.AbstractWrapperId;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* Abstract class to return the results and the id/page info
*
* @author Stuart
*/
public abstract class TmdbResults {
private int id = 0;
private int page = 0;
private int totalPages = 0;
private int totalResults = 0;
//<editor-fold defaultstate="collapsed" desc="Getters">
public int getId() {
return id;
}
public int getPage() {
return page;
}
public int getTotalPages() {
return totalPages;
}
public int getTotalResults() {
return totalResults;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setters">
public void setId(int id) {
this.id = id;
}
public void setPage(int page) {
this.page = page;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
//</editor-fold>
public void copyWrapper(AbstractWrapper wrapper) {
// These results have nothing to copy, so this is just a placeholder
}
/**
* Copy the Id from the wrapper
*
* @param wrapper
*/
public void copyWrapper(AbstractWrapperId wrapper) {
this.id = wrapper.getId();
}
/**
* Copy the Id and pages from the wrapper
*
* @param wrapper
*/
public void copyWrapper(AbstractWrapperAll wrapper) {
this.id = wrapper.getId();
this.page = wrapper.getPage();
this.totalPages = wrapper.getTotalPages();
this.totalResults = wrapper.getTotalResults();
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.results;
import java.util.ArrayList;
import java.util.List;
/**
* List of the results from TheMovieDb
*
* @author Stuart
* @param <T>
*/
public final class TmdbResultsList<T> extends TmdbResults {
private List<T> results;
public TmdbResultsList(List<T> resultList) {
if (resultList != null) {
results = new ArrayList<T>(resultList);
} else {
results = new ArrayList<T>(0);
}
}
public List<T> getResults() {
return results;
}
public void setResults(List<T> results) {
this.results = results;
}
}
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.results;
import java.util.HashMap;
import java.util.Map;
/**
* Map of the results from TheMovieDb
*
* @author Stuart
* @param <K>
* @param <V>
*/
public final class TmdbResultsMap<K, V> extends TmdbResults {
private Map<K, V> results;
public TmdbResultsMap(Map<K, V> resultsMap) {
results = new HashMap<K, V>(resultsMap);
}
public Map<K, V> getResults() {
return results;
}
public void setResults(Map<K, V> results) {
this.results = results;
}
}
@@ -19,13 +19,13 @@
*/ */
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;
@@ -53,7 +53,7 @@ public class ApiUrl {
/* /*
* Properties * Properties
*/ */
private TheMovieDbApi tmdb; private String apiKey;
private String method; private String method;
private String submethod; private String submethod;
private Map<String, String> arguments = new HashMap<String, String>(); private Map<String, String> arguments = new HashMap<String, String>();
@@ -67,7 +67,6 @@ public class ApiUrl {
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=";
@@ -75,6 +74,9 @@ public class ApiUrl {
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=";
private static final String APPEND_TO_RESPONSE = "append_to_response=";
//<editor-fold defaultstate="collapsed" desc="Constructor Methods"> //<editor-fold defaultstate="collapsed" desc="Constructor Methods">
/** /**
@@ -82,8 +84,8 @@ public class ApiUrl {
* *
* @param method * @param method
*/ */
public ApiUrl(TheMovieDbApi tmdb, String method) { public ApiUrl(String apiKey, String method) {
this.tmdb = tmdb; this.apiKey = apiKey;
this.method = method; this.method = method;
this.submethod = DEFAULT_STRING; this.submethod = DEFAULT_STRING;
} }
@@ -94,8 +96,8 @@ public class ApiUrl {
* @param method * @param method
* @param submethod * @param submethod
*/ */
public ApiUrl(TheMovieDbApi tmdb, String method, String submethod) { public ApiUrl(String apiKey, String method, String submethod) {
this.tmdb = tmdb; this.apiKey = apiKey;
this.method = method; this.method = method;
this.submethod = submethod; this.submethod = submethod;
} }
@@ -113,11 +115,14 @@ public class ApiUrl {
// We have either a queury, or a direct request // We have either a queury, or a direct request
if (arguments.containsKey(PARAM_QUERY)) { if (arguments.containsKey(PARAM_QUERY)) {
// Append the suffix of the API URL // Append the suffix of the API URL
if(StringUtils.endsWith(urlString, "/") && submethod.startsWith("/")) {
urlString.deleteCharAt(urlString.length()-1);
}
urlString.append(submethod); urlString.append(submethod);
// Append the key information // Append the key information
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY); urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
urlString.append(tmdb.getApiKey()); urlString.append(apiKey);
// Append the search term // Append the search term
urlString.append(DELIMITER_SUBSEQUENT); urlString.append(DELIMITER_SUBSEQUENT);
@@ -128,11 +133,12 @@ public class ApiUrl {
try { try {
urlString.append(URLEncoder.encode(query, "UTF-8")); urlString.append(URLEncoder.encode(query, "UTF-8"));
} catch (UnsupportedEncodingException ex) { } catch (UnsupportedEncodingException ex) {
LOG.trace("Unable to encode query: '" + query + "' trying raw."); LOG.trace("Unable to encode query: '{}' trying raw.", query);
// If we can't encode it, try it raw // If we can't encode it, try it raw
urlString.append(query); urlString.append(query);
} }
// Remove the query from the arguments so it is not added later
arguments.remove(PARAM_QUERY); arguments.remove(PARAM_QUERY);
} else { } else {
// Append the ID if provided // Append the ID if provided
@@ -142,11 +148,14 @@ public class ApiUrl {
} }
// Append the suffix of the API URL // Append the suffix of the API URL
if(StringUtils.endsWith(urlString, "/") && submethod.startsWith("/")) {
urlString.deleteCharAt(urlString.length()-1);
}
urlString.append(submethod); urlString.append(submethod);
// Append the key information // Append the key information
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY); urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
urlString.append(tmdb.getApiKey()); urlString.append(apiKey);
} }
for (Map.Entry<String, String> argEntry : arguments.entrySet()) { for (Map.Entry<String, String> argEntry : arguments.entrySet()) {
@@ -195,6 +204,16 @@ public class ApiUrl {
arguments.put(key, Boolean.toString(value)); arguments.put(key, Boolean.toString(value));
} }
/**
* Add arguments individually
*
* @param key
* @param value
*/
public void addArgument(String key, float value) {
arguments.put(key, Float.toString(value));
}
/** /**
* Clear the arguments * Clear the arguments
*/ */
@@ -210,4 +229,25 @@ public class ApiUrl {
public void setArguments(Map<String, String> args) { public void setArguments(Map<String, String> args) {
arguments.putAll(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());
}
}
} }
@@ -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.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractWrapper {
private Logger log;
public AbstractWrapper(Class classToLog) {
this.log = LoggerFactory.getLogger(classToLog);
}
/**
* Get a list of the enums passed
*
* @param <E>
* @param clz Class of the enum
* @param typeList Array of the enums
* @return
*/
public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) {
if (typeList.length > 0) {
return new ArrayList<E>(Arrays.asList(typeList));
} else {
return new ArrayList<E>(EnumSet.allOf(clz));
}
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
log.trace(sb.toString());
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
}
}
@@ -1,102 +1,74 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger; /**
* Base class for the wrappers
/** *
* Base class for the wrappers * @author Stuart
* */
* @author Stuart public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, IWrapperPages {
*/ /*
public class WrapperBase { * Properties
/* */
* Logger - set by the sub-classes
*/ @JsonProperty("page")
private int page;
private Logger log; @JsonProperty("total_pages")
/* private int totalPages;
* Properties @JsonProperty("total_results")
*/ private int totalResults;
@JsonProperty("id")
private int id; public AbstractWrapperAll(Class classToLog) {
@JsonProperty("page") super(classToLog);
private int page; }
@JsonProperty("total_pages")
private int totalPages; @Override
@JsonProperty("total_results") public int getPage() {
private int totalResults; return page;
}
public WrapperBase(Logger logger) {
this.log = logger; @Override
} public int getTotalPages() {
return totalPages;
//<editor-fold defaultstate="collapsed" desc="Getter Methods"> }
public int getId() {
return id; @Override
} public int getTotalResults() {
return totalResults;
public int getPage() { }
return page;
} @Override
public void setPage(int page) {
public int getTotalPages() { this.page = page;
return totalPages; }
}
@Override
public int getTotalResults() { public void setTotalPages(int totalPages) {
return totalResults; this.totalPages = totalPages;
} }
//</editor-fold>
@Override
//<editor-fold defaultstate="collapsed" desc="Setter Methods"> public void setTotalResults(int totalResults) {
public void setId(int id) { this.totalResults = totalResults;
this.id = id; }
} }
public void setPage(int page) {
this.page = page;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
log.trace(sb.toString());
}
}
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Base class for the wrappers
*
* @author Stuart
*/
public class AbstractWrapperId extends AbstractWrapper implements IWrapperId {
/*
* Properties
*/
@JsonProperty("id")
private int id;
public AbstractWrapperId(Class classToLog) {
super(classToLog);
}
@Override
public int getId() {
return id;
}
@Override
public void setId(int id) {
this.id = id;
}
}
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
public interface IWrapperId {
int getId();
void setId(int id);
}
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
public interface IWrapperPages {
int getPage();
void setPage(int page);
int getTotalPages();
void setTotalPages(int totalPages);
int getTotalResults();
void setTotalResults(int totalResults);
}
@@ -1,76 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model.AlternativeTitle; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperAlternativeTitles extends AbstractWrapperId {
* @author Stuart
*/ @JsonProperty("titles")
public class WrapperAlternativeTitles { private List<AlternativeTitle> titles;
/*
* Logger public WrapperAlternativeTitles() {
*/ super(WrapperAlternativeTitles.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperAlternativeTitles.class);
/* public List<AlternativeTitle> getTitles() {
* Properties return titles;
*/ }
@JsonProperty("id")
private int id; public void setTitles(List<AlternativeTitle> titles) {
@JsonProperty("titles") this.titles = titles;
private List<AlternativeTitle> titles; }
}
public int getId() {
return id;
}
public List<AlternativeTitle> getTitles() {
return titles;
}
public void setId(int id) {
this.id = id;
}
public void setTitles(List<AlternativeTitle> titles) {
this.titles = titles;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,70 +1,42 @@
/* package com.omertron.themoviedbapi.wrapper;
* Copyright (c) 2004-2013 Stuart Boston
* import java.util.ArrayList;
* This file is part of TheMovieDB API. import java.util.HashMap;
* import java.util.List;
* TheMovieDB API is free software: you can redistribute it and/or modify import java.util.Map;
* it under the terms of the GNU General Public License as published by import com.fasterxml.jackson.annotation.JsonAnyGetter;
* the Free Software Foundation, either version 3 of the License, or import com.fasterxml.jackson.annotation.JsonAnySetter;
* any later version. import com.fasterxml.jackson.annotation.JsonProperty;
* import com.omertron.themoviedbapi.model.ChangeKeyItem;
* TheMovieDB API is distributed in the hope that it will be useful, import org.apache.commons.lang3.builder.ToStringBuilder;
* but WITHOUT ANY WARRANTY; without even the implied warranty of import org.apache.commons.lang3.builder.ToStringStyle;
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. public class WrapperChanges {
*
* You should have received a copy of the GNU General Public License @JsonProperty("changes")
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. private List<ChangeKeyItem> changedItems = new ArrayList<ChangeKeyItem>();
* private Map<String, Object> newItems = new HashMap<String, Object>();
*/
package com.omertron.themoviedbapi.wrapper; public List<ChangeKeyItem> getChangedItems() {
return changedItems;
import com.fasterxml.jackson.annotation.JsonAnySetter; }
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieChanges; public void setChangedItems(List<ChangeKeyItem> changes) {
import java.util.List; this.changedItems = changes;
import org.slf4j.Logger; }
import org.slf4j.LoggerFactory;
@JsonAnyGetter
/** public Map<String, Object> getNewItems() {
* return this.newItems;
* @author stuart.boston }
*/
public class WrapperChanges { @JsonAnySetter
/* public void setNewItems(String name, Object value) {
* Logger this.newItems.put(name, value);
*/ }
private static final Logger LOG = LoggerFactory.getLogger(WrapperChanges.class); @Override
/* public String toString() {
* Properties return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
*/ }
@JsonProperty("changes") }
private List<MovieChanges> changes;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<MovieChanges> getChanges() {
return changes;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setChanges(List<MovieChanges> changes) {
this.changes = changes;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Collection; import com.omertron.themoviedbapi.model.Collection;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCollection extends AbstractWrapperAll {
public class WrapperCollection extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Collection> results;
*/
public WrapperCollection() {
@JsonProperty("results") super(WrapperCollection.class);
private List<Collection> results; }
public WrapperCollection() { public List<Collection> getResults() {
super(LoggerFactory.getLogger(WrapperCollection.class)); return results;
} }
public List<Collection> getResults() { public void setResults(List<Collection> results) {
return results; this.results = results;
} }
}
public void setResults(List<Collection> results) {
this.results = results;
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Company; import com.omertron.themoviedbapi.model.Company;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCompany extends AbstractWrapperAll {
public class WrapperCompany extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Company> results;
*/
public WrapperCompany() {
@JsonProperty("results") super(WrapperCompany.class);
private List<Company> results; }
public WrapperCompany() { public List<Company> getResults() {
super(LoggerFactory.getLogger(WrapperCompany.class)); return results;
} }
public List<Company> getResults() { public void setResults(List<Company> results) {
return results; this.results = results;
} }
}
public void setResults(List<Company> results) {
this.results = results;
}
}
@@ -1,62 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperCompanyMovies extends AbstractWrapperAll {
public class WrapperCompanyMovies extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<MovieDb> results;
*/
public WrapperCompanyMovies() {
@JsonProperty("results") super(WrapperCompanyMovies.class);
private List<MovieDb> results; }
public WrapperCompanyMovies() { public List<MovieDb> getResults() {
super(LoggerFactory.getLogger(WrapperCompanyMovies.class)); return results;
} }
public List<MovieDb> getResults() { public void setResults(List<MovieDb> results) {
return results; this.results = results;
} }
}
public void setResults(List<MovieDb> results) {
this.results = results;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[companyId=").append(getId());
sb.append("],[page=").append(getPage());
sb.append("],[pageResults=").append(getResults().size());
sb.append("],[totalPages=").append(getTotalPages());
sb.append("],[totalResults=").append(getTotalResults());
sb.append("]]");
return sb.toString();
}
}
@@ -1,77 +1,57 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.TmdbConfiguration;
import com.omertron.themoviedbapi.model.TmdbConfiguration; import java.util.Collections;
import java.util.Collections; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperConfig extends AbstractWrapper {
* @author Stuart
*/ @JsonProperty("images")
public class WrapperConfig { private TmdbConfiguration tmdbConfiguration;
/* @JsonProperty("change_keys")
* Logger private List<String> changeKeys = Collections.EMPTY_LIST;
*/
public WrapperConfig() {
private static final Logger LOG = LoggerFactory.getLogger(WrapperConfig.class); super(WrapperConfig.class);
/* }
* Properties
*/ public TmdbConfiguration getTmdbConfiguration() {
@JsonProperty("images") return tmdbConfiguration;
private TmdbConfiguration tmdbConfiguration; }
@JsonProperty("change_keys")
private List<String> changeKeys = Collections.EMPTY_LIST; public void setTmdbConfiguration(TmdbConfiguration tmdbConfiguration) {
this.tmdbConfiguration = tmdbConfiguration;
public TmdbConfiguration getTmdbConfiguration() { }
return tmdbConfiguration;
} public List<String> getChangeKeys() {
return changeKeys;
public void setTmdbConfiguration(TmdbConfiguration tmdbConfiguration) { }
this.tmdbConfiguration = tmdbConfiguration;
} public void setChangeKeys(List<String> changeKeys) {
this.changeKeys = changeKeys;
public List<String> getChangeKeys() { }
return changeKeys; }
}
public void setChangeKeys(List<String> changeKeys) {
this.changeKeys = changeKeys;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,67 +1,47 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Genre;
import com.omertron.themoviedbapi.model.Genre; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; * Wrapper class for the Genres searches
*
/** * @author Stuart
* Wrapper class for the Genres searches */
* public class WrapperGenres extends AbstractWrapper {
* @author Stuart
*/ @JsonProperty("genres")
public class WrapperGenres { private List<Genre> genres;
/*
* Logger public WrapperGenres() {
*/ super(WrapperGenres.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperGenres.class);
/* public List<Genre> getGenres() {
* Properties return genres;
*/ }
@JsonProperty("genres")
private List<Genre> genres; public void setGenres(List<Genre> genres) {
this.genres = genres;
public List<Genre> getGenres() { }
return genres; }
}
public void setGenres(List<Genre> genres) {
this.genres = genres;
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,74 +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.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.util.ArrayList;
import java.util.Arrays;
/** import java.util.Collections;
* import java.util.List;
* @author Stuart
*/ /**
public class WrapperImages extends WrapperBase { *
/* * @author Stuart
* Properties */
*/ public class WrapperImages extends AbstractWrapperAll {
@JsonProperty("backdrops") @JsonProperty("backdrops")
private List<Artwork> backdrops; private List<Artwork> backdrops = Collections.EMPTY_LIST;
@JsonProperty("posters") @JsonProperty("posters")
private List<Artwork> posters; private List<Artwork> posters = Collections.EMPTY_LIST;
@JsonProperty("profiles") @JsonProperty("profiles")
private List<Artwork> profiles; private List<Artwork> profiles = Collections.EMPTY_LIST;
public WrapperImages() { public WrapperImages() {
super(LoggerFactory.getLogger(WrapperImages.class)); super(WrapperImages.class);
} }
//<editor-fold defaultstate="collapsed" desc="Getter methods"> public List<Artwork> getBackdrops() {
public List<Artwork> getBackdrops() { return backdrops;
return backdrops; }
}
public List<Artwork> getPosters() {
public List<Artwork> getPosters() { return posters;
return posters; }
}
public List<Artwork> getProfiles() {
public List<Artwork> getProfiles() { return profiles;
return profiles; }
}
//</editor-fold> public void setBackdrops(List<Artwork> backdrops) {
this.backdrops = backdrops;
//<editor-fold defaultstate="collapsed" desc="Setter methods"> }
public void setBackdrops(List<Artwork> backdrops) {
this.backdrops = backdrops; public void setPosters(List<Artwork> posters) {
} this.posters = posters;
}
public void setPosters(List<Artwork> posters) {
this.posters = posters; public void setProfiles(List<Artwork> profiles) {
} this.profiles = profiles;
}
public void setProfiles(List<Artwork> profiles) {
this.profiles = profiles; /**
} * Return a list of all the artwork with their types.
//</editor-fold> *
} * Leaving the parameters blank will return all types
*
* @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,46 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.JobDepartment;
import java.util.List;
/**
*
* @author Stuart
*/
public class WrapperJobList extends AbstractWrapper {
@JsonProperty("jobs")
private List<JobDepartment> jobs;
public WrapperJobList() {
super(WrapperJobList.class);
}
public List<JobDepartment> getJobs() {
return jobs;
}
public void setJobs(List<JobDepartment> jobs) {
this.jobs = jobs;
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.KeywordMovie; import com.omertron.themoviedbapi.model.KeywordMovie;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperKeywordMovies extends AbstractWrapperAll {
public class WrapperKeywordMovies extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<KeywordMovie> results;
*/
public WrapperKeywordMovies() {
@JsonProperty("results") super(WrapperKeywordMovies.class);
private List<KeywordMovie> results; }
public WrapperKeywordMovies() { public List<KeywordMovie> getResults() {
super(LoggerFactory.getLogger(WrapperKeywordMovies.class)); return results;
} }
public List<KeywordMovie> getResults() { public void setResults(List<KeywordMovie> results) {
return results; this.results = results;
} }
}
public void setResults(List<KeywordMovie> results) {
this.results = results;
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Keyword; import com.omertron.themoviedbapi.model.Keyword;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperKeywords extends AbstractWrapperAll {
public class WrapperKeywords extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Keyword> results;
*/
public WrapperKeywords() {
@JsonProperty("results") super(WrapperKeywords.class);
private List<Keyword> results; }
public WrapperKeywords() { public List<Keyword> getResults() {
super(LoggerFactory.getLogger(WrapperKeywords.class)); return results;
} }
public List<Keyword> getResults() { public void setResults(List<Keyword> results) {
return results; this.results = results;
} }
}
public void setResults(List<Keyword> results) {
this.results = results;
}
}
@@ -1,62 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperMovie extends AbstractWrapperAll {
public class WrapperMovie extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<MovieDb> movies;
*/
public WrapperMovie() {
@JsonProperty("results") super(WrapperMovie.class);
private List<MovieDb> movies; }
public WrapperMovie() { public List<MovieDb> getMovies() {
super(LoggerFactory.getLogger(WrapperMovie.class)); return movies;
} }
public List<MovieDb> getMovies() { public void setMovies(List<MovieDb> movies) {
return movies; this.movies = movies;
} }
}
public void setMovies(List<MovieDb> movies) {
this.movies = movies;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[ResultList=[");
sb.append("[page=").append(getPage());
sb.append("],[pageResults=").append(getMovies().size());
sb.append("],[totalPages=").append(getTotalPages());
sb.append("],[totalResults=").append(getTotalResults());
sb.append("],[id=").append(getId());
sb.append("]]");
return sb.toString();
}
}
@@ -1,91 +1,79 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Person;
import com.omertron.themoviedbapi.model.PersonCast; import com.omertron.themoviedbapi.model.PersonCast;
import com.omertron.themoviedbapi.model.PersonCrew; import com.omertron.themoviedbapi.model.PersonCrew;
import java.util.List; import java.util.ArrayList;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author Stuart
* @author Stuart */
*/ public class WrapperMovieCasts extends AbstractWrapperId {
public class WrapperMovieCasts {
/* @JsonProperty("cast")
* Logger private List<PersonCast> cast;
*/ @JsonProperty("crew")
private List<PersonCrew> crew;
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieCasts.class);
/* public WrapperMovieCasts() {
* Properties super(WrapperMovieCasts.class);
*/ }
@JsonProperty("id")
private int id; public List<PersonCast> getCast() {
@JsonProperty("cast") return cast;
private List<PersonCast> cast; }
@JsonProperty("crew")
private List<PersonCrew> crew; public List<PersonCrew> getCrew() {
return crew;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> }
public List<PersonCast> getCast() {
return cast; public void setCast(List<PersonCast> cast) {
} this.cast = cast;
}
public List<PersonCrew> getCrew() {
return crew; public void setCrew(List<PersonCrew> crew) {
} this.crew = crew;
}
public int getId() {
return id; public List<Person> getAll() {
} List<Person> people = new ArrayList<Person>();
//</editor-fold>
// Add a cast member
//<editor-fold defaultstate="collapsed" desc="Setter methods"> for (PersonCast member : cast) {
public void setCast(List<PersonCast> cast) { Person person = new Person();
this.cast = cast; person.addCast(member.getId(), member.getName(), member.getProfilePath(), member.getCharacter(), member.getOrder());
} people.add(person);
}
public void setCrew(List<PersonCrew> crew) {
this.crew = crew; // Add a crew member
} for (PersonCrew member : crew) {
Person person = new Person();
public void setId(int id) { person.addCrew(member.getId(), member.getName(), member.getProfilePath(), member.getDepartment(), member.getJob());
this.id = id; people.add(person);
} }
//</editor-fold>
return people;
/** }
* Handle unknown properties and print a message }
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,80 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Keyword;
import com.omertron.themoviedbapi.model.Keyword; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperMovieKeywords extends AbstractWrapperId {
* @author Stuart
*/ @JsonProperty("keywords")
public class WrapperMovieKeywords { private List<Keyword> keywords;
/*
* Logger public WrapperMovieKeywords() {
*/ super(WrapperMovieKeywords.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieKeywords.class);
/* public List<Keyword> getKeywords() {
* Properties return keywords;
*/ }
@JsonProperty("id")
private int id; public void setKeywords(List<Keyword> keywords) {
@JsonProperty("keywords") this.keywords = keywords;
private List<Keyword> keywords; }
}
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() {
return id;
}
public List<Keyword> getKeywords() {
return keywords;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) {
this.id = id;
}
public void setKeywords(List<Keyword> keywords) {
this.keywords = keywords;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieList; import com.omertron.themoviedbapi.model.MovieList;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author Stuart
* @author Stuart */
*/ public class WrapperMovieList extends AbstractWrapperAll {
public class WrapperMovieList extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<MovieList> movieList;
*/
public WrapperMovieList() {
@JsonProperty("results") super(WrapperMovieList.class);
private List<MovieList> movieList; }
public WrapperMovieList() { public List<MovieList> getMovieList() {
super(LoggerFactory.getLogger(WrapperMovieList.class)); return movieList;
} }
public List<MovieList> getMovieList() { public void setMovieList(List<MovieList> movieList) {
return movieList; this.movieList = movieList;
} }
}
public void setMovieList(List<MovieList> movieList) {
this.movieList = movieList;
}
}
@@ -1,50 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Person; import com.omertron.themoviedbapi.model.Person;
import java.util.List; import java.util.List;
import org.slf4j.LoggerFactory;
/**
/** *
* * @author stuart.boston
* @author stuart.boston */
*/ public class WrapperPerson extends AbstractWrapperAll {
public class WrapperPerson extends WrapperBase {
/* @JsonProperty("results")
* Properties private List<Person> results;
*/
public WrapperPerson() {
@JsonProperty("results") super(WrapperPerson.class);
private List<Person> results; }
public WrapperPerson() { public List<Person> getResults() {
super(LoggerFactory.getLogger(WrapperPerson.class)); return results;
} }
public List<Person> getResults() { public void setResults(List<Person> results) {
return results; this.results = results;
} }
}
public void setResults(List<Person> results) {
this.results = results;
}
}
@@ -1,60 +1,81 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.PersonCredit; import com.omertron.themoviedbapi.model.PersonCredit;
import java.util.List; import com.omertron.themoviedbapi.model.PersonType;
import org.slf4j.LoggerFactory; import java.util.ArrayList;
import java.util.List;
/**
* /**
* @author stuart.boston *
*/ * @author stuart.boston
public class WrapperPersonCredits extends WrapperBase { */
/* public class WrapperPersonCredits extends AbstractWrapperAll {
* Properties
*/ @JsonProperty("cast")
private List<PersonCredit> cast;
@JsonProperty("cast") @JsonProperty("crew")
private List<PersonCredit> cast; private List<PersonCredit> crew;
@JsonProperty("crew")
private List<PersonCredit> crew; public WrapperPersonCredits() {
super(WrapperMovieCasts.class);
public WrapperPersonCredits() { }
super(LoggerFactory.getLogger(WrapperMovieCasts.class));
} public List<PersonCredit> getCast() {
return cast;
public List<PersonCredit> getCast() { }
return cast;
} public void setCast(List<PersonCredit> cast) {
this.cast = cast;
public void setCast(List<PersonCredit> cast) { }
this.cast = cast;
} public List<PersonCredit> getCrew() {
return crew;
public List<PersonCredit> getCrew() { }
return crew;
} public void setCrew(List<PersonCredit> crew) {
this.crew = crew;
public void setCrew(List<PersonCredit> crew) { }
this.crew = crew;
} public List<PersonCredit> getAll(PersonType... typeList) {
} List<PersonCredit> personCredits = new ArrayList<PersonCredit>();
List<PersonType> types = getTypeList(PersonType.class, typeList);
// Add a cast member
if (types.contains(PersonType.CAST)) {
for (PersonCredit member : cast) {
member.setPersonType(PersonType.CAST);
personCredits.add(member);
}
}
// Add a crew member
if (types.contains(PersonType.CREW)) {
for (PersonCredit member : crew) {
member.setPersonType(PersonType.CREW);
personCredits.add(member);
}
}
return personCredits;
}
}
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Person;
import java.util.List;
/**
*
* @author Stuart
*/
public class WrapperPersonList extends AbstractWrapperAll {
@JsonProperty("results")
private List<Person> personList;
public WrapperPersonList() {
super(WrapperPersonList.class);
}
public List<Person> getPersonList() {
return personList;
}
public void setPersonList(List<Person> personList) {
this.personList = personList;
}
}
@@ -1,80 +1,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model.ReleaseInfo; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperReleaseInfo extends AbstractWrapperId {
* @author Stuart
*/ @JsonProperty("countries")
public class WrapperReleaseInfo { private List<ReleaseInfo> countries;
/*
* Logger public WrapperReleaseInfo() {
*/ super(WrapperReleaseInfo.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperReleaseInfo.class);
/* public List<ReleaseInfo> getCountries() {
* Properties return countries;
*/ }
@JsonProperty("id")
private int id; public void setCountries(List<ReleaseInfo> countries) {
@JsonProperty("countries") this.countries = countries;
private List<ReleaseInfo> countries; }
}
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<ReleaseInfo> getCountries() {
return countries;
}
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setCountries(List<ReleaseInfo> countries) {
this.countries = countries;
}
public void setId(int id) {
this.id = id;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2004-2013 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.Reviews;
import java.util.List;
/**
*
* @author stuart.boston
*/
public class WrapperReviews extends AbstractWrapperAll {
@JsonProperty("results")
private List<Reviews> reviews;
public WrapperReviews() {
super(WrapperReviews.class);
}
public List<Reviews> getReviews() {
return reviews;
}
public void setReviews(List<Reviews> reviews) {
this.reviews = reviews;
}
}
@@ -1,90 +1,79 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Trailer;
import com.omertron.themoviedbapi.model.Trailer; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
*
/** * @author Stuart
* */
* @author Stuart public class WrapperTrailers extends AbstractWrapperId {
*/
public class WrapperTrailers { @JsonProperty("quicktime")
/* private List<Trailer> quicktime;
* Logger @JsonProperty("youtube")
*/ private List<Trailer> youtube;
private static final Logger LOG = LoggerFactory.getLogger(WrapperTrailers.class); public WrapperTrailers() {
/* super(WrapperTrailers.class);
* Properties }
*/
@JsonProperty("id") public List<Trailer> getQuicktime() {
private int id; return quicktime;
@JsonProperty("quicktime") }
private List<Trailer> quicktime;
@JsonProperty("youtube") public List<Trailer> getYoutube() {
private List<Trailer> youtube; return youtube;
}
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() { public void setQuicktime(List<Trailer> quicktime) {
return id; this.quicktime = quicktime;
} }
public List<Trailer> getQuicktime() { public void setYoutube(List<Trailer> youtube) {
return quicktime; this.youtube = youtube;
} }
public List<Trailer> getYoutube() { /**
return youtube; * Get a combined list of the trailers with their source website
} *
//</editor-fold> * @return
*/
//<editor-fold defaultstate="collapsed" desc="Setter methods"> public List<Trailer> getAll() {
public void setId(int id) { List<Trailer> trailers = new ArrayList<Trailer>();
this.id = id;
} // Add the trailer to the return list along with it's source
for (Trailer trailer : quicktime) {
public void setQuicktime(List<Trailer> quicktime) { trailer.setWebsite(Trailer.WEBSITE_QUICKTIME);
this.quicktime = quicktime; trailers.add(trailer);
} }
// Add the trailer to the return list along with it's source
public void setYoutube(List<Trailer> youtube) { for (Trailer trailer : youtube) {
this.youtube = youtube; trailer.setWebsite(Trailer.WEBSITE_YOUTUBE);
} trailers.add(trailer);
//</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,46 @@
/* /*
* Copyright (c) 2004-2013 Stuart Boston * Copyright (c) 2004-2013 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
* TheMovieDB API is free software: you can redistribute it and/or modify * TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* any later version. * any later version.
* *
* TheMovieDB API is distributed in the hope that it will be useful, * TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>. * along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
package com.omertron.themoviedbapi.wrapper; package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model.Translation; import java.util.List;
import java.util.List;
import org.slf4j.Logger; /**
import org.slf4j.LoggerFactory; *
* @author Stuart
/** */
* public class WrapperTranslations extends AbstractWrapperId {
* @author Stuart
*/ @JsonProperty("translations")
public class WrapperTranslations { private List<Translation> translations;
/*
* Logger public WrapperTranslations() {
*/ super(WrapperTranslations.class);
}
private static final Logger LOG = LoggerFactory.getLogger(WrapperTranslations.class);
/* public void setTranslations(List<Translation> translations) {
* Properties this.translations = translations;
*/ }
@JsonProperty("id")
private int id; public List<Translation> getTranslations() {
@JsonProperty("translations") return translations;
private List<Translation> translations; }
}
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setId(int id) {
this.id = id;
}
public void setTranslations(List<Translation> translations) {
this.translations = translations;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public int getId() {
return id;
}
public List<Translation> getTranslations() {
return translations;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
LOG.trace(sb.toString());
}
}
+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>
File diff suppressed because it is too large Load Diff