Merge branch 'master' into gh-pages
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
*.class
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
/target/
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.darylbeattie.movies.util;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(value=ElementType.METHOD)
|
||||
@Retention(value=RetentionPolicy.RUNTIME)
|
||||
public @interface JsonAnySetter {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.darylbeattie.movies.util;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface JsonProperty {
|
||||
String value() default "";
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.darylbeattie.movies.util;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface JsonRootName {
|
||||
String value() default "";
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.darylbeattie.movies.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class ObjectMapper {
|
||||
|
||||
/**
|
||||
* This takes a JSON string and creates (and populates) an object of the given class
|
||||
* with the data from that JSON string. It mimics the method signature of the jackson
|
||||
* JSON API, so that we don't have to import the jackson library into this application.
|
||||
*
|
||||
* @param jsonString The JSON string to parse.
|
||||
* @param objClass The class of object we want to create.
|
||||
* @return The instantiation of that class, populated with data from the JSON object.
|
||||
* @throws IOException If there was any kind of issue.
|
||||
*/
|
||||
public <T> T readValue(String jsonString, Class<T> objClass) throws IOException {
|
||||
try {
|
||||
return readValue(new JSONObject(jsonString), objClass);
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
throw ioe;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T, R> T readValue(JSONObject json, Class<T> objClass) throws IOException {
|
||||
try {
|
||||
//TODO Iterate through json object values and call the JsonAnySetter method on the unknown ones.
|
||||
T obj = objClass.newInstance();
|
||||
for (Field f : objClass.getFields()) {
|
||||
Annotation a = f.getAnnotation(JsonProperty.class);
|
||||
if (List.class.equals(f.getType()) && (json.optJSONArray(((JsonProperty) a).value()) != null)) { // It's a list.
|
||||
JSONArray jsonArray = json.optJSONArray(((JsonProperty) a).value());
|
||||
ParameterizedType listType = (ParameterizedType) f.getGenericType();
|
||||
Class<?> subObj = (Class<?>) listType.getActualTypeArguments()[0];
|
||||
List<R> subObjList = ((Class<List<R>>) f.getType()).newInstance();
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
subObjList.add((R) readValue(jsonArray.getJSONObject(i), subObj));
|
||||
}
|
||||
f.set(obj, subObjList);
|
||||
}
|
||||
else if (a != null) {
|
||||
f.set(obj, json.opt(((JsonProperty) a).value()));
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
throw ioe;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
Jackson Library Replacement
|
||||
===========================
|
||||
|
||||
These files are provided by Darren Beattie as an example of how to replace the Jackson libraries with native libraries inside Android.
|
||||
|
||||
They are provided without warrantee and if you modify them or find them useful, please let me know.
|
||||
+648
@@ -0,0 +1,648 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program 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
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,21 @@
|
||||
The Movie DB API
|
||||
================
|
||||
|
||||
Author: Stuart Boston (Omertron AT Gmail DOT com)
|
||||
|
||||
This API uses the TheMovieDB.org API as specified here http://api.themoviedb.org/
|
||||
|
||||
Originally written for use by YetAnotherMovieJukebox (YAMJ) http://code.google.com/p/moviejukebox/
|
||||
But anyone can feel free to use it for other projects as well.
|
||||
|
||||
TheMovieDB.org is an excellent open database for movie and film content. I encourage you to check it out and contribute to keep it growing.
|
||||
http://www.themoviedb.org
|
||||
|
||||
Project Logging
|
||||
---------------
|
||||
This project uses SLF4J (http://www.slf4j.org) to abstract the logging in the project.
|
||||
To use the logging in your own project you should add one of the bindings listed [HERE](http://www.slf4j.org/manual.html#swapping)
|
||||
|
||||
Project Documentation
|
||||
---------------------
|
||||
The automatically generated documentation can be found [HERE](http://omertron.github.com/api-themoviedb/)
|
||||
@@ -0,0 +1,337 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>7</version>
|
||||
</parent>
|
||||
|
||||
<prerequisites>
|
||||
<maven>3.0.3</maven>
|
||||
</prerequisites>
|
||||
|
||||
<groupId>com.omertron</groupId>
|
||||
<artifactId>themoviedbapi</artifactId>
|
||||
<version>3.5-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>API-The MovieDB</name>
|
||||
<description>API for the TheMovieDb.org website</description>
|
||||
<url>https://github.com/Omertron/api-themoviedb</url>
|
||||
<inceptionYear>2012</inceptionYear>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Stuart Boston</name>
|
||||
<email>omertron@gmail.com</email>
|
||||
<id>omertron</id>
|
||||
<url>http://omertron.com</url>
|
||||
<timezone>0</timezone>
|
||||
<roles>
|
||||
<role>developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU General Public License v3+</name>
|
||||
<url>http://www.gnu.org/licenses/gpl-3.0-standalone.html</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<scm>
|
||||
<url>scm:git:git@github.com:Omertron/api-themoviedb.git</url>
|
||||
<connection>scm:git:git@github.com:Omertron/api-themoviedb.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:Omertron/api-themoviedb.git</developerConnection>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<site>
|
||||
<id>github-project-site</id>
|
||||
<name>GitHub Project Pages</name>
|
||||
<url>gitsite:git@github.com/Omertron/api-themoviedb.git</url>
|
||||
</site>
|
||||
</distributionManagement>
|
||||
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>https://github.com/Omertron/api-themoviedb/issues</url>
|
||||
</issueManagement>
|
||||
|
||||
<ciManagement>
|
||||
<system>Hudson CI</system>
|
||||
<url>http://jenkins.omertron.com/job/API-TheMovieDb/</url>
|
||||
</ciManagement>
|
||||
|
||||
<properties>
|
||||
<skipTests>false</skipTests>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<distribution.format>zip</distribution.format>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<configuration>
|
||||
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
|
||||
<revisionOnScmFailure>0000</revisionOnScmFailure>
|
||||
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.0</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<failOnError>true</failOnError>
|
||||
<verbose>true</verbose>
|
||||
<!-- excludes><exclude>**/*</exclude></excludes -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Specification-Title>${project.name}</Specification-Title>
|
||||
<Specification-Version>${project.version}</Specification-Version>
|
||||
<Implementation-Version>${buildNumber}</Implementation-Version>
|
||||
<Implementation-Title>${timestamp}</Implementation-Title>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.13</version>
|
||||
<configuration>
|
||||
<!-- To skip tests by default -->
|
||||
<skipTests>${skipTests}</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-version-txt</id>
|
||||
<phase>generate-resources</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<property name="version_file" value="${project.build.directory}/version.txt" />
|
||||
<property name="header_line" value="The MovieDb API${line.separator}" />
|
||||
<property name="build_date_line" value="Build Date: ${timestamp}${line.separator}" />
|
||||
<property name="version_line" value="Version: ${project.version}${line.separator}" />
|
||||
<!--<property name="revision_line" value="Revision: r${buildNumber}${line.separator}" />-->
|
||||
<echo>Writing version file: ${version_file}</echo>
|
||||
<echo file="${version_file}" append="false">${header_line}</echo>
|
||||
<echo file="${version_file}" append="true">${build_date_line}</echo>
|
||||
<echo file="${version_file}" append="true">${version_line}</echo>
|
||||
<!--<echo file="${version_file}" append="true">${revision_line}</echo>-->
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>distro-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/resources/bin.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>2.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.2</version>
|
||||
<configuration>
|
||||
<reportPlugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<reports>
|
||||
<report>index</report>
|
||||
<report>scm</report>
|
||||
<report>issue-tracking</report>
|
||||
<report>help</report>
|
||||
<report>dependency-convergence</report>
|
||||
<report>summary</report>
|
||||
<report>dependency-management</report>
|
||||
<report>dependencies</report>
|
||||
<report>license</report>
|
||||
<report>modules</report>
|
||||
</reports>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
</plugin>
|
||||
</reportPlugins>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.scm</groupId>
|
||||
<artifactId>maven-scm-provider-gitexe</artifactId>
|
||||
<version>1.4</version>
|
||||
</extension>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.scm</groupId>
|
||||
<artifactId>maven-scm-manager-plexus</artifactId>
|
||||
<version>1.4</version>
|
||||
</extension>
|
||||
<extension>
|
||||
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
|
||||
<artifactId>wagon-gitsite</artifactId>
|
||||
<version>0.3.1</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release-sign-artifacts</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>performRelease</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi;
|
||||
|
||||
public class MovieDbException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public enum MovieDbExceptionType {
|
||||
/*
|
||||
* Unknown error occured
|
||||
*/
|
||||
UNKNOWN_CAUSE,
|
||||
/*
|
||||
* URL is invalid
|
||||
*/
|
||||
INVALID_URL,
|
||||
/*
|
||||
* Page not found
|
||||
*/
|
||||
HTTP_404_ERROR,
|
||||
/*
|
||||
* The movie id was not found
|
||||
*/
|
||||
MOVIE_ID_NOT_FOUND,
|
||||
/*
|
||||
* Mapping failed from target to internal onbjects
|
||||
*/
|
||||
MAPPING_FAILED,
|
||||
/*
|
||||
* Error connecting to the service
|
||||
*/
|
||||
CONNECTION_ERROR,
|
||||
/*
|
||||
* Image was invalid
|
||||
*/
|
||||
INVALID_IMAGE,
|
||||
/*
|
||||
* Autorisation rejected
|
||||
*/
|
||||
AUTHORISATION_FAILURE;
|
||||
}
|
||||
|
||||
private final MovieDbExceptionType exceptionType;
|
||||
private final String response;
|
||||
|
||||
public MovieDbException(final MovieDbExceptionType exceptionType, final String response) {
|
||||
super();
|
||||
this.exceptionType = exceptionType;
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final Throwable cause) {
|
||||
super(cause);
|
||||
this.exceptionType = exceptionType;
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public MovieDbExceptionType getExceptionType() {
|
||||
return exceptionType;
|
||||
}
|
||||
|
||||
public String getResponse() {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class AlternativeTitle implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AlternativeTitle.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("iso_3166_1")
|
||||
private String country;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AlternativeTitle other = (AlternativeTitle) obj;
|
||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
||||
hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[AlternativeTitle=");
|
||||
sb.append("[country=").append(country);
|
||||
sb.append("],[title=").append(title);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The artwork type information
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class Artwork implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Artwork.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("aspect_ratio")
|
||||
private float aspectRatio;
|
||||
@JsonProperty("file_path")
|
||||
private String filePath;
|
||||
@JsonProperty("height")
|
||||
private int height;
|
||||
@JsonProperty("iso_639_1")
|
||||
private String language;
|
||||
@JsonProperty("width")
|
||||
private int width;
|
||||
@JsonProperty("vote_average")
|
||||
private float voteAverage;
|
||||
@JsonProperty("vote_count")
|
||||
private int voteCount;
|
||||
@JsonProperty("flag")
|
||||
private String flag;
|
||||
private ArtworkType artworkType = ArtworkType.POSTER;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public ArtworkType getArtworkType() {
|
||||
return artworkType;
|
||||
}
|
||||
|
||||
public float getAspectRatio() {
|
||||
return aspectRatio;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public float getVoteAverage() {
|
||||
return voteAverage;
|
||||
}
|
||||
|
||||
public int getVoteCount() {
|
||||
return voteCount;
|
||||
}
|
||||
|
||||
public String getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setArtworkType(ArtworkType artworkType) {
|
||||
this.artworkType = artworkType;
|
||||
}
|
||||
|
||||
public void setAspectRatio(float aspectRatio) {
|
||||
this.aspectRatio = aspectRatio;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public void setVoteAverage(float voteAverage) {
|
||||
this.voteAverage = voteAverage;
|
||||
}
|
||||
|
||||
public void setVoteCount(int voteCount) {
|
||||
this.voteCount = voteCount;
|
||||
}
|
||||
|
||||
public void setFlag(String flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Artwork other = (Artwork) obj;
|
||||
if (Float.floatToIntBits(this.aspectRatio) != Float.floatToIntBits(other.aspectRatio)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.height != other.height) {
|
||||
return false;
|
||||
}
|
||||
if ((this.language == null) ? (other.language != null) : !this.language.equals(other.language)) {
|
||||
return false;
|
||||
}
|
||||
if (this.width != other.width) {
|
||||
return false;
|
||||
}
|
||||
if (this.artworkType != other.artworkType) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 71 * hash + Float.floatToIntBits(this.aspectRatio);
|
||||
hash = 71 * hash + (this.filePath != null ? this.filePath.hashCode() : 0);
|
||||
hash = 71 * hash + this.height;
|
||||
hash = 71 * hash + (this.language != null ? this.language.hashCode() : 0);
|
||||
hash = 71 * hash + this.width;
|
||||
hash = 71 * hash + (this.artworkType != null ? this.artworkType.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Artwork=");
|
||||
sb.append("[aspectRatio=").append(aspectRatio);
|
||||
sb.append("],[filePath=").append(filePath);
|
||||
sb.append("],[height=").append(height);
|
||||
sb.append("],[language=").append(language);
|
||||
sb.append("],[width=").append(width);
|
||||
sb.append("],[artworkType=").append(artworkType);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
/**
|
||||
* ArtworkType enum List of the artwork types that are available
|
||||
*/
|
||||
public enum ArtworkType {
|
||||
|
||||
POSTER, // Poster artwork
|
||||
BACKDROP, // Fanart/backdrop
|
||||
PROFILE // Person image
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ChangeItem {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
@JsonProperty("action")
|
||||
private String action;
|
||||
@JsonProperty("time")
|
||||
private String time;
|
||||
@JsonProperty("value")
|
||||
private ChangeValue value;
|
||||
@JsonProperty("original_value")
|
||||
private ChangeValue originalValue;
|
||||
@JsonProperty("iso_639_1")
|
||||
private String language;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public ChangeValue getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public ChangeValue getOriginalValue() {
|
||||
return originalValue;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public void setValue(ChangeValue value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void setOriginalValue(ChangeValue originalValue) {
|
||||
this.originalValue = originalValue;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChangeItem{" + "id=" + id + ", action=" + action + ", time=" + time + ", value=" + value + '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ChangeValue {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("poster")
|
||||
private Artwork poster;
|
||||
@JsonProperty("backdrop")
|
||||
private Artwork backdrop;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
@JsonProperty("iso_3166_1")
|
||||
private String language;
|
||||
@JsonProperty("site")
|
||||
private String site;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
||||
public Artwork getPoster() {
|
||||
return poster;
|
||||
}
|
||||
|
||||
public Artwork getBackdrop() {
|
||||
return backdrop;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public String getSite() {
|
||||
return site;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
||||
public void setPoster(Artwork poster) {
|
||||
this.poster = poster;
|
||||
}
|
||||
|
||||
public void setBackdrop(Artwork backdrop) {
|
||||
this.backdrop = backdrop;
|
||||
backdrop.setArtworkType(ArtworkType.BACKDROP);
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public void setSite(String site) {
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
import java.io.Serializable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("collection")
|
||||
public class Collection implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Collection.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath;
|
||||
@JsonProperty("backdrop_path")
|
||||
private String backdropPath;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
if (StringUtils.isBlank(title)) {
|
||||
return name;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return title;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Collection other = (Collection) obj;
|
||||
if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 19 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
|
||||
hash = 19 * hash + this.id;
|
||||
hash = 19 * hash + (this.title != null ? this.title.hashCode() : 0);
|
||||
hash = 19 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 19 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
|
||||
hash = 19 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Collection=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[title=").append(title);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[posterPath=").append(posterPath);
|
||||
sb.append("],[backdropPath=").append(backdropPath);
|
||||
sb.append("],[releaseDate=").append(releaseDate);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class CollectionInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CollectionInfo.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath;
|
||||
@JsonProperty("backdrop_path")
|
||||
private String backdropPath;
|
||||
@JsonProperty("parts")
|
||||
private List<Collection> parts = new ArrayList<Collection>();
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<Collection> getParts() {
|
||||
return parts;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setParts(List<Collection> parts) {
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[CollectionInfo=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[posterPath=").append(posterPath);
|
||||
sb.append("],[backdropPath=").append(backdropPath);
|
||||
sb.append("],[# of parts=").append(parts.size());
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Company information
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class Company implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Company.class);
|
||||
private static final String DEFAULT_STRING = "";
|
||||
// Properties
|
||||
@JsonProperty("id")
|
||||
private int companyId = 0;
|
||||
@JsonProperty("name")
|
||||
private String name = DEFAULT_STRING;
|
||||
@JsonProperty("description")
|
||||
private String description = DEFAULT_STRING;
|
||||
@JsonProperty("headquarters")
|
||||
private String headquarters = DEFAULT_STRING;
|
||||
@JsonProperty("homepage")
|
||||
private String homepage = DEFAULT_STRING;
|
||||
@JsonProperty("logo_path")
|
||||
private String logoPath = DEFAULT_STRING;
|
||||
@JsonProperty("parent_company")
|
||||
private String parentCompany = DEFAULT_STRING;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
||||
public int getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getHeadquarters() {
|
||||
return headquarters;
|
||||
}
|
||||
|
||||
public String getHomepage() {
|
||||
return homepage;
|
||||
}
|
||||
|
||||
public String getLogoPath() {
|
||||
return logoPath;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getParentCompany() {
|
||||
return parentCompany;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
||||
public void setCompanyId(int companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setHeadquarters(String headquarters) {
|
||||
this.headquarters = headquarters;
|
||||
}
|
||||
|
||||
public void setHomepage(String homepage) {
|
||||
this.homepage = homepage;
|
||||
}
|
||||
|
||||
public void setLogoPath(String logoPath) {
|
||||
this.logoPath = logoPath;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setParentCompany(String parentCompany) {
|
||||
this.parentCompany = parentCompany;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Company{" + "companyId=" + companyId + ", name=" + name + ", description=" + description + ", headquarters=" + headquarters + ", homepage=" + homepage + ", logoPath=" + logoPath + ", parentCompany=" + parentCompany + '}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("genre")
|
||||
public class Genre implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Genre.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Genre other = (Genre) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 53 * hash + this.id;
|
||||
hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Genre=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("keyword")
|
||||
public class Keyword implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Keyword.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Keyword other = (Keyword) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 83 * hash + this.id;
|
||||
hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Keyword=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class KeywordMovie implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(KeywordMovie.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
@JsonProperty("backdrop_path")
|
||||
private String backdropPath;
|
||||
@JsonProperty("original_title")
|
||||
private String originalTitle;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
@JsonProperty("vote_average")
|
||||
private float voteAverage;
|
||||
@JsonProperty("vote_count")
|
||||
private double voteCount;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getOriginalTitle() {
|
||||
return originalTitle;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public float getVoteAverage() {
|
||||
return voteAverage;
|
||||
}
|
||||
|
||||
public double getVoteCount() {
|
||||
return voteCount;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setOriginalTitle(String originalTitle) {
|
||||
this.originalTitle = originalTitle;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setVoteAverage(float voteAverage) {
|
||||
this.voteAverage = voteAverage;
|
||||
}
|
||||
|
||||
public void setVoteCount(double voteCount) {
|
||||
this.voteCount = voteCount;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("spoken_language")
|
||||
public class Language implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Language.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("iso_639_1")
|
||||
private String isoCode;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getIsoCode() {
|
||||
return isoCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setIsoCode(String isoCode) {
|
||||
this.isoCode = isoCode;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Language other = (Language) obj;
|
||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 71 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
||||
hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Language=");
|
||||
sb.append("isoCode=").append(isoCode);
|
||||
sb.append(", name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class MovieChanges implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("key")
|
||||
private String key;
|
||||
@JsonProperty("items")
|
||||
private List<ChangeItem> items;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public List<ChangeItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public void setItems(List<ChangeItem> items) {
|
||||
this.items = items;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Movie Bean
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class MovieDb implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MovieDb.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("backdrop_path")
|
||||
private String backdropPath;
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("original_title")
|
||||
private String originalTitle;
|
||||
@JsonProperty("popularity")
|
||||
private float popularity;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
@JsonProperty("adult")
|
||||
private boolean adult;
|
||||
@JsonProperty("belongs_to_collection")
|
||||
private Collection belongsToCollection;
|
||||
@JsonProperty("budget")
|
||||
private long budget;
|
||||
@JsonProperty("genres")
|
||||
private List<Genre> genres;
|
||||
@JsonProperty("homepage")
|
||||
private String homepage;
|
||||
@JsonProperty("imdb_id")
|
||||
private String imdbID;
|
||||
@JsonProperty("overview")
|
||||
private String overview;
|
||||
@JsonProperty("production_companies")
|
||||
private List<ProductionCompany> productionCompanies;
|
||||
@JsonProperty("production_countries")
|
||||
private List<ProductionCountry> productionCountries;
|
||||
@JsonProperty("revenue")
|
||||
private long revenue;
|
||||
@JsonProperty("runtime")
|
||||
private int runtime;
|
||||
@JsonProperty("spoken_languages")
|
||||
private List<Language> spokenLanguages;
|
||||
@JsonProperty("tagline")
|
||||
private String tagline;
|
||||
@JsonProperty("vote_average")
|
||||
private float voteAverage;
|
||||
@JsonProperty("vote_count")
|
||||
private int voteCount;
|
||||
@JsonProperty("status")
|
||||
private String status;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getBackdropPath() {
|
||||
return backdropPath;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getOriginalTitle() {
|
||||
return originalTitle;
|
||||
}
|
||||
|
||||
public float getPopularity() {
|
||||
return popularity;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public boolean isAdult() {
|
||||
return adult;
|
||||
}
|
||||
|
||||
public Collection getBelongsToCollection() {
|
||||
return belongsToCollection;
|
||||
}
|
||||
|
||||
public long getBudget() {
|
||||
return budget;
|
||||
}
|
||||
|
||||
public List<Genre> getGenres() {
|
||||
return genres;
|
||||
}
|
||||
|
||||
public String getHomepage() {
|
||||
return homepage;
|
||||
}
|
||||
|
||||
public String getImdbID() {
|
||||
return imdbID;
|
||||
}
|
||||
|
||||
public String getOverview() {
|
||||
return overview;
|
||||
}
|
||||
|
||||
public List<ProductionCompany> getProductionCompanies() {
|
||||
return productionCompanies;
|
||||
}
|
||||
|
||||
public List<ProductionCountry> getProductionCountries() {
|
||||
return productionCountries;
|
||||
}
|
||||
|
||||
public long getRevenue() {
|
||||
return revenue;
|
||||
}
|
||||
|
||||
public int getRuntime() {
|
||||
return runtime;
|
||||
}
|
||||
|
||||
public List<Language> getSpokenLanguages() {
|
||||
return spokenLanguages;
|
||||
}
|
||||
|
||||
public String getTagline() {
|
||||
return tagline;
|
||||
}
|
||||
|
||||
public float getVoteAverage() {
|
||||
return voteAverage;
|
||||
}
|
||||
|
||||
public int getVoteCount() {
|
||||
return voteCount;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdropPath(String backdropPath) {
|
||||
this.backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setOriginalTitle(String originalTitle) {
|
||||
this.originalTitle = originalTitle;
|
||||
}
|
||||
|
||||
public void setPopularity(float popularity) {
|
||||
this.popularity = popularity;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setAdult(boolean adult) {
|
||||
this.adult = adult;
|
||||
}
|
||||
|
||||
public void setBelongsToCollection(Collection belongsToCollection) {
|
||||
this.belongsToCollection = belongsToCollection;
|
||||
}
|
||||
|
||||
public void setBudget(long budget) {
|
||||
this.budget = budget;
|
||||
}
|
||||
|
||||
public void setGenres(List<Genre> genres) {
|
||||
this.genres = genres;
|
||||
}
|
||||
|
||||
public void setHomepage(String homepage) {
|
||||
this.homepage = homepage;
|
||||
}
|
||||
|
||||
public void setImdbID(String imdbID) {
|
||||
this.imdbID = imdbID;
|
||||
}
|
||||
|
||||
public void setOverview(String overview) {
|
||||
this.overview = overview;
|
||||
}
|
||||
|
||||
public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
|
||||
this.productionCompanies = productionCompanies;
|
||||
}
|
||||
|
||||
public void setProductionCountries(List<ProductionCountry> productionCountries) {
|
||||
this.productionCountries = productionCountries;
|
||||
}
|
||||
|
||||
public void setRevenue(long revenue) {
|
||||
this.revenue = revenue;
|
||||
}
|
||||
|
||||
public void setRuntime(int runtime) {
|
||||
this.runtime = runtime;
|
||||
}
|
||||
|
||||
public void setSpokenLanguages(List<Language> spokenLanguages) {
|
||||
this.spokenLanguages = spokenLanguages;
|
||||
}
|
||||
|
||||
public void setTagline(String tagline) {
|
||||
this.tagline = tagline;
|
||||
}
|
||||
|
||||
public void setVoteAverage(float voteAverage) {
|
||||
this.voteAverage = voteAverage;
|
||||
}
|
||||
|
||||
public void setVoteCount(int voteCount) {
|
||||
this.voteCount = voteCount;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final MovieDb other = (MovieDb) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) {
|
||||
return false;
|
||||
}
|
||||
if (this.runtime != other.runtime) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 89 * hash + this.id;
|
||||
hash = 89 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0);
|
||||
hash = 89 * hash + this.runtime;
|
||||
return hash;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[MovieDB=");
|
||||
sb.append("[backdropPath=").append(backdropPath);
|
||||
sb.append("],[id=").append(id);
|
||||
sb.append("],[originalTitle=").append(originalTitle);
|
||||
sb.append("],[popularity=").append(popularity);
|
||||
sb.append("],[posterPath=").append(posterPath);
|
||||
sb.append("],[releaseDate=").append(releaseDate);
|
||||
sb.append("],[title=").append(title);
|
||||
sb.append("],[adult=").append(adult);
|
||||
sb.append("],[belongsToCollection=").append(belongsToCollection);
|
||||
sb.append("],[budget=").append(budget);
|
||||
sb.append("],[genres=").append(genres);
|
||||
sb.append("],[homepage=").append(homepage);
|
||||
sb.append("],[imdbID=").append(imdbID);
|
||||
sb.append("],[overview=").append(overview);
|
||||
sb.append("],[productionCompanies=").append(productionCompanies);
|
||||
sb.append("],[productionCountries=").append(productionCountries);
|
||||
sb.append("],[revenue=").append(revenue);
|
||||
sb.append("],[runtime=").append(runtime);
|
||||
sb.append("],[spokenLanguages=").append(spokenLanguages);
|
||||
sb.append("],[tagline=").append(tagline);
|
||||
sb.append("],[voteAverage=").append(voteAverage);
|
||||
sb.append("],[voteCount=").append(voteCount);
|
||||
sb.append("],[status=").append(status);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Wrapper for the MovieDbList function
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class MovieDbList {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MovieDbList.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
@JsonProperty("created_by")
|
||||
private String createdBy;
|
||||
@JsonProperty("description")
|
||||
private String description;
|
||||
@JsonProperty("favorite_count")
|
||||
private int favoriteCount;
|
||||
@JsonProperty("items")
|
||||
private List<MovieDb> items = Collections.EMPTY_LIST;
|
||||
@JsonProperty("item_count")
|
||||
private int itemCount;
|
||||
@JsonProperty("iso_639_1")
|
||||
private String language;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getFavoriteCount() {
|
||||
return favoriteCount;
|
||||
}
|
||||
|
||||
public List<MovieDb> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public int getItemCount() {
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setFavoriteCount(int favoriteCount) {
|
||||
this.favoriteCount = favoriteCount;
|
||||
}
|
||||
|
||||
public void setItems(List<MovieDb> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public void setItemCount(int itemCount) {
|
||||
this.itemCount = itemCount;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class MovieList implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MovieList.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("description")
|
||||
private String description;
|
||||
@JsonProperty("favorite_count")
|
||||
private int favoriteCount;
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
@JsonProperty("item_count")
|
||||
private int itemCount;
|
||||
@JsonProperty("iso_639_1")
|
||||
private String language;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath;
|
||||
@JsonProperty("list_type")
|
||||
private String listType;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getFavoriteCount() {
|
||||
return favoriteCount;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getItemCount() {
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getListType() {
|
||||
return listType;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setFavoriteCount(int favoriteCount) {
|
||||
this.favoriteCount = favoriteCount;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setItemCount(int itemCount) {
|
||||
this.itemCount = itemCount;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
|
||||
public void setListType(String listType) {
|
||||
this.listType = listType;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MovieList{" + "description=" + description + ", favoriteCount=" + favoriteCount + ", id=" + id + ", itemCount=" + itemCount + ", language=" + language + ", name=" + name + ", posterPath=" + posterPath + '}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class Person implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Person.class);
|
||||
|
||||
/*
|
||||
* Static fields for default cast information
|
||||
*/
|
||||
private static final String CAST_DEPARTMENT = "acting";
|
||||
private static final String CAST_JOB = "actor";
|
||||
private static final String DEFAULT_STRING = "";
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id = -1;
|
||||
@JsonProperty("name")
|
||||
private String name = "";
|
||||
@JsonProperty("profile_path")
|
||||
private String profilePath = DEFAULT_STRING;
|
||||
private PersonType personType = PersonType.PERSON;
|
||||
private String department = DEFAULT_STRING; // Crew
|
||||
private String job = DEFAULT_STRING; // Crew
|
||||
private String character = DEFAULT_STRING; // Cast
|
||||
private int order = -1; // Cast
|
||||
@JsonProperty("adult")
|
||||
private boolean adult = false; // Person info
|
||||
@JsonProperty("also_known_as")
|
||||
private List<String> aka = new ArrayList<String>();
|
||||
@JsonProperty("biography")
|
||||
private String biography = DEFAULT_STRING;
|
||||
@JsonProperty("birthday")
|
||||
private String birthday = DEFAULT_STRING;
|
||||
@JsonProperty("deathday")
|
||||
private String deathday = DEFAULT_STRING;
|
||||
@JsonProperty("homepage")
|
||||
private String homepage = DEFAULT_STRING;
|
||||
@JsonProperty("place_of_birth")
|
||||
private String birthplace = DEFAULT_STRING;
|
||||
@JsonProperty("imdb_id")
|
||||
private String imdbId = DEFAULT_STRING;
|
||||
@JsonProperty("popularity")
|
||||
private float popularity = 0.0f;
|
||||
|
||||
/**
|
||||
* Add a crew member
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
* @param profilePath
|
||||
* @param department
|
||||
* @param job
|
||||
*/
|
||||
public void addCrew(int id, String name, String profilePath, String department, String job) {
|
||||
this.personType = PersonType.CREW;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.profilePath = profilePath;
|
||||
this.department = department;
|
||||
this.job = job;
|
||||
this.character = "";
|
||||
this.order = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a cast member
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
* @param profilePath
|
||||
* @param character
|
||||
* @param order
|
||||
*/
|
||||
public void addCast(int id, String name, String profilePath, String character, int order) {
|
||||
this.personType = PersonType.CAST;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.profilePath = profilePath;
|
||||
this.character = character;
|
||||
this.order = order;
|
||||
this.department = CAST_DEPARTMENT;
|
||||
this.job = CAST_JOB;
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getCharacter() {
|
||||
return character;
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public PersonType getPersonType() {
|
||||
return personType;
|
||||
}
|
||||
|
||||
public String getProfilePath() {
|
||||
return profilePath;
|
||||
}
|
||||
|
||||
public boolean isAdult() {
|
||||
return adult;
|
||||
}
|
||||
|
||||
public List<String> getAka() {
|
||||
return aka;
|
||||
}
|
||||
|
||||
public String getBiography() {
|
||||
return biography;
|
||||
}
|
||||
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public String getBirthplace() {
|
||||
return birthplace;
|
||||
}
|
||||
|
||||
public String getDeathday() {
|
||||
return deathday;
|
||||
}
|
||||
|
||||
public String getHomepage() {
|
||||
return homepage;
|
||||
}
|
||||
|
||||
public String getImdbId() {
|
||||
return imdbId;
|
||||
}
|
||||
|
||||
public float getPopularity() {
|
||||
return popularity;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCharacter(String character) {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setJob(String job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public void setPersonType(PersonType personType) {
|
||||
this.personType = personType;
|
||||
}
|
||||
|
||||
public void setProfilePath(String profilePath) {
|
||||
this.profilePath = profilePath;
|
||||
}
|
||||
|
||||
public void setAdult(boolean adult) {
|
||||
this.adult = adult;
|
||||
}
|
||||
|
||||
public void setAka(List<String> aka) {
|
||||
this.aka = aka;
|
||||
}
|
||||
|
||||
public void setBiography(String biography) {
|
||||
this.biography = biography;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public void setBirthplace(String birthplace) {
|
||||
this.birthplace = birthplace;
|
||||
}
|
||||
|
||||
public void setDeathday(String deathday) {
|
||||
this.deathday = deathday;
|
||||
}
|
||||
|
||||
public void setHomepage(String homepage) {
|
||||
this.homepage = homepage;
|
||||
}
|
||||
|
||||
public void setImdbId(String imdbId) {
|
||||
this.imdbId = imdbId;
|
||||
}
|
||||
|
||||
public void setPopularity(float popularity) {
|
||||
this.popularity = popularity;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Person other = (Person) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.personType != other.personType) {
|
||||
return false;
|
||||
}
|
||||
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 37 * hash + this.id;
|
||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 37 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
||||
hash = 37 * hash + (this.personType != null ? this.personType.hashCode() : 0);
|
||||
hash = 37 * hash + (this.department != null ? this.department.hashCode() : 0);
|
||||
hash = 37 * hash + (this.job != null ? this.job.hashCode() : 0);
|
||||
hash = 37 * hash + (this.character != null ? this.character.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Person=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[profilePath=").append(profilePath);
|
||||
sb.append("],[personType=").append(personType);
|
||||
sb.append("],[department=").append(department);
|
||||
sb.append("],[job=").append(job);
|
||||
sb.append("],[character=").append(character);
|
||||
sb.append("],[order=").append(order);
|
||||
sb.append("],[adult=").append(adult);
|
||||
sb.append("],[=aka").append(aka.toString());
|
||||
sb.append("],[biography=").append(biography);
|
||||
sb.append("],[birthday=").append(birthday);
|
||||
sb.append("],[deathday=").append(deathday);
|
||||
sb.append("],[homepage=").append(homepage);
|
||||
sb.append("],[birthplace=").append(birthplace);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class PersonCast implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PersonCast.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("character")
|
||||
private String character;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("order")
|
||||
private int order;
|
||||
@JsonProperty("profile_path")
|
||||
private String profilePath;
|
||||
@JsonProperty("cast_id")
|
||||
private int castId;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getCharacter() {
|
||||
return character;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public String getProfilePath() {
|
||||
return profilePath;
|
||||
}
|
||||
|
||||
public int getCastId() {
|
||||
return castId;
|
||||
}
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCharacter(String character) {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public void setProfilePath(String profilePath) {
|
||||
this.profilePath = profilePath;
|
||||
}
|
||||
|
||||
public void setCastId(int castId) {
|
||||
this.castId = castId;
|
||||
}
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final PersonCast other = (PersonCast) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if (this.order != other.order) {
|
||||
return false;
|
||||
}
|
||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 41 * hash + this.id;
|
||||
hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0);
|
||||
hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 41 * hash + this.order;
|
||||
hash = 41 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[PersonCast=");
|
||||
sb.append("id=").append(id);
|
||||
sb.append("],[character=").append(character);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[order=").append(order);
|
||||
sb.append("],[profilePath=").append(profilePath);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class PersonCredit implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PersonCredit.class);
|
||||
private static final String DEFAULT_STRING = "";
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int movieId = 0;
|
||||
@JsonProperty("character")
|
||||
private String character = DEFAULT_STRING;
|
||||
@JsonProperty("original_title")
|
||||
private String movieOriginalTitle = DEFAULT_STRING;
|
||||
@JsonProperty("poster_path")
|
||||
private String posterPath = DEFAULT_STRING;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate = DEFAULT_STRING;
|
||||
@JsonProperty("title")
|
||||
private String movieTitle = DEFAULT_STRING;
|
||||
@JsonProperty("department")
|
||||
private String department = DEFAULT_STRING;
|
||||
@JsonProperty("job")
|
||||
private String job = DEFAULT_STRING;
|
||||
@JsonProperty("adult")
|
||||
private String adult = DEFAULT_STRING;
|
||||
private PersonType personType = PersonType.PERSON;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
||||
public String getCharacter() {
|
||||
return character;
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public String getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
public int getMovieId() {
|
||||
return movieId;
|
||||
}
|
||||
|
||||
public String getMovieOriginalTitle() {
|
||||
return movieOriginalTitle;
|
||||
}
|
||||
|
||||
public String getMovieTitle() {
|
||||
return movieTitle;
|
||||
}
|
||||
|
||||
public PersonType getPersonType() {
|
||||
return personType;
|
||||
}
|
||||
|
||||
public String getPosterPath() {
|
||||
return posterPath;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public String getAdult() {
|
||||
return adult;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
||||
public void setCharacter(String character) {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public void setJob(String job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public void setMovieId(int movieId) {
|
||||
this.movieId = movieId;
|
||||
}
|
||||
|
||||
public void setMovieOriginalTitle(String movieOriginalTitle) {
|
||||
this.movieOriginalTitle = movieOriginalTitle;
|
||||
}
|
||||
|
||||
public void setMovieTitle(String movieTitle) {
|
||||
this.movieTitle = movieTitle;
|
||||
}
|
||||
|
||||
public void setPersonType(PersonType personType) {
|
||||
this.personType = personType;
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath) {
|
||||
this.posterPath = posterPath;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
|
||||
public void setAdult(String adult) {
|
||||
this.adult = adult;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[PersonCredit=");
|
||||
sb.append("[movieId=").append(movieId);
|
||||
sb.append("],[personType=").append(personType);
|
||||
sb.append("],[originalTitle=").append(movieOriginalTitle);
|
||||
sb.append("],[movieTitle=").append(movieTitle);
|
||||
sb.append("],[posterPath=").append(posterPath);
|
||||
sb.append("],[releaseDate=").append(releaseDate);
|
||||
sb.append("],[character=").append(character);
|
||||
sb.append("],[department=").append(department);
|
||||
sb.append("],[job=").append(job);
|
||||
sb.append("],[adult=").append(adult);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class PersonCrew implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PersonCrew.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("department")
|
||||
private String department;
|
||||
@JsonProperty("job")
|
||||
private String job;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("profile_path")
|
||||
private String profilePath;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getProfilePath() {
|
||||
return profilePath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setJob(String job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setProfilePath(String profilePath) {
|
||||
this.profilePath = profilePath;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final PersonCrew other = (PersonCrew) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 59 * hash + this.id;
|
||||
hash = 59 * hash + (this.department != null ? this.department.hashCode() : 0);
|
||||
hash = 59 * hash + (this.job != null ? this.job.hashCode() : 0);
|
||||
hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 59 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[PersonCrew=");
|
||||
sb.append("id=").append(id);
|
||||
sb.append("],[department=").append(department);
|
||||
sb.append("],[job=").append(job);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("],[profilePath=").append(profilePath);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public enum PersonType {
|
||||
|
||||
CAST, // A member of the cast
|
||||
CREW, // A member of the crew
|
||||
PERSON // No specific type
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("production_company")
|
||||
public class ProductionCompany implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ProductionCompany.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ProductionCompany other = (ProductionCompany) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 37 * hash + this.id;
|
||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ProductionCompany=");
|
||||
sb.append("[id=").append(id);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
@JsonRootName("production_country")
|
||||
public class ProductionCountry implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ProductionCountry.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("iso_3166_1")
|
||||
private String isoCode;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getIsoCode() {
|
||||
return isoCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setIsoCode(String isoCode) {
|
||||
this.isoCode = isoCode;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ProductionCountry other = (ProductionCountry) obj;
|
||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 47 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
||||
hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ProductionCountry=");
|
||||
sb.append("[isoCode=").append(isoCode);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class ReleaseInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ReleaseInfo.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("iso_3166_1")
|
||||
private String country;
|
||||
@JsonProperty("certification")
|
||||
private String certification;
|
||||
@JsonProperty("release_date")
|
||||
private String releaseDate;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getCertification() {
|
||||
return certification;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public String getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCertification(String certification) {
|
||||
this.certification = certification;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public void setReleaseDate(String releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ReleaseInfo other = (ReleaseInfo) obj;
|
||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.certification == null) ? (other.certification != null) : !this.certification.equals(other.certification)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
||||
hash = 89 * hash + (this.certification != null ? this.certification.hashCode() : 0);
|
||||
hash = 89 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ReleaseInfo=");
|
||||
sb.append("[country=").append(country);
|
||||
sb.append("],[certification=").append(certification);
|
||||
sb.append("],[releaseDate=").append(releaseDate);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class StatusCode implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(StatusCode.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("status_code")
|
||||
private int statusCode;
|
||||
@JsonProperty("status_message")
|
||||
private String statusMessage;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public void setStatusCode(int statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public String getStatusMessage() {
|
||||
return statusMessage;
|
||||
}
|
||||
|
||||
public void setStatusMessage(String statusMessage) {
|
||||
this.statusMessage = statusMessage;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Status Code: ").append(statusCode);
|
||||
sb.append(", Message: ").append(statusMessage);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TmdbConfiguration implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbConfiguration.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("base_url")
|
||||
private String baseUrl;
|
||||
@JsonProperty("secure_base_url")
|
||||
private String secureBaseUrl;
|
||||
@JsonProperty("poster_sizes")
|
||||
private List<String> posterSizes;
|
||||
@JsonProperty("backdrop_sizes")
|
||||
private List<String> backdropSizes;
|
||||
@JsonProperty("profile_sizes")
|
||||
private List<String> profileSizes;
|
||||
@JsonProperty("logo_sizes")
|
||||
private List<String> logoSizes;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">//GEN-BEGIN:getterMethods
|
||||
public List<String> getBackdropSizes() {
|
||||
return backdropSizes;
|
||||
}
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public List<String> getPosterSizes() {
|
||||
return posterSizes;
|
||||
}
|
||||
|
||||
public List<String> getProfileSizes() {
|
||||
return profileSizes;
|
||||
}
|
||||
|
||||
public List<String> getLogoSizes() {
|
||||
return logoSizes;
|
||||
}
|
||||
|
||||
public String getSecureBaseUrl() {
|
||||
return secureBaseUrl;
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">//GEN-BEGIN:setterMethods
|
||||
public void setBackdropSizes(List<String> backdropSizes) {
|
||||
this.backdropSizes = backdropSizes;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public void setPosterSizes(List<String> posterSizes) {
|
||||
this.posterSizes = posterSizes;
|
||||
}
|
||||
|
||||
public void setProfileSizes(List<String> profileSizes) {
|
||||
this.profileSizes = profileSizes;
|
||||
}
|
||||
|
||||
public void setLogoSizes(List<String> logoSizes) {
|
||||
this.logoSizes = logoSizes;
|
||||
}
|
||||
|
||||
public void setSecureBaseUrl(String secureBaseUrl) {
|
||||
this.secureBaseUrl = secureBaseUrl;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Copy the data from the passed object to this one
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
public void clone(TmdbConfiguration config) {
|
||||
backdropSizes = config.getBackdropSizes();
|
||||
baseUrl = config.getBaseUrl();
|
||||
posterSizes = config.getPosterSizes();
|
||||
profileSizes = config.getProfileSizes();
|
||||
logoSizes = config.getLogoSizes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the poster size is valid
|
||||
*
|
||||
* @param posterSize
|
||||
*/
|
||||
public boolean isValidPosterSize(String posterSize) {
|
||||
if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return posterSizes.contains(posterSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the backdrop size is valid
|
||||
*
|
||||
* @param backdropSize
|
||||
*/
|
||||
public boolean isValidBackdropSize(String backdropSize) {
|
||||
if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return backdropSizes.contains(backdropSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the profile size is valid
|
||||
*
|
||||
* @param profileSize
|
||||
*/
|
||||
public boolean isValidProfileSize(String profileSize) {
|
||||
if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return profileSizes.contains(profileSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the logo size is valid
|
||||
*
|
||||
* @param logoSize
|
||||
*/
|
||||
public boolean isValidLogoSize(String logoSize) {
|
||||
if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return logoSizes.contains(logoSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the size is valid for any of the images types
|
||||
*
|
||||
* @param sizeToCheck
|
||||
*/
|
||||
public boolean isValidSize(String sizeToCheck) {
|
||||
return (isValidPosterSize(sizeToCheck)
|
||||
|| isValidBackdropSize(sizeToCheck)
|
||||
|| isValidProfileSize(sizeToCheck)
|
||||
|| isValidLogoSize(sizeToCheck));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ImageConfiguration=");
|
||||
sb.append("[baseUrl=").append(baseUrl);
|
||||
sb.append("],[posterSizes=").append(posterSizes.toString());
|
||||
sb.append("],[backdropSizes=").append(backdropSizes.toString());
|
||||
sb.append("],[profileSizes=").append(profileSizes.toString());
|
||||
sb.append("],[logoSizes=").append(logoSizes.toString());
|
||||
sb.append(("]]"));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TokenAuthorisation {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TokenAuthorisation.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("expires_at")
|
||||
private String expires;
|
||||
@JsonProperty("request_token")
|
||||
private String requestToken;
|
||||
@JsonProperty("success")
|
||||
private Boolean success;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getExpires() {
|
||||
return expires;
|
||||
}
|
||||
|
||||
public String getRequestToken() {
|
||||
return requestToken;
|
||||
}
|
||||
|
||||
public Boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setExpires(String expires) {
|
||||
this.expires = expires;
|
||||
}
|
||||
|
||||
public void setRequestToken(String requestToken) {
|
||||
this.requestToken = requestToken;
|
||||
}
|
||||
|
||||
public void setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TokenAuthorisation{" + "expires=" + expires + ", requestToken=" + requestToken + ", success=" + success + '}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TokenSession {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TokenSession.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("session_id")
|
||||
private String sessionId;
|
||||
@JsonProperty("success")
|
||||
private Boolean success;
|
||||
@JsonProperty("status_code")
|
||||
private String statusCode;
|
||||
@JsonProperty("status_message")
|
||||
private String statusMessage;
|
||||
@JsonProperty("guest_session_id")
|
||||
private String guestSessionId;
|
||||
@JsonProperty("expires_at")
|
||||
private String expiresAt;
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public Boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public String getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public String getStatusMessage() {
|
||||
return statusMessage;
|
||||
}
|
||||
|
||||
public String getGuestSessionId() {
|
||||
return guestSessionId;
|
||||
}
|
||||
|
||||
public String getExpiresAt() {
|
||||
return expiresAt;
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public void setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public void setStatusCode(String statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
public void setStatusMessage(String statusMessage) {
|
||||
this.statusMessage = statusMessage;
|
||||
}
|
||||
|
||||
public void setGuestSessionId(String guestSessionId) {
|
||||
this.guestSessionId = guestSessionId;
|
||||
}
|
||||
|
||||
public void setExpiresAt(String expiresAt) {
|
||||
this.expiresAt = expiresAt;
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TokenSession{" + "sessionId=" + sessionId + ", success=" + success + ", statusCode=" + statusCode + ", statusMessage=" + statusMessage + ", guestSessionId=" + guestSessionId + ", expiresAt=" + expiresAt + '}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class Trailer implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Trailer.class);
|
||||
/*
|
||||
* Website sources
|
||||
*/
|
||||
public static final String WEBSITE_YOUTUBE = "youtube";
|
||||
public static final String WEBSITE_QUICKTIME = "quicktime";
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
private String name;
|
||||
private String size;
|
||||
private String source;
|
||||
private String website; // The website of the trailer
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public String getWebsite() {
|
||||
return website;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setSize(String size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public void setWebsite(String website) {
|
||||
this.website = website;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Trailer other = (Trailer) obj;
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.size == null) ? (other.size != null) : !this.size.equals(other.size)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.source == null) ? (other.source != null) : !this.source.equals(other.source)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 61 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
hash = 61 * hash + (this.size != null ? this.size.hashCode() : 0);
|
||||
hash = 61 * hash + (this.source != null ? this.source.hashCode() : 0);
|
||||
hash = 61 * hash + (this.website != null ? this.website.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Trailer=");
|
||||
sb.append("name=").append(name);
|
||||
sb.append("],[size=").append(size);
|
||||
sb.append("],[source=").append(source);
|
||||
sb.append("],[website=").append(website);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class Translation implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Translation.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("english_name")
|
||||
private String englishName;
|
||||
@JsonProperty("iso_639_1")
|
||||
private String isoCode;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public String getEnglishName() {
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public String getIsoCode() {
|
||||
return isoCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setEnglishName(String englishName) {
|
||||
this.englishName = englishName;
|
||||
}
|
||||
|
||||
public void setIsoCode(String isoCode) {
|
||||
this.isoCode = isoCode;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Translation other = (Translation) obj;
|
||||
if ((this.englishName == null) ? (other.englishName != null) : !this.englishName.equals(other.englishName)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 29 * hash + (this.englishName != null ? this.englishName.hashCode() : 0);
|
||||
hash = 29 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
||||
hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[Translation=");
|
||||
sb.append("[englishName=").append(englishName);
|
||||
sb.append("],[isoCode=").append(isoCode);
|
||||
sb.append("],[name=").append(name);
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.tools;
|
||||
|
||||
import com.omertron.themoviedbapi.TheMovieDbApi;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The API URL that is used to construct the API call
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class ApiUrl {
|
||||
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ApiUrl.class);
|
||||
/*
|
||||
* TheMovieDbApi API Base URL
|
||||
*/
|
||||
private static final String TMDB_API_BASE = "http://api.themoviedb.org/3/";
|
||||
/*
|
||||
* Parameter configuration
|
||||
*/
|
||||
private static final String DELIMITER_FIRST = "?";
|
||||
private static final String DELIMITER_SUBSEQUENT = "&";
|
||||
private static final String DEFAULT_STRING = "";
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
private TheMovieDbApi tmdb;
|
||||
private String method;
|
||||
private String submethod;
|
||||
private Map<String, String> arguments = new HashMap<String, String>();
|
||||
/*
|
||||
* API Parameters
|
||||
*/
|
||||
public static final String PARAM_ADULT = "include_adult=";
|
||||
public static final String PARAM_API_KEY = "api_key=";
|
||||
public static final String PARAM_COUNTRY = "country=";
|
||||
public static final String PARAM_FAVORITE = "favorite=";
|
||||
public static final String PARAM_ID = "id=";
|
||||
public static final String PARAM_LANGUAGE = "language=";
|
||||
public static final String PARAM_INCLUDE_ALL_MOVIES = "include_all_movies=";
|
||||
// public static final String PARAM_MOVIE_ID = "movie_id=";
|
||||
public static final String PARAM_MOVIE_WATCHLIST = "movie_watchlist=";
|
||||
public static final String PARAM_PAGE = "page=";
|
||||
public static final String PARAM_QUERY = "query=";
|
||||
public static final String PARAM_SESSION = "session_id=";
|
||||
public static final String PARAM_TOKEN = "request_token=";
|
||||
public static final String PARAM_VALUE = "value=";
|
||||
public static final String PARAM_YEAR = "year=";
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Constructor Methods">
|
||||
/**
|
||||
* Constructor for the simple API URL method without a sub-method
|
||||
*
|
||||
* @param method
|
||||
*/
|
||||
public ApiUrl(TheMovieDbApi tmdb, String method) {
|
||||
this.tmdb = tmdb;
|
||||
this.method = method;
|
||||
this.submethod = DEFAULT_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the API URL with a sub-method
|
||||
*
|
||||
* @param method
|
||||
* @param submethod
|
||||
*/
|
||||
public ApiUrl(TheMovieDbApi tmdb, String method, String submethod) {
|
||||
this.tmdb = tmdb;
|
||||
this.method = method;
|
||||
this.submethod = submethod;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Build the URL from the pre-created arguments.
|
||||
*/
|
||||
public URL buildUrl() {
|
||||
StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
|
||||
|
||||
// Get the start of the URL
|
||||
urlString.append(method);
|
||||
|
||||
// We have either a queury, or a direct request
|
||||
if (arguments.containsKey(PARAM_QUERY)) {
|
||||
// Append the suffix of the API URL
|
||||
urlString.append(submethod);
|
||||
|
||||
// Append the key information
|
||||
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
|
||||
urlString.append(tmdb.getApiKey());
|
||||
|
||||
// Append the search term
|
||||
urlString.append(DELIMITER_SUBSEQUENT);
|
||||
urlString.append(PARAM_QUERY);
|
||||
|
||||
String query = arguments.get(PARAM_QUERY);
|
||||
|
||||
try {
|
||||
urlString.append(URLEncoder.encode(query, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
LOG.trace("Unable to encode query: '" + query + "' trying raw.");
|
||||
// If we can't encode it, try it raw
|
||||
urlString.append(query);
|
||||
}
|
||||
|
||||
arguments.remove(PARAM_QUERY);
|
||||
} else {
|
||||
// Append the ID if provided
|
||||
if (arguments.containsKey(PARAM_ID)) {
|
||||
urlString.append(arguments.get(PARAM_ID));
|
||||
arguments.remove(PARAM_ID);
|
||||
}
|
||||
|
||||
// Append the suffix of the API URL
|
||||
urlString.append(submethod);
|
||||
|
||||
// Append the key information
|
||||
urlString.append(DELIMITER_FIRST).append(PARAM_API_KEY);
|
||||
urlString.append(tmdb.getApiKey());
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> argEntry : arguments.entrySet()) {
|
||||
urlString.append(DELIMITER_SUBSEQUENT).append(argEntry.getKey());
|
||||
urlString.append(argEntry.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
LOG.trace("URL: {}", urlString.toString());
|
||||
return new URL(urlString.toString());
|
||||
} catch (MalformedURLException ex) {
|
||||
LOG.warn("Failed to create URL {} - {}", urlString.toString(), ex.toString());
|
||||
return null;
|
||||
} finally {
|
||||
arguments.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add arguments individually
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public void addArgument(String key, String value) {
|
||||
arguments.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add arguments individually
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public void addArgument(String key, int value) {
|
||||
arguments.put(key, Integer.toString(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add arguments individually
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public void addArgument(String key, boolean value) {
|
||||
arguments.put(key, Boolean.toString(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the arguments
|
||||
*/
|
||||
public void clearArguments() {
|
||||
arguments.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the arguments directly
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public void setArguments(Map<String, String> args) {
|
||||
arguments.putAll(args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.tools;
|
||||
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.StringWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Web browser with simple cookies support
|
||||
*/
|
||||
public final class WebBrowser {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WebBrowser.class);
|
||||
private static Map<String, String> browserProperties = new HashMap<String, String>();
|
||||
private static Map<String, Map<String, String>> cookies = new HashMap<String, Map<String, String>>();
|
||||
private static String proxyHost = null;
|
||||
private static String proxyPort = null;
|
||||
private static String proxyUsername = null;
|
||||
private static String proxyPassword = null;
|
||||
private static String proxyEncodedPassword = null;
|
||||
private static int webTimeoutConnect = 25000; // 25 second timeout
|
||||
private static int webTimeoutRead = 90000; // 90 second timeout
|
||||
|
||||
// Hide the constructor
|
||||
protected WebBrowser() {
|
||||
// prevents calls from subclass
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the browser properties
|
||||
*/
|
||||
private static void populateBrowserProperties() {
|
||||
if (browserProperties.isEmpty()) {
|
||||
browserProperties.put("User-Agent", "Mozilla/5.25 Netscape/5.0 (Windows; I; Win95)");
|
||||
browserProperties.put("Accept", "application/json");
|
||||
}
|
||||
}
|
||||
|
||||
public static String request(String url) throws MovieDbException {
|
||||
try {
|
||||
return request(new URL(url));
|
||||
} catch (MalformedURLException ex) {
|
||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static URLConnection openProxiedConnection(URL url) throws MovieDbException {
|
||||
try {
|
||||
if (proxyHost != null) {
|
||||
System.getProperties().put("proxySet", "true");
|
||||
System.getProperties().put("proxyHost", proxyHost);
|
||||
System.getProperties().put("proxyPort", proxyPort);
|
||||
}
|
||||
|
||||
URLConnection cnx = url.openConnection();
|
||||
|
||||
if (proxyUsername != null) {
|
||||
cnx.setRequestProperty("Proxy-Authorization", proxyEncodedPassword);
|
||||
}
|
||||
|
||||
return cnx;
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.INVALID_URL, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static String request(URL url) throws MovieDbException {
|
||||
StringWriter content = null;
|
||||
|
||||
try {
|
||||
content = new StringWriter();
|
||||
|
||||
BufferedReader in = null;
|
||||
URLConnection cnx = null;
|
||||
try {
|
||||
cnx = openProxiedConnection(url);
|
||||
|
||||
sendHeader(cnx);
|
||||
readHeader(cnx);
|
||||
|
||||
in = new BufferedReader(new InputStreamReader(cnx.getInputStream(), getCharset(cnx)));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
content.write(line);
|
||||
}
|
||||
} finally {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
|
||||
if (cnx instanceof HttpURLConnection) {
|
||||
((HttpURLConnection) cnx).disconnect();
|
||||
}
|
||||
}
|
||||
return content.toString();
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(MovieDbException.MovieDbExceptionType.CONNECTION_ERROR, null, ex);
|
||||
} finally {
|
||||
if (content != null) {
|
||||
try {
|
||||
content.close();
|
||||
} catch (IOException ex) {
|
||||
LOG.debug("Failed to close connection: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendHeader(URLConnection cnx) {
|
||||
populateBrowserProperties();
|
||||
|
||||
// send browser properties
|
||||
for (Map.Entry<String, String> browserProperty : browserProperties.entrySet()) {
|
||||
cnx.setRequestProperty(browserProperty.getKey(), browserProperty.getValue());
|
||||
}
|
||||
// send cookies
|
||||
String cookieHeader = createCookieHeader(cnx);
|
||||
if (!cookieHeader.isEmpty()) {
|
||||
cnx.setRequestProperty("Cookie", cookieHeader);
|
||||
}
|
||||
}
|
||||
|
||||
private static String createCookieHeader(URLConnection cnx) {
|
||||
String host = cnx.getURL().getHost();
|
||||
StringBuilder cookiesHeader = new StringBuilder();
|
||||
for (Map.Entry<String, Map<String, String>> domainCookies : cookies.entrySet()) {
|
||||
if (host.endsWith(domainCookies.getKey())) {
|
||||
for (Map.Entry<String, String> cookie : domainCookies.getValue().entrySet()) {
|
||||
cookiesHeader.append(cookie.getKey());
|
||||
cookiesHeader.append("=");
|
||||
cookiesHeader.append(cookie.getValue());
|
||||
cookiesHeader.append(";");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cookiesHeader.length() > 0) {
|
||||
// remove last ; char
|
||||
cookiesHeader.deleteCharAt(cookiesHeader.length() - 1);
|
||||
}
|
||||
return cookiesHeader.toString();
|
||||
}
|
||||
|
||||
private static void readHeader(URLConnection cnx) {
|
||||
// read new cookies and update our cookies
|
||||
for (Map.Entry<String, List<String>> header : cnx.getHeaderFields().entrySet()) {
|
||||
if ("Set-Cookie".equals(header.getKey())) {
|
||||
for (String cookieHeader : header.getValue()) {
|
||||
String[] cookieElements = cookieHeader.split(" *; *");
|
||||
if (cookieElements.length >= 1) {
|
||||
String[] firstElem = cookieElements[0].split(" *= *");
|
||||
String cookieName = firstElem[0];
|
||||
String cookieValue = firstElem.length > 1 ? firstElem[1] : null;
|
||||
String cookieDomain = null;
|
||||
// find cookie domain
|
||||
for (int i = 1; i < cookieElements.length; i++) {
|
||||
String[] cookieElement = cookieElements[i].split(" *= *");
|
||||
if ("domain".equals(cookieElement[0])) {
|
||||
cookieDomain = cookieElement.length > 1 ? cookieElement[1] : null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cookieDomain == null) {
|
||||
// if domain isn't set take current host
|
||||
cookieDomain = cnx.getURL().getHost();
|
||||
}
|
||||
Map<String, String> domainCookies = cookies.get(cookieDomain);
|
||||
if (domainCookies == null) {
|
||||
domainCookies = new HashMap<String, String>();
|
||||
cookies.put(cookieDomain, domainCookies);
|
||||
}
|
||||
// add or replace cookie
|
||||
domainCookies.put(cookieName, cookieValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Charset getCharset(URLConnection cnx) {
|
||||
Charset charset = null;
|
||||
// content type will be string like "text/html; charset=UTF-8" or "text/html"
|
||||
String contentType = cnx.getContentType();
|
||||
if (contentType != null) {
|
||||
// changed 'charset' to 'harset' in regexp because some sites send 'Charset'
|
||||
Matcher m = Pattern.compile("harset *=[ '\"]*([^ ;'\"]+)[ ;'\"]*").matcher(contentType);
|
||||
if (m.find()) {
|
||||
String encoding = m.group(1);
|
||||
try {
|
||||
charset = Charset.forName(encoding);
|
||||
} catch (UnsupportedCharsetException e) {
|
||||
// there will be used default charset
|
||||
}
|
||||
}
|
||||
}
|
||||
if (charset == null) {
|
||||
charset = Charset.defaultCharset();
|
||||
}
|
||||
|
||||
return charset;
|
||||
}
|
||||
|
||||
public static String getProxyHost() {
|
||||
return proxyHost;
|
||||
}
|
||||
|
||||
public static void setProxyHost(String myProxyHost) {
|
||||
WebBrowser.proxyHost = myProxyHost;
|
||||
}
|
||||
|
||||
public static String getProxyPort() {
|
||||
return proxyPort;
|
||||
}
|
||||
|
||||
public static void setProxyPort(String myProxyPort) {
|
||||
WebBrowser.proxyPort = myProxyPort;
|
||||
}
|
||||
|
||||
public static String getProxyUsername() {
|
||||
return proxyUsername;
|
||||
}
|
||||
|
||||
public static void setProxyUsername(String myProxyUsername) {
|
||||
WebBrowser.proxyUsername = myProxyUsername;
|
||||
}
|
||||
|
||||
public static String getProxyPassword() {
|
||||
return proxyPassword;
|
||||
}
|
||||
|
||||
public static void setProxyPassword(String myProxyPassword) {
|
||||
WebBrowser.proxyPassword = myProxyPassword;
|
||||
|
||||
if (proxyUsername != null) {
|
||||
proxyEncodedPassword = proxyUsername + ":" + proxyPassword;
|
||||
proxyEncodedPassword = "Basic " + new String(Base64.encodeBase64((proxyUsername + ":" + proxyPassword).getBytes()));
|
||||
}
|
||||
}
|
||||
|
||||
public static int getWebTimeoutConnect() {
|
||||
return webTimeoutConnect;
|
||||
}
|
||||
|
||||
public static int getWebTimeoutRead() {
|
||||
return webTimeoutRead;
|
||||
}
|
||||
|
||||
public static void setWebTimeoutConnect(int webTimeoutConnect) {
|
||||
WebBrowser.webTimeoutConnect = webTimeoutConnect;
|
||||
}
|
||||
|
||||
public static void setWebTimeoutRead(int webTimeoutRead) {
|
||||
WebBrowser.webTimeoutRead = webTimeoutRead;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.AlternativeTitle;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperAlternativeTitles {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WrapperAlternativeTitles.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("titles")
|
||||
private List<AlternativeTitle> titles;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<AlternativeTitle> getTitles() {
|
||||
return titles;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setTitles(List<AlternativeTitle> titles) {
|
||||
this.titles = titles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
/**
|
||||
* Base class for the wrappers
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperBase {
|
||||
/*
|
||||
* Logger - set by the sub-classes
|
||||
*/
|
||||
|
||||
private Logger log;
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("page")
|
||||
private int page;
|
||||
@JsonProperty("total_pages")
|
||||
private int totalPages;
|
||||
@JsonProperty("total_results")
|
||||
private int totalResults;
|
||||
|
||||
public WrapperBase(Logger logger) {
|
||||
this.log = logger;
|
||||
}
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public int getTotalPages() {
|
||||
return totalPages;
|
||||
}
|
||||
|
||||
public int getTotalResults() {
|
||||
return totalResults;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public void setTotalPages(int totalPages) {
|
||||
this.totalPages = totalPages;
|
||||
}
|
||||
|
||||
public void setTotalResults(int totalResults) {
|
||||
this.totalResults = totalResults;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
log.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.MovieChanges;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperChanges {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WrapperChanges.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("changes")
|
||||
private List<MovieChanges> changes;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public List<MovieChanges> getChanges() {
|
||||
return changes;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setChanges(List<MovieChanges> changes) {
|
||||
this.changes = changes;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Collection;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperCollection extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("results")
|
||||
private List<Collection> results;
|
||||
|
||||
public WrapperCollection() {
|
||||
super(LoggerFactory.getLogger(WrapperCollection.class));
|
||||
}
|
||||
|
||||
public List<Collection> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<Collection> results) {
|
||||
this.results = results;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Company;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperCompany extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("results")
|
||||
private List<Company> results;
|
||||
|
||||
public WrapperCompany() {
|
||||
super(LoggerFactory.getLogger(WrapperCompany.class));
|
||||
}
|
||||
|
||||
public List<Company> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<Company> results) {
|
||||
this.results = results;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperCompanyMovies extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("results")
|
||||
private List<MovieDb> results;
|
||||
|
||||
public WrapperCompanyMovies() {
|
||||
super(LoggerFactory.getLogger(WrapperCompanyMovies.class));
|
||||
}
|
||||
|
||||
public List<MovieDb> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<MovieDb> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ResultList=[");
|
||||
sb.append("[companyId=").append(getId());
|
||||
sb.append("],[page=").append(getPage());
|
||||
sb.append("],[pageResults=").append(getResults().size());
|
||||
sb.append("],[totalPages=").append(getTotalPages());
|
||||
sb.append("],[totalResults=").append(getTotalResults());
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.TmdbConfiguration;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperConfig {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WrapperConfig.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("images")
|
||||
private TmdbConfiguration tmdbConfiguration;
|
||||
@JsonProperty("change_keys")
|
||||
private List<String> changeKeys = Collections.EMPTY_LIST;
|
||||
|
||||
public TmdbConfiguration getTmdbConfiguration() {
|
||||
return tmdbConfiguration;
|
||||
}
|
||||
|
||||
public void setTmdbConfiguration(TmdbConfiguration tmdbConfiguration) {
|
||||
this.tmdbConfiguration = tmdbConfiguration;
|
||||
}
|
||||
|
||||
public List<String> getChangeKeys() {
|
||||
return changeKeys;
|
||||
}
|
||||
|
||||
public void setChangeKeys(List<String> changeKeys) {
|
||||
this.changeKeys = changeKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Genre;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Wrapper class for the Genres searches
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperGenres {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WrapperGenres.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("genres")
|
||||
private List<Genre> genres;
|
||||
|
||||
public List<Genre> getGenres() {
|
||||
return genres;
|
||||
}
|
||||
|
||||
public void setGenres(List<Genre> genres) {
|
||||
this.genres = genres;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Artwork;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperImages extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("backdrops")
|
||||
private List<Artwork> backdrops;
|
||||
@JsonProperty("posters")
|
||||
private List<Artwork> posters;
|
||||
@JsonProperty("profiles")
|
||||
private List<Artwork> profiles;
|
||||
|
||||
public WrapperImages() {
|
||||
super(LoggerFactory.getLogger(WrapperImages.class));
|
||||
}
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public List<Artwork> getBackdrops() {
|
||||
return backdrops;
|
||||
}
|
||||
|
||||
public List<Artwork> getPosters() {
|
||||
return posters;
|
||||
}
|
||||
|
||||
public List<Artwork> getProfiles() {
|
||||
return profiles;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setBackdrops(List<Artwork> backdrops) {
|
||||
this.backdrops = backdrops;
|
||||
}
|
||||
|
||||
public void setPosters(List<Artwork> posters) {
|
||||
this.posters = posters;
|
||||
}
|
||||
|
||||
public void setProfiles(List<Artwork> profiles) {
|
||||
this.profiles = profiles;
|
||||
}
|
||||
//</editor-fold>
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.KeywordMovie;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperKeywordMovies extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("results")
|
||||
private List<KeywordMovie> results;
|
||||
|
||||
public WrapperKeywordMovies() {
|
||||
super(LoggerFactory.getLogger(WrapperKeywordMovies.class));
|
||||
}
|
||||
|
||||
public List<KeywordMovie> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<KeywordMovie> results) {
|
||||
this.results = results;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Keyword;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperKeywords extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("results")
|
||||
private List<Keyword> results;
|
||||
|
||||
public WrapperKeywords() {
|
||||
super(LoggerFactory.getLogger(WrapperKeywords.class));
|
||||
}
|
||||
|
||||
public List<Keyword> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<Keyword> results) {
|
||||
this.results = results;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperMovie extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("results")
|
||||
private List<MovieDb> movies;
|
||||
|
||||
public WrapperMovie() {
|
||||
super(LoggerFactory.getLogger(WrapperMovie.class));
|
||||
}
|
||||
|
||||
public List<MovieDb> getMovies() {
|
||||
return movies;
|
||||
}
|
||||
|
||||
public void setMovies(List<MovieDb> movies) {
|
||||
this.movies = movies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ResultList=[");
|
||||
sb.append("[page=").append(getPage());
|
||||
sb.append("],[pageResults=").append(getMovies().size());
|
||||
sb.append("],[totalPages=").append(getTotalPages());
|
||||
sb.append("],[totalResults=").append(getTotalResults());
|
||||
sb.append("],[id=").append(getId());
|
||||
sb.append("]]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.PersonCast;
|
||||
import com.omertron.themoviedbapi.model.PersonCrew;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperMovieCasts {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieCasts.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("cast")
|
||||
private List<PersonCast> cast;
|
||||
@JsonProperty("crew")
|
||||
private List<PersonCrew> crew;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public List<PersonCast> getCast() {
|
||||
return cast;
|
||||
}
|
||||
|
||||
public List<PersonCrew> getCrew() {
|
||||
return crew;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCast(List<PersonCast> cast) {
|
||||
this.cast = cast;
|
||||
}
|
||||
|
||||
public void setCrew(List<PersonCrew> crew) {
|
||||
this.crew = crew;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Keyword;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperMovieKeywords {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WrapperMovieKeywords.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("keywords")
|
||||
private List<Keyword> keywords;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<Keyword> getKeywords() {
|
||||
return keywords;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setKeywords(List<Keyword> keywords) {
|
||||
this.keywords = keywords;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.MovieList;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperMovieList extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("results")
|
||||
private List<MovieList> movieList;
|
||||
|
||||
public WrapperMovieList() {
|
||||
super(LoggerFactory.getLogger(WrapperMovieList.class));
|
||||
}
|
||||
|
||||
public List<MovieList> getMovieList() {
|
||||
return movieList;
|
||||
}
|
||||
|
||||
public void setMovieList(List<MovieList> movieList) {
|
||||
this.movieList = movieList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Person;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperPerson extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("results")
|
||||
private List<Person> results;
|
||||
|
||||
public WrapperPerson() {
|
||||
super(LoggerFactory.getLogger(WrapperPerson.class));
|
||||
}
|
||||
|
||||
public List<Person> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<Person> results) {
|
||||
this.results = results;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.PersonCredit;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class WrapperPersonCredits extends WrapperBase {
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
|
||||
@JsonProperty("cast")
|
||||
private List<PersonCredit> cast;
|
||||
@JsonProperty("crew")
|
||||
private List<PersonCredit> crew;
|
||||
|
||||
public WrapperPersonCredits() {
|
||||
super(LoggerFactory.getLogger(WrapperMovieCasts.class));
|
||||
}
|
||||
|
||||
public List<PersonCredit> getCast() {
|
||||
return cast;
|
||||
}
|
||||
|
||||
public void setCast(List<PersonCredit> cast) {
|
||||
this.cast = cast;
|
||||
}
|
||||
|
||||
public List<PersonCredit> getCrew() {
|
||||
return crew;
|
||||
}
|
||||
|
||||
public void setCrew(List<PersonCredit> crew) {
|
||||
this.crew = crew;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.ReleaseInfo;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperReleaseInfo {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WrapperReleaseInfo.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("countries")
|
||||
private List<ReleaseInfo> countries;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public List<ReleaseInfo> getCountries() {
|
||||
return countries;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setCountries(List<ReleaseInfo> countries) {
|
||||
this.countries = countries;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Trailer;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperTrailers {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WrapperTrailers.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("quicktime")
|
||||
private List<Trailer> quicktime;
|
||||
@JsonProperty("youtube")
|
||||
private List<Trailer> youtube;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<Trailer> getQuicktime() {
|
||||
return quicktime;
|
||||
}
|
||||
|
||||
public List<Trailer> getYoutube() {
|
||||
return youtube;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setQuicktime(List<Trailer> quicktime) {
|
||||
this.quicktime = quicktime;
|
||||
}
|
||||
|
||||
public void setYoutube(List<Trailer> youtube) {
|
||||
this.youtube = youtube;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.Translation;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart
|
||||
*/
|
||||
public class WrapperTranslations {
|
||||
/*
|
||||
* Logger
|
||||
*/
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WrapperTranslations.class);
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("translations")
|
||||
private List<Translation> translations;
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setTranslations(List<Translation> translations) {
|
||||
this.translations = translations;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<Translation> getTranslations() {
|
||||
return translations;
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Handle unknown properties and print a message
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@JsonAnySetter
|
||||
public void handleUnknown(String key, Object value) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Unknown property: '").append(key);
|
||||
sb.append("' value: '").append(value).append("'");
|
||||
LOG.trace(sb.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>${distribution.format}</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<!-- add version.txt file -->
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<outputDirectory></outputDirectory>
|
||||
<includes>
|
||||
<include>version.txt</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<!-- add readme.txt file -->
|
||||
<fileSet>
|
||||
<directory>${basedir}</directory>
|
||||
<outputDirectory></outputDirectory>
|
||||
<includes>
|
||||
<include>readme.txt</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<!-- add jar files -->
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<outputDirectory></outputDirectory>
|
||||
<includes>
|
||||
<include>**/*.jar</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
</fileSets>
|
||||
|
||||
</assembly>
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of the FanartTV API.
|
||||
*
|
||||
* The FanartTV API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* The FanartTV API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the FanartTV API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.LogManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TestLogger {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TestLogger.class);
|
||||
private static final String CRLF = "\n";
|
||||
|
||||
private TestLogger() {
|
||||
throw new UnsupportedOperationException("Class can not be instantiated");
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the logger with a simple in-memory file for the required log level
|
||||
*
|
||||
* @param level The logging level required
|
||||
* @return True if successful
|
||||
*/
|
||||
public static boolean Configure(String level) {
|
||||
StringBuilder config = new StringBuilder("handlers = java.util.logging.ConsoleHandler\n");
|
||||
config.append(".level = ").append(level).append(CRLF);
|
||||
config.append("java.util.logging.ConsoleHandler.level = ").append(level).append(CRLF);
|
||||
// Only works with Java 7 or later
|
||||
config.append("java.util.logging.SimpleFormatter.format = [%1$tc %4$s] %2$s - %5$s %6$s%n").append(CRLF);
|
||||
// Exclude http logging
|
||||
config.append("sun.net.www.protocol.http.HttpURLConnection.level = OFF").append(CRLF);
|
||||
|
||||
InputStream ins = new ByteArrayInputStream(config.toString().getBytes());
|
||||
try {
|
||||
LogManager.getLogManager().readConfiguration(ins);
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Failed to configure log manager due to an IO problem", e);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
LOG.debug("Logger initialized to '{}' level", level);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the logging level to "ALL"
|
||||
*
|
||||
* @return True if successful
|
||||
*/
|
||||
public static boolean Configure() {
|
||||
return Configure("ALL");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,665 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2013 Stuart Boston
|
||||
*
|
||||
* This file is part of TheMovieDB API.
|
||||
*
|
||||
* TheMovieDB API is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* TheMovieDB API is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.omertron.themoviedbapi;
|
||||
|
||||
import com.omertron.themoviedbapi.model.AlternativeTitle;
|
||||
import com.omertron.themoviedbapi.model.Artwork;
|
||||
import com.omertron.themoviedbapi.model.Collection;
|
||||
import com.omertron.themoviedbapi.model.CollectionInfo;
|
||||
import com.omertron.themoviedbapi.model.Company;
|
||||
import com.omertron.themoviedbapi.model.Genre;
|
||||
import com.omertron.themoviedbapi.model.Keyword;
|
||||
import com.omertron.themoviedbapi.model.KeywordMovie;
|
||||
import com.omertron.themoviedbapi.model.MovieChanges;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import com.omertron.themoviedbapi.model.MovieDbList;
|
||||
import com.omertron.themoviedbapi.model.MovieList;
|
||||
import com.omertron.themoviedbapi.model.Person;
|
||||
import com.omertron.themoviedbapi.model.PersonCredit;
|
||||
import com.omertron.themoviedbapi.model.ReleaseInfo;
|
||||
import com.omertron.themoviedbapi.model.TmdbConfiguration;
|
||||
import com.omertron.themoviedbapi.model.TokenAuthorisation;
|
||||
import com.omertron.themoviedbapi.model.TokenSession;
|
||||
import com.omertron.themoviedbapi.model.Trailer;
|
||||
import com.omertron.themoviedbapi.model.Translation;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Test cases for TheMovieDbApi API
|
||||
*
|
||||
* @author stuart.boston
|
||||
*/
|
||||
public class TheMovieDbApiTest {
|
||||
|
||||
// Logger
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TheMovieDbApiTest.class);
|
||||
// API Key
|
||||
private static final String API_KEY = "5a1a77e2eba8984804586122754f969f";
|
||||
private static TheMovieDbApi tmdb;
|
||||
// Test data
|
||||
private static final int ID_MOVIE_BLADE_RUNNER = 78;
|
||||
private static final int ID_MOVIE_STAR_WARS_COLLECTION = 10;
|
||||
private static final int ID_PERSON_BRUCE_WILLIS = 62;
|
||||
private static final int ID_COMPANY_LUCASFILM = 1;
|
||||
private static final String COMPANY_NAME = "Marvel Studios";
|
||||
private static final int ID_GENRE_ACTION = 28;
|
||||
private static final String ID_KEYWORD = "1721";
|
||||
// Languages
|
||||
private static final String LANGUAGE_DEFAULT = "";
|
||||
private static final String LANGUAGE_ENGLISH = "en";
|
||||
private static final String LANGUAGE_RUSSIAN = "ru";
|
||||
|
||||
public TheMovieDbApiTest() throws MovieDbException {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
tmdb = new TheMovieDbApi(API_KEY);
|
||||
TestLogger.Configure();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() throws Exception {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getConfiguration method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testConfiguration() throws IOException {
|
||||
LOG.info("Test Configuration");
|
||||
|
||||
TmdbConfiguration tmdbConfig = tmdb.getConfiguration();
|
||||
assertNotNull("Configuration failed", tmdbConfig);
|
||||
assertTrue("No base URL", StringUtils.isNotBlank(tmdbConfig.getBaseUrl()));
|
||||
assertTrue("No backdrop sizes", tmdbConfig.getBackdropSizes().size() > 0);
|
||||
assertTrue("No poster sizes", tmdbConfig.getPosterSizes().size() > 0);
|
||||
assertTrue("No profile sizes", tmdbConfig.getProfileSizes().size() > 0);
|
||||
LOG.info(tmdbConfig.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchMovie method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchMovie() throws MovieDbException {
|
||||
LOG.info("searchMovie");
|
||||
|
||||
// Try a movie with less than 1 page of results
|
||||
List<MovieDb> movieList = tmdb.searchMovie("Blade Runner", 0, "", true, 0);
|
||||
// List<MovieDb> movieList = tmdb.searchMovie("Blade Runner", "", true);
|
||||
assertTrue("No movies found, should be at least 1", movieList.size() > 0);
|
||||
|
||||
// Try a russian langugage movie
|
||||
movieList = tmdb.searchMovie("О чём говорят мужчины", 0, LANGUAGE_RUSSIAN, true, 0);
|
||||
assertTrue("No 'RU' movies found, should be at least 1", movieList.size() > 0);
|
||||
|
||||
// Try a movie with more than 20 results
|
||||
movieList = tmdb.searchMovie("Star Wars", 0, LANGUAGE_ENGLISH, false, 0);
|
||||
assertTrue("Not enough movies found, should be over 15, found " + movieList.size(), movieList.size() >= 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieInfo method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieInfo() throws MovieDbException {
|
||||
LOG.info("getMovieInfo");
|
||||
MovieDb result = tmdb.getMovieInfo(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH);
|
||||
assertEquals("Incorrect movie information", "Blade Runner", result.getOriginalTitle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieAlternativeTitles method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieAlternativeTitles() throws MovieDbException {
|
||||
LOG.info("getMovieAlternativeTitles");
|
||||
String country = "";
|
||||
List<AlternativeTitle> results = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country);
|
||||
assertTrue("No alternative titles found", results.size() > 0);
|
||||
|
||||
country = "US";
|
||||
results = tmdb.getMovieAlternativeTitles(ID_MOVIE_BLADE_RUNNER, country);
|
||||
assertTrue("No alternative titles found", results.size() > 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieCasts method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieCasts() throws MovieDbException {
|
||||
LOG.info("getMovieCasts");
|
||||
List<Person> people = tmdb.getMovieCasts(ID_MOVIE_BLADE_RUNNER);
|
||||
assertTrue("No cast information", people.size() > 0);
|
||||
|
||||
String name1 = "Harrison Ford";
|
||||
String name2 = "Charles Knode";
|
||||
boolean foundName1 = Boolean.FALSE;
|
||||
boolean foundName2 = Boolean.FALSE;
|
||||
|
||||
for (Person person : people) {
|
||||
if (!foundName1 && person.getName().equalsIgnoreCase(name1)) {
|
||||
foundName1 = Boolean.TRUE;
|
||||
}
|
||||
|
||||
if (!foundName2 && person.getName().equalsIgnoreCase(name2)) {
|
||||
foundName2 = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
assertTrue("Couldn't find " + name1, foundName1);
|
||||
assertTrue("Couldn't find " + name2, foundName2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieImages method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieImages() throws MovieDbException {
|
||||
LOG.info("getMovieImages");
|
||||
String language = "";
|
||||
List<Artwork> result = tmdb.getMovieImages(ID_MOVIE_BLADE_RUNNER, language);
|
||||
assertFalse("No artwork found", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieKeywords method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieKeywords() throws MovieDbException {
|
||||
LOG.info("getMovieKeywords");
|
||||
List<Keyword> result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER);
|
||||
assertFalse("No keywords found", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieReleaseInfo method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieReleaseInfo() throws MovieDbException {
|
||||
LOG.info("getMovieReleaseInfo");
|
||||
List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, "");
|
||||
assertFalse("Release information missing", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieTrailers method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieTrailers() throws MovieDbException {
|
||||
LOG.info("getMovieTrailers");
|
||||
List<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
|
||||
assertFalse("Movie trailers missing", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieTranslations method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieTranslations() throws MovieDbException {
|
||||
LOG.info("getMovieTranslations");
|
||||
List<Translation> result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER);
|
||||
assertFalse("No translations found", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getCollectionInfo method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetCollectionInfo() throws MovieDbException {
|
||||
LOG.info("getCollectionInfo");
|
||||
String language = "";
|
||||
CollectionInfo result = tmdb.getCollectionInfo(ID_MOVIE_STAR_WARS_COLLECTION, language);
|
||||
assertFalse("No collection information", result.getParts().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of createImageUrl method, of class TheMovieDbApi.
|
||||
*
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
@Test
|
||||
public void testCreateImageUrl() throws MovieDbException {
|
||||
LOG.info("createImageUrl");
|
||||
MovieDb movie = tmdb.getMovieInfo(ID_MOVIE_BLADE_RUNNER, "");
|
||||
String result = tmdb.createImageUrl(movie.getPosterPath(), "original").toString();
|
||||
assertTrue("Error compiling image URL", !result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieInfoImdb method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMovieInfoImdb() throws MovieDbException {
|
||||
LOG.info("getMovieInfoImdb");
|
||||
MovieDb result = tmdb.getMovieInfoImdb("tt0076759", "en-US");
|
||||
assertTrue("Error getting the movie from IMDB ID", result.getId() == 11);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getApiKey method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetApiKey() {
|
||||
// Not required
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getApiBase method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetApiBase() {
|
||||
// Not required
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getConfiguration method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetConfiguration() {
|
||||
// Not required
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchPeople method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchPeople() throws MovieDbException {
|
||||
LOG.info("searchPeople");
|
||||
String personName = "Bruce Willis";
|
||||
boolean includeAdult = false;
|
||||
List<Person> result = tmdb.searchPeople(personName, includeAdult, 0);
|
||||
assertTrue("Couldn't find the person", result.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonInfo method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPersonInfo() throws MovieDbException {
|
||||
LOG.info("getPersonInfo");
|
||||
Person result = tmdb.getPersonInfo(ID_PERSON_BRUCE_WILLIS);
|
||||
assertTrue("Wrong actor returned", result.getId() == ID_PERSON_BRUCE_WILLIS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonCredits method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPersonCredits() throws MovieDbException {
|
||||
LOG.info("getPersonCredits");
|
||||
|
||||
List<PersonCredit> people = tmdb.getPersonCredits(ID_PERSON_BRUCE_WILLIS);
|
||||
assertTrue("No cast information", people.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonImages method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPersonImages() throws MovieDbException {
|
||||
LOG.info("getPersonImages");
|
||||
|
||||
List<Artwork> artwork = tmdb.getPersonImages(ID_PERSON_BRUCE_WILLIS);
|
||||
assertTrue("No cast information", artwork.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getLatestMovie method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetLatestMovie() throws MovieDbException {
|
||||
LOG.info("getLatestMovie");
|
||||
MovieDb result = tmdb.getLatestMovie();
|
||||
assertTrue("No latest movie found", result != null);
|
||||
assertTrue("No latest movie found", result.getId() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of compareMovies method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testCompareMovies() {
|
||||
// Not required
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of setProxy method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testSetProxy() {
|
||||
// Not required
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of setTimeout method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testSetTimeout() {
|
||||
// Not required
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getNowPlayingMovies method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetNowPlayingMovies() throws MovieDbException {
|
||||
LOG.info("getNowPlayingMovies");
|
||||
List<MovieDb> results = tmdb.getNowPlayingMovies(LANGUAGE_DEFAULT, 0);
|
||||
assertTrue("No now playing movies found", !results.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPopularMovieList method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetPopularMovieList() throws MovieDbException {
|
||||
LOG.info("getPopularMovieList");
|
||||
List<MovieDb> results = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
|
||||
assertTrue("No popular movies found", !results.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getTopRatedMovies method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetTopRatedMovies() throws MovieDbException {
|
||||
LOG.info("getTopRatedMovies");
|
||||
List<MovieDb> results = tmdb.getTopRatedMovies(LANGUAGE_DEFAULT, 0);
|
||||
assertTrue("No top rated movies found", !results.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getCompanyInfo method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetCompanyInfo() throws MovieDbException {
|
||||
LOG.info("getCompanyInfo");
|
||||
Company company = tmdb.getCompanyInfo(ID_COMPANY_LUCASFILM);
|
||||
assertTrue("No company information found", company.getCompanyId() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getCompanyMovies method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetCompanyMovies() throws MovieDbException {
|
||||
LOG.info("getCompanyMovies");
|
||||
List<MovieDb> results = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, LANGUAGE_DEFAULT, 0);
|
||||
assertTrue("No company movies found", !results.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchCompanies method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchCompanies() throws MovieDbException {
|
||||
LOG.info("searchCompanies");
|
||||
List<Company> results = tmdb.searchCompanies(COMPANY_NAME, 0);
|
||||
assertTrue("No company information found", !results.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getSimilarMovies method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetSimilarMovies() throws MovieDbException {
|
||||
LOG.info("getSimilarMovies");
|
||||
List<MovieDb> results = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, LANGUAGE_DEFAULT, 0);
|
||||
assertTrue("No similar movies found", !results.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getGenreList method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetGenreList() throws MovieDbException {
|
||||
LOG.info("getGenreList");
|
||||
List<Genre> results = tmdb.getGenreList(LANGUAGE_DEFAULT);
|
||||
assertTrue("No genres found", !results.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getGenreMovies method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetGenreMovies() throws MovieDbException {
|
||||
LOG.info("getGenreMovies");
|
||||
List<MovieDb> results = tmdb.getGenreMovies(ID_GENRE_ACTION, LANGUAGE_DEFAULT, 0, Boolean.TRUE);
|
||||
assertTrue("No genre movies found", !results.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getUpcoming method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetUpcoming() throws Exception {
|
||||
LOG.info("getUpcoming");
|
||||
List<MovieDb> results = tmdb.getUpcoming(LANGUAGE_DEFAULT, 0);
|
||||
assertTrue("No upcoming movies found", !results.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getCollectionImages method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetCollectionImages() throws Exception {
|
||||
LOG.info("getCollectionImages");
|
||||
List<Artwork> result = tmdb.getCollectionImages(ID_MOVIE_STAR_WARS_COLLECTION, LANGUAGE_DEFAULT);
|
||||
assertFalse("No artwork found", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAuthorisationToken method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAuthorisationToken() throws Exception {
|
||||
LOG.info("getAuthorisationToken");
|
||||
TokenAuthorisation result = tmdb.getAuthorisationToken();
|
||||
assertFalse("Token is null", result == null);
|
||||
assertTrue("Token is not valid", result.getSuccess());
|
||||
LOG.info(result.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getSessionToken method, of class TheMovieDbApi.
|
||||
*
|
||||
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
|
||||
*/
|
||||
public void testGetSessionToken() throws Exception {
|
||||
LOG.info("getSessionToken");
|
||||
TokenAuthorisation token = tmdb.getAuthorisationToken();
|
||||
assertFalse("Token is null", token == null);
|
||||
assertTrue("Token is not valid", token.getSuccess());
|
||||
LOG.info(token.toString());
|
||||
|
||||
TokenSession result = tmdb.getSessionToken(token);
|
||||
assertFalse("Session token is null", result == null);
|
||||
assertTrue("Session token is not valid", result.getSuccess());
|
||||
LOG.info(result.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getGuestSessionToken method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetGuestSessionToken() throws Exception {
|
||||
LOG.info("getGuestSessionToken");
|
||||
TokenSession result = tmdb.getGuestSessionToken();
|
||||
|
||||
assertTrue("Failed to get guest session", result.getSuccess());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMovieLists() throws Exception {
|
||||
LOG.info("getMovieLists");
|
||||
List<MovieList> results = tmdb.getMovieLists(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, 0);
|
||||
assertNotNull("No results found", results);
|
||||
assertTrue("No results found", results.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMovieChanges method,of class TheMovieDbApi
|
||||
*
|
||||
* TODO: Do not test this until it is fixed
|
||||
*/
|
||||
public void testGetMovieChanges() throws Exception {
|
||||
LOG.info("getMovieChanges");
|
||||
|
||||
String startDate = "";
|
||||
String endDate = null;
|
||||
List<MovieChanges> results = Collections.EMPTY_LIST;
|
||||
|
||||
// Get some popular movies
|
||||
List<MovieDb> movieList = tmdb.getPopularMovieList(LANGUAGE_DEFAULT, 0);
|
||||
for (MovieDb movie : movieList) {
|
||||
results = tmdb.getMovieChanges(movie.getId(), startDate, endDate);
|
||||
LOG.info("{} has {} changes.", new Object[]{movie.getTitle(), results.size()});
|
||||
}
|
||||
|
||||
assertNotNull("No results found", results);
|
||||
assertTrue("No results found", results.size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPersonLatest() throws Exception {
|
||||
LOG.info("getPersonLatest");
|
||||
|
||||
Person result = tmdb.getPersonLatest();
|
||||
|
||||
assertNotNull("No results found", result);
|
||||
assertTrue("No results found", StringUtils.isNotBlank(result.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchCollection method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchCollection() throws Exception {
|
||||
LOG.info("searchCollection");
|
||||
String query = "batman";
|
||||
int page = 0;
|
||||
List<Collection> result = tmdb.searchCollection(query, LANGUAGE_DEFAULT, page);
|
||||
assertFalse("No collections found", result == null);
|
||||
assertTrue("No collections found", result.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchList method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchList() throws Exception {
|
||||
LOG.info("searchList");
|
||||
String query = "watch";
|
||||
int page = 0;
|
||||
List result = tmdb.searchList(query, LANGUAGE_DEFAULT, page);
|
||||
assertFalse("No lists found", result == null);
|
||||
assertTrue("No lists found", result.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of searchKeyword method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchKeyword() throws Exception {
|
||||
LOG.info("searchKeyword");
|
||||
String query = "action";
|
||||
int page = 0;
|
||||
List<Keyword> result = tmdb.searchKeyword(query, page);
|
||||
assertFalse("No keywords found", result == null);
|
||||
assertTrue("No keywords found", result.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of postMovieRating method, of class TheMovieDbApi.
|
||||
*
|
||||
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
|
||||
*/
|
||||
public void testPostMovieRating() throws Exception {
|
||||
LOG.info("postMovieRating");
|
||||
String sessionId = "";
|
||||
String rating = "";
|
||||
boolean expResult = false;
|
||||
boolean result = tmdb.postMovieRating(sessionId, rating);
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPersonChanges method, of class TheMovieDbApi.
|
||||
*
|
||||
* TODO: Fix the method before testing
|
||||
*/
|
||||
public void testGetPersonChanges() throws Exception {
|
||||
LOG.info("getPersonChanges");
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
tmdb.getPersonChanges(ID_PERSON_BRUCE_WILLIS, startDate, endDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getList method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetList() throws Exception {
|
||||
LOG.info("getList");
|
||||
String listId = "509ec17b19c2950a0600050d";
|
||||
MovieDbList result = tmdb.getList(listId);
|
||||
assertFalse("List not found", result.getItems().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getKeyword method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetKeyword() throws Exception {
|
||||
LOG.info("getKeyword");
|
||||
Keyword result = tmdb.getKeyword(ID_KEYWORD);
|
||||
assertEquals("fight", result.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getKeywordMovies method, of class TheMovieDbApi.
|
||||
*/
|
||||
@Test
|
||||
public void testGetKeywordMovies() throws Exception {
|
||||
LOG.info("getKeywordMovies");
|
||||
int page = 0;
|
||||
List<KeywordMovie> result = tmdb.getKeywordMovies(ID_KEYWORD, LANGUAGE_DEFAULT, page);
|
||||
assertFalse("No keyword movies found", result.isEmpty());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user