Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1189d6babd | |||
| 82c8b31f9f | |||
| d25c09f219 | |||
| 75c9142385 | |||
| d5fc5e279d | |||
| 00b24e3bdc | |||
| 8572433707 | |||
| a2f88915a5 | |||
| f05dbb817f | |||
| 6ed9d9ea4c | |||
| 2e7c85a41a | |||
| 4ee48e15c2 | |||
| 1e1cceceac | |||
| 48a8ff4e29 | |||
| c2d2c7cbe3 | |||
| 5c6f6fd9b1 | |||
| f908794e2b | |||
| 85eb7a5a4a | |||
| d7fd35c4d5 | |||
| e465c9cfdd | |||
| 46bfa7a324 | |||
| 021daccadc | |||
| 421084737c | |||
| 88f120923e | |||
| d5c996aef6 | |||
| 8c1aabf1d3 | |||
| c0653861c0 | |||
| d3c0c70fc9 | |||
| 67b4efe77c | |||
| 917c3bb029 | |||
| 68cbc9b54b | |||
| e2f1008d01 | |||
| 51b202df2d | |||
| d84582d336 | |||
| 121838598d | |||
| cd09cf8dfe | |||
| 3a53039b3e | |||
| f7b37a1eb9 | |||
| 52c19f98d4 | |||
| 796459b816 | |||
| eaf5849a43 | |||
| 231f60624b | |||
| 3b1855d75c | |||
| 0cfa4d0dd4 | |||
| 971ee44375 | |||
| 359a0d56a3 | |||
| 8eea8c796a | |||
| 82e9c5b06f | |||
| 57691ed17f | |||
| b705a85566 | |||
| db4f3e6f80 | |||
| 9eed62c8d7 | |||
| 51e5166233 | |||
| dd5176d6c6 | |||
| 6448542fb4 | |||
| 1ac805bed3 | |||
| 2ef41457d0 | |||
| d3338cc106 | |||
| 2c5569d53d | |||
| 546a1e0d93 | |||
| 3b503e78ef | |||
| 4cb0314c56 | |||
| 95b3a4dd36 |
@@ -0,0 +1,22 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Custom for Visual Studio
|
||||||
|
*.cs diff=csharp
|
||||||
|
*.sln merge=union
|
||||||
|
*.csproj merge=union
|
||||||
|
*.vbproj merge=union
|
||||||
|
*.fsproj merge=union
|
||||||
|
*.dbproj merge=union
|
||||||
|
|
||||||
|
# Standard to msysgit
|
||||||
|
*.doc diff=astextplain
|
||||||
|
*.DOC diff=astextplain
|
||||||
|
*.docx diff=astextplain
|
||||||
|
*.DOCX diff=astextplain
|
||||||
|
*.dot diff=astextplain
|
||||||
|
*.DOT diff=astextplain
|
||||||
|
*.pdf diff=astextplain
|
||||||
|
*.PDF diff=astextplain
|
||||||
|
*.rtf diff=astextplain
|
||||||
|
*.RTF diff=astextplain
|
||||||
@@ -7,3 +7,4 @@
|
|||||||
|
|
||||||
/target/
|
/target/
|
||||||
/nbactions.xml
|
/nbactions.xml
|
||||||
|
testing.properties
|
||||||
|
|||||||
@@ -8,6 +8,23 @@ This API uses the [TheMovieDB.org API](http://api.themoviedb.org/)
|
|||||||
Originally written for use by Yet Another Movie Jukebox [(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 use it for other projects as well.
|
But anyone can use it for other projects as well.
|
||||||
|
|
||||||
|
[](https://flattr.com/submit/auto?user_id=Omertron&url=https://github.com/Omertron/api-themoviedb&title=TheMovieDB API&language=&tags=github&category=software)
|
||||||
|
|
||||||
|
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||||
|
***
|
||||||
|
|
||||||
|
TMDB TV Support
|
||||||
|
===============
|
||||||
|
|
||||||
|
TheMovieDb has recently added TV shows to their site.
|
||||||
|
I am working on an update to this API to support that, but it will require a re-write of the API to support the new models and ensure that it is simple to understand.
|
||||||
|
|
||||||
|
Therefore TV support will be added to *v4.0* of the API, major version change because of the large change to the API. I will release a stable version of 3.9 in the next week before releaseing 4.0 SNAPSHOT.
|
||||||
|
|
||||||
|
If you are interested in the current level of TV support checkout the `tv` branch where all the changes are being done.
|
||||||
|
|
||||||
|
|
||||||
***
|
***
|
||||||
### TheMovieDB.org
|
### TheMovieDB.org
|
||||||
This is an excellent open database for movie and film content.
|
This is an excellent open database for movie and film content.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.sonatype.oss</groupId>
|
<groupId>org.sonatype.oss</groupId>
|
||||||
<artifactId>oss-parent</artifactId>
|
<artifactId>oss-parent</artifactId>
|
||||||
<version>7</version>
|
<version>9</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<prerequisites>
|
<prerequisites>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<groupId>com.omertron</groupId>
|
<groupId>com.omertron</groupId>
|
||||||
<artifactId>themoviedbapi</artifactId>
|
<artifactId>themoviedbapi</artifactId>
|
||||||
<version>3.7</version>
|
<version>3.10</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>API-The MovieDB</name>
|
<name>API-The MovieDB</name>
|
||||||
@@ -71,9 +71,16 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<distribution.format>zip</distribution.format>
|
<distribution.format>zip</distribution.format>
|
||||||
|
<version.jackson>2.4.3</version.jackson>
|
||||||
|
<version.slf4j>1.7.7</version.slf4j>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
</dependency>
|
||||||
<!--TESTING-->
|
<!--TESTING-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
@@ -85,35 +92,35 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
<version>2.2.3</version>
|
<version>${version.jackson}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>2.2.3</version>
|
<version>${version.jackson}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>2.2.3</version>
|
<version>${version.jackson}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--LOGGING-->
|
<!--LOGGING-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.5</version>
|
<version>${version.slf4j}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-jdk14</artifactId>
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
<version>1.7.5</version>
|
<version>${version.slf4j}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--COMMON HTTP TOOLS-->
|
<!--COMMON HTTP TOOLS-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.yamj</groupId>
|
<groupId>org.yamj</groupId>
|
||||||
<artifactId>api-common</artifactId>
|
<artifactId>api-common</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@@ -174,7 +181,7 @@
|
|||||||
<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.14.1</version>
|
<version>2.16</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!-- To skip tests by default -->
|
<!-- To skip tests by default -->
|
||||||
<skipTests>${skipTests}</skipTests>
|
<skipTests>${skipTests}</skipTests>
|
||||||
@@ -233,7 +240,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>versions-maven-plugin</artifactId>
|
<artifactId>versions-maven-plugin</artifactId>
|
||||||
<version>2.0</version>
|
<version>2.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -277,7 +284,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>2.7</version>
|
<version>2.8.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -289,7 +296,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
<version>2.4</version>
|
<version>2.5.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,6 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi;
|
package com.omertron.themoviedbapi;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
public class MovieDbException extends Exception {
|
public class MovieDbException extends Exception {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -64,17 +66,34 @@ public class MovieDbException extends Exception {
|
|||||||
|
|
||||||
private final MovieDbExceptionType exceptionType;
|
private final MovieDbExceptionType exceptionType;
|
||||||
private final String response;
|
private final String response;
|
||||||
|
private final String url;
|
||||||
|
|
||||||
public MovieDbException(final MovieDbExceptionType exceptionType, final String response) {
|
public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final String url) {
|
||||||
super();
|
super();
|
||||||
this.exceptionType = exceptionType;
|
this.exceptionType = exceptionType;
|
||||||
this.response = response;
|
this.response = response;
|
||||||
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final Throwable cause) {
|
public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final URL url) {
|
||||||
|
super();
|
||||||
|
this.exceptionType = exceptionType;
|
||||||
|
this.response = response;
|
||||||
|
this.url = url.toExternalForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final String url, final Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
this.exceptionType = exceptionType;
|
this.exceptionType = exceptionType;
|
||||||
this.response = response;
|
this.response = response;
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final URL url, final Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
this.exceptionType = exceptionType;
|
||||||
|
this.response = response;
|
||||||
|
this.url = url.toExternalForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MovieDbExceptionType getExceptionType() {
|
public MovieDbExceptionType getExceptionType() {
|
||||||
@@ -84,4 +103,8 @@ public class MovieDbException extends Exception {
|
|||||||
public String getResponse() {
|
public String getResponse() {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUrl(){
|
||||||
|
return url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Stuart.Boston
|
||||||
|
*/
|
||||||
|
public class AbstractIdName extends AbstractJsonMapping {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 2L;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Properties
|
||||||
|
*/
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id;
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (obj instanceof AbstractIdName) {
|
||||||
|
final AbstractIdName other = (AbstractIdName) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(id, other.id)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return new HashCodeBuilder()
|
||||||
|
.append(id)
|
||||||
|
.append(name)
|
||||||
|
.toHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,21 +20,20 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||||
|
import java.io.Serializable;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Holger Brandl
|
* Abstract class to handle any unknown properties by outputting a log message
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractJsonMapping implements Serializable {
|
public abstract class AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
private static Logger getLogger(Class<?> aClass) {
|
private static final Logger LOG = LoggerFactory.getLogger(AbstractJsonMapping.class);
|
||||||
return LoggerFactory.getLogger(aClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle unknown properties and print a message
|
* Handle unknown properties and print a message
|
||||||
@@ -43,16 +42,16 @@ public abstract class AbstractJsonMapping implements Serializable {
|
|||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
@JsonAnySetter
|
@JsonAnySetter
|
||||||
public void handleUnknown(String key, Object value) {
|
protected void handleUnknown(String key, Object value) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder unknown = new StringBuilder(this.getClass().getSimpleName());
|
||||||
sb.append("Unknown property: '").append(key);
|
unknown.append(": Unknown property='").append(key);
|
||||||
sb.append("' value: '").append(value).append("'");
|
unknown.append("' value='").append(value).append("'");
|
||||||
|
|
||||||
getLogger(this.getClass()).warn(sb.toString());
|
LOG.trace(unknown.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
|
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -31,6 +31,10 @@ public class Account extends AbstractJsonMapping {
|
|||||||
private String userName;
|
private String userName;
|
||||||
@JsonProperty("include_adult")
|
@JsonProperty("include_adult")
|
||||||
private boolean includeAdult;
|
private boolean includeAdult;
|
||||||
|
@JsonProperty("iso_639_1")
|
||||||
|
private String language;
|
||||||
|
@JsonProperty("iso_3166_1")
|
||||||
|
private String country;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
@@ -63,4 +67,20 @@ public class Account extends AbstractJsonMapping {
|
|||||||
public void setUserName(String userName) {
|
public void setUserName(String userName) {
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,8 +20,9 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
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.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
@@ -60,27 +61,22 @@ public class AlternativeTitle implements Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof AlternativeTitle) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final AlternativeTitle other = (AlternativeTitle) obj;
|
final AlternativeTitle other = (AlternativeTitle) obj;
|
||||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
return new EqualsBuilder()
|
||||||
|
.append(country, other.country)
|
||||||
|
.append(title, other.title)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return new HashCodeBuilder()
|
||||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
.append(country)
|
||||||
hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0);
|
.append(title)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The artwork type information
|
* The artwork type information
|
||||||
@@ -30,9 +32,8 @@ public class Artwork extends AbstractJsonMapping {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/*
|
@JsonProperty("id")
|
||||||
* Properties
|
private String id;
|
||||||
*/
|
|
||||||
@JsonProperty("aspect_ratio")
|
@JsonProperty("aspect_ratio")
|
||||||
private float aspectRatio;
|
private float aspectRatio;
|
||||||
@JsonProperty("file_path")
|
@JsonProperty("file_path")
|
||||||
@@ -51,7 +52,6 @@ public class Artwork extends AbstractJsonMapping {
|
|||||||
private String flag;
|
private String flag;
|
||||||
private ArtworkType artworkType = ArtworkType.POSTER;
|
private ArtworkType artworkType = ArtworkType.POSTER;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public ArtworkType getArtworkType() {
|
public ArtworkType getArtworkType() {
|
||||||
return artworkType;
|
return artworkType;
|
||||||
}
|
}
|
||||||
@@ -87,9 +87,11 @@ public class Artwork extends AbstractJsonMapping {
|
|||||||
public String getFlag() {
|
public String getFlag() {
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public void setArtworkType(ArtworkType artworkType) {
|
public void setArtworkType(ArtworkType artworkType) {
|
||||||
this.artworkType = artworkType;
|
this.artworkType = artworkType;
|
||||||
}
|
}
|
||||||
@@ -125,47 +127,37 @@ public class Artwork extends AbstractJsonMapping {
|
|||||||
public void setFlag(String flag) {
|
public void setFlag(String flag) {
|
||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof Artwork) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Artwork other = (Artwork) obj;
|
final Artwork other = (Artwork) obj;
|
||||||
if (Float.floatToIntBits(this.aspectRatio) != Float.floatToIntBits(other.aspectRatio)) {
|
return new EqualsBuilder()
|
||||||
|
.append(aspectRatio, other.aspectRatio)
|
||||||
|
.append(filePath, other.filePath)
|
||||||
|
.append(language, other.language)
|
||||||
|
.append(height, other.height)
|
||||||
|
.append(width, other.width)
|
||||||
|
.append(artworkType, other.artworkType)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.height != other.height) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.language == null) ? (other.language != null) : !this.language.equals(other.language)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.width != other.width) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.artworkType != other.artworkType) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 3;
|
return new HashCodeBuilder()
|
||||||
hash = 71 * hash + Float.floatToIntBits(this.aspectRatio);
|
.append(aspectRatio)
|
||||||
hash = 71 * hash + (this.filePath != null ? this.filePath.hashCode() : 0);
|
.append(filePath)
|
||||||
hash = 71 * hash + this.height;
|
.append(height)
|
||||||
hash = 71 * hash + (this.language != null ? this.language.hashCode() : 0);
|
.append(width)
|
||||||
hash = 71 * hash + this.width;
|
.append(language)
|
||||||
hash = 71 * hash + (this.artworkType != null ? this.artworkType.hashCode() : 0);
|
.append(artworkType)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -24,7 +24,10 @@ package com.omertron.themoviedbapi.model;
|
|||||||
*/
|
*/
|
||||||
public enum ArtworkType {
|
public enum ArtworkType {
|
||||||
|
|
||||||
POSTER, // Poster artwork
|
// Poster artwork
|
||||||
BACKDROP, // Fanart/backdrop
|
POSTER,
|
||||||
PROFILE // Person image
|
// Fanart/backdrop
|
||||||
|
BACKDROP,
|
||||||
|
// Person image
|
||||||
|
PROFILE
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2014 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;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -16,7 +34,7 @@ public class ChangeKeyItem {
|
|||||||
private String key;
|
private String key;
|
||||||
@JsonProperty("items")
|
@JsonProperty("items")
|
||||||
private List<ChangedItem> changedItems = new ArrayList<ChangedItem>();
|
private List<ChangedItem> changedItems = new ArrayList<ChangedItem>();
|
||||||
private Map<String, Object> newItems = new HashMap<String, Object>();
|
private final Map<String, Object> newItems = new HashMap<String, Object>();
|
||||||
|
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return key;
|
return key;
|
||||||
|
|||||||
@@ -1,9 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2014 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;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -20,7 +38,7 @@ public class ChangedItem extends AbstractJsonMapping {
|
|||||||
private String language;
|
private String language;
|
||||||
@JsonProperty("value")
|
@JsonProperty("value")
|
||||||
private Object value;
|
private Object value;
|
||||||
private Map<String, Object> newItems = new HashMap<String, Object>();
|
private final Map<String, Object> newItems = new HashMap<String, Object>();
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
|
*
|
||||||
|
* This file is part of TheMovieDB API.
|
||||||
|
*
|
||||||
|
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class ChangedMovie extends AbstractJsonMapping {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private String id;
|
||||||
|
@JsonProperty("adult")
|
||||||
|
private boolean adult;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAdult() {
|
||||||
|
return adult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdult(boolean adult) {
|
||||||
|
this.adult = adult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -22,6 +22,8 @@ package com.omertron.themoviedbapi.model;
|
|||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
@@ -47,7 +49,6 @@ public class Collection extends AbstractJsonMapping {
|
|||||||
@JsonProperty("release_date")
|
@JsonProperty("release_date")
|
||||||
private String releaseDate;
|
private String releaseDate;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getBackdropPath() {
|
public String getBackdropPath() {
|
||||||
return backdropPath;
|
return backdropPath;
|
||||||
}
|
}
|
||||||
@@ -104,37 +105,28 @@ public class Collection extends AbstractJsonMapping {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof Collection) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Collection other = (Collection) obj;
|
final Collection other = (Collection) obj;
|
||||||
if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) {
|
return new EqualsBuilder()
|
||||||
|
.append(id, other.id)
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(title, other.title)
|
||||||
|
.append(backdropPath, other.backdropPath)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return new HashCodeBuilder()
|
||||||
hash = 19 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
|
.append(id)
|
||||||
hash = 19 * hash + this.id;
|
.append(backdropPath)
|
||||||
hash = 19 * hash + (this.title != null ? this.title.hashCode() : 0);
|
.append(title)
|
||||||
hash = 19 * hash + (this.name != null ? this.name.hashCode() : 0);
|
.append(name)
|
||||||
hash = 19 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
|
.append(posterPath)
|
||||||
hash = 19 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
.append(releaseDate)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -47,7 +47,6 @@ public class CollectionInfo extends AbstractJsonMapping {
|
|||||||
@JsonProperty("parts")
|
@JsonProperty("parts")
|
||||||
private List<Collection> parts = new ArrayList<Collection>();
|
private List<Collection> parts = new ArrayList<Collection>();
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getBackdropPath() {
|
public String getBackdropPath() {
|
||||||
return backdropPath;
|
return backdropPath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -46,7 +46,6 @@ public class Company extends AbstractJsonMapping {
|
|||||||
@JsonProperty("parent_company")
|
@JsonProperty("parent_company")
|
||||||
private Company parentCompany = null;
|
private Company parentCompany = null;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
|
||||||
public int getCompanyId() {
|
public int getCompanyId() {
|
||||||
return companyId;
|
return companyId;
|
||||||
}
|
}
|
||||||
@@ -105,7 +104,7 @@ public class Company extends AbstractJsonMapping {
|
|||||||
|
|
||||||
public void setParentCompany(int id, String name, String logoPath) {
|
public void setParentCompany(int id, String name, String logoPath) {
|
||||||
Company parent = new Company();
|
Company parent = new Company();
|
||||||
parent.setCompanyId(companyId);
|
parent.setCompanyId(id);
|
||||||
parent.setName(name);
|
parent.setName(name);
|
||||||
parent.setLogoPath(logoPath);
|
parent.setLogoPath(logoPath);
|
||||||
this.parentCompany = parent;
|
this.parentCompany = parent;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,12 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import static com.omertron.themoviedbapi.tools.ApiUrl.PARAM_ADULT;
|
||||||
|
import static com.omertron.themoviedbapi.tools.ApiUrl.PARAM_LANGUAGE;
|
||||||
|
import static com.omertron.themoviedbapi.tools.ApiUrl.PARAM_PAGE;
|
||||||
|
import static com.omertron.themoviedbapi.tools.ApiUrl.PARAM_YEAR;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import static com.omertron.themoviedbapi.tools.ApiUrl.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a discover object for use in the MovieDbApi
|
* Generate a discover object for use in the MovieDbApi
|
||||||
@@ -35,7 +36,7 @@ import static com.omertron.themoviedbapi.tools.ApiUrl.*;
|
|||||||
*/
|
*/
|
||||||
public class Discover {
|
public class Discover {
|
||||||
|
|
||||||
private Map<String, String> params = new HashMap<String, String>();
|
private final Map<String, String> params = new HashMap<String, String>();
|
||||||
private static final String PARAM_PRIMARY_RELEASE_YEAR = "primary_release_year=";
|
private static final String PARAM_PRIMARY_RELEASE_YEAR = "primary_release_year=";
|
||||||
private static final String PARAM_VOTE_COUNT_GTE = "vote_count.gte=";
|
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_VOTE_AVERAGE_GTE = "vote_average.gte=";
|
||||||
@@ -64,6 +65,7 @@ public class Discover {
|
|||||||
* Minimum value is 1 if included.
|
* Minimum value is 1 if included.
|
||||||
*
|
*
|
||||||
* @param page
|
* @param page
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover page(int page) {
|
public Discover page(int page) {
|
||||||
if (page > 0) {
|
if (page > 0) {
|
||||||
@@ -76,6 +78,7 @@ public class Discover {
|
|||||||
* ISO 639-1 code
|
* ISO 639-1 code
|
||||||
*
|
*
|
||||||
* @param language
|
* @param language
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover language(String language) {
|
public Discover language(String language) {
|
||||||
if (StringUtils.isNotBlank(language)) {
|
if (StringUtils.isNotBlank(language)) {
|
||||||
@@ -94,6 +97,7 @@ public class Discover {
|
|||||||
* popularity.asc
|
* popularity.asc
|
||||||
*
|
*
|
||||||
* @param sortBy
|
* @param sortBy
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover sortBy(String sortBy) {
|
public Discover sortBy(String sortBy) {
|
||||||
if (StringUtils.isNotBlank(sortBy)) {
|
if (StringUtils.isNotBlank(sortBy)) {
|
||||||
@@ -106,6 +110,7 @@ public class Discover {
|
|||||||
* Toggle the inclusion of adult titles
|
* Toggle the inclusion of adult titles
|
||||||
*
|
*
|
||||||
* @param includeAdult
|
* @param includeAdult
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover includeAdult(boolean includeAdult) {
|
public Discover includeAdult(boolean includeAdult) {
|
||||||
params.put(PARAM_ADULT, String.valueOf(includeAdult));
|
params.put(PARAM_ADULT, String.valueOf(includeAdult));
|
||||||
@@ -116,6 +121,7 @@ public class Discover {
|
|||||||
* Filter the results release dates to matches that include this value.
|
* Filter the results release dates to matches that include this value.
|
||||||
*
|
*
|
||||||
* @param year
|
* @param year
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover year(int year) {
|
public Discover year(int year) {
|
||||||
if (checkYear(year)) {
|
if (checkYear(year)) {
|
||||||
@@ -128,6 +134,7 @@ public class Discover {
|
|||||||
* Filter the results so that only the primary release date year has this value
|
* Filter the results so that only the primary release date year has this value
|
||||||
*
|
*
|
||||||
* @param primaryReleaseYear
|
* @param primaryReleaseYear
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover primaryReleaseYear(int primaryReleaseYear) {
|
public Discover primaryReleaseYear(int primaryReleaseYear) {
|
||||||
if (checkYear(primaryReleaseYear)) {
|
if (checkYear(primaryReleaseYear)) {
|
||||||
@@ -140,6 +147,7 @@ public class Discover {
|
|||||||
* Only include movies that are equal to, or have a vote count higher than this value
|
* Only include movies that are equal to, or have a vote count higher than this value
|
||||||
*
|
*
|
||||||
* @param voteCountGte
|
* @param voteCountGte
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover voteCountGte(int voteCountGte) {
|
public Discover voteCountGte(int voteCountGte) {
|
||||||
if (voteCountGte > 0) {
|
if (voteCountGte > 0) {
|
||||||
@@ -152,6 +160,7 @@ public class Discover {
|
|||||||
* Only include movies that are equal to, or have a higher average rating than this value
|
* Only include movies that are equal to, or have a higher average rating than this value
|
||||||
*
|
*
|
||||||
* @param voteAverageGte
|
* @param voteAverageGte
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover voteAverageGte(float voteAverageGte) {
|
public Discover voteAverageGte(float voteAverageGte) {
|
||||||
if (voteAverageGte > 0) {
|
if (voteAverageGte > 0) {
|
||||||
@@ -170,6 +179,7 @@ public class Discover {
|
|||||||
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'
|
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'
|
||||||
*
|
*
|
||||||
* @param withGenres
|
* @param withGenres
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover withGenres(String withGenres) {
|
public Discover withGenres(String withGenres) {
|
||||||
if (StringUtils.isNotBlank(withGenres)) {
|
if (StringUtils.isNotBlank(withGenres)) {
|
||||||
@@ -184,6 +194,7 @@ public class Discover {
|
|||||||
* Expected format is YYYY-MM-DD.
|
* Expected format is YYYY-MM-DD.
|
||||||
*
|
*
|
||||||
* @param releaseDateGte
|
* @param releaseDateGte
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover releaseDateGte(String releaseDateGte) {
|
public Discover releaseDateGte(String releaseDateGte) {
|
||||||
if (StringUtils.isNotBlank(releaseDateGte)) {
|
if (StringUtils.isNotBlank(releaseDateGte)) {
|
||||||
@@ -198,6 +209,7 @@ public class Discover {
|
|||||||
* Expected format is YYYY-MM-DD.
|
* Expected format is YYYY-MM-DD.
|
||||||
*
|
*
|
||||||
* @param releaseDateLte
|
* @param releaseDateLte
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover releaseDateLte(String releaseDateLte) {
|
public Discover releaseDateLte(String releaseDateLte) {
|
||||||
if (StringUtils.isNotBlank(releaseDateLte)) {
|
if (StringUtils.isNotBlank(releaseDateLte)) {
|
||||||
@@ -214,6 +226,7 @@ public class Discover {
|
|||||||
* A ISO 3166-1 is expected
|
* A ISO 3166-1 is expected
|
||||||
*
|
*
|
||||||
* @param certificationCountry
|
* @param certificationCountry
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover certificationCountry(String certificationCountry) {
|
public Discover certificationCountry(String certificationCountry) {
|
||||||
if (StringUtils.isNotBlank(certificationCountry)) {
|
if (StringUtils.isNotBlank(certificationCountry)) {
|
||||||
@@ -228,6 +241,7 @@ public class Discover {
|
|||||||
* Expected value is a valid certification for the specified 'certificationCountry'.
|
* Expected value is a valid certification for the specified 'certificationCountry'.
|
||||||
*
|
*
|
||||||
* @param certificationLte
|
* @param certificationLte
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover certificationLte(String certificationLte) {
|
public Discover certificationLte(String certificationLte) {
|
||||||
if (StringUtils.isNotBlank(certificationLte)) {
|
if (StringUtils.isNotBlank(certificationLte)) {
|
||||||
@@ -244,6 +258,7 @@ public class Discover {
|
|||||||
* They can be comma separated to indicate an 'AND' query
|
* They can be comma separated to indicate an 'AND' query
|
||||||
*
|
*
|
||||||
* @param withCompanies
|
* @param withCompanies
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public Discover withCompanies(String withCompanies) {
|
public Discover withCompanies(String withCompanies) {
|
||||||
if (StringUtils.isNotBlank(withCompanies)) {
|
if (StringUtils.isNotBlank(withCompanies)) {
|
||||||
@@ -259,6 +274,6 @@ public class Discover {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean checkYear(int year) {
|
private boolean checkYear(int year) {
|
||||||
return (year >= YEAR_MIN && year <= YEAR_MAX);
|
return year >= YEAR_MIN && year <= YEAR_MAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,64 +19,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
@JsonRootName("genre")
|
@JsonRootName("genre")
|
||||||
public class Genre extends AbstractJsonMapping {
|
public class Genre extends AbstractIdName {
|
||||||
|
// Nothing to override from the base class.
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Genre other = (Genre) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 5;
|
|
||||||
hash = 53 * hash + this.id;
|
|
||||||
hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class JobDepartment {
|
public class JobDepartment extends AbstractJsonMapping {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
// Properties
|
// Properties
|
||||||
@@ -32,7 +32,6 @@ public class JobDepartment {
|
|||||||
@JsonProperty("job_list")
|
@JsonProperty("job_list")
|
||||||
private List<String> jobs;
|
private List<String> jobs;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getters">
|
|
||||||
public String getDepartment() {
|
public String getDepartment() {
|
||||||
return department;
|
return department;
|
||||||
}
|
}
|
||||||
@@ -41,7 +40,6 @@ public class JobDepartment {
|
|||||||
return jobs;
|
return jobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setters">
|
|
||||||
public void setDepartment(String department) {
|
public void setDepartment(String department) {
|
||||||
this.department = department;
|
this.department = department;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,65 +19,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
@JsonRootName("keyword")
|
@JsonRootName("keyword")
|
||||||
public class Keyword extends AbstractJsonMapping {
|
public class Keyword extends AbstractIdName {
|
||||||
|
// Nothing to override from the base class.
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Keyword other = (Keyword) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 3;
|
|
||||||
hash = 83 * hash + this.id;
|
|
||||||
hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -52,7 +52,6 @@ public class KeywordMovie extends AbstractJsonMapping {
|
|||||||
@JsonProperty("popularity")
|
@JsonProperty("popularity")
|
||||||
private float popularity;
|
private float popularity;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public static long getSerialVersionUID() {
|
public static long getSerialVersionUID() {
|
||||||
return serialVersionUID;
|
return serialVersionUID;
|
||||||
}
|
}
|
||||||
@@ -96,9 +95,7 @@ public class KeywordMovie extends AbstractJsonMapping {
|
|||||||
public float getPopularity() {
|
public float getPopularity() {
|
||||||
return popularity;
|
return popularity;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setBackdropPath(String backdropPath) {
|
public void setBackdropPath(String backdropPath) {
|
||||||
this.backdropPath = backdropPath;
|
this.backdropPath = backdropPath;
|
||||||
}
|
}
|
||||||
@@ -138,5 +135,4 @@ public class KeywordMovie extends AbstractJsonMapping {
|
|||||||
public void setPopularity(float popularity) {
|
public void setPopularity(float popularity) {
|
||||||
this.popularity = popularity;
|
this.popularity = popularity;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
@@ -37,7 +39,6 @@ public class Language extends AbstractJsonMapping {
|
|||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getIsoCode() {
|
public String getIsoCode() {
|
||||||
return isoCode;
|
return isoCode;
|
||||||
}
|
}
|
||||||
@@ -56,27 +57,22 @@ public class Language extends AbstractJsonMapping {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof Language) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Language other = (Language) obj;
|
final Language other = (Language) obj;
|
||||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
return new EqualsBuilder()
|
||||||
|
.append(isoCode, other.isoCode)
|
||||||
|
.append(name, other.name)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return new HashCodeBuilder()
|
||||||
hash = 71 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
.append(isoCode)
|
||||||
hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0);
|
.append(name)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,9 +20,19 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.wrapper.*;
|
import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperImages;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperMovie;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperMovieCasts;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperMovieKeywords;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperMovieList;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperReleaseInfo;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperReviews;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperTrailers;
|
||||||
|
import com.omertron.themoviedbapi.wrapper.WrapperTranslations;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Movie Bean
|
* Movie Bean
|
||||||
@@ -32,9 +42,6 @@ import java.util.List;
|
|||||||
public class MovieDb extends AbstractJsonMapping {
|
public class MovieDb extends AbstractJsonMapping {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("backdrop_path")
|
@JsonProperty("backdrop_path")
|
||||||
private String backdropPath;
|
private String backdropPath;
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
@@ -392,32 +399,25 @@ public class MovieDb extends AbstractJsonMapping {
|
|||||||
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
|
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof MovieDb) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final MovieDb other = (MovieDb) obj;
|
final MovieDb other = (MovieDb) obj;
|
||||||
if (this.id != other.id) {
|
return new EqualsBuilder()
|
||||||
|
.append(id, other.id)
|
||||||
|
.append(imdbID, other.imdbID)
|
||||||
|
.append(runtime, other.runtime)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
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
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 5;
|
return new HashCodeBuilder()
|
||||||
hash = 89 * hash + this.id;
|
.append(id)
|
||||||
hash = 89 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0);
|
.append(imdbID)
|
||||||
hash = 89 * hash + this.runtime;
|
.append(runtime)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
// </editor-fold>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@@ -31,9 +30,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class MovieDbList extends AbstractJsonMapping {
|
public class MovieDbList extends AbstractJsonMapping {
|
||||||
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private String id;
|
private String id;
|
||||||
@JsonProperty("created_by")
|
@JsonProperty("created_by")
|
||||||
@@ -43,7 +39,7 @@ public class MovieDbList extends AbstractJsonMapping {
|
|||||||
@JsonProperty("favorite_count")
|
@JsonProperty("favorite_count")
|
||||||
private int favoriteCount;
|
private int favoriteCount;
|
||||||
@JsonProperty("items")
|
@JsonProperty("items")
|
||||||
private List<MovieDb> items = Collections.EMPTY_LIST;
|
private List<MovieDb> items = Collections.emptyList();
|
||||||
@JsonProperty("item_count")
|
@JsonProperty("item_count")
|
||||||
private int itemCount;
|
private int itemCount;
|
||||||
@JsonProperty("iso_639_1")
|
@JsonProperty("iso_639_1")
|
||||||
@@ -57,7 +53,6 @@ public class MovieDbList extends AbstractJsonMapping {
|
|||||||
@JsonProperty("status_message")
|
@JsonProperty("status_message")
|
||||||
private String statusMessage;
|
private String statusMessage;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -101,9 +96,7 @@ public class MovieDbList extends AbstractJsonMapping {
|
|||||||
public String getStatusMessage() {
|
public String getStatusMessage() {
|
||||||
return statusMessage;
|
return statusMessage;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@@ -147,5 +140,4 @@ public class MovieDbList extends AbstractJsonMapping {
|
|||||||
public void setStatusMessage(String statusMessage) {
|
public void setStatusMessage(String statusMessage) {
|
||||||
this.statusMessage = statusMessage;
|
this.statusMessage = statusMessage;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -28,9 +28,6 @@ public class MovieList extends AbstractJsonMapping {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("description")
|
@JsonProperty("description")
|
||||||
private String description;
|
private String description;
|
||||||
@JsonProperty("favorite_count")
|
@JsonProperty("favorite_count")
|
||||||
@@ -48,7 +45,6 @@ public class MovieList extends AbstractJsonMapping {
|
|||||||
@JsonProperty("list_type")
|
@JsonProperty("list_type")
|
||||||
private String listType;
|
private String listType;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
@@ -80,9 +76,7 @@ public class MovieList extends AbstractJsonMapping {
|
|||||||
public String getListType() {
|
public String getListType() {
|
||||||
return listType;
|
return listType;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
@@ -114,5 +108,4 @@ public class MovieList extends AbstractJsonMapping {
|
|||||||
public void setListType(String listType) {
|
public void setListType(String listType) {
|
||||||
this.listType = listType;
|
this.listType = listType;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,10 +20,11 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
@@ -48,12 +49,17 @@ public class Person extends AbstractJsonMapping {
|
|||||||
@JsonProperty("profile_path")
|
@JsonProperty("profile_path")
|
||||||
private String profilePath = DEFAULT_STRING;
|
private String profilePath = DEFAULT_STRING;
|
||||||
private PersonType personType = PersonType.PERSON;
|
private PersonType personType = PersonType.PERSON;
|
||||||
private String department = DEFAULT_STRING; // Crew
|
// Crew
|
||||||
private String job = DEFAULT_STRING; // Crew
|
private String department = DEFAULT_STRING;
|
||||||
private String character = DEFAULT_STRING; // Cast
|
// Crew
|
||||||
private int order = -1; // Cast
|
private String job = DEFAULT_STRING;
|
||||||
|
// Cast
|
||||||
|
private String character = DEFAULT_STRING;
|
||||||
|
// Cast
|
||||||
|
private int order = -1;
|
||||||
@JsonProperty("adult")
|
@JsonProperty("adult")
|
||||||
private boolean adult = false; // Person info
|
// Person info
|
||||||
|
private boolean adult = false;
|
||||||
@JsonProperty("also_known_as")
|
@JsonProperty("also_known_as")
|
||||||
private List<String> aka = new ArrayList<String>();
|
private List<String> aka = new ArrayList<String>();
|
||||||
@JsonProperty("biography")
|
@JsonProperty("biography")
|
||||||
@@ -70,6 +76,8 @@ public class Person extends AbstractJsonMapping {
|
|||||||
private String imdbId = DEFAULT_STRING;
|
private String imdbId = DEFAULT_STRING;
|
||||||
@JsonProperty("popularity")
|
@JsonProperty("popularity")
|
||||||
private float popularity = 0.0f;
|
private float popularity = 0.0f;
|
||||||
|
@JsonProperty("known_for")
|
||||||
|
private List<PersonCredit> knownFor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a crew member
|
* Add a crew member
|
||||||
@@ -111,7 +119,6 @@ public class Person extends AbstractJsonMapping {
|
|||||||
setJob(CAST_JOB);
|
setJob(CAST_JOB);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getCharacter() {
|
public String getCharacter() {
|
||||||
return character;
|
return character;
|
||||||
}
|
}
|
||||||
@@ -179,9 +186,7 @@ public class Person extends AbstractJsonMapping {
|
|||||||
public float getPopularity() {
|
public float getPopularity() {
|
||||||
return popularity;
|
return popularity;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setCharacter(String character) {
|
public void setCharacter(String character) {
|
||||||
this.character = character;
|
this.character = character;
|
||||||
}
|
}
|
||||||
@@ -249,51 +254,43 @@ public class Person extends AbstractJsonMapping {
|
|||||||
public void setPopularity(float popularity) {
|
public void setPopularity(float popularity) {
|
||||||
this.popularity = popularity;
|
this.popularity = popularity;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
public List<PersonCredit> getKnownFor() {
|
||||||
|
return knownFor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKnownFor(List<PersonCredit> knownFor) {
|
||||||
|
this.knownFor = knownFor;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof Person) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Person other = (Person) obj;
|
final Person other = (Person) obj;
|
||||||
if (this.id != other.id) {
|
return new EqualsBuilder()
|
||||||
|
.append(id, other.id)
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(profilePath, other.profilePath)
|
||||||
|
.append(personType, other.personType)
|
||||||
|
.append(department, other.department)
|
||||||
|
.append(job, other.job)
|
||||||
|
.append(character, other.character)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.personType != other.personType) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 3;
|
return new HashCodeBuilder()
|
||||||
hash = 37 * hash + this.id;
|
.append(id)
|
||||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
.append(name)
|
||||||
hash = 37 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
.append(profilePath)
|
||||||
hash = 37 * hash + (this.personType != null ? this.personType.hashCode() : 0);
|
.append(personType)
|
||||||
hash = 37 * hash + (this.department != null ? this.department.hashCode() : 0);
|
.append(department)
|
||||||
hash = 37 * hash + (this.job != null ? this.job.hashCode() : 0);
|
.append(job)
|
||||||
hash = 37 * hash + (this.character != null ? this.character.hashCode() : 0);
|
.append(character)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
@@ -44,8 +46,9 @@ public class PersonCast extends AbstractJsonMapping {
|
|||||||
private String profilePath;
|
private String profilePath;
|
||||||
@JsonProperty("cast_id")
|
@JsonProperty("cast_id")
|
||||||
private int castId;
|
private int castId;
|
||||||
|
@JsonProperty("credit_id")
|
||||||
|
private String creditId;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getCharacter() {
|
public String getCharacter() {
|
||||||
return character;
|
return character;
|
||||||
}
|
}
|
||||||
@@ -94,41 +97,38 @@ public class PersonCast extends AbstractJsonMapping {
|
|||||||
this.castId = castId;
|
this.castId = castId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCreditId() {
|
||||||
|
return creditId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreditId(String creditId) {
|
||||||
|
this.creditId = creditId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof PersonCast) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final PersonCast other = (PersonCast) obj;
|
final PersonCast other = (PersonCast) obj;
|
||||||
if (this.id != other.id) {
|
return new EqualsBuilder()
|
||||||
|
.append(id, other.id)
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(character, other.character)
|
||||||
|
.append(order, other.order)
|
||||||
|
.append(profilePath, other.profilePath)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.order != other.order) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return new HashCodeBuilder()
|
||||||
hash = 41 * hash + this.id;
|
.append(id)
|
||||||
hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0);
|
.append(character)
|
||||||
hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
|
.append(name)
|
||||||
hash = 41 * hash + this.order;
|
.append(order)
|
||||||
hash = 41 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
.append(profilePath)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -40,6 +40,8 @@ public class PersonCredit extends AbstractJsonMapping {
|
|||||||
private String movieOriginalTitle = DEFAULT_STRING;
|
private String movieOriginalTitle = DEFAULT_STRING;
|
||||||
@JsonProperty("poster_path")
|
@JsonProperty("poster_path")
|
||||||
private String posterPath = DEFAULT_STRING;
|
private String posterPath = DEFAULT_STRING;
|
||||||
|
@JsonProperty("backdrop_path")
|
||||||
|
private String backdropPath = DEFAULT_STRING;
|
||||||
@JsonProperty("release_date")
|
@JsonProperty("release_date")
|
||||||
private String releaseDate = DEFAULT_STRING;
|
private String releaseDate = DEFAULT_STRING;
|
||||||
@JsonProperty("title")
|
@JsonProperty("title")
|
||||||
@@ -50,9 +52,18 @@ public class PersonCredit extends AbstractJsonMapping {
|
|||||||
private String job = DEFAULT_STRING;
|
private String job = DEFAULT_STRING;
|
||||||
@JsonProperty("adult")
|
@JsonProperty("adult")
|
||||||
private String adult = DEFAULT_STRING;
|
private String adult = DEFAULT_STRING;
|
||||||
|
@JsonProperty("credit_id")
|
||||||
|
private String creditId = DEFAULT_STRING;
|
||||||
private PersonType personType = PersonType.PERSON;
|
private PersonType personType = PersonType.PERSON;
|
||||||
|
@JsonProperty("popularity")
|
||||||
|
private float popularity;
|
||||||
|
@JsonProperty("vote_average")
|
||||||
|
private float voteAverage;
|
||||||
|
@JsonProperty("vote_count")
|
||||||
|
private int voteCount;
|
||||||
|
@JsonProperty("media_type")
|
||||||
|
private String mediaType;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
|
||||||
public String getCharacter() {
|
public String getCharacter() {
|
||||||
return character;
|
return character;
|
||||||
}
|
}
|
||||||
@@ -93,6 +104,10 @@ public class PersonCredit extends AbstractJsonMapping {
|
|||||||
return adult;
|
return adult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCreditId() {
|
||||||
|
return creditId;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCharacter(String character) {
|
public void setCharacter(String character) {
|
||||||
this.character = StringUtils.trimToEmpty(character);
|
this.character = StringUtils.trimToEmpty(character);
|
||||||
}
|
}
|
||||||
@@ -132,4 +147,48 @@ public class PersonCredit extends AbstractJsonMapping {
|
|||||||
public void setAdult(String adult) {
|
public void setAdult(String adult) {
|
||||||
this.adult = StringUtils.trimToEmpty(adult);
|
this.adult = StringUtils.trimToEmpty(adult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCreditId(String creditId) {
|
||||||
|
this.creditId = creditId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackdropPath() {
|
||||||
|
return backdropPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackdropPath(String backdropPath) {
|
||||||
|
this.backdropPath = backdropPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getPopularity() {
|
||||||
|
return popularity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPopularity(float popularity) {
|
||||||
|
this.popularity = popularity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getVoteAverage() {
|
||||||
|
return voteAverage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoteAverage(float voteAverage) {
|
||||||
|
this.voteAverage = voteAverage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVoteCount() {
|
||||||
|
return voteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoteCount(int voteCount) {
|
||||||
|
this.voteCount = voteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMediaType() {
|
||||||
|
return mediaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMediaType(String mediaType) {
|
||||||
|
this.mediaType = mediaType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
@@ -42,8 +44,9 @@ public class PersonCrew extends AbstractJsonMapping {
|
|||||||
private String name;
|
private String name;
|
||||||
@JsonProperty("profile_path")
|
@JsonProperty("profile_path")
|
||||||
private String profilePath;
|
private String profilePath;
|
||||||
|
@JsonProperty("credit_id")
|
||||||
|
private String creditId;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getDepartment() {
|
public String getDepartment() {
|
||||||
return department;
|
return department;
|
||||||
}
|
}
|
||||||
@@ -64,6 +67,14 @@ public class PersonCrew extends AbstractJsonMapping {
|
|||||||
return profilePath;
|
return profilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCreditId() {
|
||||||
|
return creditId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreditId(String creditId) {
|
||||||
|
this.creditId = creditId;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDepartment(String department) {
|
public void setDepartment(String department) {
|
||||||
this.department = StringUtils.trimToEmpty(department);
|
this.department = StringUtils.trimToEmpty(department);
|
||||||
}
|
}
|
||||||
@@ -86,36 +97,27 @@ public class PersonCrew extends AbstractJsonMapping {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof PersonCrew) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final PersonCrew other = (PersonCrew) obj;
|
final PersonCrew other = (PersonCrew) obj;
|
||||||
if (this.id != other.id) {
|
return new EqualsBuilder()
|
||||||
|
.append(id, other.id)
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(department, other.department)
|
||||||
|
.append(job, other.job)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return new HashCodeBuilder()
|
||||||
hash = 59 * hash + this.id;
|
.append(id)
|
||||||
hash = 59 * hash + (this.department != null ? this.department.hashCode() : 0);
|
.append(department)
|
||||||
hash = 59 * hash + (this.job != null ? this.job.hashCode() : 0);
|
.append(job)
|
||||||
hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
|
.append(name)
|
||||||
hash = 59 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
.append(profilePath)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -24,7 +24,10 @@ package com.omertron.themoviedbapi.model;
|
|||||||
*/
|
*/
|
||||||
public enum PersonType {
|
public enum PersonType {
|
||||||
|
|
||||||
CAST, // A member of the cast
|
// A member of the cast
|
||||||
CREW, // A member of the crew
|
CAST,
|
||||||
PERSON // No specific type
|
// A member of the crew
|
||||||
|
CREW,
|
||||||
|
// No specific type
|
||||||
|
PERSON
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,65 +19,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
@JsonRootName("production_company")
|
@JsonRootName("production_company")
|
||||||
public class ProductionCompany extends AbstractJsonMapping {
|
public class ProductionCompany extends AbstractIdName {
|
||||||
|
// Nothing to override from the base class.
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final ProductionCompany other = (ProductionCompany) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 5;
|
|
||||||
hash = 37 * hash + this.id;
|
|
||||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
@@ -38,7 +40,6 @@ public class ProductionCountry extends AbstractJsonMapping {
|
|||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getIsoCode() {
|
public String getIsoCode() {
|
||||||
return isoCode;
|
return isoCode;
|
||||||
}
|
}
|
||||||
@@ -57,27 +58,22 @@ public class ProductionCountry extends AbstractJsonMapping {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof ProductionCountry) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final ProductionCountry other = (ProductionCountry) obj;
|
final ProductionCountry other = (ProductionCountry) obj;
|
||||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
return new EqualsBuilder()
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(isoCode, other.isoCode)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return new HashCodeBuilder()
|
||||||
hash = 47 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
.append(isoCode)
|
||||||
hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
|
.append(name)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
@@ -38,7 +40,6 @@ public class ReleaseInfo extends AbstractJsonMapping {
|
|||||||
@JsonProperty("release_date")
|
@JsonProperty("release_date")
|
||||||
private String releaseDate;
|
private String releaseDate;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getCertification() {
|
public String getCertification() {
|
||||||
return certification;
|
return certification;
|
||||||
}
|
}
|
||||||
@@ -65,31 +66,24 @@ public class ReleaseInfo extends AbstractJsonMapping {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof ReleaseInfo) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final ReleaseInfo other = (ReleaseInfo) obj;
|
final ReleaseInfo other = (ReleaseInfo) obj;
|
||||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
return new EqualsBuilder()
|
||||||
|
.append(country, other.country)
|
||||||
|
.append(certification, other.certification)
|
||||||
|
.append(releaseDate, other.releaseDate)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.certification == null) ? (other.certification != null) : !this.certification.equals(other.certification)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 3;
|
return new HashCodeBuilder()
|
||||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
.append(country)
|
||||||
hash = 89 * hash + (this.certification != null ? this.certification.hashCode() : 0);
|
.append(certification)
|
||||||
hash = 89 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
.append(releaseDate)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -40,7 +40,6 @@ public class Reviews extends AbstractJsonMapping {
|
|||||||
@JsonProperty("url")
|
@JsonProperty("url")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -56,9 +55,7 @@ public class Reviews extends AbstractJsonMapping {
|
|||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@@ -74,5 +71,4 @@ public class Reviews extends AbstractJsonMapping {
|
|||||||
public void setUrl(String url) {
|
public void setUrl(String url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -36,7 +36,6 @@ public class StatusCode extends AbstractJsonMapping {
|
|||||||
@JsonProperty("status_message")
|
@JsonProperty("status_message")
|
||||||
private String statusMessage;
|
private String statusMessage;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public int getStatusCode() {
|
public int getStatusCode() {
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,9 +20,8 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
@@ -45,8 +44,9 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
private List<String> profileSizes;
|
private List<String> profileSizes;
|
||||||
@JsonProperty("logo_sizes")
|
@JsonProperty("logo_sizes")
|
||||||
private List<String> logoSizes;
|
private List<String> logoSizes;
|
||||||
|
@JsonProperty("still_sizes")
|
||||||
|
private List<String> stillSizes;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">//GEN-BEGIN:getterMethods
|
|
||||||
public List<String> getBackdropSizes() {
|
public List<String> getBackdropSizes() {
|
||||||
return backdropSizes;
|
return backdropSizes;
|
||||||
}
|
}
|
||||||
@@ -71,8 +71,10 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
return secureBaseUrl;
|
return secureBaseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// </editor-fold>
|
public List<String> getStillSizes() {
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">//GEN-BEGIN:setterMethods
|
return stillSizes;
|
||||||
|
}
|
||||||
|
|
||||||
public void setBackdropSizes(List<String> backdropSizes) {
|
public void setBackdropSizes(List<String> backdropSizes) {
|
||||||
this.backdropSizes = backdropSizes;
|
this.backdropSizes = backdropSizes;
|
||||||
}
|
}
|
||||||
@@ -96,7 +98,10 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
public void setSecureBaseUrl(String secureBaseUrl) {
|
public void setSecureBaseUrl(String secureBaseUrl) {
|
||||||
this.secureBaseUrl = secureBaseUrl;
|
this.secureBaseUrl = secureBaseUrl;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
public void setStillSizes(List<String> stillSizes) {
|
||||||
|
this.stillSizes = stillSizes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the data from the passed object to this one
|
* Copy the data from the passed object to this one
|
||||||
@@ -115,6 +120,7 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
* Check that the poster size is valid
|
* Check that the poster size is valid
|
||||||
*
|
*
|
||||||
* @param posterSize
|
* @param posterSize
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidPosterSize(String posterSize) {
|
public boolean isValidPosterSize(String posterSize) {
|
||||||
if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) {
|
if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) {
|
||||||
@@ -127,6 +133,7 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
* Check that the backdrop size is valid
|
* Check that the backdrop size is valid
|
||||||
*
|
*
|
||||||
* @param backdropSize
|
* @param backdropSize
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidBackdropSize(String backdropSize) {
|
public boolean isValidBackdropSize(String backdropSize) {
|
||||||
if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) {
|
if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) {
|
||||||
@@ -139,6 +146,7 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
* Check that the profile size is valid
|
* Check that the profile size is valid
|
||||||
*
|
*
|
||||||
* @param profileSize
|
* @param profileSize
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidProfileSize(String profileSize) {
|
public boolean isValidProfileSize(String profileSize) {
|
||||||
if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) {
|
if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) {
|
||||||
@@ -151,6 +159,7 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
* Check that the logo size is valid
|
* Check that the logo size is valid
|
||||||
*
|
*
|
||||||
* @param logoSize
|
* @param logoSize
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidLogoSize(String logoSize) {
|
public boolean isValidLogoSize(String logoSize) {
|
||||||
if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) {
|
if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) {
|
||||||
@@ -163,11 +172,12 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
* Check to see if the size is valid for any of the images types
|
* Check to see if the size is valid for any of the images types
|
||||||
*
|
*
|
||||||
* @param sizeToCheck
|
* @param sizeToCheck
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidSize(String sizeToCheck) {
|
public boolean isValidSize(String sizeToCheck) {
|
||||||
return (isValidPosterSize(sizeToCheck)
|
return isValidPosterSize(sizeToCheck)
|
||||||
|| isValidBackdropSize(sizeToCheck)
|
|| isValidBackdropSize(sizeToCheck)
|
||||||
|| isValidProfileSize(sizeToCheck)
|
|| isValidProfileSize(sizeToCheck)
|
||||||
|| isValidLogoSize(sizeToCheck));
|
|| isValidLogoSize(sizeToCheck);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,10 +20,8 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class TokenAuthorisation {
|
public class TokenAuthorisation extends AbstractJsonMapping {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Properties
|
* Properties
|
||||||
@@ -35,7 +33,6 @@ public class TokenAuthorisation {
|
|||||||
@JsonProperty("success")
|
@JsonProperty("success")
|
||||||
private Boolean success;
|
private Boolean success;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getExpires() {
|
public String getExpires() {
|
||||||
return expires;
|
return expires;
|
||||||
}
|
}
|
||||||
@@ -47,9 +44,7 @@ public class TokenAuthorisation {
|
|||||||
public Boolean getSuccess() {
|
public Boolean getSuccess() {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setExpires(String expires) {
|
public void setExpires(String expires) {
|
||||||
this.expires = expires;
|
this.expires = expires;
|
||||||
}
|
}
|
||||||
@@ -61,10 +56,4 @@ public class TokenAuthorisation {
|
|||||||
public void setSuccess(Boolean success) {
|
public void setSuccess(Boolean success) {
|
||||||
this.success = success;
|
this.success = success;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,10 +20,8 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class TokenSession {
|
public class TokenSession extends AbstractJsonMapping {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Properties
|
* Properties
|
||||||
@@ -41,7 +39,6 @@ public class TokenSession {
|
|||||||
@JsonProperty("expires_at")
|
@JsonProperty("expires_at")
|
||||||
private String expiresAt;
|
private String expiresAt;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
@@ -65,9 +62,7 @@ public class TokenSession {
|
|||||||
public String getExpiresAt() {
|
public String getExpiresAt() {
|
||||||
return expiresAt;
|
return expiresAt;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setSessionId(String sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
@@ -91,10 +86,4 @@ public class TokenSession {
|
|||||||
public void setExpiresAt(String expiresAt) {
|
public void setExpiresAt(String expiresAt) {
|
||||||
this.expiresAt = expiresAt;
|
this.expiresAt = expiresAt;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,6 +19,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
@@ -37,9 +40,10 @@ public class Trailer extends AbstractJsonMapping {
|
|||||||
private String name;
|
private String name;
|
||||||
private String size;
|
private String size;
|
||||||
private String source;
|
private String source;
|
||||||
private String website; // The website of the trailer
|
// The website of the trailer
|
||||||
|
private String website;
|
||||||
|
private String type;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -56,6 +60,10 @@ public class Trailer extends AbstractJsonMapping {
|
|||||||
return website;
|
return website;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
@@ -72,34 +80,31 @@ public class Trailer extends AbstractJsonMapping {
|
|||||||
this.website = website;
|
this.website = website;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof Trailer) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Trailer other = (Trailer) obj;
|
final Trailer other = (Trailer) obj;
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
return new EqualsBuilder()
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(size, other.size)
|
||||||
|
.append(source, other.source)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.size == null) ? (other.size != null) : !this.size.equals(other.size)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.source == null) ? (other.source != null) : !this.source.equals(other.source)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return new HashCodeBuilder()
|
||||||
hash = 61 * hash + (this.name != null ? this.name.hashCode() : 0);
|
.append(name)
|
||||||
hash = 61 * hash + (this.size != null ? this.size.hashCode() : 0);
|
.append(size)
|
||||||
hash = 61 * hash + (this.source != null ? this.source.hashCode() : 0);
|
.append(source)
|
||||||
hash = 61 * hash + (this.website != null ? this.website.hashCode() : 0);
|
.append(website)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
@@ -40,7 +42,6 @@ public class Translation extends AbstractJsonMapping {
|
|||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getEnglishName() {
|
public String getEnglishName() {
|
||||||
return englishName;
|
return englishName;
|
||||||
}
|
}
|
||||||
@@ -67,32 +68,25 @@ public class Translation extends AbstractJsonMapping {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof Translation) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Translation other = (Translation) obj;
|
final Translation other = (Translation) obj;
|
||||||
if ((this.englishName == null) ? (other.englishName != null) : !this.englishName.equals(other.englishName)) {
|
return new EqualsBuilder()
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(englishName, other.englishName)
|
||||||
|
.append(isoCode, other.isoCode)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 3;
|
return new HashCodeBuilder()
|
||||||
hash = 29 * hash + (this.englishName != null ? this.englishName.hashCode() : 0);
|
.append(englishName)
|
||||||
hash = 29 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
.append(isoCode)
|
||||||
hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0);
|
.append(name)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+98
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
|
*
|
||||||
|
* This file is part of TheMovieDB API.
|
||||||
|
*
|
||||||
|
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation;private either version 3 of the License;private or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* TheMovieDB API is distributed in the hope that it will be useful;private
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with TheMovieDB API. If not;private see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.omertron.themoviedbapi.model.comparator;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.model.PersonCredit;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two PersonCredits by date
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class PersonCreditDateComparator implements Comparator<PersonCredit>, Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static final Pattern YEAR_PATTERN = Pattern.compile("(?:.*?)(\\d{4})(?:.*?)");
|
||||||
|
private final boolean ascending;
|
||||||
|
|
||||||
|
public PersonCreditDateComparator() {
|
||||||
|
this.ascending = Boolean.FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PersonCreditDateComparator(boolean ascending) {
|
||||||
|
this.ascending = ascending;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(PersonCredit pc1, PersonCredit pc2) {
|
||||||
|
return compare(pc1, pc2, ascending);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two PersonCredits based on the respective years
|
||||||
|
*
|
||||||
|
* @param pc1
|
||||||
|
* @param pc2
|
||||||
|
* @param ascending
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int compare(PersonCredit pc1, PersonCredit pc2, boolean ascending) {
|
||||||
|
boolean valid1 = StringUtils.isNotBlank(pc1.getReleaseDate());
|
||||||
|
boolean valid2 = StringUtils.isNotBlank(pc2.getReleaseDate());
|
||||||
|
|
||||||
|
if (!valid1 && !valid2) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!valid1) {
|
||||||
|
return ascending ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!valid2) {
|
||||||
|
return ascending ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int year1 = extractYear(pc1.getReleaseDate());
|
||||||
|
int year2 = extractYear(pc2.getReleaseDate());
|
||||||
|
return ascending ? year1 - year2 : year2 - year1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* locate a 4 digit year in a date string
|
||||||
|
*
|
||||||
|
* @param date
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static int extractYear(String date) {
|
||||||
|
int year = 0;
|
||||||
|
Matcher m = YEAR_PATTERN.matcher(date);
|
||||||
|
if (m.find()) {
|
||||||
|
year = Integer.parseInt(m.group(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Give up and return 0
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -30,7 +30,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public abstract class TmdbResults {
|
public abstract class AbstractResults {
|
||||||
|
|
||||||
private int id = 0;
|
private int id = 0;
|
||||||
private int page = 0;
|
private int page = 0;
|
||||||
@@ -73,8 +73,12 @@ public abstract class TmdbResults {
|
|||||||
}
|
}
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This wrapper does not have anything to copy.
|
||||||
|
*
|
||||||
|
* @param wrapper
|
||||||
|
*/
|
||||||
public void copyWrapper(AbstractWrapper wrapper) {
|
public void copyWrapper(AbstractWrapper wrapper) {
|
||||||
// These results have nothing to copy, so this is just a placeholder
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,6 +104,6 @@ public abstract class TmdbResults {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
|
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -28,7 +28,7 @@ import java.util.List;
|
|||||||
* @author Stuart
|
* @author Stuart
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public final class TmdbResultsList<T> extends TmdbResults {
|
public final class TmdbResultsList<T> extends AbstractResults {
|
||||||
|
|
||||||
private List<T> results;
|
private List<T> results;
|
||||||
|
|
||||||
@@ -47,4 +47,13 @@ public final class TmdbResultsList<T> extends TmdbResults {
|
|||||||
public void setResults(List<T> results) {
|
public void setResults(List<T> results) {
|
||||||
this.results = results;
|
this.results = results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTotalResults() {
|
||||||
|
if (super.getTotalResults() == 0) {
|
||||||
|
return results.size();
|
||||||
|
} else {
|
||||||
|
return super.getTotalResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -29,7 +29,7 @@ import java.util.Map;
|
|||||||
* @param <K>
|
* @param <K>
|
||||||
* @param <V>
|
* @param <V>
|
||||||
*/
|
*/
|
||||||
public final class TmdbResultsMap<K, V> extends TmdbResults {
|
public final class TmdbResultsMap<K, V> extends AbstractResults {
|
||||||
|
|
||||||
private Map<K, V> results;
|
private Map<K, V> results;
|
||||||
|
|
||||||
@@ -44,4 +44,13 @@ public final class TmdbResultsMap<K, V> extends TmdbResults {
|
|||||||
public void setResults(Map<K, V> results) {
|
public void setResults(Map<K, V> results) {
|
||||||
this.results = results;
|
this.results = results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTotalResults() {
|
||||||
|
if (super.getTotalResults() == 0) {
|
||||||
|
return results.size();
|
||||||
|
} else {
|
||||||
|
return super.getTotalResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -53,10 +53,10 @@ public class ApiUrl {
|
|||||||
/*
|
/*
|
||||||
* Properties
|
* Properties
|
||||||
*/
|
*/
|
||||||
private String apiKey;
|
private final String apiKey;
|
||||||
private String method;
|
private final String method;
|
||||||
private String submethod;
|
private final String submethod;
|
||||||
private Map<String, String> arguments = new HashMap<String, String>();
|
private final Map<String, String> arguments = new HashMap<String, String>();
|
||||||
/*
|
/*
|
||||||
* API Parameters
|
* API Parameters
|
||||||
*/
|
*/
|
||||||
@@ -82,6 +82,7 @@ public class ApiUrl {
|
|||||||
/**
|
/**
|
||||||
* Constructor for the simple API URL method without a sub-method
|
* Constructor for the simple API URL method without a sub-method
|
||||||
*
|
*
|
||||||
|
* @param apiKey
|
||||||
* @param method
|
* @param method
|
||||||
*/
|
*/
|
||||||
public ApiUrl(String apiKey, String method) {
|
public ApiUrl(String apiKey, String method) {
|
||||||
@@ -93,6 +94,7 @@ public class ApiUrl {
|
|||||||
/**
|
/**
|
||||||
* Constructor for the API URL with a sub-method
|
* Constructor for the API URL with a sub-method
|
||||||
*
|
*
|
||||||
|
* @param apiKey
|
||||||
* @param method
|
* @param method
|
||||||
* @param submethod
|
* @param submethod
|
||||||
*/
|
*/
|
||||||
@@ -105,6 +107,8 @@ public class ApiUrl {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the URL from the pre-created arguments.
|
* Build the URL from the pre-created arguments.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public URL buildUrl() {
|
public URL buildUrl() {
|
||||||
StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
|
StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
|
||||||
@@ -133,7 +137,7 @@ public class ApiUrl {
|
|||||||
try {
|
try {
|
||||||
urlString.append(URLEncoder.encode(query, "UTF-8"));
|
urlString.append(URLEncoder.encode(query, "UTF-8"));
|
||||||
} catch (UnsupportedEncodingException ex) {
|
} catch (UnsupportedEncodingException ex) {
|
||||||
LOG.trace("Unable to encode query: '{}' trying raw.", query);
|
LOG.trace("Unable to encode query: '{}' trying raw.", query, ex);
|
||||||
// If we can't encode it, try it raw
|
// If we can't encode it, try it raw
|
||||||
urlString.append(query);
|
urlString.append(query);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,14 +19,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.tools;
|
package com.omertron.themoviedbapi.tools;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.omertron.themoviedbapi.MovieDbException;
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import java.io.BufferedReader;
|
||||||
import org.slf4j.Logger;
|
import java.io.IOException;
|
||||||
import org.slf4j.LoggerFactory;
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.*;
|
import java.io.StringWriter;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@@ -38,6 +36,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web browser with simple cookies support
|
* Web browser with simple cookies support
|
||||||
@@ -45,15 +47,17 @@ import java.util.regex.Pattern;
|
|||||||
public final class WebBrowser {
|
public final class WebBrowser {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(WebBrowser.class);
|
private static final Logger LOG = LoggerFactory.getLogger(WebBrowser.class);
|
||||||
private static Map<String, String> browserProperties = new HashMap<String, String>();
|
private static final Map<String, String> BROWSER_PROPERTIES = new HashMap<String, String>();
|
||||||
private static Map<String, Map<String, String>> cookies = new HashMap<String, Map<String, String>>();
|
private static final Map<String, Map<String, String>> COOKIES = new HashMap<String, Map<String, String>>();
|
||||||
private static String proxyHost = null;
|
private static String proxyHost = null;
|
||||||
private static String proxyPort = null;
|
private static int proxyPort = 0;
|
||||||
private static String proxyUsername = null;
|
private static String proxyUsername = null;
|
||||||
private static String proxyPassword = null;
|
private static String proxyPassword = null;
|
||||||
private static String proxyEncodedPassword = null;
|
private static String proxyEncodedPassword = null;
|
||||||
private static int webTimeoutConnect = 25000; // 25 second timeout
|
// 25 second timeout
|
||||||
private static int webTimeoutRead = 90000; // 90 second timeout
|
private static int webTimeoutConnect = 25000;
|
||||||
|
// 90 second timeout
|
||||||
|
private static int webTimeoutRead = 90000;
|
||||||
|
|
||||||
// Hide the constructor
|
// Hide the constructor
|
||||||
protected WebBrowser() {
|
protected WebBrowser() {
|
||||||
@@ -65,10 +69,10 @@ public final class WebBrowser {
|
|||||||
* Populate the browser properties
|
* Populate the browser properties
|
||||||
*/
|
*/
|
||||||
private static void populateBrowserProperties() {
|
private static void populateBrowserProperties() {
|
||||||
if (browserProperties.isEmpty()) {
|
if (BROWSER_PROPERTIES.isEmpty()) {
|
||||||
browserProperties.put("User-Agent", "Mozilla/5.25 Netscape/5.0 (Windows; I; Win95)");
|
BROWSER_PROPERTIES.put("User-Agent", "Mozilla/5.25 Netscape/5.0 (Windows; I; Win95)");
|
||||||
browserProperties.put("Accept", "application/json");
|
BROWSER_PROPERTIES.put("Accept", "application/json");
|
||||||
browserProperties.put("Content-type", "application/json");
|
BROWSER_PROPERTIES.put("Content-type", "application/json");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +80,7 @@ public final class WebBrowser {
|
|||||||
try {
|
try {
|
||||||
return request(new URL(url));
|
return request(new URL(url));
|
||||||
} catch (MalformedURLException ex) {
|
} catch (MalformedURLException ex) {
|
||||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex);
|
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, url, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,16 +100,16 @@ public final class WebBrowser {
|
|||||||
|
|
||||||
return cnx;
|
return cnx;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex);
|
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, url, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String request(URL url) throws MovieDbException {
|
public static String request(URL url) throws MovieDbException {
|
||||||
return request(url, null);
|
return request(url, null, Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String request(URL url, String jsonBody) throws MovieDbException {
|
public static String request(URL url, String jsonBody) throws MovieDbException {
|
||||||
return request(url, jsonBody, false);
|
return request(url, jsonBody, Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String request(URL url, String jsonBody, boolean isDeleteRequest) throws MovieDbException {
|
public static String request(URL url, String jsonBody, boolean isDeleteRequest) throws MovieDbException {
|
||||||
@@ -121,6 +125,11 @@ public final class WebBrowser {
|
|||||||
try {
|
try {
|
||||||
cnx = (HttpURLConnection) openProxiedConnection(url);
|
cnx = (HttpURLConnection) openProxiedConnection(url);
|
||||||
|
|
||||||
|
// If we get a null connection, then throw an exception
|
||||||
|
if (cnx == null) {
|
||||||
|
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, "No HTTP connection could be made.", url);
|
||||||
|
}
|
||||||
|
|
||||||
if (isDeleteRequest) {
|
if (isDeleteRequest) {
|
||||||
cnx.setDoOutput(true);
|
cnx.setDoOutput(true);
|
||||||
cnx.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
cnx.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||||
@@ -129,7 +138,7 @@ public final class WebBrowser {
|
|||||||
|
|
||||||
sendHeader(cnx);
|
sendHeader(cnx);
|
||||||
|
|
||||||
if (jsonBody != null) {
|
if (StringUtils.isNotBlank(jsonBody)) {
|
||||||
cnx.setDoOutput(true);
|
cnx.setDoOutput(true);
|
||||||
wr = new OutputStreamWriter(cnx.getOutputStream());
|
wr = new OutputStreamWriter(cnx.getOutputStream());
|
||||||
wr.write(jsonBody);
|
wr.write(jsonBody);
|
||||||
@@ -164,7 +173,7 @@ public final class WebBrowser {
|
|||||||
}
|
}
|
||||||
return content.toString();
|
return content.toString();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, ex);
|
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, url, ex);
|
||||||
} finally {
|
} finally {
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
try {
|
try {
|
||||||
@@ -180,7 +189,7 @@ public final class WebBrowser {
|
|||||||
populateBrowserProperties();
|
populateBrowserProperties();
|
||||||
|
|
||||||
// send browser properties
|
// send browser properties
|
||||||
for (Map.Entry<String, String> browserProperty : browserProperties.entrySet()) {
|
for (Map.Entry<String, String> browserProperty : BROWSER_PROPERTIES.entrySet()) {
|
||||||
cnx.setRequestProperty(browserProperty.getKey(), browserProperty.getValue());
|
cnx.setRequestProperty(browserProperty.getKey(), browserProperty.getValue());
|
||||||
}
|
}
|
||||||
// send cookies
|
// send cookies
|
||||||
@@ -193,7 +202,7 @@ public final class WebBrowser {
|
|||||||
private static String createCookieHeader(URLConnection cnx) {
|
private static String createCookieHeader(URLConnection cnx) {
|
||||||
String host = cnx.getURL().getHost();
|
String host = cnx.getURL().getHost();
|
||||||
StringBuilder cookiesHeader = new StringBuilder();
|
StringBuilder cookiesHeader = new StringBuilder();
|
||||||
for (Map.Entry<String, Map<String, String>> domainCookies : cookies.entrySet()) {
|
for (Map.Entry<String, Map<String, String>> domainCookies : COOKIES.entrySet()) {
|
||||||
if (host.endsWith(domainCookies.getKey())) {
|
if (host.endsWith(domainCookies.getKey())) {
|
||||||
for (Map.Entry<String, String> cookie : domainCookies.getValue().entrySet()) {
|
for (Map.Entry<String, String> cookie : domainCookies.getValue().entrySet()) {
|
||||||
cookiesHeader.append(cookie.getKey());
|
cookiesHeader.append(cookie.getKey());
|
||||||
@@ -233,10 +242,10 @@ public final class WebBrowser {
|
|||||||
// if domain isn't set take current host
|
// if domain isn't set take current host
|
||||||
cookieDomain = cnx.getURL().getHost();
|
cookieDomain = cnx.getURL().getHost();
|
||||||
}
|
}
|
||||||
Map<String, String> domainCookies = cookies.get(cookieDomain);
|
Map<String, String> domainCookies = COOKIES.get(cookieDomain);
|
||||||
if (domainCookies == null) {
|
if (domainCookies == null) {
|
||||||
domainCookies = new HashMap<String, String>();
|
domainCookies = new HashMap<String, String>();
|
||||||
cookies.put(cookieDomain, domainCookies);
|
COOKIES.put(cookieDomain, domainCookies);
|
||||||
}
|
}
|
||||||
// add or replace cookie
|
// add or replace cookie
|
||||||
domainCookies.put(cookieName, cookieValue);
|
domainCookies.put(cookieName, cookieValue);
|
||||||
@@ -277,11 +286,11 @@ public final class WebBrowser {
|
|||||||
WebBrowser.proxyHost = myProxyHost;
|
WebBrowser.proxyHost = myProxyHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getProxyPort() {
|
public static int getProxyPort() {
|
||||||
return proxyPort;
|
return proxyPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setProxyPort(String myProxyPort) {
|
public static void setProxyPort(int myProxyPort) {
|
||||||
WebBrowser.proxyPort = myProxyPort;
|
WebBrowser.proxyPort = myProxyPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,15 +330,4 @@ public final class WebBrowser {
|
|||||||
public static void setWebTimeoutRead(int webTimeoutRead) {
|
public static void setWebTimeoutRead(int webTimeoutRead) {
|
||||||
WebBrowser.webTimeoutRead = webTimeoutRead;
|
WebBrowser.webTimeoutRead = webTimeoutRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Use Jackson to convert Map to JSON string.
|
|
||||||
*/
|
|
||||||
public static String convertToJson(Map<String, ?> map) throws MovieDbException {
|
|
||||||
try {
|
|
||||||
return new ObjectMapper().writeValueAsString(map);
|
|
||||||
} catch (JsonProcessingException jpe) {
|
|
||||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.MAPPING_FAILED, "JSON conversion failed", jpe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,23 +19,16 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
package com.omertron.themoviedbapi.wrapper;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
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.LoggerFactory;
|
|
||||||
|
|
||||||
public abstract class AbstractWrapper {
|
public abstract class AbstractWrapper extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
private Logger log;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public AbstractWrapper(Class classToLog) {
|
|
||||||
this.log = LoggerFactory.getLogger(classToLog);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of the enums passed
|
* Get a list of the enums passed
|
||||||
@@ -52,23 +45,4 @@ public abstract class AbstractWrapper {
|
|||||||
return new ArrayList<E>(EnumSet.allOf(clz));
|
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,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -27,9 +27,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, IWrapperPages, IWrapperDates {
|
public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, IWrapperPages, IWrapperDates {
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
|
|
||||||
@JsonProperty("page")
|
@JsonProperty("page")
|
||||||
private int page;
|
private int page;
|
||||||
@@ -40,10 +37,6 @@ public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId,
|
|||||||
@JsonProperty("dates")
|
@JsonProperty("dates")
|
||||||
private ResultDates dates = new ResultDates();
|
private ResultDates dates = new ResultDates();
|
||||||
|
|
||||||
public AbstractWrapperAll(Class classToLog) {
|
|
||||||
super(classToLog);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPage() {
|
public int getPage() {
|
||||||
return page;
|
return page;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -27,17 +27,11 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class AbstractWrapperId extends AbstractWrapper implements IWrapperId {
|
public class AbstractWrapperId extends AbstractWrapper implements IWrapperId {
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
public AbstractWrapperId(Class classToLog) {
|
|
||||||
super(classToLog);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.wrapper;
|
package com.omertron.themoviedbapi.wrapper;
|
||||||
|
|
||||||
import 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;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,21 +21,19 @@ package com.omertron.themoviedbapi.wrapper;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.model.AlternativeTitle;
|
import com.omertron.themoviedbapi.model.AlternativeTitle;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class WrapperAlternativeTitles extends AbstractWrapperId {
|
public class WrapperAlternativeTitles extends AbstractWrapperId implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("titles")
|
@JsonProperty("titles")
|
||||||
private List<AlternativeTitle> titles;
|
private List<AlternativeTitle> titles;
|
||||||
|
|
||||||
public WrapperAlternativeTitles() {
|
|
||||||
super(WrapperAlternativeTitles.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<AlternativeTitle> getTitles() {
|
public List<AlternativeTitle> getTitles() {
|
||||||
return titles;
|
return titles;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2014 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;
|
package com.omertron.themoviedbapi.wrapper;
|
||||||
|
|
||||||
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.JsonAnyGetter;
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.model.ChangeKeyItem;
|
import com.omertron.themoviedbapi.model.ChangeKeyItem;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
@@ -15,7 +34,7 @@ public class WrapperChanges {
|
|||||||
|
|
||||||
@JsonProperty("changes")
|
@JsonProperty("changes")
|
||||||
private List<ChangeKeyItem> changedItems = new ArrayList<ChangeKeyItem>();
|
private List<ChangeKeyItem> changedItems = new ArrayList<ChangeKeyItem>();
|
||||||
private Map<String, Object> newItems = new HashMap<String, Object>();
|
private final Map<String, Object> newItems = new HashMap<String, Object>();
|
||||||
|
|
||||||
public List<ChangeKeyItem> getChangedItems() {
|
public List<ChangeKeyItem> getChangedItems() {
|
||||||
return changedItems;
|
return changedItems;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -32,10 +32,6 @@ public class WrapperCollection extends AbstractWrapperAll {
|
|||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<Collection> results;
|
private List<Collection> results;
|
||||||
|
|
||||||
public WrapperCollection() {
|
|
||||||
super(WrapperCollection.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Collection> getResults() {
|
public List<Collection> getResults() {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -32,10 +32,6 @@ public class WrapperCompany extends AbstractWrapperAll {
|
|||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<Company> results;
|
private List<Company> results;
|
||||||
|
|
||||||
public WrapperCompany() {
|
|
||||||
super(WrapperCompany.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Company> getResults() {
|
public List<Company> getResults() {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -32,10 +32,6 @@ public class WrapperCompanyMovies extends AbstractWrapperAll {
|
|||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<MovieDb> results;
|
private List<MovieDb> results;
|
||||||
|
|
||||||
public WrapperCompanyMovies() {
|
|
||||||
super(WrapperCompanyMovies.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MovieDb> getResults() {
|
public List<MovieDb> getResults() {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -33,11 +33,7 @@ public class WrapperConfig extends AbstractWrapper {
|
|||||||
@JsonProperty("images")
|
@JsonProperty("images")
|
||||||
private TmdbConfiguration tmdbConfiguration;
|
private TmdbConfiguration tmdbConfiguration;
|
||||||
@JsonProperty("change_keys")
|
@JsonProperty("change_keys")
|
||||||
private List<String> changeKeys = Collections.EMPTY_LIST;
|
private List<String> changeKeys = Collections.emptyList();
|
||||||
|
|
||||||
public WrapperConfig() {
|
|
||||||
super(WrapperConfig.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TmdbConfiguration getTmdbConfiguration() {
|
public TmdbConfiguration getTmdbConfiguration() {
|
||||||
return tmdbConfiguration;
|
return tmdbConfiguration;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -33,10 +33,6 @@ public class WrapperGenres extends AbstractWrapper {
|
|||||||
@JsonProperty("genres")
|
@JsonProperty("genres")
|
||||||
private List<Genre> genres;
|
private List<Genre> genres;
|
||||||
|
|
||||||
public WrapperGenres() {
|
|
||||||
super(WrapperGenres.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Genre> getGenres() {
|
public List<Genre> getGenres() {
|
||||||
return genres;
|
return genres;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -22,6 +22,7 @@ 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 com.omertron.themoviedbapi.model.ArtworkType;
|
import com.omertron.themoviedbapi.model.ArtworkType;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -31,18 +32,15 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class WrapperImages extends AbstractWrapperAll {
|
public class WrapperImages extends AbstractWrapperAll implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("backdrops")
|
@JsonProperty("backdrops")
|
||||||
private List<Artwork> backdrops = Collections.EMPTY_LIST;
|
private List<Artwork> backdrops = Collections.emptyList();
|
||||||
@JsonProperty("posters")
|
@JsonProperty("posters")
|
||||||
private List<Artwork> posters = Collections.EMPTY_LIST;
|
private List<Artwork> posters = Collections.emptyList();
|
||||||
@JsonProperty("profiles")
|
@JsonProperty("profiles")
|
||||||
private List<Artwork> profiles = Collections.EMPTY_LIST;
|
private List<Artwork> profiles = Collections.emptyList();
|
||||||
|
|
||||||
public WrapperImages() {
|
|
||||||
super(WrapperImages.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Artwork> getBackdrops() {
|
public List<Artwork> getBackdrops() {
|
||||||
return backdrops;
|
return backdrops;
|
||||||
@@ -73,6 +71,7 @@ public class WrapperImages extends AbstractWrapperAll {
|
|||||||
*
|
*
|
||||||
* Leaving the parameters blank will return all types
|
* Leaving the parameters blank will return all types
|
||||||
*
|
*
|
||||||
|
* @param artworkList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Artwork> getAll(ArtworkType... artworkList) {
|
public List<Artwork> getAll(ArtworkType... artworkList) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -32,10 +32,6 @@ public class WrapperJobList extends AbstractWrapper {
|
|||||||
@JsonProperty("jobs")
|
@JsonProperty("jobs")
|
||||||
private List<JobDepartment> jobs;
|
private List<JobDepartment> jobs;
|
||||||
|
|
||||||
public WrapperJobList() {
|
|
||||||
super(WrapperJobList.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<JobDepartment> getJobs() {
|
public List<JobDepartment> getJobs() {
|
||||||
return jobs;
|
return jobs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -32,10 +32,6 @@ public class WrapperKeywordMovies extends AbstractWrapperAll {
|
|||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<KeywordMovie> results;
|
private List<KeywordMovie> results;
|
||||||
|
|
||||||
public WrapperKeywordMovies() {
|
|
||||||
super(WrapperKeywordMovies.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<KeywordMovie> getResults() {
|
public List<KeywordMovie> getResults() {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -32,10 +32,6 @@ public class WrapperKeywords extends AbstractWrapperAll {
|
|||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<Keyword> results;
|
private List<Keyword> results;
|
||||||
|
|
||||||
public WrapperKeywords() {
|
|
||||||
super(WrapperKeywords.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Keyword> getResults() {
|
public List<Keyword> getResults() {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,21 +21,19 @@ 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.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
public class WrapperMovie extends AbstractWrapperAll {
|
public class WrapperMovie extends AbstractWrapperAll implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<MovieDb> movies;
|
private List<MovieDb> movies;
|
||||||
|
|
||||||
public WrapperMovie() {
|
|
||||||
super(WrapperMovie.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MovieDb> getMovies() {
|
public List<MovieDb> getMovies() {
|
||||||
return movies;
|
return movies;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.omertron.themoviedbapi.model.Person;
|
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.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -30,17 +31,14 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class WrapperMovieCasts extends AbstractWrapperId {
|
public class WrapperMovieCasts extends AbstractWrapperId implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("cast")
|
@JsonProperty("cast")
|
||||||
private List<PersonCast> cast;
|
private List<PersonCast> cast;
|
||||||
@JsonProperty("crew")
|
@JsonProperty("crew")
|
||||||
private List<PersonCrew> crew;
|
private List<PersonCrew> crew;
|
||||||
|
|
||||||
public WrapperMovieCasts() {
|
|
||||||
super(WrapperMovieCasts.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PersonCast> getCast() {
|
public List<PersonCast> getCast() {
|
||||||
return cast;
|
return cast;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
|
*
|
||||||
|
* This file is part of TheMovieDB API.
|
||||||
|
*
|
||||||
|
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.omertron.themoviedbapi.wrapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.model.ChangedMovie;
|
||||||
|
|
||||||
|
public class WrapperMovieChanges extends AbstractWrapperAll {
|
||||||
|
|
||||||
|
@JsonProperty("results")
|
||||||
|
private List<ChangedMovie> results;
|
||||||
|
|
||||||
|
public List<ChangedMovie> getResults() {
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResults(List<ChangedMovie> results) {
|
||||||
|
this.results = results;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2014 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;
|
package com.omertron.themoviedbapi.wrapper;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.model.MovieDbList;
|
import com.omertron.themoviedbapi.model.MovieDbList;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class WrapperMovieDbList extends AbstractWrapperAll {
|
public class WrapperMovieDbList extends AbstractWrapperAll {
|
||||||
@@ -11,10 +29,6 @@ public class WrapperMovieDbList extends AbstractWrapperAll {
|
|||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<MovieDbList> lists;
|
private List<MovieDbList> lists;
|
||||||
|
|
||||||
public WrapperMovieDbList() {
|
|
||||||
super(WrapperMovieDbList.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MovieDbList> getLists() {
|
public List<MovieDbList> getLists() {
|
||||||
return lists;
|
return lists;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,21 +21,19 @@ 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.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class WrapperMovieKeywords extends AbstractWrapperId {
|
public class WrapperMovieKeywords extends AbstractWrapperId implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("keywords")
|
@JsonProperty("keywords")
|
||||||
private List<Keyword> keywords;
|
private List<Keyword> keywords;
|
||||||
|
|
||||||
public WrapperMovieKeywords() {
|
|
||||||
super(WrapperMovieKeywords.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Keyword> getKeywords() {
|
public List<Keyword> getKeywords() {
|
||||||
return keywords;
|
return keywords;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,21 +21,19 @@ 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.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class WrapperMovieList extends AbstractWrapperAll {
|
public class WrapperMovieList extends AbstractWrapperAll implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<MovieList> movieList;
|
private List<MovieList> movieList;
|
||||||
|
|
||||||
public WrapperMovieList() {
|
|
||||||
super(WrapperMovieList.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MovieList> getMovieList() {
|
public List<MovieList> getMovieList() {
|
||||||
return movieList;
|
return movieList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -32,10 +32,6 @@ public class WrapperPerson extends AbstractWrapperAll {
|
|||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<Person> results;
|
private List<Person> results;
|
||||||
|
|
||||||
public WrapperPerson() {
|
|
||||||
super(WrapperPerson.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Person> getResults() {
|
public List<Person> getResults() {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -36,10 +36,6 @@ public class WrapperPersonCredits extends AbstractWrapperAll {
|
|||||||
@JsonProperty("crew")
|
@JsonProperty("crew")
|
||||||
private List<PersonCredit> crew;
|
private List<PersonCredit> crew;
|
||||||
|
|
||||||
public WrapperPersonCredits() {
|
|
||||||
super(WrapperMovieCasts.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PersonCredit> getCast() {
|
public List<PersonCredit> getCast() {
|
||||||
return cast;
|
return cast;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -32,10 +32,6 @@ public class WrapperPersonList extends AbstractWrapperAll {
|
|||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<Person> personList;
|
private List<Person> personList;
|
||||||
|
|
||||||
public WrapperPersonList() {
|
|
||||||
super(WrapperPersonList.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Person> getPersonList() {
|
public List<Person> getPersonList() {
|
||||||
return personList;
|
return personList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,21 +21,19 @@ package com.omertron.themoviedbapi.wrapper;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.model.ReleaseInfo;
|
import com.omertron.themoviedbapi.model.ReleaseInfo;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class WrapperReleaseInfo extends AbstractWrapperId {
|
public class WrapperReleaseInfo extends AbstractWrapperId implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("countries")
|
@JsonProperty("countries")
|
||||||
private List<ReleaseInfo> countries;
|
private List<ReleaseInfo> countries;
|
||||||
|
|
||||||
public WrapperReleaseInfo() {
|
|
||||||
super(WrapperReleaseInfo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReleaseInfo> getCountries() {
|
public List<ReleaseInfo> getCountries() {
|
||||||
return countries;
|
return countries;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,21 +21,19 @@ package com.omertron.themoviedbapi.wrapper;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.model.Reviews;
|
import com.omertron.themoviedbapi.model.Reviews;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
public class WrapperReviews extends AbstractWrapperAll {
|
public class WrapperReviews extends AbstractWrapperAll implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("results")
|
@JsonProperty("results")
|
||||||
private List<Reviews> reviews;
|
private List<Reviews> reviews;
|
||||||
|
|
||||||
public WrapperReviews() {
|
|
||||||
super(WrapperReviews.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Reviews> getReviews() {
|
public List<Reviews> getReviews() {
|
||||||
return reviews;
|
return reviews;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,6 +21,7 @@ package com.omertron.themoviedbapi.wrapper;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.model.Trailer;
|
import com.omertron.themoviedbapi.model.Trailer;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -28,17 +29,14 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class WrapperTrailers extends AbstractWrapperId {
|
public class WrapperTrailers extends AbstractWrapperId implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("quicktime")
|
@JsonProperty("quicktime")
|
||||||
private List<Trailer> quicktime;
|
private List<Trailer> quicktime;
|
||||||
@JsonProperty("youtube")
|
@JsonProperty("youtube")
|
||||||
private List<Trailer> youtube;
|
private List<Trailer> youtube;
|
||||||
|
|
||||||
public WrapperTrailers() {
|
|
||||||
super(WrapperTrailers.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Trailer> getQuicktime() {
|
public List<Trailer> getQuicktime() {
|
||||||
return quicktime;
|
return quicktime;
|
||||||
}
|
}
|
||||||
@@ -56,7 +54,7 @@ public class WrapperTrailers extends AbstractWrapperId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a combined list of the trailers with their source website
|
* Get a combined list of the trailers with their source
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -64,15 +62,20 @@ public class WrapperTrailers extends AbstractWrapperId {
|
|||||||
List<Trailer> trailers = new ArrayList<Trailer>();
|
List<Trailer> trailers = new ArrayList<Trailer>();
|
||||||
|
|
||||||
// Add the trailer to the return list along with it's source
|
// Add the trailer to the return list along with it's source
|
||||||
|
if (quicktime != null) {
|
||||||
for (Trailer trailer : quicktime) {
|
for (Trailer trailer : quicktime) {
|
||||||
trailer.setWebsite(Trailer.WEBSITE_QUICKTIME);
|
trailer.setWebsite(Trailer.WEBSITE_QUICKTIME);
|
||||||
trailers.add(trailer);
|
trailers.add(trailer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add the trailer to the return list along with it's source
|
// Add the trailer to the return list along with it's source
|
||||||
|
if (youtube != null) {
|
||||||
for (Trailer trailer : youtube) {
|
for (Trailer trailer : youtube) {
|
||||||
trailer.setWebsite(Trailer.WEBSITE_YOUTUBE);
|
trailer.setWebsite(Trailer.WEBSITE_YOUTUBE);
|
||||||
trailers.add(trailer);
|
trailers.add(trailer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return trailers;
|
return trailers;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -21,21 +21,19 @@ package com.omertron.themoviedbapi.wrapper;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.model.Translation;
|
import com.omertron.themoviedbapi.model.Translation;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class WrapperTranslations extends AbstractWrapperId {
|
public class WrapperTranslations extends AbstractWrapperId implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
@JsonProperty("translations")
|
@JsonProperty("translations")
|
||||||
private List<Translation> translations;
|
private List<Translation> translations;
|
||||||
|
|
||||||
public WrapperTranslations() {
|
|
||||||
super(WrapperTranslations.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTranslations(List<Translation> translations) {
|
public void setTranslations(List<Translation> translations) {
|
||||||
this.translations = translations;
|
this.translations = translations;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,35 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of the FanartTV API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
* The FanartTV 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.
|
||||||
*
|
*
|
||||||
* The FanartTV 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 the FanartTV API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi;
|
package com.omertron.themoviedbapi;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.logging.LogManager;
|
import java.util.logging.LogManager;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -46,7 +53,7 @@ public class TestLogger {
|
|||||||
config.append(".level = ").append(level).append(CRLF);
|
config.append(".level = ").append(level).append(CRLF);
|
||||||
config.append("java.util.logging.ConsoleHandler.level = ").append(level).append(CRLF);
|
config.append("java.util.logging.ConsoleHandler.level = ").append(level).append(CRLF);
|
||||||
// Only works with Java 7 or later
|
// Only works with Java 7 or later
|
||||||
config.append("java.util.logging.SimpleFormatter.format = [%1$tc %4$s] %2$s - %5$s %6$s%n").append(CRLF);
|
config.append("java.util.logging.SimpleFormatter.format = [%1$tH:%1$tM:%1$tS %4$6s] %2$s - %5$s %6$s%n").append(CRLF);
|
||||||
// Exclude http logging
|
// Exclude http logging
|
||||||
config.append("sun.net.www.protocol.http.HttpURLConnection.level = OFF").append(CRLF);
|
config.append("sun.net.www.protocol.http.HttpURLConnection.level = OFF").append(CRLF);
|
||||||
|
|
||||||
@@ -69,4 +76,59 @@ public class TestLogger {
|
|||||||
public static boolean Configure() {
|
public static boolean Configure() {
|
||||||
return Configure("ALL");
|
return Configure("ALL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load properties from a file
|
||||||
|
*
|
||||||
|
* @param props
|
||||||
|
* @param propertyFile
|
||||||
|
*/
|
||||||
|
public static void loadProperties(Properties props, File propertyFile) {
|
||||||
|
InputStream is = null;
|
||||||
|
try {
|
||||||
|
is = new FileInputStream(propertyFile);
|
||||||
|
props.load(is);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOG.warn("Failed to load properties file", ex);
|
||||||
|
} finally {
|
||||||
|
if (is != null) {
|
||||||
|
try {
|
||||||
|
is.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
LOG.warn("Failed to close properties file", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save properties to a file
|
||||||
|
*
|
||||||
|
* @param props
|
||||||
|
* @param propertyFile
|
||||||
|
* @param headerText
|
||||||
|
*/
|
||||||
|
public static void saveProperties(Properties props, File propertyFile, String headerText) {
|
||||||
|
OutputStream out = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
out = new FileOutputStream(propertyFile);
|
||||||
|
if (StringUtils.isNotBlank(headerText)) {
|
||||||
|
props.store(out, headerText);
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException ex) {
|
||||||
|
LOG.warn("Failed to find properties file", ex);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
LOG.warn("Failed to read properties file", ex);
|
||||||
|
} finally {
|
||||||
|
if (out != null) {
|
||||||
|
try {
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
LOG.warn("Failed to close properties file", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2014 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,19 +19,57 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi;
|
package com.omertron.themoviedbapi;
|
||||||
|
|
||||||
import com.omertron.themoviedbapi.model.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
import static org.junit.Assert.assertFalse;
|
||||||
import com.omertron.themoviedbapi.results.TmdbResultsMap;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import static org.junit.Assert.assertTrue;
|
||||||
import org.junit.*;
|
import static org.junit.Assert.fail;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.model.Account;
|
||||||
|
import com.omertron.themoviedbapi.model.AlternativeTitle;
|
||||||
|
import com.omertron.themoviedbapi.model.Artwork;
|
||||||
|
import com.omertron.themoviedbapi.model.ChangedItem;
|
||||||
|
import com.omertron.themoviedbapi.model.ChangedMovie;
|
||||||
|
import com.omertron.themoviedbapi.model.Collection;
|
||||||
|
import com.omertron.themoviedbapi.model.CollectionInfo;
|
||||||
|
import com.omertron.themoviedbapi.model.Company;
|
||||||
|
import com.omertron.themoviedbapi.model.Discover;
|
||||||
|
import com.omertron.themoviedbapi.model.Genre;
|
||||||
|
import com.omertron.themoviedbapi.model.JobDepartment;
|
||||||
|
import com.omertron.themoviedbapi.model.Keyword;
|
||||||
|
import com.omertron.themoviedbapi.model.KeywordMovie;
|
||||||
|
import com.omertron.themoviedbapi.model.MovieDb;
|
||||||
|
import com.omertron.themoviedbapi.model.MovieDbList;
|
||||||
|
import com.omertron.themoviedbapi.model.MovieList;
|
||||||
|
import com.omertron.themoviedbapi.model.Person;
|
||||||
|
import com.omertron.themoviedbapi.model.PersonCredit;
|
||||||
|
import com.omertron.themoviedbapi.model.ReleaseInfo;
|
||||||
|
import com.omertron.themoviedbapi.model.Reviews;
|
||||||
|
import com.omertron.themoviedbapi.model.StatusCode;
|
||||||
|
import com.omertron.themoviedbapi.model.TmdbConfiguration;
|
||||||
|
import com.omertron.themoviedbapi.model.TokenAuthorisation;
|
||||||
|
import com.omertron.themoviedbapi.model.TokenSession;
|
||||||
|
import com.omertron.themoviedbapi.model.Trailer;
|
||||||
|
import com.omertron.themoviedbapi.model.Translation;
|
||||||
|
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||||
|
import com.omertron.themoviedbapi.results.TmdbResultsMap;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Properties;
|
||||||
|
import org.apache.commons.lang3.math.NumberUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases for TheMovieDbApi API
|
* Test cases for TheMovieDbApi API
|
||||||
@@ -43,7 +81,10 @@ public class TheMovieDbApiTest {
|
|||||||
// Logger
|
// Logger
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(TheMovieDbApiTest.class);
|
private static final Logger LOG = LoggerFactory.getLogger(TheMovieDbApiTest.class);
|
||||||
// API Key
|
// API Key
|
||||||
private static final String API_KEY = "5a1a77e2eba8984804586122754f969f";
|
private static final String PROP_FIlENAME = "testing.properties";
|
||||||
|
private static String API_KEY;
|
||||||
|
private static int ACCOUNT_ID_APITESTS;
|
||||||
|
private static String SESSION_ID_APITESTS;
|
||||||
private static TheMovieDbApi tmdb;
|
private static TheMovieDbApi tmdb;
|
||||||
// Test data
|
// Test data
|
||||||
private static final int ID_MOVIE_BLADE_RUNNER = 78;
|
private static final int ID_MOVIE_BLADE_RUNNER = 78;
|
||||||
@@ -59,16 +100,35 @@ public class TheMovieDbApiTest {
|
|||||||
private static final String LANGUAGE_ENGLISH = "en";
|
private static final String LANGUAGE_ENGLISH = "en";
|
||||||
private static final String LANGUAGE_RUSSIAN = "ru";
|
private static final String LANGUAGE_RUSSIAN = "ru";
|
||||||
// session and account id of test users named 'apitests'
|
// session and account id of test users named 'apitests'
|
||||||
private static final String SESSION_ID_APITESTS = "63c85deb39337e29b69d78265eb28d639cbd6f72";
|
|
||||||
private static final int ACCOUNT_ID_APITESTS = 6065849;
|
|
||||||
|
|
||||||
public TheMovieDbApiTest() throws MovieDbException {
|
public TheMovieDbApiTest() throws MovieDbException {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpClass() throws Exception {
|
public static void setUpClass() throws Exception {
|
||||||
tmdb = new TheMovieDbApi(API_KEY);
|
|
||||||
TestLogger.Configure();
|
TestLogger.Configure();
|
||||||
|
|
||||||
|
Properties props = new Properties();
|
||||||
|
File f = new File(PROP_FIlENAME);
|
||||||
|
if (f.exists()) {
|
||||||
|
LOG.info("Loading properties from '{}'", PROP_FIlENAME);
|
||||||
|
TestLogger.loadProperties(props, f);
|
||||||
|
|
||||||
|
API_KEY = props.getProperty("API_Key");
|
||||||
|
ACCOUNT_ID_APITESTS = NumberUtils.toInt(props.getProperty("Account_ID"), 0);
|
||||||
|
SESSION_ID_APITESTS = props.getProperty("Session_ID");
|
||||||
|
} else {
|
||||||
|
LOG.info("Property file '{}' not found, creating dummy file.", PROP_FIlENAME);
|
||||||
|
|
||||||
|
props.setProperty("API_Key", "INSERT_YOUR_KEY_HERE");
|
||||||
|
props.setProperty("Account_ID", "ACCOUNT ID FOR SESSION TESTS");
|
||||||
|
props.setProperty("Session_ID", "INSERT_YOUR_SESSION_ID_HERE");
|
||||||
|
|
||||||
|
TestLogger.saveProperties(props, f, "Properties file for tests");
|
||||||
|
fail("Failed to get key information from properties file '" + PROP_FIlENAME + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
tmdb = new TheMovieDbApi(API_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
@@ -87,7 +147,7 @@ public class TheMovieDbApiTest {
|
|||||||
* Test of getConfiguration method, of class TheMovieDbApi.
|
* Test of getConfiguration method, of class TheMovieDbApi.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testConfiguration() throws IOException {
|
public void testConfiguration() {
|
||||||
LOG.info("Test Configuration");
|
LOG.info("Test Configuration");
|
||||||
|
|
||||||
TmdbConfiguration tmdbConfig = tmdb.getConfiguration();
|
TmdbConfiguration tmdbConfig = tmdb.getConfiguration();
|
||||||
@@ -101,11 +161,12 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAccount() throws MovieDbException {
|
public void testAccount() throws MovieDbException {
|
||||||
|
LOG.info("Using Session ID '{}' for test", SESSION_ID_APITESTS);
|
||||||
Account account = tmdb.getAccount(SESSION_ID_APITESTS);
|
Account account = tmdb.getAccount(SESSION_ID_APITESTS);
|
||||||
|
|
||||||
// Make sure properties are extracted correctly
|
// Make sure properties are extracted correctly
|
||||||
assertEquals(account.getUserName(), "apitests");
|
assertEquals("apitests", account.getUserName());
|
||||||
assertEquals(account.getId(), ACCOUNT_ID_APITESTS);
|
assertEquals(ACCOUNT_ID_APITESTS, account.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("Session required")
|
@Ignore("Session required")
|
||||||
@@ -146,6 +207,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of searchMovie method, of class TheMovieDbApi.
|
* Test of searchMovie method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSearchMovie() throws MovieDbException {
|
public void testSearchMovie() throws MovieDbException {
|
||||||
@@ -167,6 +230,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieInfo method, of class TheMovieDbApi.
|
* Test of getMovieInfo method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetMovieInfo() throws MovieDbException {
|
public void testGetMovieInfo() throws MovieDbException {
|
||||||
@@ -177,6 +242,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieAlternativeTitles method, of class TheMovieDbApi.
|
* Test of getMovieAlternativeTitles method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetMovieAlternativeTitles() throws MovieDbException {
|
public void testGetMovieAlternativeTitles() throws MovieDbException {
|
||||||
@@ -193,6 +260,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieCasts method, of class TheMovieDbApi.
|
* Test of getMovieCasts method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetMovieCasts() throws MovieDbException {
|
public void testGetMovieCasts() throws MovieDbException {
|
||||||
@@ -220,6 +289,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieImages method, of class TheMovieDbApi.
|
* Test of getMovieImages method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetMovieImages() throws MovieDbException {
|
public void testGetMovieImages() throws MovieDbException {
|
||||||
@@ -231,6 +302,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieKeywords method, of class TheMovieDbApi.
|
* Test of getMovieKeywords method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetMovieKeywords() throws MovieDbException {
|
public void testGetMovieKeywords() throws MovieDbException {
|
||||||
@@ -241,6 +314,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieReleaseInfo method, of class TheMovieDbApi.
|
* Test of getMovieReleaseInfo method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetMovieReleaseInfo() throws MovieDbException {
|
public void testGetMovieReleaseInfo() throws MovieDbException {
|
||||||
@@ -251,6 +326,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieTrailers method, of class TheMovieDbApi.
|
* Test of getMovieTrailers method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetMovieTrailers() throws MovieDbException {
|
public void testGetMovieTrailers() throws MovieDbException {
|
||||||
@@ -261,6 +338,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieTranslations method, of class TheMovieDbApi.
|
* Test of getMovieTranslations method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetMovieTranslations() throws MovieDbException {
|
public void testGetMovieTranslations() throws MovieDbException {
|
||||||
@@ -271,6 +350,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getCollectionInfo method, of class TheMovieDbApi.
|
* Test of getCollectionInfo method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetCollectionInfo() throws MovieDbException {
|
public void testGetCollectionInfo() throws MovieDbException {
|
||||||
@@ -295,6 +376,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieInfoImdb method, of class TheMovieDbApi.
|
* Test of getMovieInfoImdb method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetMovieInfoImdb() throws MovieDbException {
|
public void testGetMovieInfoImdb() throws MovieDbException {
|
||||||
@@ -305,6 +388,7 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getApiKey method, of class TheMovieDbApi.
|
* Test of getApiKey method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetApiKey() {
|
public void testGetApiKey() {
|
||||||
@@ -313,6 +397,7 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getApiBase method, of class TheMovieDbApi.
|
* Test of getApiBase method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetApiBase() {
|
public void testGetApiBase() {
|
||||||
@@ -321,6 +406,7 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getConfiguration method, of class TheMovieDbApi.
|
* Test of getConfiguration method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetConfiguration() {
|
public void testGetConfiguration() {
|
||||||
@@ -329,6 +415,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of searchPeople method, of class TheMovieDbApi.
|
* Test of searchPeople method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSearchPeople() throws MovieDbException {
|
public void testSearchPeople() throws MovieDbException {
|
||||||
@@ -341,6 +429,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getPersonInfo method, of class TheMovieDbApi.
|
* Test of getPersonInfo method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetPersonInfo() throws MovieDbException {
|
public void testGetPersonInfo() throws MovieDbException {
|
||||||
@@ -351,6 +441,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getPersonCredits method, of class TheMovieDbApi.
|
* Test of getPersonCredits method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetPersonCredits() throws MovieDbException {
|
public void testGetPersonCredits() throws MovieDbException {
|
||||||
@@ -362,6 +454,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getPersonImages method, of class TheMovieDbApi.
|
* Test of getPersonImages method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetPersonImages() throws MovieDbException {
|
public void testGetPersonImages() throws MovieDbException {
|
||||||
@@ -373,6 +467,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getLatestMovie method, of class TheMovieDbApi.
|
* Test of getLatestMovie method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetLatestMovie() throws MovieDbException {
|
public void testGetLatestMovie() throws MovieDbException {
|
||||||
@@ -384,6 +480,7 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of compareMovies method, of class TheMovieDbApi.
|
* Test of compareMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCompareMovies() {
|
public void testCompareMovies() {
|
||||||
@@ -392,6 +489,7 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of setProxy method, of class TheMovieDbApi.
|
* Test of setProxy method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSetProxy() {
|
public void testSetProxy() {
|
||||||
@@ -400,6 +498,7 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of setTimeout method, of class TheMovieDbApi.
|
* Test of setTimeout method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSetTimeout() {
|
public void testSetTimeout() {
|
||||||
@@ -408,6 +507,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getNowPlayingMovies method, of class TheMovieDbApi.
|
* Test of getNowPlayingMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetNowPlayingMovies() throws MovieDbException {
|
public void testGetNowPlayingMovies() throws MovieDbException {
|
||||||
@@ -418,6 +519,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getPopularMovieList method, of class TheMovieDbApi.
|
* Test of getPopularMovieList method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetPopularMovieList() throws MovieDbException {
|
public void testGetPopularMovieList() throws MovieDbException {
|
||||||
@@ -428,6 +531,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getTopRatedMovies method, of class TheMovieDbApi.
|
* Test of getTopRatedMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetTopRatedMovies() throws MovieDbException {
|
public void testGetTopRatedMovies() throws MovieDbException {
|
||||||
@@ -438,6 +543,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getCompanyInfo method, of class TheMovieDbApi.
|
* Test of getCompanyInfo method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetCompanyInfo() throws MovieDbException {
|
public void testGetCompanyInfo() throws MovieDbException {
|
||||||
@@ -449,6 +556,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getCompanyMovies method, of class TheMovieDbApi.
|
* Test of getCompanyMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetCompanyMovies() throws MovieDbException {
|
public void testGetCompanyMovies() throws MovieDbException {
|
||||||
@@ -459,6 +568,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of searchCompanies method, of class TheMovieDbApi.
|
* Test of searchCompanies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSearchCompanies() throws MovieDbException {
|
public void testSearchCompanies() throws MovieDbException {
|
||||||
@@ -469,6 +580,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getSimilarMovies method, of class TheMovieDbApi.
|
* Test of getSimilarMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetSimilarMovies() throws MovieDbException {
|
public void testGetSimilarMovies() throws MovieDbException {
|
||||||
@@ -479,6 +592,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getGenreList method, of class TheMovieDbApi.
|
* Test of getGenreList method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetGenreList() throws MovieDbException {
|
public void testGetGenreList() throws MovieDbException {
|
||||||
@@ -489,6 +604,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getGenreMovies method, of class TheMovieDbApi.
|
* Test of getGenreMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetGenreMovies() throws MovieDbException {
|
public void testGetGenreMovies() throws MovieDbException {
|
||||||
@@ -499,6 +616,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getUpcoming method, of class TheMovieDbApi.
|
* Test of getUpcoming method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetUpcoming() throws Exception {
|
public void testGetUpcoming() throws Exception {
|
||||||
@@ -509,6 +628,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getCollectionImages method, of class TheMovieDbApi.
|
* Test of getCollectionImages method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetCollectionImages() throws Exception {
|
public void testGetCollectionImages() throws Exception {
|
||||||
@@ -519,6 +640,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getAuthorisationToken method, of class TheMovieDbApi.
|
* Test of getAuthorisationToken method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetAuthorisationToken() throws Exception {
|
public void testGetAuthorisationToken() throws Exception {
|
||||||
@@ -533,6 +656,8 @@ public class TheMovieDbApiTest {
|
|||||||
* Test of getSessionToken method, of class TheMovieDbApi.
|
* Test of getSessionToken method, of class TheMovieDbApi.
|
||||||
*
|
*
|
||||||
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
|
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Session required")
|
@Ignore("Session required")
|
||||||
public void testGetSessionToken() throws Exception {
|
public void testGetSessionToken() throws Exception {
|
||||||
@@ -550,6 +675,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getGuestSessionToken method, of class TheMovieDbApi.
|
* Test of getGuestSessionToken method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Not ready yet")
|
@Ignore("Not ready yet")
|
||||||
public void testGetGuestSessionToken() throws Exception {
|
public void testGetGuestSessionToken() throws Exception {
|
||||||
@@ -571,6 +698,8 @@ public class TheMovieDbApiTest {
|
|||||||
* Test of getMovieChanges method,of class TheMovieDbApi
|
* Test of getMovieChanges method,of class TheMovieDbApi
|
||||||
*
|
*
|
||||||
* TODO: Do not test this until it is fixed
|
* TODO: Do not test this until it is fixed
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Do not test this until it is fixed")
|
@Ignore("Do not test this until it is fixed")
|
||||||
public void testGetMovieChanges() throws Exception {
|
public void testGetMovieChanges() throws Exception {
|
||||||
@@ -601,6 +730,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of searchCollection method, of class TheMovieDbApi.
|
* Test of searchCollection method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSearchCollection() throws Exception {
|
public void testSearchCollection() throws Exception {
|
||||||
@@ -614,6 +745,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of searchList method, of class TheMovieDbApi.
|
* Test of searchList method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSearchList() throws Exception {
|
public void testSearchList() throws Exception {
|
||||||
@@ -627,6 +760,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of searchKeyword method, of class TheMovieDbApi.
|
* Test of searchKeyword method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSearchKeyword() throws Exception {
|
public void testSearchKeyword() throws Exception {
|
||||||
@@ -642,6 +777,8 @@ public class TheMovieDbApiTest {
|
|||||||
* Test of postMovieRating method, of class TheMovieDbApi.
|
* Test of postMovieRating method, of class TheMovieDbApi.
|
||||||
*
|
*
|
||||||
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
|
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Session required")
|
@Ignore("Session required")
|
||||||
public void testMovieRating() throws Exception {
|
public void testMovieRating() throws Exception {
|
||||||
@@ -655,7 +792,6 @@ public class TheMovieDbApiTest {
|
|||||||
assertTrue(wasPosted);
|
assertTrue(wasPosted);
|
||||||
|
|
||||||
// get all rated movies
|
// get all rated movies
|
||||||
|
|
||||||
List<MovieDb> ratedMovies = tmdb.getRatedMovies(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS);
|
List<MovieDb> ratedMovies = tmdb.getRatedMovies(SESSION_ID_APITESTS, ACCOUNT_ID_APITESTS);
|
||||||
assertTrue(ratedMovies.size() > 0);
|
assertTrue(ratedMovies.size() > 0);
|
||||||
|
|
||||||
@@ -699,6 +835,7 @@ public class TheMovieDbApiTest {
|
|||||||
/**
|
/**
|
||||||
* Test of getPersonChanges method, of class TheMovieDbApi.
|
* Test of getPersonChanges method, of class TheMovieDbApi.
|
||||||
*
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Not ready yet")
|
@Ignore("Not ready yet")
|
||||||
public void testGetPersonChanges() throws Exception {
|
public void testGetPersonChanges() throws Exception {
|
||||||
@@ -710,6 +847,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getList method, of class TheMovieDbApi.
|
* Test of getList method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetList() throws Exception {
|
public void testGetList() throws Exception {
|
||||||
@@ -721,6 +860,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getKeyword method, of class TheMovieDbApi.
|
* Test of getKeyword method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetKeyword() throws Exception {
|
public void testGetKeyword() throws Exception {
|
||||||
@@ -731,6 +872,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getKeywordMovies method, of class TheMovieDbApi.
|
* Test of getKeywordMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetKeywordMovies() throws Exception {
|
public void testGetKeywordMovies() throws Exception {
|
||||||
@@ -742,6 +885,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getReviews method, of class TheMovieDbApi.
|
* Test of getReviews method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetReviews() throws Exception {
|
public void testGetReviews() throws Exception {
|
||||||
@@ -754,6 +899,7 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of compareMovies method, of class TheMovieDbApi.
|
* Test of compareMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Ignore("Not required")
|
@Ignore("Not required")
|
||||||
public void testCompareMovies_3args() {
|
public void testCompareMovies_3args() {
|
||||||
@@ -761,6 +907,7 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of compareMovies method, of class TheMovieDbApi.
|
* Test of compareMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Ignore("Not required")
|
@Ignore("Not required")
|
||||||
public void testCompareMovies_4args() {
|
public void testCompareMovies_4args() {
|
||||||
@@ -768,13 +915,16 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getPersonPopular method, of class TheMovieDbApi.
|
* Test of getPersonPopular method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Ignore("Not required")
|
@Ignore("Not required")
|
||||||
public void testGetPersonPopular_0args() throws Exception {
|
public void testGetPersonPopular_0args() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getPersonPopular method, of class TheMovieDbApi.
|
* Test of getPersonPopular method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetPersonPopular_int() throws Exception {
|
public void testGetPersonPopular_int() throws Exception {
|
||||||
@@ -786,6 +936,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getGenreMovies method, of class TheMovieDbApi.
|
* Test of getGenreMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Not required")
|
@Ignore("Not required")
|
||||||
public void testGetGenreMovies_3args() throws Exception {
|
public void testGetGenreMovies_3args() throws Exception {
|
||||||
@@ -793,6 +945,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getGenreMovies method, of class TheMovieDbApi.
|
* Test of getGenreMovies method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Not required")
|
@Ignore("Not required")
|
||||||
public void testGetGenreMovies_4args() throws Exception {
|
public void testGetGenreMovies_4args() throws Exception {
|
||||||
@@ -800,20 +954,23 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieChangesList method, of class TheMovieDbApi.
|
* Test of getMovieChangesList method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Not ready yet")
|
@Test
|
||||||
public void testGetMovieChangesList() throws Exception {
|
public void testGetMovieChangesList() throws Exception {
|
||||||
LOG.info("getMovieChangesList");
|
LOG.info("getMovieChangesList");
|
||||||
int page = 0;
|
int page = 0;
|
||||||
String startDate = "";
|
String startDate = "";
|
||||||
String endDate = "";
|
String endDate = "";
|
||||||
tmdb.getMovieChangesList(page, startDate, endDate);
|
TmdbResultsList<ChangedMovie> result = tmdb.getMovieChangesList(page, startDate, endDate);
|
||||||
// TODO review the generated test code and remove the default call to fail.
|
assertFalse("No movie changes.", result.getResults().isEmpty());
|
||||||
fail("The test case is a prototype.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getPersonChangesList method, of class TheMovieDbApi.
|
* Test of getPersonChangesList method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Not ready yet")
|
@Ignore("Not ready yet")
|
||||||
public void testGetPersonChangesList() throws Exception {
|
public void testGetPersonChangesList() throws Exception {
|
||||||
@@ -828,6 +985,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getJobs method, of class TheMovieDbApi.
|
* Test of getJobs method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetJobs() throws Exception {
|
public void testGetJobs() throws Exception {
|
||||||
@@ -838,6 +997,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getDiscover method, of class TheMovieDbApi.
|
* Test of getDiscover method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Ignore("Not required")
|
@Ignore("Not required")
|
||||||
public void testGetDiscover_14args() throws Exception {
|
public void testGetDiscover_14args() throws Exception {
|
||||||
@@ -845,6 +1006,8 @@ public class TheMovieDbApiTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getDiscover method, of class TheMovieDbApi.
|
* Test of getDiscover method, of class TheMovieDbApi.
|
||||||
|
*
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetDiscover_Discover() throws Exception {
|
public void testGetDiscover_Discover() throws Exception {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#Properties file for tests
|
||||||
|
#Fill in the details here
|
||||||
|
Session_ID=INSERT_YOUR_SESSION_ID_HERE
|
||||||
|
Account_ID=ACCOUNT ID FOR SESSION TESTS
|
||||||
|
API_Key=INSERT_YOUR_KEY_HERE
|
||||||
Reference in New Issue
Block a user