Compare commits
28 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 |
@@ -7,3 +7,4 @@
|
|||||||
|
|
||||||
/target/
|
/target/
|
||||||
/nbactions.xml
|
/nbactions.xml
|
||||||
|
testing.properties
|
||||||
|
|||||||
@@ -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.9</version>
|
<version>3.10</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>API-The MovieDB</name>
|
<name>API-The MovieDB</name>
|
||||||
@@ -71,11 +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.3.0</version.jackson>
|
<version.jackson>2.4.3</version.jackson>
|
||||||
<version.slf4j>1.7.5</version.slf4j>
|
<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>
|
||||||
|
|||||||
@@ -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,18 +66,35 @@ 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 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);
|
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() {
|
||||||
return exceptionType;
|
return exceptionType;
|
||||||
@@ -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,13 +20,12 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class to handle any unknown properties by outputting a log message
|
* 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 {
|
public abstract class AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
private Logger log = null;
|
private static final Logger LOG = LoggerFactory.getLogger(AbstractJsonMapping.class);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current logger.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Logger getLogger() {
|
|
||||||
if (log == null) {
|
|
||||||
log = LoggerFactory.getLogger(this.getClass());
|
|
||||||
}
|
|
||||||
return log;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle unknown properties and print a message
|
* 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(": Unknown property='").append(key);
|
||||||
unknown.append("' value='").append(value).append("'");
|
unknown.append("' value='").append(value).append("'");
|
||||||
|
|
||||||
getLogger().trace(unknown.toString());
|
LOG.trace(unknown.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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,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) {
|
||||||
|
final AlternativeTitle other = (AlternativeTitle) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(country, other.country)
|
||||||
|
.append(title, other.title)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
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
|
@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,6 +32,8 @@ public class Artwork extends AbstractJsonMapping {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private String id;
|
||||||
@JsonProperty("aspect_ratio")
|
@JsonProperty("aspect_ratio")
|
||||||
private float aspectRatio;
|
private float aspectRatio;
|
||||||
@JsonProperty("file_path")
|
@JsonProperty("file_path")
|
||||||
@@ -84,6 +88,10 @@ public class Artwork extends AbstractJsonMapping {
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public void setArtworkType(ArtworkType artworkType) {
|
public void setArtworkType(ArtworkType artworkType) {
|
||||||
this.artworkType = artworkType;
|
this.artworkType = artworkType;
|
||||||
}
|
}
|
||||||
@@ -120,45 +128,36 @@ public class Artwork extends AbstractJsonMapping {
|
|||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
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;
|
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
|
@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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -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
|
||||||
@@ -103,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) {
|
||||||
|
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;
|
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
|
@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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -104,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
|
||||||
@@ -273,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,63 +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;
|
|
||||||
|
|
||||||
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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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("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;
|
|
||||||
|
|
||||||
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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -55,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) {
|
||||||
|
final Language other = (Language) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(isoCode, other.isoCode)
|
||||||
|
.append(name, other.name)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
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
|
@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
|
||||||
@@ -389,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) {
|
||||||
|
final MovieDb other = (MovieDb) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(id, other.id)
|
||||||
|
.append(imdbID, other.imdbID)
|
||||||
|
.append(runtime, other.runtime)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
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
|
@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;
|
||||||
|
|
||||||
@@ -40,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")
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -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
|
||||||
@@ -75,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
|
||||||
@@ -252,49 +255,42 @@ public class Person extends AbstractJsonMapping {
|
|||||||
this.popularity = popularity;
|
this.popularity = popularity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
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;
|
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
|
@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,6 +46,8 @@ 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;
|
||||||
|
|
||||||
public String getCharacter() {
|
public String getCharacter() {
|
||||||
return character;
|
return character;
|
||||||
@@ -93,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) {
|
||||||
|
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;
|
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
|
@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,7 +52,17 @@ 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;
|
||||||
|
|
||||||
public String getCharacter() {
|
public String getCharacter() {
|
||||||
return character;
|
return character;
|
||||||
@@ -92,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);
|
||||||
}
|
}
|
||||||
@@ -131,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,6 +44,8 @@ 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;
|
||||||
|
|
||||||
public String getDepartment() {
|
public String getDepartment() {
|
||||||
return department;
|
return department;
|
||||||
@@ -63,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);
|
||||||
}
|
}
|
||||||
@@ -85,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) {
|
||||||
|
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;
|
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
|
@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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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("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;
|
|
||||||
|
|
||||||
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
|
||||||
@@ -56,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) {
|
||||||
|
final ProductionCountry other = (ProductionCountry) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(isoCode, other.isoCode)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
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
|
@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
|
||||||
@@ -64,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) {
|
||||||
|
final ReleaseInfo other = (ReleaseInfo) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(country, other.country)
|
||||||
|
.append(certification, other.certification)
|
||||||
|
.append(releaseDate, other.releaseDate)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
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
|
@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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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,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,6 +44,8 @@ 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;
|
||||||
|
|
||||||
public List<String> getBackdropSizes() {
|
public List<String> getBackdropSizes() {
|
||||||
return backdropSizes;
|
return backdropSizes;
|
||||||
@@ -70,6 +71,10 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
return secureBaseUrl;
|
return secureBaseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getStillSizes() {
|
||||||
|
return stillSizes;
|
||||||
|
}
|
||||||
|
|
||||||
public void setBackdropSizes(List<String> backdropSizes) {
|
public void setBackdropSizes(List<String> backdropSizes) {
|
||||||
this.backdropSizes = backdropSizes;
|
this.backdropSizes = backdropSizes;
|
||||||
}
|
}
|
||||||
@@ -94,6 +99,10 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
this.secureBaseUrl = secureBaseUrl;
|
this.secureBaseUrl = secureBaseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
*
|
*
|
||||||
@@ -166,9 +175,9 @@ public class TmdbConfiguration extends AbstractJsonMapping {
|
|||||||
* @return
|
* @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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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,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
|
||||||
*/
|
*/
|
||||||
@@ -83,32 +86,25 @@ public class Trailer extends AbstractJsonMapping {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof Trailer) {
|
||||||
|
final Trailer other = (Trailer) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(size, other.size)
|
||||||
|
.append(source, other.source)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
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
|
@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;
|
||||||
|
|
||||||
@@ -66,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) {
|
||||||
|
final Translation other = (Translation) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(englishName, other.englishName)
|
||||||
|
.append(isoCode, other.isoCode)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
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
|
@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
|
||||||
|
|||||||
+3
-3
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -76,7 +76,7 @@ public class PersonCreditDateComparator implements Comparator<PersonCredit>, Ser
|
|||||||
|
|
||||||
int year1 = extractYear(pc1.getReleaseDate());
|
int year1 = extractYear(pc1.getReleaseDate());
|
||||||
int year2 = extractYear(pc2.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;
|
int year = 0;
|
||||||
Matcher m = YEAR_PATTERN.matcher(date);
|
Matcher m = YEAR_PATTERN.matcher(date);
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
year = Integer.valueOf(m.group(1)).intValue();
|
year = Integer.parseInt(m.group(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give up and return 0
|
// Give up and return 0
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -73,8 +73,12 @@ public abstract class AbstractResults {
|
|||||||
}
|
}
|
||||||
//</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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -137,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.
|
||||||
*
|
*
|
||||||
@@ -20,11 +20,11 @@
|
|||||||
package com.omertron.themoviedbapi.tools;
|
package com.omertron.themoviedbapi.tools;
|
||||||
|
|
||||||
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;
|
||||||
@@ -36,7 +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.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web browser with simple cookies support
|
* Web browser with simple cookies support
|
||||||
@@ -77,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +100,7 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,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");
|
||||||
@@ -165,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 {
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -33,7 +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 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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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,11 +36,11 @@ public class WrapperImages extends AbstractWrapperAll implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
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 List<Artwork> getBackdrops() {
|
public List<Artwork> getBackdrops() {
|
||||||
return backdrops;
|
return backdrops;
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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,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 {
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -54,7 +54,7 @@ public class WrapperTrailers extends AbstractWrapperId implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a combined list of the trailers with their source website
|
* Get a combined list of the trailers with their source
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -62,14 +62,19 @@ public class WrapperTrailers extends AbstractWrapperId implements Serializable {
|
|||||||
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
|
||||||
for (Trailer trailer : quicktime) {
|
if (quicktime != null) {
|
||||||
trailer.setWebsite(Trailer.WEBSITE_QUICKTIME);
|
for (Trailer trailer : quicktime) {
|
||||||
trailers.add(trailer);
|
trailer.setWebsite(Trailer.WEBSITE_QUICKTIME);
|
||||||
|
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
|
||||||
for (Trailer trailer : youtube) {
|
if (youtube != null) {
|
||||||
trailer.setWebsite(Trailer.WEBSITE_YOUTUBE);
|
for (Trailer trailer : youtube) {
|
||||||
trailers.add(trailer);
|
trailer.setWebsite(Trailer.WEBSITE_YOUTUBE);
|
||||||
|
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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -67,6 +67,9 @@ import com.omertron.themoviedbapi.model.Trailer;
|
|||||||
import com.omertron.themoviedbapi.model.Translation;
|
import com.omertron.themoviedbapi.model.Translation;
|
||||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||||
import com.omertron.themoviedbapi.results.TmdbResultsMap;
|
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
|
||||||
@@ -78,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;
|
||||||
@@ -94,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
|
||||||
@@ -136,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")
|
||||||
|
|||||||
@@ -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