Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 035b998511 | |||
| b353311169 | |||
| 588c618208 | |||
| 5eb756e03e | |||
| 9c58841c6c | |||
| 64ee879834 | |||
| 56a0cdb341 | |||
| aa522e2e7e | |||
| 67496724ba | |||
| 6b5eb2f5ad | |||
| 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 |
@@ -7,3 +7,4 @@
|
||||
|
||||
/target/
|
||||
/nbactions.xml
|
||||
testing.properties
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>7</version>
|
||||
<version>9</version>
|
||||
</parent>
|
||||
|
||||
<prerequisites>
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<groupId>com.omertron</groupId>
|
||||
<artifactId>themoviedbapi</artifactId>
|
||||
<version>3.9</version>
|
||||
<version>3.11</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>API-The MovieDB</name>
|
||||
@@ -71,16 +71,21 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<distribution.format>zip</distribution.format>
|
||||
<version.jackson>2.3.0</version.jackson>
|
||||
<version.slf4j>1.7.5</version.slf4j>
|
||||
<version.jackson>2.4.4</version.jackson>
|
||||
<version.slf4j>1.7.9</version.slf4j>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<!--TESTING-->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--JSON-->
|
||||
@@ -115,7 +120,7 @@
|
||||
<dependency>
|
||||
<groupId>org.yamj</groupId>
|
||||
<artifactId>api-common</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -127,7 +132,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.3</version>
|
||||
<configuration>
|
||||
<shortRevisionLength>10</shortRevisionLength>
|
||||
<doCheck>false</doCheck>
|
||||
@@ -147,10 +152,8 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<version>3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<failOnError>true</failOnError>
|
||||
<verbose>true</verbose>
|
||||
<!-- excludes><exclude>**/*</exclude></excludes -->
|
||||
@@ -160,7 +163,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>2.5</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
@@ -176,7 +179,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.16</version>
|
||||
<version>2.18</version>
|
||||
<configuration>
|
||||
<!-- To skip tests by default -->
|
||||
<skipTests>${skipTests}</skipTests>
|
||||
@@ -215,7 +218,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>2.5.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>distro-assembly</id>
|
||||
@@ -241,7 +244,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<version>3.4</version>
|
||||
<configuration>
|
||||
<reportPlugins>
|
||||
<plugin>
|
||||
@@ -273,31 +276,31 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>2.6.1</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.1</version>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<version>1.5</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<version>2.7</version>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -19,6 +19,8 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
public class MovieDbException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -64,18 +66,35 @@ public class MovieDbException extends Exception {
|
||||
|
||||
private final MovieDbExceptionType exceptionType;
|
||||
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();
|
||||
this.exceptionType = exceptionType;
|
||||
this.response = response;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
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 Throwable cause) {
|
||||
public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final String url, final Throwable cause) {
|
||||
super(cause);
|
||||
this.exceptionType = exceptionType;
|
||||
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() {
|
||||
return exceptionType;
|
||||
@@ -84,4 +103,8 @@ public class MovieDbException extends Exception {
|
||||
public String getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
public String getUrl(){
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation;private either version 3 of the License;private or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful;private
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not;private see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
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-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,13 +20,12 @@
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import java.io.Serializable;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Abstract class to handle any unknown properties by outputting a log message
|
||||
*
|
||||
@@ -34,19 +33,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
public abstract class AbstractJsonMapping implements Serializable {
|
||||
|
||||
private Logger log = null;
|
||||
|
||||
/**
|
||||
* Return the current logger.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private Logger getLogger() {
|
||||
if (log == null) {
|
||||
log = LoggerFactory.getLogger(this.getClass());
|
||||
}
|
||||
return log;
|
||||
}
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractJsonMapping.class);
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
@@ -60,7 +47,7 @@ public abstract class AbstractJsonMapping implements Serializable {
|
||||
unknown.append(": Unknown property='").append(key);
|
||||
unknown.append("' value='").append(value).append("'");
|
||||
|
||||
getLogger().trace(unknown.toString());
|
||||
LOG.trace(unknown.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,8 +20,9 @@
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* @author Stuart
|
||||
@@ -60,27 +61,22 @@ public class AlternativeTitle implements Serializable {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof AlternativeTitle) {
|
||||
final AlternativeTitle other = (AlternativeTitle) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(country, other.country)
|
||||
.append(title, other.title)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AlternativeTitle other = (AlternativeTitle) obj;
|
||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
||||
hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(country)
|
||||
.append(title)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,6 +20,8 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* The artwork type information
|
||||
@@ -30,6 +32,8 @@ public class Artwork extends AbstractJsonMapping {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
@JsonProperty("aspect_ratio")
|
||||
private float aspectRatio;
|
||||
@JsonProperty("file_path")
|
||||
@@ -84,6 +88,10 @@ public class Artwork extends AbstractJsonMapping {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setArtworkType(ArtworkType artworkType) {
|
||||
this.artworkType = artworkType;
|
||||
}
|
||||
@@ -120,45 +128,36 @@ public class Artwork extends AbstractJsonMapping {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof Artwork) {
|
||||
final Artwork other = (Artwork) obj;
|
||||
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;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Artwork other = (Artwork) obj;
|
||||
if (Float.floatToIntBits(this.aspectRatio) != Float.floatToIntBits(other.aspectRatio)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.height != other.height) {
|
||||
return false;
|
||||
}
|
||||
if ((this.language == null) ? (other.language != null) : !this.language.equals(other.language)) {
|
||||
return false;
|
||||
}
|
||||
if (this.width != other.width) {
|
||||
return false;
|
||||
}
|
||||
if (this.artworkType != other.artworkType) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 71 * hash + Float.floatToIntBits(this.aspectRatio);
|
||||
hash = 71 * hash + (this.filePath != null ? this.filePath.hashCode() : 0);
|
||||
hash = 71 * hash + this.height;
|
||||
hash = 71 * hash + (this.language != null ? this.language.hashCode() : 0);
|
||||
hash = 71 * hash + this.width;
|
||||
hash = 71 * hash + (this.artworkType != null ? this.artworkType.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(aspectRatio)
|
||||
.append(filePath)
|
||||
.append(height)
|
||||
.append(width)
|
||||
.append(language)
|
||||
.append(artworkType)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2015 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.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2015 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.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* 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.JsonRootName;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
@@ -103,37 +105,28 @@ public class Collection extends AbstractJsonMapping {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof Collection) {
|
||||
final Collection other = (Collection) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(id, other.id)
|
||||
.append(name, other.name)
|
||||
.append(title, other.title)
|
||||
.append(backdropPath, other.backdropPath)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Collection other = (Collection) obj;
|
||||
if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 19 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
|
||||
hash = 19 * hash + this.id;
|
||||
hash = 19 * hash + (this.title != null ? this.title.hashCode() : 0);
|
||||
hash = 19 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 19 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
|
||||
hash = 19 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(id)
|
||||
.append(backdropPath)
|
||||
.append(title)
|
||||
.append(name)
|
||||
.append(posterPath)
|
||||
.append(releaseDate)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -104,7 +104,7 @@ public class Company extends AbstractJsonMapping {
|
||||
|
||||
public void setParentCompany(int id, String name, String logoPath) {
|
||||
Company parent = new Company();
|
||||
parent.setCompanyId(companyId);
|
||||
parent.setCompanyId(id);
|
||||
parent.setName(name);
|
||||
parent.setLogoPath(logoPath);
|
||||
this.parentCompany = parent;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -19,12 +19,13 @@
|
||||
*/
|
||||
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.Map;
|
||||
|
||||
import static com.omertron.themoviedbapi.tools.ApiUrl.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* Generate a discover object for use in the MovieDbApi
|
||||
@@ -273,6 +274,6 @@ public class Discover {
|
||||
* @return
|
||||
*/
|
||||
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-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -19,63 +19,12 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("genre")
|
||||
public class Genre extends AbstractJsonMapping {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/*
|
||||
* 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(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;
|
||||
}
|
||||
public class Genre extends AbstractIdName {
|
||||
// Nothing to override from the base class.
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -19,64 +19,12 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("keyword")
|
||||
public class Keyword extends AbstractJsonMapping {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* 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(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;
|
||||
}
|
||||
public class Keyword extends AbstractIdName {
|
||||
// Nothing to override from the base class.
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -51,6 +51,8 @@ public class KeywordMovie extends AbstractJsonMapping {
|
||||
private boolean adult;
|
||||
@JsonProperty("popularity")
|
||||
private float popularity;
|
||||
@JsonProperty("video")
|
||||
private boolean video;
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
@@ -96,6 +98,10 @@ public class KeywordMovie extends AbstractJsonMapping {
|
||||
return popularity;
|
||||
}
|
||||
|
||||
public boolean isVideo() {
|
||||
return video;
|
||||
}
|
||||
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
@@ -135,4 +141,8 @@ public class KeywordMovie extends AbstractJsonMapping {
|
||||
public void setPopularity(float popularity) {
|
||||
this.popularity = popularity;
|
||||
}
|
||||
|
||||
public void setVideo(boolean video) {
|
||||
this.video = video;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* 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.JsonRootName;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
@@ -55,27 +57,22 @@ public class Language extends AbstractJsonMapping {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof Language) {
|
||||
final Language other = (Language) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(isoCode, other.isoCode)
|
||||
.append(name, other.name)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Language other = (Language) obj;
|
||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 71 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
||||
hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(isoCode)
|
||||
.append(name)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.wrapper.*;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -91,7 +93,7 @@ public class MovieDb extends AbstractJsonMapping {
|
||||
private WrapperMovieKeywords keywords;
|
||||
@JsonProperty("releases")
|
||||
private WrapperReleaseInfo releases;
|
||||
@JsonProperty("trailers")
|
||||
@JsonProperty("videos")
|
||||
private WrapperTrailers trailers;
|
||||
@JsonProperty("translations")
|
||||
private WrapperTranslations translations;
|
||||
@@ -101,6 +103,8 @@ public class MovieDb extends AbstractJsonMapping {
|
||||
private WrapperReviews reviews;
|
||||
@JsonProperty("lists")
|
||||
private WrapperMovieList lists;
|
||||
@JsonProperty("video")
|
||||
private Boolean video = null;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getBackdropPath() {
|
||||
@@ -198,6 +202,10 @@ public class MovieDb extends AbstractJsonMapping {
|
||||
public float getUserRating() {
|
||||
return userRating;
|
||||
}
|
||||
|
||||
public Boolean getVideo() {
|
||||
return video;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
@@ -296,8 +304,12 @@ public class MovieDb extends AbstractJsonMapping {
|
||||
public void setUserRating(float userRating) {
|
||||
this.userRating = userRating;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
public void setVideo(Boolean video) {
|
||||
this.video = video;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="AppendToResponse Getters">
|
||||
public List<AlternativeTitle> getAlternativeTitles() {
|
||||
return alternativeTitles.getTitles();
|
||||
@@ -324,7 +336,7 @@ public class MovieDb extends AbstractJsonMapping {
|
||||
}
|
||||
|
||||
public List<Trailer> getTrailers() {
|
||||
return trailers.getAll();
|
||||
return trailers.getTrailers();
|
||||
}
|
||||
|
||||
public List<Translation> getTranslations() {
|
||||
@@ -389,32 +401,25 @@ public class MovieDb extends AbstractJsonMapping {
|
||||
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof MovieDb) {
|
||||
final MovieDb other = (MovieDb) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(id, other.id)
|
||||
.append(imdbID, other.imdbID)
|
||||
.append(runtime, other.runtime)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final MovieDb other = (MovieDb) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) {
|
||||
return false;
|
||||
}
|
||||
if (this.runtime != other.runtime) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 89 * hash + this.id;
|
||||
hash = 89 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0);
|
||||
hash = 89 * hash + this.runtime;
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(id)
|
||||
.append(imdbID)
|
||||
.append(runtime)
|
||||
.toHashCode();
|
||||
}
|
||||
// </editor-fold>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,7 +20,6 @@
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,7 +39,7 @@ public class MovieDbList extends AbstractJsonMapping {
|
||||
@JsonProperty("favorite_count")
|
||||
private int favoriteCount;
|
||||
@JsonProperty("items")
|
||||
private List<MovieDb> items = Collections.EMPTY_LIST;
|
||||
private List<MovieDb> items = Collections.emptyList();
|
||||
@JsonProperty("item_count")
|
||||
private int itemCount;
|
||||
@JsonProperty("iso_639_1")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,10 +20,11 @@
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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
|
||||
@@ -75,6 +76,8 @@ public class Person extends AbstractJsonMapping {
|
||||
private String imdbId = DEFAULT_STRING;
|
||||
@JsonProperty("popularity")
|
||||
private float popularity = 0.0f;
|
||||
@JsonProperty("known_for")
|
||||
private List<PersonCredit> knownFor;
|
||||
|
||||
/**
|
||||
* Add a crew member
|
||||
@@ -252,49 +255,42 @@ public class Person extends AbstractJsonMapping {
|
||||
this.popularity = popularity;
|
||||
}
|
||||
|
||||
public List<PersonCredit> getKnownFor() {
|
||||
return knownFor;
|
||||
}
|
||||
|
||||
public void setKnownFor(List<PersonCredit> knownFor) {
|
||||
this.knownFor = knownFor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof Person) {
|
||||
final Person other = (Person) obj;
|
||||
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;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Person other = (Person) obj;
|
||||
if (this.id != other.id) {
|
||||
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
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 37 * hash + this.id;
|
||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 37 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
||||
hash = 37 * hash + (this.personType != null ? this.personType.hashCode() : 0);
|
||||
hash = 37 * hash + (this.department != null ? this.department.hashCode() : 0);
|
||||
hash = 37 * hash + (this.job != null ? this.job.hashCode() : 0);
|
||||
hash = 37 * hash + (this.character != null ? this.character.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(id)
|
||||
.append(name)
|
||||
.append(profilePath)
|
||||
.append(personType)
|
||||
.append(department)
|
||||
.append(job)
|
||||
.append(character)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* @author Stuart
|
||||
@@ -44,6 +46,8 @@ public class PersonCast extends AbstractJsonMapping {
|
||||
private String profilePath;
|
||||
@JsonProperty("cast_id")
|
||||
private int castId;
|
||||
@JsonProperty("credit_id")
|
||||
private String creditId;
|
||||
|
||||
public String getCharacter() {
|
||||
return character;
|
||||
@@ -93,41 +97,38 @@ public class PersonCast extends AbstractJsonMapping {
|
||||
this.castId = castId;
|
||||
}
|
||||
|
||||
public String getCreditId() {
|
||||
return creditId;
|
||||
}
|
||||
|
||||
public void setCreditId(String creditId) {
|
||||
this.creditId = creditId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof PersonCast) {
|
||||
final PersonCast other = (PersonCast) obj;
|
||||
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;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final PersonCast other = (PersonCast) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if (this.order != other.order) {
|
||||
return false;
|
||||
}
|
||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 41 * hash + this.id;
|
||||
hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0);
|
||||
hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 41 * hash + this.order;
|
||||
hash = 41 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(id)
|
||||
.append(character)
|
||||
.append(name)
|
||||
.append(order)
|
||||
.append(profilePath)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,6 +20,8 @@
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -40,6 +42,8 @@ public class PersonCredit extends AbstractJsonMapping {
|
||||
private String movieOriginalTitle = DEFAULT_STRING;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath = DEFAULT_STRING;
|
||||
@JsonProperty("backdrop_path")
|
||||
private String backdropPath = DEFAULT_STRING;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate = DEFAULT_STRING;
|
||||
@JsonProperty("title")
|
||||
@@ -50,7 +54,27 @@ public class PersonCredit extends AbstractJsonMapping {
|
||||
private String job = DEFAULT_STRING;
|
||||
@JsonProperty("adult")
|
||||
private String adult = DEFAULT_STRING;
|
||||
@JsonProperty("credit_id")
|
||||
private String creditId = DEFAULT_STRING;
|
||||
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;
|
||||
@JsonProperty("video")
|
||||
private boolean video;
|
||||
@JsonProperty("original_name")
|
||||
private String tvOriginalName = DEFAULT_STRING;
|
||||
@JsonProperty("name")
|
||||
private String tvName = DEFAULT_STRING;
|
||||
@JsonProperty("first_air_date")
|
||||
private String firstAirDate = DEFAULT_STRING;
|
||||
@JsonProperty("origin_country")
|
||||
private List<String> originCountry = Collections.emptyList();
|
||||
|
||||
public String getCharacter() {
|
||||
return character;
|
||||
@@ -92,6 +116,30 @@ public class PersonCredit extends AbstractJsonMapping {
|
||||
return adult;
|
||||
}
|
||||
|
||||
public String getCreditId() {
|
||||
return creditId;
|
||||
}
|
||||
|
||||
public boolean getVideo() {
|
||||
return video;
|
||||
}
|
||||
|
||||
public String getTvOriginalName() {
|
||||
return tvOriginalName;
|
||||
}
|
||||
|
||||
public String getTvName() {
|
||||
return tvName;
|
||||
}
|
||||
|
||||
public String getFirstAirDate() {
|
||||
return firstAirDate;
|
||||
}
|
||||
|
||||
public List<String> getOriginCountry() {
|
||||
return originCountry;
|
||||
}
|
||||
|
||||
public void setCharacter(String character) {
|
||||
this.character = StringUtils.trimToEmpty(character);
|
||||
}
|
||||
@@ -131,4 +179,68 @@ public class PersonCredit extends AbstractJsonMapping {
|
||||
public void setAdult(String 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;
|
||||
}
|
||||
|
||||
public void setVideo(boolean video) {
|
||||
this.video = video;
|
||||
}
|
||||
|
||||
public void setTvOriginalName(String tvOriginalName) {
|
||||
this.tvOriginalName = tvOriginalName;
|
||||
}
|
||||
|
||||
public void setTvName(String tvName) {
|
||||
this.tvName = tvName;
|
||||
}
|
||||
|
||||
public void setFirstAirDate(String firstAirDate) {
|
||||
this.firstAirDate = firstAirDate;
|
||||
}
|
||||
|
||||
public void setOriginCountry(List<String> originCountry) {
|
||||
this.originCountry = originCountry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -21,6 +21,8 @@ package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* @author Stuart
|
||||
@@ -42,6 +44,8 @@ public class PersonCrew extends AbstractJsonMapping {
|
||||
private String name;
|
||||
@JsonProperty("profile_path")
|
||||
private String profilePath;
|
||||
@JsonProperty("credit_id")
|
||||
private String creditId;
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
@@ -63,6 +67,14 @@ public class PersonCrew extends AbstractJsonMapping {
|
||||
return profilePath;
|
||||
}
|
||||
|
||||
public String getCreditId() {
|
||||
return creditId;
|
||||
}
|
||||
|
||||
public void setCreditId(String creditId) {
|
||||
this.creditId = creditId;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = StringUtils.trimToEmpty(department);
|
||||
}
|
||||
@@ -85,36 +97,27 @@ public class PersonCrew extends AbstractJsonMapping {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof PersonCrew) {
|
||||
final PersonCrew other = (PersonCrew) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(id, other.id)
|
||||
.append(name, other.name)
|
||||
.append(department, other.department)
|
||||
.append(job, other.job)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final PersonCrew other = (PersonCrew) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 59 * hash + this.id;
|
||||
hash = 59 * hash + (this.department != null ? this.department.hashCode() : 0);
|
||||
hash = 59 * hash + (this.job != null ? this.job.hashCode() : 0);
|
||||
hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 59 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(id)
|
||||
.append(department)
|
||||
.append(job)
|
||||
.append(name)
|
||||
.append(profilePath)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -19,64 +19,12 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("production_company")
|
||||
public class ProductionCompany extends AbstractJsonMapping {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* 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(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;
|
||||
}
|
||||
public class ProductionCompany extends AbstractIdName {
|
||||
// Nothing to override from the base class.
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* 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.JsonRootName;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
@@ -56,27 +58,22 @@ public class ProductionCountry extends AbstractJsonMapping {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof ProductionCountry) {
|
||||
final ProductionCountry other = (ProductionCountry) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(name, other.name)
|
||||
.append(isoCode, other.isoCode)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ProductionCountry other = (ProductionCountry) obj;
|
||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 47 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
||||
hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(isoCode)
|
||||
.append(name)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,6 +20,8 @@
|
||||
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
|
||||
@@ -64,31 +66,24 @@ public class ReleaseInfo extends AbstractJsonMapping {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof ReleaseInfo) {
|
||||
final ReleaseInfo other = (ReleaseInfo) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(country, other.country)
|
||||
.append(certification, other.certification)
|
||||
.append(releaseDate, other.releaseDate)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ReleaseInfo other = (ReleaseInfo) obj;
|
||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.certification == null) ? (other.certification != null) : !this.certification.equals(other.certification)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
||||
hash = 89 * hash + (this.certification != null ? this.certification.hashCode() : 0);
|
||||
hash = 89 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(country)
|
||||
.append(certification)
|
||||
.append(releaseDate)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,9 +20,8 @@
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
@@ -45,6 +44,8 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
||||
private List<String> profileSizes;
|
||||
@JsonProperty("logo_sizes")
|
||||
private List<String> logoSizes;
|
||||
@JsonProperty("still_sizes")
|
||||
private List<String> stillSizes;
|
||||
|
||||
public List<String> getBackdropSizes() {
|
||||
return backdropSizes;
|
||||
@@ -70,6 +71,10 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
||||
return secureBaseUrl;
|
||||
}
|
||||
|
||||
public List<String> getStillSizes() {
|
||||
return stillSizes;
|
||||
}
|
||||
|
||||
public void setBackdropSizes(List<String> backdropSizes) {
|
||||
this.backdropSizes = backdropSizes;
|
||||
}
|
||||
@@ -94,6 +99,10 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
||||
this.secureBaseUrl = secureBaseUrl;
|
||||
}
|
||||
|
||||
public void setStillSizes(List<String> stillSizes) {
|
||||
this.stillSizes = stillSizes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the data from the passed object to this one
|
||||
*
|
||||
@@ -166,9 +175,9 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
||||
* @return
|
||||
*/
|
||||
public boolean isValidSize(String sizeToCheck) {
|
||||
return (isValidPosterSize(sizeToCheck)
|
||||
return isValidPosterSize(sizeToCheck)
|
||||
|| isValidBackdropSize(sizeToCheck)
|
||||
|| isValidProfileSize(sizeToCheck)
|
||||
|| isValidLogoSize(sizeToCheck));
|
||||
|| isValidLogoSize(sizeToCheck);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -19,6 +19,10 @@
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@@ -34,13 +38,21 @@ public class Trailer extends AbstractJsonMapping {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
private String id;
|
||||
private String name;
|
||||
private String size;
|
||||
private String source;
|
||||
private String key;
|
||||
// The website of the trailer
|
||||
private String website;
|
||||
private String site;
|
||||
private String type;
|
||||
|
||||
@JsonProperty("iso_639_1")
|
||||
private String language;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -49,18 +61,26 @@ public class Trailer extends AbstractJsonMapping {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getWebsite() {
|
||||
return website;
|
||||
public String getSite() {
|
||||
return site;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -69,46 +89,47 @@ public class Trailer extends AbstractJsonMapping {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public void setWebsite(String website) {
|
||||
this.website = website;
|
||||
public void setSite(String site) {
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof Trailer) {
|
||||
final Trailer other = (Trailer) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(id, other.id)
|
||||
.append(name, other.name)
|
||||
.append(size, other.size)
|
||||
.append(key, other.key)
|
||||
.append(language, other.language)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Trailer other = (Trailer) obj;
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
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
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 61 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 61 * hash + (this.size != null ? this.size.hashCode() : 0);
|
||||
hash = 61 * hash + (this.source != null ? this.source.hashCode() : 0);
|
||||
hash = 61 * hash + (this.website != null ? this.website.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(id)
|
||||
.append(name)
|
||||
.append(size)
|
||||
.append(key)
|
||||
.append(site)
|
||||
.append(language)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,6 +20,8 @@
|
||||
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;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@@ -66,32 +68,25 @@ public class Translation extends AbstractJsonMapping {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
if (obj instanceof Translation) {
|
||||
final Translation other = (Translation) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(name, other.name)
|
||||
.append(englishName, other.englishName)
|
||||
.append(isoCode, other.isoCode)
|
||||
.isEquals();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Translation other = (Translation) obj;
|
||||
if ((this.englishName == null) ? (other.englishName != null) : !this.englishName.equals(other.englishName)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 29 * hash + (this.englishName != null ? this.englishName.hashCode() : 0);
|
||||
hash = 29 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
||||
hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
return new HashCodeBuilder()
|
||||
.append(englishName)
|
||||
.append(isoCode)
|
||||
.append(name)
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -76,7 +76,7 @@ public class PersonCreditDateComparator implements Comparator<PersonCredit>, Ser
|
||||
|
||||
int year1 = extractYear(pc1.getReleaseDate());
|
||||
int year2 = extractYear(pc2.getReleaseDate());
|
||||
return ascending ? (year1 - year2) : (year2 - year1);
|
||||
return ascending ? year1 - year2 : year2 - year1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ public class PersonCreditDateComparator implements Comparator<PersonCredit>, Ser
|
||||
int year = 0;
|
||||
Matcher m = YEAR_PATTERN.matcher(date);
|
||||
if (m.find()) {
|
||||
year = Integer.valueOf(m.group(1)).intValue();
|
||||
year = Integer.parseInt(m.group(1));
|
||||
}
|
||||
|
||||
// Give up and return 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -73,8 +73,12 @@ public abstract class AbstractResults {
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* This wrapper does not have anything to copy.
|
||||
*
|
||||
* @param wrapper
|
||||
*/
|
||||
public void copyWrapper(AbstractWrapper wrapper) {
|
||||
// These results have nothing to copy, so this is just a placeholder
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -137,7 +137,7 @@ public class ApiUrl {
|
||||
try {
|
||||
urlString.append(URLEncoder.encode(query, "UTF-8"));
|
||||
} 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
|
||||
urlString.append(query);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -20,11 +20,11 @@
|
||||
package com.omertron.themoviedbapi.tools;
|
||||
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@@ -36,7 +36,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
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
|
||||
@@ -77,7 +80,7 @@ public final class WebBrowser {
|
||||
try {
|
||||
return request(new URL(url));
|
||||
} catch (MalformedURLException ex) {
|
||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex);
|
||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +100,7 @@ public final class WebBrowser {
|
||||
|
||||
return cnx;
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex);
|
||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +125,11 @@ public final class WebBrowser {
|
||||
try {
|
||||
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) {
|
||||
cnx.setDoOutput(true);
|
||||
cnx.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -165,7 +173,7 @@ public final class WebBrowser {
|
||||
}
|
||||
return content.toString();
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, ex);
|
||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, url, ex);
|
||||
} finally {
|
||||
if (content != null) {
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,13 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2015 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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import 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.ToStringStyle;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -33,7 +33,7 @@ public class WrapperConfig extends AbstractWrapper {
|
||||
@JsonProperty("images")
|
||||
private TmdbConfiguration tmdbConfiguration;
|
||||
@JsonProperty("change_keys")
|
||||
private List<String> changeKeys = Collections.EMPTY_LIST;
|
||||
private List<String> changeKeys = Collections.emptyList();
|
||||
|
||||
public TmdbConfiguration getTmdbConfiguration() {
|
||||
return tmdbConfiguration;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -36,11 +36,11 @@ public class WrapperImages extends AbstractWrapperAll implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@JsonProperty("backdrops")
|
||||
private List<Artwork> backdrops = Collections.EMPTY_LIST;
|
||||
private List<Artwork> backdrops = Collections.emptyList();
|
||||
@JsonProperty("posters")
|
||||
private List<Artwork> posters = Collections.EMPTY_LIST;
|
||||
private List<Artwork> posters = Collections.emptyList();
|
||||
@JsonProperty("profiles")
|
||||
private List<Artwork> profiles = Collections.EMPTY_LIST;
|
||||
private List<Artwork> profiles = Collections.emptyList();
|
||||
|
||||
public List<Artwork> getBackdrops() {
|
||||
return backdrops;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.MovieDbList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WrapperMovieDbList extends AbstractWrapperAll {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -21,8 +21,8 @@ package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Trailer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,46 +32,15 @@ import java.util.List;
|
||||
public class WrapperTrailers extends AbstractWrapperId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@JsonProperty("quicktime")
|
||||
private List<Trailer> quicktime;
|
||||
@JsonProperty("youtube")
|
||||
private List<Trailer> youtube;
|
||||
|
||||
public List<Trailer> getQuicktime() {
|
||||
return quicktime;
|
||||
}
|
||||
|
||||
public List<Trailer> getYoutube() {
|
||||
return youtube;
|
||||
}
|
||||
|
||||
public void setQuicktime(List<Trailer> quicktime) {
|
||||
this.quicktime = quicktime;
|
||||
}
|
||||
|
||||
public void setYoutube(List<Trailer> youtube) {
|
||||
this.youtube = youtube;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a combined list of the trailers with their source website
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Trailer> getAll() {
|
||||
List<Trailer> trailers = new ArrayList<Trailer>();
|
||||
|
||||
// Add the trailer to the return list along with it's source
|
||||
for (Trailer trailer : quicktime) {
|
||||
trailer.setWebsite(Trailer.WEBSITE_QUICKTIME);
|
||||
trailers.add(trailer);
|
||||
}
|
||||
// Add the trailer to the return list along with it's source
|
||||
for (Trailer trailer : youtube) {
|
||||
trailer.setWebsite(Trailer.WEBSITE_YOUTUBE);
|
||||
trailers.add(trailer);
|
||||
}
|
||||
@JsonProperty("results")
|
||||
private List<Trailer> trailers;
|
||||
|
||||
public List<Trailer> getTrailers() {
|
||||
return trailers;
|
||||
}
|
||||
|
||||
public void setTrailers(List<Trailer> trailers) {
|
||||
this.trailers = trailers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
|
||||
@@ -1,28 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
* Copyright (c) 2004-2015 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* The FanartTV API is distributed in the hope that it will be useful,
|
||||
* 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 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;
|
||||
|
||||
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.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.LogManager;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -69,4 +76,59 @@ public class TestLogger {
|
||||
public static boolean Configure() {
|
||||
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-2015 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
@@ -19,54 +19,21 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.omertron.themoviedbapi.model.*;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsMap;
|
||||
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.apache.commons.lang3.math.NumberUtils;
|
||||
import org.junit.*;
|
||||
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.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Test cases for TheMovieDbApi API
|
||||
@@ -78,7 +45,10 @@ public class TheMovieDbApiTest {
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TheMovieDbApiTest.class);
|
||||
// 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;
|
||||
// Test data
|
||||
private static final int ID_MOVIE_BLADE_RUNNER = 78;
|
||||
@@ -94,16 +64,35 @@ public class TheMovieDbApiTest {
|
||||
private static final String LANGUAGE_ENGLISH = "en";
|
||||
private static final String LANGUAGE_RUSSIAN = "ru";
|
||||
// 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 {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
tmdb = new TheMovieDbApi(API_KEY);
|
||||
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
|
||||
@@ -136,11 +125,12 @@ public class TheMovieDbApiTest {
|
||||
|
||||
@Test
|
||||
public void testAccount() throws MovieDbException {
|
||||
LOG.info("Using Session ID '{}' for test", SESSION_ID_APITESTS);
|
||||
Account account = tmdb.getAccount(SESSION_ID_APITESTS);
|
||||
|
||||
// Make sure properties are extracted correctly
|
||||
assertEquals(account.getUserName(), "apitests");
|
||||
assertEquals(account.getId(), ACCOUNT_ID_APITESTS);
|
||||
assertEquals("apitests", account.getUserName());
|
||||
assertEquals(ACCOUNT_ID_APITESTS, account.getId());
|
||||
}
|
||||
|
||||
@Ignore("Session required")
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#Properties file for tests
|
||||
#Fill in the details here
|
||||
Session_ID=63c85deb39337e29b69d78265eb28d639cbd6f72
|
||||
Account_ID=6065849
|
||||
API_Key=5a1a77e2eba8984804586122754f969f
|
||||
Reference in New Issue
Block a user