Merge branch 'master' into new-is-app
This commit is contained in:
commit
7ad5bc2395
|
@ -0,0 +1,661 @@
|
||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 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 Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
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 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 work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>apps</artifactId>
|
<artifactId>apps</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>apps</artifactId>
|
<artifactId>apps</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,9 @@ lbs.mail.smtpUser = smtp-dnet
|
||||||
lbs.mail.smtpPassword = hhr*7932
|
lbs.mail.smtpPassword = hhr*7932
|
||||||
lbs.mail.message.template = classpath:/templates/dhp_openaire_mail.st
|
lbs.mail.message.template = classpath:/templates/dhp_openaire_mail.st
|
||||||
lbs.mail.message.template.dashboard.baseUrl = https://provide.openaire.eu/content/notifications/
|
lbs.mail.message.template.dashboard.baseUrl = https://provide.openaire.eu/content/notifications/
|
||||||
lbs.mail.message.template.dashboard.helpdesk = https://www.openaire.eu/support/helpdesk
|
lbs.mail.message.template.dashboard.helpdesk = https://www.openaire.eu/helpdesk
|
||||||
lbs.mail.message.template.publicApi = https://api.openaire.eu/broker
|
lbs.mail.message.template.publicApi = https://api.openaire.eu/broker
|
||||||
|
|
||||||
|
|
||||||
lbs.queues.maxReturnedValues = 1000
|
lbs.queues.maxReturnedValues = 1000
|
||||||
|
|
||||||
lbs.task.deleteOldEvents.cron = 0 0 4 1/1 * ?
|
lbs.task.deleteOldEvents.cron = 0 0 4 1/1 * ?
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>apps</artifactId>
|
<artifactId>apps</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>apps</artifactId>
|
<artifactId>apps</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>apps</artifactId>
|
<artifactId>apps</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -26,6 +26,11 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-cache</artifactId>
|
<artifactId>spring-boot-starter-cache</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
|
<artifactId>dnet-exporter-model</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>eu.dnetlib</groupId>
|
<groupId>eu.dnetlib</groupId>
|
||||||
<artifactId>cnr-rmi-api</artifactId>
|
<artifactId>cnr-rmi-api</artifactId>
|
||||||
|
@ -125,7 +130,7 @@
|
||||||
<artifactId>dnet-datasource-manager-common</artifactId>
|
<artifactId>dnet-datasource-manager-common</artifactId>
|
||||||
<version>[2.0.1,3.0.0)</version>
|
<version>[2.0.1,3.0.0)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
|
|
@ -1,29 +1,18 @@
|
||||||
package eu.dnetlib;
|
package eu.dnetlib;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.cache.CacheManagerCustomizer;
|
import org.springframework.boot.autoconfigure.cache.CacheManagerCustomizer;
|
||||||
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
|
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import static java.util.Arrays.asList;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CacheCustomizer implements CacheManagerCustomizer<ConcurrentMapCacheManager> {
|
public class CacheCustomizer implements CacheManagerCustomizer<ConcurrentMapCacheManager> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customize(final ConcurrentMapCacheManager cacheManager) {
|
public void customize(final ConcurrentMapCacheManager cacheManager) {
|
||||||
cacheManager.setCacheNames(
|
cacheManager
|
||||||
asList(
|
.setCacheNames(asList("fundingpath-ids", "indexdsinfo-cache", "objectstoreid-cache", "context-cache", "context-cache-funder", "context-cache-community", "dsm-aggregationhistory-cache-v1", "dsm-aggregationhistory-cache-v2", "dsm-firstharvestdate-cache", "vocabularies-cache", "community-cache", "info"));
|
||||||
"fundingpath-ids",
|
}
|
||||||
"indexdsinfo-cache",
|
|
||||||
"objectstoreid-cache",
|
|
||||||
"context-cache",
|
|
||||||
"context-cache-funder",
|
|
||||||
"context-cache-community",
|
|
||||||
"dsm-aggregationhistory-cache",
|
|
||||||
"dsm-firstharvestdate-cache",
|
|
||||||
"vocabularies-cache",
|
|
||||||
"community-cache",
|
|
||||||
"info"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,8 @@ import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
|
import eu.dnetlib.openaire.exporter.model.dsm.Response;
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.Response;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by claudio on 18/07/2017.
|
* Created by claudio on 18/07/2017.
|
||||||
|
@ -30,29 +28,13 @@ public abstract class AbstractExporterController {
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ExceptionHandler({
|
@ExceptionHandler({
|
||||||
DsmException.class
|
DsmApiException.class
|
||||||
})
|
})
|
||||||
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
public ErrorMessage handleDSMException(final Exception e) {
|
public ErrorMessage handleDSMException(final Exception e) {
|
||||||
return _handleError(e);
|
return _handleError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@ExceptionHandler(DsmForbiddenException.class)
|
|
||||||
@ResponseStatus(value = HttpStatus.FORBIDDEN)
|
|
||||||
public ErrorMessage handleForbiddenException(final Exception e) {
|
|
||||||
return _handleError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@ExceptionHandler({
|
|
||||||
DsmNotFoundException.class
|
|
||||||
})
|
|
||||||
@ResponseStatus(value = HttpStatus.NOT_FOUND)
|
|
||||||
public ErrorMessage handleNotFoundException(final Exception e) {
|
|
||||||
return _handleError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
|
|
|
@ -4,15 +4,14 @@ import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
|
||||||
import eu.dnetlib.openaire.context.Context;
|
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
|
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Context;
|
||||||
|
|
||||||
public interface ISClient {
|
public interface ISClient {
|
||||||
|
|
||||||
IndexDsInfo calculateCurrentIndexDsInfo() throws DsmException;
|
IndexDsInfo calculateCurrentIndexDsInfo() throws Exception;
|
||||||
|
|
||||||
String getObjectStoreId(String dsId) throws DsmException;
|
String getObjectStoreId(String dsId) throws Exception;
|
||||||
|
|
||||||
Map<String, Context> getFunderContextMap() throws IOException;
|
Map<String, Context> getFunderContextMap() throws IOException;
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ public interface ISClient {
|
||||||
|
|
||||||
Map<String, Context> getContextMap(final List<String> type) throws IOException;
|
Map<String, Context> getContextMap(final List<String> type) throws IOException;
|
||||||
|
|
||||||
void updateContextParam(String id, String name, String value);
|
void updateContextParam(String id, String name, String value, boolean toEscape);
|
||||||
|
|
||||||
void updateContextAttribute(String id, String name, String value);
|
void updateContextAttribute(String id, String name, String value);
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,9 @@ import eu.dnetlib.enabling.datasources.common.DsmException;
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmRuntimeException;
|
import eu.dnetlib.enabling.datasources.common.DsmRuntimeException;
|
||||||
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
|
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
|
||||||
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
|
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
|
||||||
import eu.dnetlib.openaire.context.Context;
|
|
||||||
import eu.dnetlib.openaire.context.ContextMappingUtils;
|
import eu.dnetlib.openaire.context.ContextMappingUtils;
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
|
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by claudio on 20/10/2016.
|
* Created by claudio on 20/10/2016.
|
||||||
|
@ -52,7 +52,7 @@ public class ISClientImpl implements ISClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable("indexdsinfo-cache")
|
@Cacheable("indexdsinfo-cache")
|
||||||
public IndexDsInfo calculateCurrentIndexDsInfo() throws DsmException {
|
public IndexDsInfo calculateCurrentIndexDsInfo() throws Exception {
|
||||||
log.warn("calculateCurrentIndexDsInfo(): not using cache");
|
log.warn("calculateCurrentIndexDsInfo(): not using cache");
|
||||||
final String[] arr;
|
final String[] arr;
|
||||||
try {
|
try {
|
||||||
|
@ -67,7 +67,7 @@ public class ISClientImpl implements ISClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable("objectstoreid-cache")
|
@Cacheable("objectstoreid-cache")
|
||||||
public String getObjectStoreId(final String dsId) throws DsmException {
|
public String getObjectStoreId(final String dsId) throws Exception {
|
||||||
log.warn(String.format("getObjectStoreId(%s): not using cache", dsId));
|
log.warn(String.format("getObjectStoreId(%s): not using cache", dsId));
|
||||||
try {
|
try {
|
||||||
final String xqueryTemplate = _getQuery(config.getFindObjectStore());
|
final String xqueryTemplate = _getQuery(config.getFindObjectStore());
|
||||||
|
@ -109,12 +109,33 @@ public class ISClientImpl implements ISClient {
|
||||||
@CacheEvict(value = {
|
@CacheEvict(value = {
|
||||||
"context-cache", "context-cache-funder"
|
"context-cache", "context-cache-funder"
|
||||||
}, allEntries = true)
|
}, allEntries = true)
|
||||||
public void updateContextParam(final String id, final String name, final String value) {
|
public void updateContextParam(final String id, final String name, final String value, final boolean toEscape) {
|
||||||
try {
|
if (getSize(id, name) > 0) {
|
||||||
_quickSeachProfile(getXQuery(id, name, value));
|
try {
|
||||||
} catch (final ISLookUpException e) {
|
_quickSeachProfile(getXQuery(id, name, value, toEscape));
|
||||||
throw new DsmRuntimeException(String.format("unable update context param [id: %s, name: %s, value: %s]", id, name, value), e);
|
} catch (final ISLookUpException e) {
|
||||||
|
throw new DsmRuntimeException(String.format("unable to update context param [id: %s, name: %s, value: %s]", id, name, value), e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
_quickSeachProfile(getInsertXQuery(id, name, value, toEscape));
|
||||||
|
} catch (final ISLookUpException e) {
|
||||||
|
throw new DsmRuntimeException(String.format("unable to insert context param [id: %s, name: %s, value: %s]", id, name, value), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getSize(final String id, final String name) {
|
||||||
|
int size = 0;
|
||||||
|
try {
|
||||||
|
size = _quickSeachProfile(String
|
||||||
|
.format("for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') where $x//context[@id='%s']/param[@name='%s'] return $x", id, name))
|
||||||
|
.size();
|
||||||
|
} catch (final ISLookUpException e) {
|
||||||
|
throw new DsmRuntimeException("unable to execute search query", e);
|
||||||
|
}
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -200,17 +221,48 @@ public class ISClientImpl implements ISClient {
|
||||||
|
|
||||||
/// HELPERS
|
/// HELPERS
|
||||||
|
|
||||||
private String getXQuery(final String id, final String name, final String value) {
|
private String getInsertXQuery(final String id, final String paramName, final String paramValue, final boolean toEscape) {
|
||||||
final Escaper esc = XmlEscapers.xmlContentEscaper();
|
String value;
|
||||||
|
if (toEscape) {
|
||||||
|
value = escape(XmlEscapers.xmlContentEscaper(), paramValue);
|
||||||
|
} else {
|
||||||
|
value = paramValue;
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(value)) {
|
||||||
|
return String.format("update insert <param name='%s'>%s</param> into collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
|
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, value, id);
|
||||||
|
} else {
|
||||||
|
return String.format("update insert <param name='%s'/> into collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
|
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']", paramName, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getXQuery(final String id, final String name, final String paramValue, final boolean toEscape) {
|
||||||
|
String value = paramValue;
|
||||||
|
if (toEscape) {
|
||||||
|
value = escape(XmlEscapers.xmlContentEscaper(), paramValue);
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(value)) {
|
if (StringUtils.isNotBlank(value)) {
|
||||||
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'>%s</param>", id, name, name, escape(esc, value));
|
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'>%s</param>", id, name, name, value);
|
||||||
} else {
|
} else {
|
||||||
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'/>", id, name, name);
|
"/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'/>", id, name, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private String getXQueryNoEscape(final String id, final String name, final String value) {
|
||||||
|
// if (StringUtils.isNotBlank(value)) {
|
||||||
|
// return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
|
// "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'>%s</param>", id, name, name,
|
||||||
|
// value);
|
||||||
|
// } else {
|
||||||
|
// return String.format("update replace collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')" +
|
||||||
|
// "/RESOURCE_PROFILE/BODY/CONFIGURATION/context[./@id = '%s']/param[./@name = '%s'] with <param name='%s'/>", id, name, name);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
private String getConceptXQuery(final String id, final String name, final String value) {
|
private String getConceptXQuery(final String id, final String name, final String value) {
|
||||||
final Escaper esc = XmlEscapers.xmlContentEscaper();
|
final Escaper esc = XmlEscapers.xmlContentEscaper();
|
||||||
if (StringUtils.isNotBlank(value)) {
|
if (StringUtils.isNotBlank(value)) {
|
||||||
|
|
|
@ -10,6 +10,18 @@ import static eu.dnetlib.openaire.common.ExporterConstants.W;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityOpenAIRECommunities;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityWritableProperties;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
|
@ -133,6 +145,44 @@ public class CommunityApiController {
|
||||||
communityApiCore.removeCommunityProject(id, projectId);
|
communityApiCore.removeCommunityProject(id, projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/projectList", produces = {
|
||||||
|
"application/json"
|
||||||
|
}, method = RequestMethod.POST)
|
||||||
|
@Operation(summary = "associate a list of project to the community",
|
||||||
|
description = "associate a list of project to the community", tags = {
|
||||||
|
C_PJ, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public List<CommunityProject> addCommunityProjectList(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<CommunityProject> projectList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
return communityApiCore.addCommunityProjectList(id, projectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/projectList", produces = {
|
||||||
|
"application/json"
|
||||||
|
}, method = RequestMethod.DELETE)
|
||||||
|
@Operation(summary = "remove a list of projects from the community",
|
||||||
|
description = "remove a list of projects from the community", tags = {
|
||||||
|
C_PJ, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public void deleteCommunityProjectList(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<Integer> projectIdList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
communityApiCore.removeCommunityProjectList(id, projectIdList);
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/community/{id}/contentproviders", produces = {
|
@RequestMapping(value = "/community/{id}/contentproviders", produces = {
|
||||||
"application/json"
|
"application/json"
|
||||||
}, method = RequestMethod.GET)
|
}, method = RequestMethod.GET)
|
||||||
|
@ -184,6 +234,44 @@ public class CommunityApiController {
|
||||||
communityApiCore.removeCommunityContentProvider(id, contentproviderId);
|
communityApiCore.removeCommunityContentProvider(id, contentproviderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/contentprovidersList", produces = {
|
||||||
|
"application/json"
|
||||||
|
}, method = RequestMethod.POST)
|
||||||
|
@Operation(summary = "associate a list of content providers to the community",
|
||||||
|
description = "associate a list of content providers to the community", tags = {
|
||||||
|
C_PJ, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public List<CommunityContentprovider> addCommunityContentProvidersList(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<CommunityContentprovider> contentprovidersList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
return communityApiCore.addCommunityContentProvidersList(id, contentprovidersList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/contentprovidersList", produces = {
|
||||||
|
"application/json"
|
||||||
|
}, method = RequestMethod.DELETE)
|
||||||
|
@Operation(summary = "remove a list of content providers from the community",
|
||||||
|
description = "remove a list of content providers from the community", tags = {
|
||||||
|
C_PJ, W
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public void deleteCommunityContentProvidersList(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<Integer> contentProviderIdList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
communityApiCore.removeCommunityContentProviderList(id, contentProviderIdList);
|
||||||
|
}
|
||||||
|
|
||||||
// ADDING CODE FOR COMMUNITY ORGANIZATIONS
|
// ADDING CODE FOR COMMUNITY ORGANIZATIONS
|
||||||
|
|
||||||
@RequestMapping(value = "/community/{id}/organizations", produces = {
|
@RequestMapping(value = "/community/{id}/organizations", produces = {
|
||||||
|
@ -273,6 +361,101 @@ public class CommunityApiController {
|
||||||
|
|
||||||
return communityApiCore.removeCommunitySubjects(id, subjects);
|
return communityApiCore.removeCommunitySubjects(id, subjects);
|
||||||
}
|
}
|
||||||
|
@RequestMapping(value = "/community/{id}/fos", produces = { "application/json" }, method = RequestMethod.POST)
|
||||||
|
@Operation(
|
||||||
|
summary = "associate a fos to the community",
|
||||||
|
description = "associate a fos to the community",
|
||||||
|
tags = { C, W })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error") })
|
||||||
|
public CommunityDetails addCommunityFOS(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<String> subjects) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
return communityApiCore.addCommunityFOS(id, subjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/fos", produces = { "application/json" }, method = RequestMethod.DELETE)
|
||||||
|
@Operation(
|
||||||
|
summary = "remove fos from a community",
|
||||||
|
description = "remove fos from a community",
|
||||||
|
tags = { C, W })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error") })
|
||||||
|
public CommunityDetails removeCommunityFOS(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<String> subjects) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
return communityApiCore.removeCommunityFOS(id, subjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/sdg", produces = { "application/json" }, method = RequestMethod.POST)
|
||||||
|
@Operation(
|
||||||
|
summary = "associate a sdg to the community",
|
||||||
|
description = "associate a sdg to the community",
|
||||||
|
tags = { C, W })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error") })
|
||||||
|
public CommunityDetails addCommunitySDG(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<String> subjects) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
return communityApiCore.addCommunitySDG(id, subjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/sdg", produces = { "application/json" }, method = RequestMethod.DELETE)
|
||||||
|
@Operation(
|
||||||
|
summary = "remove sdg from a community",
|
||||||
|
description = "remove sdg from a community",
|
||||||
|
tags = { C, W })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error") })
|
||||||
|
public CommunityDetails removeCommunitySDG(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final List<String> subjects) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
return communityApiCore.removeCommunitySDG(id, subjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/advancedConstraint", produces = { "application/json" }, method = RequestMethod.POST)
|
||||||
|
@Operation(
|
||||||
|
summary = "the set of constraints to be used to extend the association between result and community",
|
||||||
|
description = "the set of constraints to be used to extend the association between result and community",
|
||||||
|
tags = { C, W })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error") })
|
||||||
|
public CommunityDetails addAdvancedConstraint(
|
||||||
|
@PathVariable final String id,
|
||||||
|
@RequestBody final SelectionCriteria advancedConstraint) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
return communityApiCore.addCommunityAdvancedConstraint(id, advancedConstraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/community/{id}/advancedConstraint", produces = { "application/json" }, method = RequestMethod.DELETE)
|
||||||
|
@Operation(
|
||||||
|
summary = "remove the constraints to extend the association result community from a community",
|
||||||
|
description = "remove the constraints to extend the association result community from a community",
|
||||||
|
tags = { C, W })
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "not found"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error") })
|
||||||
|
public CommunityDetails removeAdvancedConstraint(
|
||||||
|
@PathVariable final String id) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
return communityApiCore.removeCommunityAdvancedConstraint(id);
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/community/{id}/zenodocommunities", produces = {
|
@RequestMapping(value = "/community/{id}/zenodocommunities", produces = {
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
|
@ -1,37 +1,22 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.community;
|
||||||
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CCONTENTPROVIDER_NAME;
|
import java.util.*;
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CCONTENTPROVIDER_OFFICIALNAME;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CCONTENTPROVIDER_SELCRITERIA;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CLABEL;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CONTENTPROVIDERS_ID_SUFFIX;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CORGANIZATION_LOGOURL;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CORGANIZATION_NAME;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CORGANIZATION_WEBSITEURL;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CPROFILE_SUBJECT;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CPROJECT_ACRONYM;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CPROJECT_FULLNAME;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CPROJECT_FUNDER;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CPROJECT_NUMBER;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_DESCRIPTION;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_LOGOURL;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_NAME;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_STATUS;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CSUMMARY_ZENODOC;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.CSV_DELIMITER;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.ID_SEPARATOR;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.OPENAIRE_ID;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.ORGANIZATION_ID_SUFFIX;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.PROJECTS_ID_SUFFIX;
|
|
||||||
import static eu.dnetlib.openaire.community.CommunityConstants.ZENODOCOMMUNITY_ID_SUFFIX;
|
|
||||||
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityOpenAIRECommunities;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityWritableProperties;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -47,6 +32,8 @@ import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.common.ISClient;
|
import eu.dnetlib.openaire.common.ISClient;
|
||||||
|
|
||||||
|
import static eu.dnetlib.openaire.community.CommunityConstants.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnProperty(value = "openaire.exporter.enable.community", havingValue = "true")
|
@ConditionalOnProperty(value = "openaire.exporter.enable.community", havingValue = "true")
|
||||||
public class CommunityApiCore {// implements CommunityClient{
|
public class CommunityApiCore {// implements CommunityClient{
|
||||||
|
@ -72,6 +59,13 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeAdvancedConstraint(String id) throws CommunityNotFoundException, CommunityException {
|
||||||
|
cc.getCommunity(id);
|
||||||
|
isClient.updateContextParam(id, CPROFILE_ADVANCED_CONSTRAINT, "", false);
|
||||||
|
cc.removeAdvancedConstraint(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void setCommunity(final String id, final CommunityWritableProperties details) throws CommunityException, CommunityNotFoundException {
|
public void setCommunity(final String id, final CommunityWritableProperties details) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
cc.getCommunity(id); // ensure the community exists.
|
cc.getCommunity(id); // ensure the community exists.
|
||||||
|
@ -81,27 +75,39 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getName() != null) {
|
if (details.getName() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_NAME, details.getName());
|
isClient.updateContextParam(id, CSUMMARY_NAME, details.getName(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getDescription() != null) {
|
if (details.getDescription() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_DESCRIPTION, details.getDescription());
|
isClient.updateContextParam(id, CSUMMARY_DESCRIPTION, details.getDescription(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getLogoUrl() != null) {
|
if (details.getLogoUrl() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_LOGOURL, details.getLogoUrl());
|
isClient.updateContextParam(id, CSUMMARY_LOGOURL, details.getLogoUrl(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getStatus() != null) {
|
if (details.getStatus() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_STATUS, details.getStatus().name());
|
isClient.updateContextParam(id, CSUMMARY_STATUS, details.getStatus().name(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getSubjects() != null) {
|
if (details.getSubjects() != null) {
|
||||||
isClient.updateContextParam(id, CPROFILE_SUBJECT, Joiner.on(CSV_DELIMITER).join(details.getSubjects()));
|
isClient.updateContextParam(id, CPROFILE_SUBJECT, Joiner.on(CSV_DELIMITER).join(details.getSubjects()), true);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (details.getFos() != null) {
|
||||||
|
isClient.updateContextParam(id, CPROFILE_FOS, Joiner.on(CSV_DELIMITER).join(details.getFos()), true);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (details.getSdg() != null) {
|
||||||
|
isClient.updateContextParam(id, CPROFILE_SDG, Joiner.on(CSV_DELIMITER).join(details.getSdg()), true);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (details.getAdvancedConstraint() != null) {
|
||||||
|
isClient.updateContextParam(id, CPROFILE_ADVANCED_CONSTRAINT, "<![CDATA[" + new Gson().toJson(details.getAdvancedConstraint()) + "]]>", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (details.getMainZenodoCommunity() != null) {
|
if (details.getMainZenodoCommunity() != null) {
|
||||||
isClient.updateContextParam(id, CSUMMARY_ZENODOC, details.getMainZenodoCommunity());
|
isClient.updateContextParam(id, CSUMMARY_ZENODOC, details.getMainZenodoCommunity(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
cc.updateCommunity(id, details);
|
cc.updateCommunity(id, details);
|
||||||
|
@ -117,40 +123,63 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
throw new CommunityException("parameters 'id' and project.communityId must be coherent");
|
throw new CommunityException("parameters 'id' and project.communityId must be coherent");
|
||||||
}
|
}
|
||||||
|
|
||||||
final TreeMap<Integer, CommunityProject> projects = getCommunityProjectMap(id);
|
return updateProject(id, project);
|
||||||
final String project_id = project.getId();
|
|
||||||
|
|
||||||
if (project_id != null && projects.keySet().contains(Integer.valueOf(project_id))) {
|
}
|
||||||
|
|
||||||
|
private CommunityProject updateProject(String id, CommunityProject project) throws CommunityException, CommunityNotFoundException {
|
||||||
|
final TreeMap<Integer, CommunityProject> projects = getCommunityProjectMap(id);
|
||||||
|
String project_id = project.getId();
|
||||||
|
|
||||||
|
if (project_id != null && projects.keySet().contains(Integer.valueOf(project_id))){
|
||||||
if (project.getName() != null) {
|
if (project.getName() != null) {
|
||||||
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_FULLNAME, project.getName());
|
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_FULLNAME, project.getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (project.getAcronym() != null) {
|
if(project.getAcronym()!= null){
|
||||||
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_ACRONYM, project.getAcronym());
|
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_ACRONYM, project.getAcronym());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (project.getOpenaireId() != null) {
|
if (project.getOpenaireId() != null){
|
||||||
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, OPENAIRE_ID, project.getOpenaireId());
|
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, OPENAIRE_ID, project.getOpenaireId());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (project.getFunder() != null) {
|
if (project.getFunder() != null){
|
||||||
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_FUNDER, project.getFunder());
|
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_FUNDER, project.getFunder());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (project.getGrantId() != null) {
|
if(project.getGrantId() != null){
|
||||||
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_NUMBER, project.getGrantId());
|
isClient.updateConceptParam(id + PROJECTS_ID_SUFFIX + ID_SEPARATOR + project_id, CPROJECT_NUMBER, project.getGrantId());
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
}else {
|
||||||
project.setId(nextId(projects != null && !projects.isEmpty() ? projects.lastKey() : 0));
|
project.setId(nextId(projects != null && !projects.isEmpty() ? projects.lastKey() : 0));
|
||||||
|
|
||||||
isClient.addConcept(id, id + PROJECTS_ID_SUFFIX, CommunityMappingUtils.asProjectXML(id, project));
|
isClient.addConcept(id, id + PROJECTS_ID_SUFFIX, CommunityMappingUtils.asProjectXML(id, project));
|
||||||
|
|
||||||
}
|
}
|
||||||
cc.updateProject(id, project);
|
cc.updateProject(id, project );
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<CommunityProject> addCommunityProjectList(final String id, final List<CommunityProject> projectList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
if(projectList == null || projectList.size() == 0){
|
||||||
|
throw new CommunityException("parameter 'projectList' must be present and should contain at least one project");
|
||||||
|
}
|
||||||
|
if (!StringUtils.equalsIgnoreCase(id, projectList.get(0).getCommunityId())) {
|
||||||
|
throw new CommunityException("parameters 'id' and project.communityId must be coherent");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<CommunityProject> projects = new ArrayList();
|
||||||
|
|
||||||
|
for(CommunityProject project : projectList){
|
||||||
|
projects.add(updateProject(id, project));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return projects;
|
||||||
|
}
|
||||||
|
|
||||||
private String nextId(final Integer id) {
|
private String nextId(final Integer id) {
|
||||||
return String.valueOf(id + 1);
|
return String.valueOf(id + 1);
|
||||||
}
|
}
|
||||||
|
@ -164,6 +193,12 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
cc.removeFromCategory(id, PROJECTS_ID_SUFFIX, String.valueOf(projectId));
|
cc.removeFromCategory(id, PROJECTS_ID_SUFFIX, String.valueOf(projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeCommunityProjectList(final String id, final List<Integer> projectIdList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
for(Integer projectId: projectIdList){
|
||||||
|
removeCommunityProject(id, projectId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<CommunityContentprovider> getCommunityContentproviders(final String id) throws CommunityException, CommunityNotFoundException {
|
public List<CommunityContentprovider> getCommunityContentproviders(final String id) throws CommunityException, CommunityNotFoundException {
|
||||||
cc.getCommunity(id); // ensure the community exists.
|
cc.getCommunity(id); // ensure the community exists.
|
||||||
return cc.getCommunityInfo(id, CONTENTPROVIDERS_ID_SUFFIX, c -> CommunityMappingUtils.asCommunityDataprovider(id, c));
|
return cc.getCommunityInfo(id, CONTENTPROVIDERS_ID_SUFFIX, c -> CommunityMappingUtils.asCommunityDataprovider(id, c));
|
||||||
|
@ -174,6 +209,10 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
log.info("content provider to add " + cp.toString());
|
log.info("content provider to add " + cp.toString());
|
||||||
if (!StringUtils.equalsIgnoreCase(id, cp.getCommunityId())) { throw new CommunityException("parameters 'id' and cp.communityId must be coherent"); }
|
if (!StringUtils.equalsIgnoreCase(id, cp.getCommunityId())) { throw new CommunityException("parameters 'id' and cp.communityId must be coherent"); }
|
||||||
|
|
||||||
|
return updateContentprovider(id, cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommunityContentprovider updateContentprovider(String id, CommunityContentprovider cp) throws CommunityException, CommunityNotFoundException {
|
||||||
final TreeMap<Integer, CommunityContentprovider> cps = getCommunityContentproviderMap(id);
|
final TreeMap<Integer, CommunityContentprovider> cps = getCommunityContentproviderMap(id);
|
||||||
final String concept_id = cp.getId();
|
final String concept_id = cp.getId();
|
||||||
if (concept_id != null && cps.keySet().contains(Integer.valueOf(concept_id))) {
|
if (concept_id != null && cps.keySet().contains(Integer.valueOf(concept_id))) {
|
||||||
|
@ -209,6 +248,30 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
cc.removeFromCategory(id, CONTENTPROVIDERS_ID_SUFFIX, String.valueOf(contentproviderId));
|
cc.removeFromCategory(id, CONTENTPROVIDERS_ID_SUFFIX, String.valueOf(contentproviderId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<CommunityContentprovider> addCommunityContentProvidersList(String id, List<CommunityContentprovider> contentprovidersList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
if(contentprovidersList == null || contentprovidersList.size() == 0){
|
||||||
|
throw new CommunityException("parameter 'contentprovidersList' must be present and should contain at least one content provider");
|
||||||
|
}
|
||||||
|
if (!StringUtils.equalsIgnoreCase(id, contentprovidersList.get(0).getCommunityId())) {
|
||||||
|
throw new CommunityException("parameters 'id' and contentprovider.communityId must be coherent");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<CommunityContentprovider> contentproviders = new ArrayList();
|
||||||
|
|
||||||
|
for(CommunityContentprovider contentProvider : contentprovidersList){
|
||||||
|
contentproviders.add(updateContentprovider(id, contentProvider));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return contentproviders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeCommunityContentProviderList(final String id, final List<Integer> contentProviderIdList) throws CommunityException, CommunityNotFoundException {
|
||||||
|
for(Integer contentProviderId: contentProviderIdList){
|
||||||
|
removeCommunityContentProvider(id, contentProviderId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void removeCommunityOrganization(final String id, final Integer organizationId) throws CommunityException, CommunityNotFoundException {
|
public void removeCommunityOrganization(final String id, final Integer organizationId) throws CommunityException, CommunityNotFoundException {
|
||||||
final Map<Integer, CommunityOrganization> organizations = getCommunityOrganizationMap(id);
|
final Map<Integer, CommunityOrganization> organizations = getCommunityOrganizationMap(id);
|
||||||
if (!organizations.containsKey(organizationId)) {
|
if (!organizations.containsKey(organizationId)) {
|
||||||
|
@ -258,6 +321,91 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
return cd;
|
return cd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CommunityDetails addCommunityFOS(final String id, final List<String> foss) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
final CommunityDetails cd = new CommunityDetails();
|
||||||
|
|
||||||
|
final Set<String> current = Sets.newHashSet();
|
||||||
|
if(Optional.ofNullable(cc.getCommunity(id).getFos()).isPresent()){
|
||||||
|
current.addAll(cc.getCommunity(id).getFos());
|
||||||
|
}
|
||||||
|
|
||||||
|
current.addAll(foss);
|
||||||
|
|
||||||
|
cd.setFos(Lists.newArrayList(current));
|
||||||
|
|
||||||
|
setCommunity(id, CommunityWritableProperties.fromDetails(cd));
|
||||||
|
|
||||||
|
return cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommunityDetails removeCommunityFOS(final String id, final List<String> foss) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
final CommunityDetails cd = new CommunityDetails();
|
||||||
|
|
||||||
|
final Set<String> current = Sets.newHashSet(cc.getCommunity(id).getFos());
|
||||||
|
|
||||||
|
current.removeAll(foss);
|
||||||
|
|
||||||
|
cd.setFos(Lists.newArrayList(current));
|
||||||
|
|
||||||
|
setCommunity(id, CommunityWritableProperties.fromDetails(cd));
|
||||||
|
|
||||||
|
return cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommunityDetails addCommunitySDG(final String id, final List<String> sdgs) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
final CommunityDetails cd = new CommunityDetails();
|
||||||
|
final Set<String> current = Sets.newHashSet();
|
||||||
|
if(Optional.ofNullable(cc.getCommunity(id).getSdg()).isPresent()){
|
||||||
|
current.addAll(cc.getCommunity(id).getSdg());
|
||||||
|
}
|
||||||
|
|
||||||
|
current.addAll(sdgs);
|
||||||
|
|
||||||
|
cd.setSdg(Lists.newArrayList(current));
|
||||||
|
|
||||||
|
setCommunity(id, CommunityWritableProperties.fromDetails(cd));
|
||||||
|
|
||||||
|
return cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommunityDetails removeCommunitySDG(final String id, final List<String> sdgs) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
final CommunityDetails cd = new CommunityDetails();
|
||||||
|
|
||||||
|
final Set<String> current = Sets.newHashSet(cc.getCommunity(id).getSdg());
|
||||||
|
|
||||||
|
current.removeAll(sdgs);
|
||||||
|
|
||||||
|
cd.setSdg(Lists.newArrayList(current));
|
||||||
|
|
||||||
|
setCommunity(id, CommunityWritableProperties.fromDetails(cd));
|
||||||
|
|
||||||
|
return cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommunityDetails addCommunityAdvancedConstraint(final String id, final SelectionCriteria advancedCosntraint) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
final CommunityDetails cd = new CommunityDetails();
|
||||||
|
|
||||||
|
cd.setAdvancedConstraint(advancedCosntraint);
|
||||||
|
|
||||||
|
setCommunity(id, CommunityWritableProperties.fromDetails(cd));
|
||||||
|
|
||||||
|
return cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommunityDetails removeCommunityAdvancedConstraint(final String id) throws CommunityNotFoundException, CommunityException {
|
||||||
|
|
||||||
|
removeAdvancedConstraint(id);
|
||||||
|
|
||||||
|
return new CommunityDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@CacheEvict(value = "community-cache", allEntries = true)
|
@CacheEvict(value = "community-cache", allEntries = true)
|
||||||
public void removeCommunityZenodoCommunity(final String id, final Integer zenodoCommId) throws CommunityException, CommunityNotFoundException {
|
public void removeCommunityZenodoCommunity(final String id, final Integer zenodoCommId) throws CommunityException, CommunityNotFoundException {
|
||||||
|
|
||||||
|
@ -365,4 +513,5 @@ public class CommunityApiCore {// implements CommunityClient{
|
||||||
return organization;
|
return organization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@ package eu.dnetlib.openaire.community;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
|
||||||
|
|
||||||
public interface CommunityClient {
|
public interface CommunityClient {
|
||||||
|
|
||||||
Map<String, Set<String>> getInverseZenodoCommunityMap() throws CommunityException, CommunityNotFoundException;
|
Map<String, Set<String>> getInverseZenodoCommunityMap() throws CommunityException, CommunityNotFoundException;
|
||||||
|
|
|
@ -8,6 +8,11 @@ import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
|
|
@ -2,11 +2,23 @@ package eu.dnetlib.openaire.community;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import eu.dnetlib.openaire.common.ISClient;
|
import eu.dnetlib.openaire.common.ISClient;
|
||||||
import eu.dnetlib.openaire.context.Category;
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityException;
|
||||||
import eu.dnetlib.openaire.context.Concept;
|
import eu.dnetlib.openaire.exporter.exceptions.CommunityNotFoundException;
|
||||||
import eu.dnetlib.openaire.context.Context;
|
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
|
||||||
import eu.dnetlib.openaire.context.Param;
|
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityWritableProperties;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Category;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Concept;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Context;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Param;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -166,6 +178,13 @@ public class CommunityCommon {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeAdvancedConstraint(String id) throws CommunityException {
|
||||||
|
final Context context = getContextMap().get(id);
|
||||||
|
context.getParams()
|
||||||
|
.replace(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param()
|
||||||
|
.setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(null)));
|
||||||
|
}
|
||||||
|
|
||||||
public void updateCommunity(String id, CommunityWritableProperties community) throws CommunityException {
|
public void updateCommunity(String id, CommunityWritableProperties community) throws CommunityException {
|
||||||
final Context context = getContextMap().get(id);
|
final Context context = getContextMap().get(id);
|
||||||
|
|
||||||
|
@ -199,6 +218,37 @@ public class CommunityCommon {
|
||||||
.setValue(Joiner.on(CSV_DELIMITER)
|
.setValue(Joiner.on(CSV_DELIMITER)
|
||||||
.join(community.getSubjects()))));
|
.join(community.getSubjects()))));
|
||||||
}
|
}
|
||||||
|
if(community.getFos() != null){
|
||||||
|
if (context.getParams().containsKey(CPROFILE_FOS))
|
||||||
|
context.getParams()
|
||||||
|
.replace(CPROFILE_FOS, Arrays.asList(new Param().setName(CPROFILE_FOS)
|
||||||
|
.setValue(Joiner.on(CSV_DELIMITER)
|
||||||
|
.join(community.getFos()))));
|
||||||
|
else
|
||||||
|
context.getParams().put(CPROFILE_FOS, Arrays.asList(new Param().setName(CPROFILE_FOS)
|
||||||
|
.setValue(Joiner.on(CSV_DELIMITER)
|
||||||
|
.join(community.getFos()))));
|
||||||
|
}
|
||||||
|
if(community.getSdg() != null){
|
||||||
|
if(context.getParams().containsKey(CPROFILE_SDG))
|
||||||
|
context.getParams()
|
||||||
|
.replace(CPROFILE_SDG, Arrays.asList(new Param().setName(CPROFILE_SDG)
|
||||||
|
.setValue(Joiner.on(CSV_DELIMITER)
|
||||||
|
.join(community.getSdg()))));
|
||||||
|
else
|
||||||
|
context.getParams().put(CPROFILE_SDG, Arrays.asList(new Param().setName(CPROFILE_SDG)
|
||||||
|
.setValue(Joiner.on(CSV_DELIMITER)
|
||||||
|
.join(community.getSdg()))));
|
||||||
|
}
|
||||||
|
if (community.getAdvancedConstraint() != null) {
|
||||||
|
if(context.getParams().containsKey(CPROFILE_ADVANCED_CONSTRAINT))
|
||||||
|
context.getParams()
|
||||||
|
.replace(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param()
|
||||||
|
.setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(new Gson().toJson(community.getAdvancedConstraint()))));
|
||||||
|
else
|
||||||
|
context.getParams().put(CPROFILE_ADVANCED_CONSTRAINT, Arrays.asList(new Param()
|
||||||
|
.setName(CPROFILE_ADVANCED_CONSTRAINT).setValue(new Gson().toJson(community.getAdvancedConstraint()))));
|
||||||
|
}
|
||||||
if(community.getMainZenodoCommunity() != null){
|
if(community.getMainZenodoCommunity() != null){
|
||||||
context.getParams()
|
context.getParams()
|
||||||
.replace(CSUMMARY_ZENODOC, Arrays.asList(new Param()
|
.replace(CSUMMARY_ZENODOC, Arrays.asList(new Param()
|
||||||
|
|
|
@ -32,6 +32,9 @@ public class CommunityConstants {
|
||||||
// community profile
|
// community profile
|
||||||
public final static String CPROFILE_SUBJECT = "subject";
|
public final static String CPROFILE_SUBJECT = "subject";
|
||||||
public final static String CPROFILE_CREATIONDATE = "creationdate";
|
public final static String CPROFILE_CREATIONDATE = "creationdate";
|
||||||
|
public final static String CPROFILE_FOS = "fos";
|
||||||
|
public final static String CPROFILE_SDG = "sdg";
|
||||||
|
public final static String CPROFILE_ADVANCED_CONSTRAINT = "advancedConstraint";
|
||||||
|
|
||||||
// community project
|
// community project
|
||||||
public final static String CPROJECT_FUNDER = "funder";
|
public final static String CPROJECT_FUNDER = "funder";
|
||||||
|
|
|
@ -7,10 +7,19 @@ import java.util.stream.Stream;
|
||||||
|
|
||||||
import com.google.common.escape.Escaper;
|
import com.google.common.escape.Escaper;
|
||||||
import com.google.common.xml.XmlEscapers;
|
import com.google.common.xml.XmlEscapers;
|
||||||
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
|
|
||||||
import eu.dnetlib.openaire.context.Concept;
|
import eu.dnetlib.openaire.exporter.model.community.CommunityContentprovider;
|
||||||
import eu.dnetlib.openaire.context.Context;
|
import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
|
||||||
import eu.dnetlib.openaire.context.Param;
|
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityStatus;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunityZenodoCommunity;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Concept;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Context;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Param;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -62,11 +71,22 @@ public class CommunityMappingUtils {
|
||||||
if (params.containsKey(CPROFILE_SUBJECT)) {
|
if (params.containsKey(CPROFILE_SUBJECT)) {
|
||||||
p.setSubjects(splitValues(asValues(params.get(CPROFILE_SUBJECT)), CSV_DELIMITER));
|
p.setSubjects(splitValues(asValues(params.get(CPROFILE_SUBJECT)), CSV_DELIMITER));
|
||||||
}
|
}
|
||||||
|
if (params.containsKey(CPROFILE_FOS)) {
|
||||||
|
p.setFos(splitValues(asValues(params.get(CPROFILE_FOS)), CSV_DELIMITER));
|
||||||
|
}
|
||||||
|
if (params.containsKey(CPROFILE_SDG)) {
|
||||||
|
p.setSdg(splitValues(asValues(params.get(CPROFILE_SDG)), CSV_DELIMITER));
|
||||||
|
}
|
||||||
|
if (params.containsKey(CPROFILE_ADVANCED_CONSTRAINT)) {
|
||||||
|
//In the map the string is the serialization of the json representing the selection criteria so it is a valid json
|
||||||
|
p.setAdvancedConstraint(SelectionCriteria.fromJson(asCsv(params.get(CPROFILE_ADVANCED_CONSTRAINT))));
|
||||||
|
|
||||||
|
}
|
||||||
if (params.containsKey(CPROFILE_CREATIONDATE)){
|
if (params.containsKey(CPROFILE_CREATIONDATE)){
|
||||||
try {
|
try {
|
||||||
p.setCreationDate(org.apache.commons.lang3.time.DateUtils.parseDate(asCsv(params.get(CPROFILE_CREATIONDATE)), pattern));
|
p.setCreationDate(org.apache.commons.lang3.time.DateUtils.parseDate(asCsv(params.get(CPROFILE_CREATIONDATE)), pattern));
|
||||||
}catch(ParseException e) {
|
}catch(ParseException e) {
|
||||||
e.printStackTrace();
|
log.debug("Exception on date format: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.ContextException;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.CategorySummary;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.ConceptSummary;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.ContextSummary;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
|
|
@ -15,6 +15,13 @@ import com.google.common.base.Splitter;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.common.ISClient;
|
import eu.dnetlib.openaire.common.ISClient;
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.ContextException;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Category;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.CategorySummary;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Concept;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.ConceptSummary;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Context;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.ContextSummary;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnProperty(value = "openaire.exporter.enable.context", havingValue = "true")
|
@ConditionalOnProperty(value = "openaire.exporter.enable.context", havingValue = "true")
|
||||||
|
|
|
@ -20,7 +20,11 @@ import org.dom4j.Node;
|
||||||
import com.google.common.base.Functions;
|
import com.google.common.base.Functions;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.funders.domain.FunderDetails;
|
import eu.dnetlib.openaire.exporter.model.context.Category;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Concept;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Context;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Param;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
|
||||||
|
|
||||||
public class ContextMappingUtils {
|
public class ContextMappingUtils {
|
||||||
|
|
||||||
|
|
|
@ -24,25 +24,23 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
|
|
||||||
import eu.dnetlib.openaire.common.AbstractExporterController;
|
import eu.dnetlib.openaire.common.AbstractExporterController;
|
||||||
import eu.dnetlib.openaire.common.OperationManager;
|
import eu.dnetlib.openaire.common.OperationManager;
|
||||||
import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponse;
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
import eu.dnetlib.openaire.dsm.domain.ApiDetails;
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV1;
|
||||||
import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse;
|
import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails;
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse;
|
import eu.dnetlib.openaire.exporter.model.dsm.ApiDetailsResponse;
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetails;
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailResponse;
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate;
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails;
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsWithApis;
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsUpdate;
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse;
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsWithApis;
|
||||||
import eu.dnetlib.openaire.dsm.domain.RegisteredDatasourceInfo;
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetResponse;
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestFilter;
|
import eu.dnetlib.openaire.exporter.model.dsm.RegisteredDatasourceInfo;
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSort;
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter;
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSort;
|
||||||
import eu.dnetlib.openaire.dsm.domain.SimpleResponse;
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSortOrder;
|
||||||
import eu.dnetlib.openaire.vocabularies.Country;
|
import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.vocabularies.Country;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
@ -69,7 +67,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public List<Country> listCountries() throws DsmException {
|
public List<Country> listCountries() throws DsmApiException {
|
||||||
return dsmCore.listCountries();
|
return dsmCore.listCountries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +86,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@RequestParam final RequestSortOrder order,
|
@RequestParam final RequestSortOrder order,
|
||||||
@RequestBody final RequestFilter requestFilter,
|
@RequestBody final RequestFilter requestFilter,
|
||||||
@PathVariable final int page,
|
@PathVariable final int page,
|
||||||
@PathVariable final int size) throws DsmException {
|
@PathVariable final int size) throws DsmApiException {
|
||||||
final StopWatch stop = StopWatch.createStarted();
|
final StopWatch stop = StopWatch.createStarted();
|
||||||
final DatasourceDetailResponse rsp = dsmCore.searchDsDetails(requestSortBy, order, requestFilter, page, size);
|
final DatasourceDetailResponse rsp = dsmCore.searchDsDetails(requestSortBy, order, requestFilter, page, size);
|
||||||
return prepareResponse(page, size, stop, rsp);
|
return prepareResponse(page, size, stop, rsp);
|
||||||
|
@ -97,16 +95,16 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@GetMapping(value = "/ds/aggregationhistory/{dsId}", produces = {
|
@GetMapping(value = "/ds/aggregationhistory/{dsId}", produces = {
|
||||||
"application/json"
|
"application/json"
|
||||||
})
|
})
|
||||||
@Operation(summary = "search datasources", description = "Returns list of Datasource details.", tags = {
|
@Operation(summary = "return aggregation hitory", description = "Returns the aggregation history of a datasource", tags = {
|
||||||
DS, R
|
DS, R
|
||||||
})
|
})
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public AggregationHistoryResponse aggregationHistory(@PathVariable final String dsId) throws DsmException {
|
public AggregationHistoryResponseV1 aggregationHistory(@PathVariable final String dsId) throws DsmApiException {
|
||||||
final StopWatch stop = StopWatch.createStarted();
|
final StopWatch stop = StopWatch.createStarted();
|
||||||
final AggregationHistoryResponse rsp = dsmCore.aggregationhistory(dsId);
|
final AggregationHistoryResponseV1 rsp = dsmCore.aggregationhistoryV1(dsId);
|
||||||
return prepareResponse(0, rsp.getAggregationInfo().size(), stop, rsp);
|
return prepareResponse(0, rsp.getAggregationInfo().size(), stop, rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +123,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@RequestParam final RequestSortOrder order,
|
@RequestParam final RequestSortOrder order,
|
||||||
@RequestBody final RequestFilter requestFilter,
|
@RequestBody final RequestFilter requestFilter,
|
||||||
@PathVariable final int page,
|
@PathVariable final int page,
|
||||||
@PathVariable final int size) throws DsmException {
|
@PathVariable final int size) throws DsmApiException {
|
||||||
final StopWatch stop = StopWatch.createStarted();
|
final StopWatch stop = StopWatch.createStarted();
|
||||||
final DatasourceSnippetResponse rsp = dsmCore.searchSnippet(requestSortBy, order, requestFilter, page, size);
|
final DatasourceSnippetResponse rsp = dsmCore.searchSnippet(requestSortBy, order, requestFilter, page, size);
|
||||||
return prepareResponse(page, size, stop, rsp);
|
return prepareResponse(page, size, stop, rsp);
|
||||||
|
@ -147,7 +145,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@RequestParam final RequestSortOrder order,
|
@RequestParam final RequestSortOrder order,
|
||||||
@RequestBody final RequestFilter requestFilter,
|
@RequestBody final RequestFilter requestFilter,
|
||||||
@PathVariable final int page,
|
@PathVariable final int page,
|
||||||
@PathVariable final int size) throws DsmException {
|
@PathVariable final int size) throws DsmApiException {
|
||||||
final StopWatch stop = StopWatch.createStarted();
|
final StopWatch stop = StopWatch.createStarted();
|
||||||
final DatasourceSnippetResponse rsp = dsmCore.searchRegistered(requestSortBy, order, requestFilter, page, size);
|
final DatasourceSnippetResponse rsp = dsmCore.searchRegistered(requestSortBy, order, requestFilter, page, size);
|
||||||
return prepareResponse(page, size, stop, rsp);
|
return prepareResponse(page, size, stop, rsp);
|
||||||
|
@ -198,7 +196,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public ApiDetailsResponse getApi(
|
public ApiDetailsResponse getApi(
|
||||||
@PathVariable final String dsId) throws DsmException {
|
@PathVariable final String dsId) throws DsmApiException {
|
||||||
|
|
||||||
final StopWatch stop = StopWatch.createStarted();
|
final StopWatch stop = StopWatch.createStarted();
|
||||||
final ApiDetailsResponse rsp = dsmCore.getApis(dsId);
|
final ApiDetailsResponse rsp = dsmCore.getApis(dsId);
|
||||||
|
@ -218,7 +216,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
public List<String> searchBaseUrls(
|
public List<String> searchBaseUrls(
|
||||||
@RequestBody final RequestFilter requestFilter,
|
@RequestBody final RequestFilter requestFilter,
|
||||||
@PathVariable final int page,
|
@PathVariable final int page,
|
||||||
@PathVariable final int size) throws DsmException {
|
@PathVariable final int size) throws DsmApiException {
|
||||||
|
|
||||||
return dsmCore.findBaseURLs(requestFilter, page, size);
|
return dsmCore.findBaseURLs(requestFilter, page, size);
|
||||||
}
|
}
|
||||||
|
@ -233,7 +231,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "403", description = "Api not removable"),
|
@ApiResponse(responseCode = "403", description = "Api not removable"),
|
||||||
@ApiResponse(responseCode = "500", description = "DSM Server error")
|
@ApiResponse(responseCode = "500", description = "DSM Server error")
|
||||||
})
|
})
|
||||||
public void deleteApi(@PathVariable final String apiId) throws DsmForbiddenException, DsmNotFoundException {
|
public void deleteApi(@PathVariable final String apiId) throws DsmApiException {
|
||||||
dsmCore.deleteApi(apiId);
|
dsmCore.deleteApi(apiId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +245,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
})
|
})
|
||||||
public void setManaged(
|
public void setManaged(
|
||||||
@RequestParam final String id,
|
@RequestParam final String id,
|
||||||
@RequestParam final boolean managed) throws DsmException {
|
@RequestParam final boolean managed) throws DsmApiException {
|
||||||
|
|
||||||
dsmCore.setManaged(id, managed);
|
dsmCore.setManaged(id, managed);
|
||||||
}
|
}
|
||||||
|
@ -260,7 +258,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public boolean isManaged(@PathVariable final String id) throws DsmException {
|
public boolean isManaged(@PathVariable final String id) throws DsmApiException {
|
||||||
return dsmCore.isManaged(id);
|
return dsmCore.isManaged(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,10 +271,10 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "400", description = "Malformed request"),
|
@ApiResponse(responseCode = "400", description = "Malformed request"),
|
||||||
@ApiResponse(responseCode = "500", description = "Unexpected error")
|
@ApiResponse(responseCode = "500", description = "Unexpected error")
|
||||||
})
|
})
|
||||||
public void saveDs(@Valid @RequestBody final DatasourceDetails datasource) throws DsmException {
|
public void saveDs(@Valid @RequestBody final DatasourceDetails datasource) throws DsmApiException {
|
||||||
|
|
||||||
if (dsmCore.exist(datasource)) { // TODO further check that the DS doesn't have any API
|
if (dsmCore.exist(datasource)) { // TODO further check that the DS doesn't have any API
|
||||||
throw new DsmException(HttpStatus.SC_CONFLICT, String.format("cannot register, datasource already defined '%s'", datasource.getId()));
|
throw new DsmApiException(HttpStatus.SC_CONFLICT, String.format("cannot register, datasource already defined '%s'", datasource.getId()));
|
||||||
}
|
}
|
||||||
dsmCore.save(datasource);
|
dsmCore.save(datasource);
|
||||||
}
|
}
|
||||||
|
@ -290,10 +288,10 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "400", description = "Malformed request"),
|
@ApiResponse(responseCode = "400", description = "Malformed request"),
|
||||||
@ApiResponse(responseCode = "500", description = "Unexpected error")
|
@ApiResponse(responseCode = "500", description = "Unexpected error")
|
||||||
})
|
})
|
||||||
public void saveDsWithApis(@Valid @RequestBody final DatasourceDetailsWithApis d) throws DsmException {
|
public void saveDsWithApis(@Valid @RequestBody final DatasourceDetailsWithApis d) throws DsmApiException {
|
||||||
if (d.getDatasource() == null) { throw new DsmException(HttpStatus.SC_BAD_REQUEST, "Datasource field is null"); }
|
if (d.getDatasource() == null) { throw new DsmApiException(HttpStatus.SC_BAD_REQUEST, "Datasource field is null"); }
|
||||||
if (dsmCore.exist(d.getDatasource())) { // TODO further check that the DS doesn't have any API
|
if (dsmCore.exist(d.getDatasource())) { // TODO further check that the DS doesn't have any API
|
||||||
throw new DsmException(HttpStatus.SC_CONFLICT, String.format("cannot register, datasource already defined '%s'", d.getDatasource().getId()));
|
throw new DsmApiException(HttpStatus.SC_CONFLICT, String.format("cannot register, datasource already defined '%s'", d.getDatasource().getId()));
|
||||||
}
|
}
|
||||||
dsmCore.save(d);
|
dsmCore.save(d);
|
||||||
}
|
}
|
||||||
|
@ -307,7 +305,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public void updateDatasource(
|
public void updateDatasource(
|
||||||
@RequestBody final DatasourceDetailsUpdate ds) throws DsmException, DsmNotFoundException {
|
@RequestBody final DatasourceDetailsUpdate ds) throws DsmApiException {
|
||||||
|
|
||||||
dsmCore.updateDatasource(ds);
|
dsmCore.updateDatasource(ds);
|
||||||
}
|
}
|
||||||
|
@ -323,7 +321,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
public void updateBaseUrl(
|
public void updateBaseUrl(
|
||||||
@RequestParam final String dsId,
|
@RequestParam final String dsId,
|
||||||
@RequestParam final String apiId,
|
@RequestParam final String apiId,
|
||||||
@RequestParam final String baseUrl) throws DsmException {
|
@RequestParam final String baseUrl) throws DsmApiException {
|
||||||
|
|
||||||
dsmCore.updateApiBaseurl(dsId, apiId, baseUrl);
|
dsmCore.updateApiBaseurl(dsId, apiId, baseUrl);
|
||||||
}
|
}
|
||||||
|
@ -340,7 +338,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@RequestParam final String dsId,
|
@RequestParam final String dsId,
|
||||||
@RequestParam final String apiId,
|
@RequestParam final String apiId,
|
||||||
@RequestParam final String compliance,
|
@RequestParam final String compliance,
|
||||||
@RequestParam(required = false, defaultValue = "false") final boolean override) throws DsmException {
|
@RequestParam(required = false, defaultValue = "false") final boolean override) throws DsmApiException {
|
||||||
|
|
||||||
dsmCore.updateApiCompatibility(dsId, apiId, compliance, override);
|
dsmCore.updateApiCompatibility(dsId, apiId, compliance, override);
|
||||||
}
|
}
|
||||||
|
@ -356,7 +354,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
public void updateOaiSetl(
|
public void updateOaiSetl(
|
||||||
@RequestParam final String dsId,
|
@RequestParam final String dsId,
|
||||||
@RequestParam final String apiId,
|
@RequestParam final String apiId,
|
||||||
@RequestParam final String oaiSet) throws DsmException {
|
@RequestParam final String oaiSet) throws DsmApiException {
|
||||||
|
|
||||||
dsmCore.updateApiOaiSet(dsId, apiId, oaiSet);
|
dsmCore.updateApiOaiSet(dsId, apiId, oaiSet);
|
||||||
}
|
}
|
||||||
|
@ -369,8 +367,8 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public void addApi(@RequestBody final ApiDetails api) throws DsmException {
|
public void addApi(@RequestBody final ApiDetails api) throws DsmApiException {
|
||||||
if (StringUtils.isBlank(api.getDatasource())) { throw new DsmException(HttpStatus.SC_BAD_REQUEST, "missing datasource id"); }
|
if (StringUtils.isBlank(api.getDatasource())) { throw new DsmApiException(HttpStatus.SC_BAD_REQUEST, "missing datasource id"); }
|
||||||
dsmCore.addApi(api);
|
dsmCore.addApi(api);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +385,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public int getOps() throws DsmException {
|
public int getOps() throws DsmApiException {
|
||||||
return operationManager.getOpSize();
|
return operationManager.getOpSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +397,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public int killOps() throws DsmException {
|
public int killOps() throws DsmApiException {
|
||||||
return operationManager.dropAll();
|
return operationManager.dropAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +409,7 @@ public class DsmApiController extends AbstractExporterController {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
})
|
})
|
||||||
public void dropCache() throws DsmException {
|
public void dropCache() throws DsmApiException {
|
||||||
dsmCore.dropCaches();
|
dsmCore.dropCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.common.AbstractExporterController;
|
import eu.dnetlib.openaire.common.AbstractExporterController;
|
||||||
import eu.dnetlib.openaire.dsm.dao.ResponseUtils;
|
import eu.dnetlib.openaire.dsm.dao.ResponseUtils;
|
||||||
import eu.dnetlib.openaire.dsm.domain.SimpleDatasourceInfo;
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
import eu.dnetlib.openaire.dsm.domain.SimpleResponse;
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV2;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.SimpleDatasourceInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
@ -83,4 +85,20 @@ public class DsmApiControllerV2 extends AbstractExporterController {
|
||||||
return prepareResponse(1, list.size(), stop, rsp);
|
return prepareResponse(1, list.size(), stop, rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/aggregationhistory/{dsId}", produces = {
|
||||||
|
"application/json"
|
||||||
|
})
|
||||||
|
@Operation(summary = "Return history", description = "Returns the aggregation history of the datasources (it includes also the failures)", tags = {
|
||||||
|
DS, R
|
||||||
|
})
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||||
|
})
|
||||||
|
public AggregationHistoryResponseV2 aggregationHistory(@PathVariable final String dsId) throws DsmApiException {
|
||||||
|
final StopWatch stop = StopWatch.createStarted();
|
||||||
|
final AggregationHistoryResponseV2 rsp = dsmCore.aggregationhistoryV2(dsId);
|
||||||
|
return prepareResponse(0, rsp.getAggregationInfo().size(), stop, rsp);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.nio.charset.Charset;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -29,35 +30,42 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.core.RowMapper;
|
import org.springframework.jdbc.core.RowMapper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
import eu.dnetlib.enabling.datasources.common.DsmException;
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
|
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
|
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
|
||||||
import eu.dnetlib.openaire.common.ISClient;
|
import eu.dnetlib.openaire.common.ISClient;
|
||||||
import eu.dnetlib.openaire.community.CommunityClient;
|
import eu.dnetlib.openaire.community.CommunityClient;
|
||||||
|
import eu.dnetlib.openaire.dsm.dao.CountryTermRepository;
|
||||||
import eu.dnetlib.openaire.dsm.dao.DatasourceDao;
|
import eu.dnetlib.openaire.dsm.dao.DatasourceDao;
|
||||||
import eu.dnetlib.openaire.dsm.dao.MongoLoggerClient;
|
import eu.dnetlib.openaire.dsm.dao.MongoLoggerClient;
|
||||||
import eu.dnetlib.openaire.dsm.dao.ResponseUtils;
|
import eu.dnetlib.openaire.dsm.dao.ResponseUtils;
|
||||||
import eu.dnetlib.openaire.dsm.dao.VocabularyClient;
|
import eu.dnetlib.openaire.dsm.dao.VocabularyClient;
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
|
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
|
||||||
import eu.dnetlib.openaire.dsm.domain.AggregationHistoryResponse;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.ApiDetails;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetails;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsWithApis;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.RegisteredDatasourceInfo;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestFilter;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSort;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.SimpleDatasourceInfo;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.SimpleResponse;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.IdentityDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.IdentityDbEntry;
|
||||||
import eu.dnetlib.openaire.vocabularies.Country;
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV1;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV2;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.ApiDetailsResponse;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailResponse;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsUpdate;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsWithApis;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetResponse;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.RegisteredDatasourceInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSort;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSortOrder;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.SimpleDatasourceInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.vocabularies.Country;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.vocabularies.Vocabulary;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnProperty(value = "openaire.exporter.enable.dsm", havingValue = "true")
|
@ConditionalOnProperty(value = "openaire.exporter.enable.dsm", havingValue = "true")
|
||||||
|
@ -77,19 +85,24 @@ public class DsmCore {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DatasourceDao<DatasourceDbEntry, ApiDbEntry> dsDao;
|
private DatasourceDao<DatasourceDbEntry, ApiDbEntry> dsDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CountryTermRepository countryTermRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcTemplate jdbcTemplate;
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommunityClient communityClient;
|
private CommunityClient communityClient;
|
||||||
|
|
||||||
public List<Country> listCountries() throws DsmException {
|
public List<Country> listCountries() throws DsmApiException {
|
||||||
try {
|
final List<Country> countries = Lists.newArrayList();
|
||||||
return dsDao.listCountries();
|
final Vocabulary v = vocabularyClient.getCountries();
|
||||||
} catch (final Throwable e) {
|
countries.addAll(countryTermRepository.findAll()
|
||||||
log.error("error listing countries", e);
|
.stream()
|
||||||
throw e;
|
.filter(Objects::nonNull)
|
||||||
}
|
.map(t -> new Country(t.getTerm(), v.getEnglishName(t.getTerm())))
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
return countries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatasourceDetailResponse searchDsDetails(final RequestSort requestSortBy,
|
public DatasourceDetailResponse searchDsDetails(final RequestSort requestSortBy,
|
||||||
|
@ -97,14 +110,14 @@ public class DsmCore {
|
||||||
final RequestFilter requestFilter,
|
final RequestFilter requestFilter,
|
||||||
final int page,
|
final int page,
|
||||||
final int size)
|
final int size)
|
||||||
throws DsmException {
|
throws DsmApiException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Page<DatasourceDbEntry> dsPage = dsDao.search(requestSortBy, order, requestFilter, page, size);
|
final Page<DatasourceDbEntry> dsPage = dsDao.search(requestSortBy, order, requestFilter, page, size);
|
||||||
return ResponseUtils.detailsResponse(dsPage.map(d -> asDetails(d)).getContent(), dsPage.getTotalElements());
|
return ResponseUtils.detailsResponse(dsPage.map(d -> asDetails(d)).getContent(), dsPage.getTotalElements());
|
||||||
} catch (final Throwable e) {
|
} catch (final DsmException e) {
|
||||||
log.error("error searching datasources", e);
|
log.error("error searching datasources", e);
|
||||||
throw e;
|
throw new DsmApiException(e.getCode(), "error searching datasources", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,13 +126,13 @@ public class DsmCore {
|
||||||
final RequestFilter requestFilter,
|
final RequestFilter requestFilter,
|
||||||
final int page,
|
final int page,
|
||||||
final int size)
|
final int size)
|
||||||
throws DsmException {
|
throws DsmApiException {
|
||||||
try {
|
try {
|
||||||
final Page<DatasourceDbEntry> dsPage = dsDao.search(requestSortBy, order, requestFilter, page, size);
|
final Page<DatasourceDbEntry> dsPage = dsDao.search(requestSortBy, order, requestFilter, page, size);
|
||||||
return ResponseUtils.snippetResponse(dsPage.map(DsmMappingUtils::asSnippetExtended).getContent(), dsPage.getTotalElements());
|
return ResponseUtils.snippetResponse(dsPage.map(DsmMappingUtils::asSnippetExtended).getContent(), dsPage.getTotalElements());
|
||||||
} catch (final Throwable e) {
|
} catch (final DsmException e) {
|
||||||
log.error("error searching datasources", e);
|
log.error("error searching datasources", e);
|
||||||
throw e;
|
throw new DsmApiException(e.getCode(), "error searching datasources", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,26 +141,26 @@ public class DsmCore {
|
||||||
final RequestFilter requestFilter,
|
final RequestFilter requestFilter,
|
||||||
final int page,
|
final int page,
|
||||||
final int size)
|
final int size)
|
||||||
throws DsmException {
|
throws DsmApiException {
|
||||||
try {
|
try {
|
||||||
final Page<DatasourceDbEntry> dsPage = dsDao.searchRegistered(requestSortBy, order, requestFilter, page, size);
|
final Page<DatasourceDbEntry> dsPage = dsDao.searchRegistered(requestSortBy, order, requestFilter, page, size);
|
||||||
return ResponseUtils.snippetResponse(dsPage.map(DsmMappingUtils::asSnippetExtended).getContent(), dsPage.getTotalElements());
|
return ResponseUtils.snippetResponse(dsPage.map(DsmMappingUtils::asSnippetExtended).getContent(), dsPage.getTotalElements());
|
||||||
} catch (final Throwable e) {
|
} catch (final DsmException e) {
|
||||||
log.error("error searching datasources", e);
|
log.error("error searching datasources", e);
|
||||||
throw e;
|
throw new DsmApiException(e.getCode(), "error searching datasources", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> findBaseURLs(final RequestFilter requestFilter, final int page, final int size) throws DsmException {
|
public List<String> findBaseURLs(final RequestFilter requestFilter, final int page, final int size) throws DsmApiException {
|
||||||
try {
|
try {
|
||||||
return dsDao.findApiBaseURLs(requestFilter, page, size);
|
return dsDao.findApiBaseURLs(requestFilter, page, size);
|
||||||
} catch (final Throwable e) {
|
} catch (final DsmException e) {
|
||||||
log.error("error searching datasource base urls", e);
|
log.error("error searching datasource base urls", e);
|
||||||
throw e;
|
throw new DsmApiException(e.getCode(), "error searching datasource base urls", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiDetailsResponse getApis(final String dsId) throws DsmException {
|
public ApiDetailsResponse getApis(final String dsId) throws DsmApiException {
|
||||||
try {
|
try {
|
||||||
final DatasourceDbEntry ds = dsDao.getDs(dsId);
|
final DatasourceDbEntry ds = dsDao.getDs(dsId);
|
||||||
final List<? extends ApiDbEntry> apis = dsDao.getApis(dsId);
|
final List<? extends ApiDbEntry> apis = dsDao.getApis(dsId);
|
||||||
|
@ -157,37 +170,49 @@ public class DsmCore {
|
||||||
.map(a -> a.setTypology(ds.getTypology()))
|
.map(a -> a.setTypology(ds.getTypology()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return ResponseUtils.apiResponse(api, api.size());
|
return ResponseUtils.apiResponse(api, api.size());
|
||||||
} catch (final Throwable e) {
|
} catch (final DsmException e) {
|
||||||
log.error(String.format("error searching datasource api %s", dsId), e);
|
log.error(String.format("error searching datasource api %s", dsId), e);
|
||||||
throw e;
|
throw new DsmApiException(e.getCode(), String.format("error searching datasource api %s", dsId), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setManaged(final String dsId, final boolean managed) throws DsmException {
|
public void setManaged(final String dsId, final boolean managed) throws DsmApiException {
|
||||||
log.info(String.format("updated ds '%s' managed with '%s'", dsId, managed));
|
log.info(String.format("updated ds '%s' managed with '%s'", dsId, managed));
|
||||||
dsDao.setManaged(dsId, managed);
|
try {
|
||||||
|
dsDao.setManaged(dsId, managed);
|
||||||
|
} catch (final DsmException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isManaged(final String dsId) throws DsmException {
|
public boolean isManaged(final String dsId) throws DsmApiException {
|
||||||
return dsDao.isManaged(dsId);
|
try {
|
||||||
|
return dsDao.isManaged(dsId);
|
||||||
|
} catch (final DsmException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean exist(final DatasourceDetails d) throws DsmException {
|
public boolean exist(final DatasourceDetails d) throws DsmApiException {
|
||||||
return dsDao.existDs(d.getId());
|
try {
|
||||||
|
return dsDao.existDs(d.getId());
|
||||||
|
} catch (final DsmException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(final DatasourceDetails d) throws DsmException {
|
public void save(final DatasourceDetails d) throws DsmApiException {
|
||||||
try {
|
try {
|
||||||
dsDao.saveDs(asDbEntry(d));
|
dsDao.saveDs(asDbEntry(d));
|
||||||
log.info("DS saved, " + d.getId());
|
log.info("DS saved, " + d.getId());
|
||||||
} catch (final Throwable e) {
|
} catch (final DsmException e) {
|
||||||
log.error(ExceptionUtils.getStackTrace(e));
|
log.error(ExceptionUtils.getStackTrace(e));
|
||||||
throw e;
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void save(final DatasourceDetailsWithApis d) throws DsmException {
|
public void save(final DatasourceDetailsWithApis d) throws DsmApiException {
|
||||||
try {
|
try {
|
||||||
dsDao.saveDs(asDbEntry(d.getDatasource()));
|
dsDao.saveDs(asDbEntry(d.getDatasource()));
|
||||||
final List<ApiDetails> apis = d.getApis();
|
final List<ApiDetails> apis = d.getApis();
|
||||||
|
@ -197,15 +222,13 @@ public class DsmCore {
|
||||||
addApi(api);
|
addApi(api);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (
|
} catch (final DsmException e) {
|
||||||
|
|
||||||
final Throwable e) {
|
|
||||||
log.error(ExceptionUtils.getStackTrace(e));
|
log.error(ExceptionUtils.getStackTrace(e));
|
||||||
throw e;
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDatasource(final DatasourceDetailsUpdate d) throws DsmException, DsmNotFoundException {
|
public void updateDatasource(final DatasourceDetailsUpdate d) throws DsmApiException {
|
||||||
try {
|
try {
|
||||||
// initialize with current values from DB
|
// initialize with current values from DB
|
||||||
final DatasourceDbEntry ds = dsDao.getDs(d.getId());
|
final DatasourceDbEntry ds = dsDao.getDs(d.getId());
|
||||||
|
@ -226,46 +249,72 @@ public class DsmCore {
|
||||||
}
|
}
|
||||||
|
|
||||||
dsDao.saveDs(ds);
|
dsDao.saveDs(ds);
|
||||||
} catch (final Throwable e) {
|
} catch (final DsmException e) {
|
||||||
log.error(ExceptionUtils.getStackTrace(e));
|
log.error(ExceptionUtils.getStackTrace(e));
|
||||||
throw e;
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove if unused
|
// TODO remove if unused
|
||||||
public void deleteDs(final String dsId) throws DsmException {
|
public void deleteDs(final String dsId) throws DsmApiException {
|
||||||
log.info(String.format("deleted datasource '%s'", dsId));
|
log.info(String.format("deleted datasource '%s'", dsId));
|
||||||
dsDao.deleteDs(dsId);
|
try {
|
||||||
|
dsDao.deleteDs(dsId);
|
||||||
|
} catch (final DsmException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// API
|
// API
|
||||||
|
|
||||||
public void updateApiOaiSet(final String dsId, final String apiId, final String oaiSet) throws DsmException {
|
public void updateApiOaiSet(final String dsId, final String apiId, final String oaiSet) throws DsmApiException {
|
||||||
dsDao.upsertApiOaiSet(apiId, oaiSet);
|
try {
|
||||||
|
dsDao.upsertApiOaiSet(apiId, oaiSet);
|
||||||
|
} catch (final DsmException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateApiBaseurl(final String dsId, final String apiId, final String baseUrl) throws DsmException {
|
public void updateApiBaseurl(final String dsId, final String apiId, final String baseUrl) throws DsmApiException {
|
||||||
log.info(String.format("updated api '%s' baseurl with '%s'", apiId, baseUrl));
|
log.info(String.format("updated api '%s' baseurl with '%s'", apiId, baseUrl));
|
||||||
dsDao.updateApiBaseUrl(apiId, baseUrl);
|
try {
|
||||||
|
dsDao.updateApiBaseUrl(apiId, baseUrl);
|
||||||
|
} catch (final DsmException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateApiCompatibility(final String dsId, final String apiId, final String compliance, final boolean override) throws DsmException {
|
public void updateApiCompatibility(final String dsId, final String apiId, final String compliance, final boolean override) throws DsmApiException {
|
||||||
log.info(String.format("updated api '%s' compliance with '%s'", apiId, compliance));
|
log.info(String.format("updated api '%s' compliance with '%s'", apiId, compliance));
|
||||||
dsDao.updateCompliance(null, apiId, compliance, override);
|
try {
|
||||||
|
dsDao.updateCompliance(null, apiId, compliance, override);
|
||||||
|
} catch (final DsmException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addApi(final ApiDetails api) throws DsmException {
|
public void addApi(final ApiDetails api) throws DsmApiException {
|
||||||
if (StringUtils.isBlank(api.getId())) {
|
if (StringUtils.isBlank(api.getId())) {
|
||||||
api.setId(createId(api));
|
api.setId(createId(api));
|
||||||
log.info(String.format("missing api id, created '%s'", api.getId()));
|
log.info(String.format("missing api id, created '%s'", api.getId()));
|
||||||
}
|
}
|
||||||
dsDao.addApi(asDbEntry(api));
|
try {
|
||||||
log.info("API saved, id: " + api.getId());
|
dsDao.addApi(asDbEntry(api));
|
||||||
|
log.info("API saved, id: " + api.getId());
|
||||||
|
} catch (final DsmException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteApi(final String apiId) throws DsmForbiddenException, DsmNotFoundException {
|
public void deleteApi(final String apiId) throws DsmApiException {
|
||||||
// TODO handle the api removal in case of associated workflows.
|
// TODO handle the api removal in case of associated workflows.
|
||||||
dsDao.deleteApi(null, apiId);
|
try {
|
||||||
|
dsDao.deleteApi(null, apiId);
|
||||||
|
} catch (final DsmForbiddenException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
} catch (final DsmNotFoundException e) {
|
||||||
|
throw new DsmApiException(e.getCode(), e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropCaches() {
|
public void dropCaches() {
|
||||||
|
@ -313,9 +362,17 @@ public class DsmCore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AggregationHistoryResponse aggregationhistory(final String dsId) throws DsmException {
|
@Deprecated
|
||||||
final List<AggregationInfo> history = mongoLoggerClient.getAggregationHistory(dsId);
|
public AggregationHistoryResponseV1 aggregationhistoryV1(final String dsId) throws DsmApiException {
|
||||||
final AggregationHistoryResponse rsp = new AggregationHistoryResponse(history);
|
final List<AggregationInfoV1> history = mongoLoggerClient.getAggregationHistoryV1(dsId);
|
||||||
|
final AggregationHistoryResponseV1 rsp = new AggregationHistoryResponseV1(history);
|
||||||
|
rsp.setHeader(ResponseUtils.header(history.size()));
|
||||||
|
return rsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AggregationHistoryResponseV2 aggregationhistoryV2(final String dsId) throws DsmApiException {
|
||||||
|
final List<AggregationInfo> history = mongoLoggerClient.getAggregationHistoryV2(dsId);
|
||||||
|
final AggregationHistoryResponseV2 rsp = new AggregationHistoryResponseV2(history);
|
||||||
rsp.setHeader(ResponseUtils.header(history.size()));
|
rsp.setHeader(ResponseUtils.header(history.size()));
|
||||||
return rsp;
|
return rsp;
|
||||||
|
|
||||||
|
|
|
@ -8,17 +8,14 @@ import eu.dnetlib.enabling.datasources.common.Api;
|
||||||
import eu.dnetlib.enabling.datasources.common.Datasource;
|
import eu.dnetlib.enabling.datasources.common.Datasource;
|
||||||
import eu.dnetlib.enabling.datasources.common.DatasourceManagerCommon;
|
import eu.dnetlib.enabling.datasources.common.DatasourceManagerCommon;
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
import eu.dnetlib.enabling.datasources.common.DsmException;
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestFilter;
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter;
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSort;
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSort;
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSortOrder;
|
||||||
import eu.dnetlib.openaire.vocabularies.Country;
|
|
||||||
|
|
||||||
public interface DatasourceDao<DS extends Datasource<?, ?, ?>, API extends Api<?>> extends DatasourceManagerCommon<DS, API> {
|
public interface DatasourceDao<DS extends Datasource<?, ?, ?>, API extends Api<?>> extends DatasourceManagerCommon<DS, API> {
|
||||||
|
|
||||||
// DATASOURCE
|
// DATASOURCE
|
||||||
|
|
||||||
List<Country> listCountries() throws DsmException;
|
|
||||||
|
|
||||||
boolean existDs(final String dsId) throws DsmException;
|
boolean existDs(final String dsId) throws DsmException;
|
||||||
|
|
||||||
Page<DS> search(RequestSort requestSortBy, RequestSortOrder order, RequestFilter requestFilter, int page, int size) throws DsmException;
|
Page<DS> search(RequestSort requestSortBy, RequestSortOrder order, RequestFilter requestFilter, int page, int size) throws DsmException;
|
||||||
|
@ -55,6 +52,4 @@ public interface DatasourceDao<DS extends Datasource<?, ?, ?>, API extends Api<?
|
||||||
|
|
||||||
void updateApiBaseUrl(String apiId, String baseUrl) throws DsmException;
|
void updateApiBaseUrl(String apiId, String baseUrl) throws DsmException;
|
||||||
|
|
||||||
@Override
|
|
||||||
void addApi(final API api) throws DsmException;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import static eu.dnetlib.openaire.dsm.dao.DatasourceSpecs.dsSpec;
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -33,15 +32,13 @@ import eu.dnetlib.DnetOpenaireExporterProperties;
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
import eu.dnetlib.enabling.datasources.common.DsmException;
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
|
import eu.dnetlib.enabling.datasources.common.DsmForbiddenException;
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
|
import eu.dnetlib.enabling.datasources.common.DsmNotFoundException;
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestFilter;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSort;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.ApiParamDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.ApiParamDbEntry;
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.DatasourceApiDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.DatasourceApiDbEntry;
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
||||||
import eu.dnetlib.openaire.vocabularies.Country;
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter;
|
||||||
import eu.dnetlib.openaire.vocabularies.Vocabulary;
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSort;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSortOrder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by claudio on 20/10/2016.
|
* Created by claudio on 20/10/2016.
|
||||||
|
@ -55,9 +52,6 @@ public class DatasourceDaoImpl implements DatasourceDao<DatasourceDbEntry, ApiDb
|
||||||
@Autowired
|
@Autowired
|
||||||
private DnetOpenaireExporterProperties config;
|
private DnetOpenaireExporterProperties config;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CountryTermRepository countryTermRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DatasourceDbEntryRepository dsRepository;
|
private DatasourceDbEntryRepository dsRepository;
|
||||||
|
|
||||||
|
@ -67,20 +61,8 @@ public class DatasourceDaoImpl implements DatasourceDao<DatasourceDbEntry, ApiDb
|
||||||
@Autowired
|
@Autowired
|
||||||
private DatasourceApiDbEntryRepository dsApiRepository;
|
private DatasourceApiDbEntryRepository dsApiRepository;
|
||||||
|
|
||||||
@Autowired
|
// @Autowired
|
||||||
private VocabularyClient vocabularyClient;
|
// private VocabularyClient vocabularyClient;
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Country> listCountries() throws DsmException {
|
|
||||||
final List<Country> countries = Lists.newArrayList();
|
|
||||||
final Vocabulary v = vocabularyClient.getCountries();
|
|
||||||
countries.addAll(countryTermRepository.findAll()
|
|
||||||
.stream()
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.map(t -> new Country(t.getTerm(), v.getEnglishName(t.getTerm())))
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
return countries;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<DatasourceDbEntry> search(final RequestSort requestSortBy,
|
public Page<DatasourceDbEntry> search(final RequestSort requestSortBy,
|
||||||
|
@ -239,13 +221,11 @@ public class DatasourceDaoImpl implements DatasourceDao<DatasourceDbEntry, ApiDb
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEoscDatasourceType(final String dsId, final String type) throws DsmException {
|
public void updateEoscDatasourceType(final String dsId, final String type) throws DsmException {
|
||||||
final Vocabulary typologies = vocabularyClient.getDatasourceTypologies();
|
/*
|
||||||
if (!typologies.hasCode(type)) {
|
* final Vocabulary typologies = vocabularyClient.getDatasourceTypologies(); if (!typologies.hasCode(type)) { throw new
|
||||||
throw new DsmException(
|
* DsmException( HttpStatus.SC_BAD_REQUEST, String.format("invalid datasource type '%s', provide one according to vocabulary %s",
|
||||||
HttpStatus.SC_BAD_REQUEST,
|
* type, config.getVocabularies() .getDatasourceTypologiesEndpoint())); }
|
||||||
String.format("invalid datasource type '%s', provide one according to vocabulary %s", type, config.getVocabularies()
|
*/
|
||||||
.getDatasourceTypologiesEndpoint()));
|
|
||||||
}
|
|
||||||
dsRepository.setEoscDatasourceType(dsId, type);
|
dsRepository.setEoscDatasourceType(dsId, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,14 @@ package eu.dnetlib.openaire.dsm.dao;
|
||||||
|
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
|
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.IndexRecordsInfo;
|
import eu.dnetlib.openaire.dsm.dao.utils.IndexRecordsInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
|
|
||||||
public interface DatasourceIndexClient {
|
public interface DatasourceIndexClient {
|
||||||
|
|
||||||
IndexRecordsInfo getIndexInfo(final String dsId, final IndexDsInfo info, final Queue<Throwable> errors) throws DsmException;
|
IndexRecordsInfo getIndexInfo(final String dsId, final IndexDsInfo info, final Queue<Throwable> errors) throws DsmApiException;
|
||||||
|
|
||||||
String getLastIndexingDate(final IndexDsInfo info) throws DsmException;
|
|
||||||
|
|
||||||
|
|
||||||
|
String getLastIndexingDate(final IndexDsInfo info) throws DsmApiException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,15 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.util.concurrent.*;
|
|
||||||
import eu.dnetlib.DnetOpenaireExporterProperties;
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
|
||||||
import eu.dnetlib.miscutils.functional.hash.Hashing;
|
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
|
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
|
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.IndexRecordsInfo;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -33,6 +29,22 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
|
import com.google.common.util.concurrent.Futures;
|
||||||
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
|
import com.google.common.util.concurrent.MoreExecutors;
|
||||||
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
|
|
||||||
|
import eu.dnetlib.DnetOpenaireExporterProperties;
|
||||||
|
import eu.dnetlib.enabling.datasources.common.DsmException;
|
||||||
|
import eu.dnetlib.miscutils.functional.hash.Hashing;
|
||||||
|
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
|
||||||
|
import eu.dnetlib.openaire.dsm.dao.utils.IndexDsInfo;
|
||||||
|
import eu.dnetlib.openaire.dsm.dao.utils.IndexRecordsInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by claudio on 20/10/2016.
|
* Created by claudio on 20/10/2016.
|
||||||
*/
|
*/
|
||||||
|
@ -54,9 +66,8 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
executor = MoreExecutors.listeningDecorator(
|
executor = MoreExecutors.listeningDecorator(new ScheduledThreadPoolExecutor(5,
|
||||||
new ScheduledThreadPoolExecutor(5,
|
new ThreadFactoryBuilder().setNameFormat("datasource-index-client-%d").build()));
|
||||||
new ThreadFactoryBuilder().setNameFormat("datasource-index-client-%d").build()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
|
@ -64,65 +75,61 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
|
||||||
indexClientMap.forEach((name, client) -> {
|
indexClientMap.forEach((name, client) -> {
|
||||||
try {
|
try {
|
||||||
client.close();
|
client.close();
|
||||||
} catch (IOException e) {
|
} catch (final IOException e) {
|
||||||
log.warn(String.format("unable to gracefully shutdown client for index %s", name));
|
log.warn(String.format("unable to gracefully shutdown client for index %s", name));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IndexRecordsInfo getIndexInfo(final String dsId, final IndexDsInfo info, final Queue<Throwable> errors) throws DsmException {
|
public IndexRecordsInfo getIndexInfo(final String dsId, final IndexDsInfo info, final Queue<Throwable> errors) throws DsmApiException {
|
||||||
try {
|
try {
|
||||||
final String collectedFrom = StringUtils.substringBefore(dsId, SEPARATOR) + SEPARATOR + Hashing.md5(StringUtils.substringAfter(dsId, SEPARATOR));
|
final String collectedFrom = StringUtils.substringBefore(dsId, SEPARATOR) + SEPARATOR + Hashing.md5(StringUtils.substringAfter(dsId, SEPARATOR));
|
||||||
final CloudSolrClient indexClient = getIndexClient(info);
|
final CloudSolrClient indexClient = getIndexClient(info);
|
||||||
final CountDownLatch latch = new CountDownLatch(2);
|
final CountDownLatch latch = new CountDownLatch(2);
|
||||||
final IndexRecordsInfo indexRecordInfo = new IndexRecordsInfo();
|
final IndexRecordsInfo indexRecordInfo = new IndexRecordsInfo();
|
||||||
|
|
||||||
Futures.addCallback(
|
Futures.addCallback(executor.submit(() -> setDateAndTotal(dsId, collectedFrom, indexClient)), new FutureCallback<IndexRecordsInfo>() {
|
||||||
executor.submit(() -> setDateAndTotal(dsId, collectedFrom, indexClient)),
|
|
||||||
new FutureCallback<IndexRecordsInfo>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(final IndexRecordsInfo info) {
|
public void onSuccess(final IndexRecordsInfo info) {
|
||||||
indexRecordInfo
|
indexRecordInfo
|
||||||
.setTotal(info.getTotal())
|
.setTotal(info.getTotal())
|
||||||
.setDate(info.getDate());
|
.setDate(info.getDate());
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(final Throwable e) {
|
public void onFailure(final Throwable e) {
|
||||||
errors.offer(e);
|
errors.offer(e);
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
}, executor);
|
}, executor);
|
||||||
|
|
||||||
Futures.addCallback(
|
Futures.addCallback(executor.submit(() -> setFunded(dsId, collectedFrom, indexClient)), new FutureCallback<Long>() {
|
||||||
executor.submit(() -> setFunded(dsId, collectedFrom, indexClient)),
|
|
||||||
new FutureCallback<Long>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(final Long numFound) {
|
public void onSuccess(final Long numFound) {
|
||||||
indexRecordInfo.setFunded(numFound);
|
indexRecordInfo.setFunded(numFound);
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(final Throwable e) {
|
public void onFailure(final Throwable e) {
|
||||||
errors.offer(e);
|
errors.offer(e);
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
}, executor);
|
}, executor);
|
||||||
|
|
||||||
waitLatch(latch, errors, config.getRequestTimeout());
|
waitLatch(latch, errors, config.getRequestTimeout());
|
||||||
return indexRecordInfo;
|
return indexRecordInfo;
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("error reading index info", dsId), e);
|
throw new DsmApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("error reading index info", dsId), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLastIndexingDate(final IndexDsInfo info) throws DsmException {
|
public String getLastIndexingDate(final IndexDsInfo info) throws DsmApiException {
|
||||||
try {
|
try {
|
||||||
final SolrQuery query = new SolrQuery("oaftype:datasource").setRows(1);
|
final SolrQuery query = new SolrQuery("oaftype:datasource").setRows(1);
|
||||||
final QueryResponse rsp = getIndexClient(info).query(query);
|
final QueryResponse rsp = getIndexClient(info).query(query);
|
||||||
|
@ -130,28 +137,28 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
|
||||||
final String dsversion = doc.get("__dsversion").toString();
|
final String dsversion = doc.get("__dsversion").toString();
|
||||||
return StringUtils.substringBefore(dsversion, "T");
|
return StringUtils.substringBefore(dsversion, "T");
|
||||||
} catch (SolrServerException | IOException e) {
|
} catch (SolrServerException | IOException e) {
|
||||||
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying index DS profile: " + info, e);
|
throw new DsmApiException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Error querying index DS profile: " + info, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long setFunded(
|
private Long setFunded(
|
||||||
final String dsId,
|
final String dsId,
|
||||||
final String collectedFrom,
|
final String collectedFrom,
|
||||||
final CloudSolrClient indexClient) throws DsmException {
|
final CloudSolrClient indexClient) throws DsmException {
|
||||||
final String query =
|
final String query =
|
||||||
String.format("oaftype:result AND deletedbyinference:false AND collectedfromdatasourceid:\"%s\" AND relprojectid:*", collectedFrom);
|
String.format("oaftype:result AND deletedbyinference:false AND collectedfromdatasourceid:\"%s\" AND relprojectid:*", collectedFrom);
|
||||||
log.debug(String.format("query: %s", query));
|
log.debug(String.format("query: %s", query));
|
||||||
try {
|
try {
|
||||||
return indexClient.query(new SolrQuery(query).setRows(0)).getResults().getNumFound();
|
return indexClient.query(new SolrQuery(query).setRows(0)).getResults().getNumFound();
|
||||||
} catch (Throwable e) {
|
} catch (final Throwable e) {
|
||||||
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("Error querying index for funded results '%s'", dsId), e);
|
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("Error querying index for funded results '%s'", dsId), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IndexRecordsInfo setDateAndTotal(
|
private IndexRecordsInfo setDateAndTotal(
|
||||||
final String dsId,
|
final String dsId,
|
||||||
final String collectedFrom,
|
final String collectedFrom,
|
||||||
final CloudSolrClient indexClient) throws DsmException {
|
final CloudSolrClient indexClient) throws DsmException {
|
||||||
try {
|
try {
|
||||||
final String query = String.format("oaftype:result AND deletedbyinference:false AND collectedfromdatasourceid:\"%s\"", collectedFrom);
|
final String query = String.format("oaftype:result AND deletedbyinference:false AND collectedfromdatasourceid:\"%s\"", collectedFrom);
|
||||||
log.debug(String.format("query: %s", query));
|
log.debug(String.format("query: %s", query));
|
||||||
|
@ -166,9 +173,9 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
|
||||||
// query: %s", queryTotal));
|
// query: %s", queryTotal));
|
||||||
// }
|
// }
|
||||||
return new IndexRecordsInfo()
|
return new IndexRecordsInfo()
|
||||||
.setDate(getDate(doc))
|
.setDate(getDate(doc))
|
||||||
.setTotal(rsp.getResults().getNumFound());
|
.setTotal(rsp.getResults().getNumFound());
|
||||||
} catch (Throwable e) {
|
} catch (final Throwable e) {
|
||||||
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("Error querying index for date and total '%s'", dsId), e);
|
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(), String.format("Error querying index for date and total '%s'", dsId), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,8 +183,10 @@ public class DatasourceIndexClientImpl implements DatasourceIndexClient {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private String getDate(final SolrDocument doc) throws DsmException {
|
private String getDate(final SolrDocument doc) throws DsmException {
|
||||||
final List<Date> dsversion = (List<Date>) doc.get(DSVERSION);
|
final List<Date> dsversion = (List<Date>) doc.get(DSVERSION);
|
||||||
if (dsversion == null || dsversion.isEmpty()) { throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(),
|
if (dsversion == null || dsversion.isEmpty()) {
|
||||||
String.format("cannot find %s in matched solr document", DSVERSION)); }
|
throw new DsmException(HttpStatus.INTERNAL_SERVER_ERROR.value(),
|
||||||
|
String.format("cannot find %s in matched solr document", DSVERSION));
|
||||||
|
}
|
||||||
final Date date = Iterables.getLast(dsversion);
|
final Date date = Iterables.getLast(dsversion);
|
||||||
|
|
||||||
return DateFormatUtils.format(date, DsmMappingUtils.DATE_FORMAT);
|
return DateFormatUtils.format(date, DsmMappingUtils.DATE_FORMAT);
|
||||||
|
|
|
@ -17,12 +17,12 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmRuntimeException;
|
import eu.dnetlib.enabling.datasources.common.DsmRuntimeException;
|
||||||
import eu.dnetlib.openaire.dsm.domain.FilterName;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestFilter;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSort;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.RequestSortOrder;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.DatasourceApiDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.DatasourceApiDbEntry;
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.FilterName;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestFilter;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSort;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.RequestSortOrder;
|
||||||
|
|
||||||
public class DatasourceSpecs {
|
public class DatasourceSpecs {
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
package eu.dnetlib.openaire.dsm.dao;
|
package eu.dnetlib.openaire.dsm.dao;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1;
|
||||||
|
|
||||||
public interface MongoLoggerClient {
|
public interface MongoLoggerClient {
|
||||||
|
|
||||||
List<AggregationInfo> getAggregationHistory(final String dsId) throws DsmException;
|
List<AggregationInfoV1> getAggregationHistoryV1(final String dsId) throws DsmApiException;
|
||||||
|
|
||||||
|
List<AggregationInfo> getAggregationHistoryV2(final String dsId) throws DsmApiException;
|
||||||
|
|
||||||
void dropCache();
|
void dropCache();
|
||||||
|
|
||||||
|
|
|
@ -41,15 +41,18 @@ import com.mongodb.client.MongoCollection;
|
||||||
|
|
||||||
import eu.dnetlib.DnetOpenaireExporterProperties;
|
import eu.dnetlib.DnetOpenaireExporterProperties;
|
||||||
import eu.dnetlib.DnetOpenaireExporterProperties.Datasource;
|
import eu.dnetlib.DnetOpenaireExporterProperties.Datasource;
|
||||||
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
|
|
||||||
import eu.dnetlib.enabling.datasources.common.AggregationStage;
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
|
||||||
import eu.dnetlib.miscutils.datetime.DateUtils;
|
import eu.dnetlib.miscutils.datetime.DateUtils;
|
||||||
import eu.dnetlib.openaire.common.Utils;
|
import eu.dnetlib.openaire.common.Utils;
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
|
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
|
||||||
import eu.dnetlib.openaire.dsm.domain.CollectionInfo;
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
import eu.dnetlib.openaire.dsm.domain.CollectionMode;
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
|
||||||
import eu.dnetlib.openaire.dsm.domain.TransformationInfo;
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfoV1;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.AggregationStage;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.CollectionInfoV1;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.CollectionInfoV2;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.CollectionMode;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.TransformationInfoV1;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.TransformationInfoV2;
|
||||||
import eu.dnetlib.openaire.info.JdbcInfoDao;
|
import eu.dnetlib.openaire.info.JdbcInfoDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,10 +74,8 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
|
||||||
private JdbcInfoDao jdbcInfoDao;
|
private JdbcInfoDao jdbcInfoDao;
|
||||||
|
|
||||||
private final static String LOADTIME = "loadtime";
|
private final static String LOADTIME = "loadtime";
|
||||||
private final LoadingCache<String, Instant> loadingCache = CacheBuilder.newBuilder()
|
private final LoadingCache<String, Instant> loadingCache =
|
||||||
.maximumSize(1)
|
CacheBuilder.newBuilder().maximumSize(1).expireAfterWrite(60, TimeUnit.MINUTES).build(new CacheLoader<String, Instant>() {
|
||||||
.expireAfterWrite(60, TimeUnit.MINUTES)
|
|
||||||
.build(new CacheLoader<String, Instant>() {
|
|
||||||
|
|
||||||
// The only cached value is associated to "loadtime"
|
// The only cached value is associated to "loadtime"
|
||||||
@Override
|
@Override
|
||||||
|
@ -90,18 +91,31 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
|
||||||
private static MongoCollection<Document> collection = null;
|
private static MongoCollection<Document> collection = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable("dsm-aggregationhistory-cache")
|
@Cacheable("dsm-aggregationhistory-cache-v1")
|
||||||
public List<AggregationInfo> getAggregationHistory(final String dsId) throws DsmException {
|
@Deprecated
|
||||||
|
public List<AggregationInfoV1> getAggregationHistoryV1(final String dsId) throws DsmApiException {
|
||||||
|
return getAggregationHistory(dsId, queryForAggregationHistoryV1(dsId, "(collect|transform)"), getMapperV1());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Cacheable("dsm-aggregationhistory-cache-v2")
|
||||||
|
public List<AggregationInfo> getAggregationHistoryV2(final String dsId) throws DsmApiException {
|
||||||
|
return getAggregationHistory(dsId, queryForAggregationHistoryV2(dsId, "(collect|transform)"), getMapperV2());
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T extends AggregationInfo> List<T> getAggregationHistory(final String dsId,
|
||||||
|
final Bson queryForAggregationHistory,
|
||||||
|
final Function<Document, T> mapper) throws DsmApiException {
|
||||||
log.warn(String.format("getAggregationHistory(dsId = %s): not using cache", dsId));
|
log.warn(String.format("getAggregationHistory(dsId = %s): not using cache", dsId));
|
||||||
final Datasource conf = config.getDatasource();
|
final Datasource conf = config.getDatasource();
|
||||||
try {
|
try {
|
||||||
final FindIterable<Document> aggregationDocs = getCollection().find(queryForAggregationHistory(dsId, "(collect|transform)"))
|
final FindIterable<Document> aggregationDocs = getCollection().find(queryForAggregationHistory)
|
||||||
.projection(fields)
|
.projection(fields)
|
||||||
.limit(conf.getMongoQueryLimit())
|
.limit(conf.getMongoQueryLimit())
|
||||||
.sort(dbo("system:startHumanDate", -1));
|
.sort(dbo("system:startHumanDate", -1));
|
||||||
|
|
||||||
final List<AggregationInfo> aggregationInfos = Utils.stream(aggregationDocs.iterator())
|
final List<T> aggregationInfos = Utils.stream(aggregationDocs.iterator())
|
||||||
.map(getMapper())
|
.map(mapper)
|
||||||
.filter(ai -> ai.getNumberOfRecords() >= 0 && StringUtils.isNotBlank(ai.getDate()))
|
.filter(ai -> ai.getNumberOfRecords() >= 0 && StringUtils.isNotBlank(ai.getDate()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
@ -118,7 +132,7 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
|
||||||
|
|
||||||
return aggregationInfos;
|
return aggregationInfos;
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
throw new DsmException(HttpStatus.SC_INTERNAL_SERVER_ERROR, String.format("error reading aggregation history for '%s'", dsId), e);
|
throw new DsmApiException(HttpStatus.SC_INTERNAL_SERVER_ERROR, String.format("error reading aggregation history for '%s'", dsId), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,69 +148,97 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(cacheNames = {
|
@CacheEvict(cacheNames = {
|
||||||
"dsm-aggregationhistory-cache", "dsm-firstharvestdate-cache"
|
"dsm-aggregationhistory-cache-v1", "dsm-aggregationhistory-cache-v2", "dsm-firstharvestdate-cache"
|
||||||
}, allEntries = true)
|
}, allEntries = true)
|
||||||
@Scheduled(fixedDelayString = "${openaire.exporter.cache.ttl}")
|
@Scheduled(fixedDelayString = "${openaire.exporter.cache.ttl}")
|
||||||
public void dropCache() {
|
public void dropCache() {
|
||||||
log.debug("dropped dsManager aggregation history cache");
|
log.debug("dropped dsManager aggregation history cache");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Function<Document, AggregationInfo> getMapper() {
|
@Deprecated
|
||||||
return new Function<Document, AggregationInfo>() {
|
private Function<Document, AggregationInfoV1> getMapperV1() {
|
||||||
|
return d -> {
|
||||||
|
|
||||||
@Override
|
AggregationInfoV1 info = null;
|
||||||
public AggregationInfo apply(final Document d) {
|
final AggregationStage stage = AggregationStage.parse(d.getString("system:wfName"));
|
||||||
|
final boolean success = isCompletedSuccesfully(d);
|
||||||
|
|
||||||
AggregationInfo info = null;
|
switch (stage) {
|
||||||
final AggregationStage stage = AggregationStage.parse(d.getString("system:wfName"));
|
|
||||||
final boolean success = isCompletedSuccesfully(d);
|
|
||||||
|
|
||||||
switch (stage) {
|
case COLLECT:
|
||||||
|
final CollectionInfoV1 cInfo = new CollectionInfoV1();
|
||||||
case COLLECT:
|
cInfo.setAggregationStage(stage);
|
||||||
final CollectionInfo cInfo = new CollectionInfo();
|
cInfo.setCollectionMode(getCollectionMode(d));
|
||||||
cInfo.setAggregationStage(stage);
|
cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
|
||||||
cInfo.setCollectionMode(getCollectionMode(d));
|
cInfo.setDate(getDate(d));
|
||||||
cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
|
cInfo.setCompletedSuccessfully(success);
|
||||||
cInfo.setDate(getDate(d));
|
info = cInfo;
|
||||||
cInfo.setCompletedSuccessfully(success);
|
break;
|
||||||
info = cInfo;
|
case TRANSFORM:
|
||||||
break;
|
final TransformationInfoV1 tInfo = new TransformationInfoV1();
|
||||||
case TRANSFORM:
|
tInfo.setAggregationStage(stage);
|
||||||
final TransformationInfo tInfo = new TransformationInfo();
|
tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
|
||||||
tInfo.setAggregationStage(stage);
|
tInfo.setDate(getDate(d));
|
||||||
tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
|
tInfo.setCompletedSuccessfully(success);
|
||||||
tInfo.setDate(getDate(d));
|
info = tInfo;
|
||||||
tInfo.setCompletedSuccessfully(success);
|
break;
|
||||||
info = tInfo;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CollectionMode getCollectionMode(final Document d) {
|
|
||||||
return Optional.ofNullable(d.getString("system:node:SELECT_MODE:selection"))
|
|
||||||
.map(CollectionMode::valueOf)
|
|
||||||
.orElseGet(() -> Optional.ofNullable(d.getString("collectionMode"))
|
|
||||||
.map(CollectionMode::valueOf)
|
|
||||||
.orElse(null));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Integer getNumberOfRecords(final Document d) {
|
|
||||||
final String sinkSize = d.getString("mainlog:sinkSize");
|
|
||||||
final String total = d.getString("mainlog:total");
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(sinkSize)) {
|
|
||||||
return Ints.tryParse(sinkSize);
|
|
||||||
} else if (StringUtils.isNotBlank(total)) {
|
|
||||||
return Ints.tryParse(total);
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return info;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Function<Document, AggregationInfo> getMapperV2() {
|
||||||
|
return d -> {
|
||||||
|
|
||||||
|
AggregationInfo info = null;
|
||||||
|
final AggregationStage stage = AggregationStage.parse(d.getString("system:wfName"));
|
||||||
|
final boolean success = isCompletedSuccesfully(d);
|
||||||
|
|
||||||
|
switch (stage) {
|
||||||
|
|
||||||
|
case COLLECT:
|
||||||
|
final CollectionInfoV2 cInfo = new CollectionInfoV2();
|
||||||
|
cInfo.setAggregationStage(stage);
|
||||||
|
cInfo.setCollectionMode(getCollectionMode(d));
|
||||||
|
cInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
|
||||||
|
cInfo.setDate(getDate(d));
|
||||||
|
cInfo.setCompletedSuccessfully(success);
|
||||||
|
info = cInfo;
|
||||||
|
break;
|
||||||
|
case TRANSFORM:
|
||||||
|
final TransformationInfoV2 tInfo = new TransformationInfoV2();
|
||||||
|
tInfo.setAggregationStage(stage);
|
||||||
|
tInfo.setNumberOfRecords(success ? getNumberOfRecords(d) : 0);
|
||||||
|
tInfo.setDate(getDate(d));
|
||||||
|
tInfo.setCompletedSuccessfully(success);
|
||||||
|
info = tInfo;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private CollectionMode getCollectionMode(final Document d) {
|
||||||
|
return Optional.ofNullable(d.getString("system:node:SELECT_MODE:selection"))
|
||||||
|
.map(CollectionMode::valueOf)
|
||||||
|
.orElseGet(() -> Optional.ofNullable(d.getString("collectionMode"))
|
||||||
|
.map(CollectionMode::valueOf)
|
||||||
|
.orElse(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getNumberOfRecords(final Document d) {
|
||||||
|
final String sinkSize = d.getString("mainlog:sinkSize");
|
||||||
|
final String total = d.getString("mainlog:total");
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(sinkSize)) {
|
||||||
|
return Ints.tryParse(sinkSize);
|
||||||
|
} else if (StringUtils.isNotBlank(total)) {
|
||||||
|
return Ints.tryParse(total);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String getDate(final Document d) {
|
private String getDate(final Document d) {
|
||||||
final String dateString = d.getString("system:startHumanDate");
|
final String dateString = d.getString("system:startHumanDate");
|
||||||
if (StringUtils.isBlank(dateString)) { return ""; }
|
if (StringUtils.isBlank(dateString)) { return ""; }
|
||||||
|
@ -216,7 +258,12 @@ public class MongoLoggerClientImpl implements MongoLoggerClient {
|
||||||
return new BasicDBObject(key, value);
|
return new BasicDBObject(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Bson queryForAggregationHistory(final String dsId, final String pattern) {
|
@Deprecated
|
||||||
|
private Bson queryForAggregationHistoryV1(final String dsId, final String pattern) {
|
||||||
|
return and(eq("parentDatasourceId", dsId), eq("system:profileFamily", "aggregator"), eq("system:isCompletedSuccessfully", "true"), regex("system:wfName", pattern, "i"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Bson queryForAggregationHistoryV2(final String dsId, final String pattern) {
|
||||||
return and(eq("parentDatasourceId", dsId), eq("system:profileFamily", "aggregator"), regex("system:wfName", pattern, "i"));
|
return and(eq("parentDatasourceId", dsId), eq("system:profileFamily", "aggregator"), regex("system:wfName", pattern, "i"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package eu.dnetlib.openaire.dsm.dao;
|
package eu.dnetlib.openaire.dsm.dao;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
|
|
||||||
public interface ObjectStoreClient {
|
public interface ObjectStoreClient {
|
||||||
|
|
||||||
Long getObjectStoreSize(final String objectStoreId) throws DsmException;
|
Long getObjectStoreSize(final String objectStoreId) throws DsmApiException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package eu.dnetlib.openaire.dsm.dao;
|
package eu.dnetlib.openaire.dsm.dao;
|
||||||
|
|
||||||
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService;
|
|
||||||
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -10,6 +7,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import eu.dnetlib.data.objectstore.rmi.ObjectStoreService;
|
||||||
|
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnProperty(value = "openaire.exporter.enable.dsm", havingValue = "true")
|
@ConditionalOnProperty(value = "openaire.exporter.enable.dsm", havingValue = "true")
|
||||||
public class ObjectStoreClientImpl implements ObjectStoreClient {
|
public class ObjectStoreClientImpl implements ObjectStoreClient {
|
||||||
|
@ -20,17 +21,15 @@ public class ObjectStoreClientImpl implements ObjectStoreClient {
|
||||||
private ObjectStoreService objectStoreService;
|
private ObjectStoreService objectStoreService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getObjectStoreSize(final String objectStoreId) throws DsmException {
|
public Long getObjectStoreSize(final String objectStoreId) throws DsmApiException {
|
||||||
log.debug("get size for objectStore " + objectStoreId);
|
log.debug("get size for objectStore " + objectStoreId);
|
||||||
if (StringUtils.isBlank(objectStoreId)) {
|
if (StringUtils.isBlank(objectStoreId)) { return 0L; }
|
||||||
return 0L;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
final long size = objectStoreService.getSize(objectStoreId);
|
final long size = objectStoreService.getSize(objectStoreId);
|
||||||
log.debug("got objectStore size: " + size);
|
log.debug("got objectStore size: " + size);
|
||||||
return size;
|
return size;
|
||||||
} catch (ObjectStoreServiceException e) {
|
} catch (final ObjectStoreServiceException e) {
|
||||||
throw new DsmException("unable to get size for objectStore " + objectStoreId);
|
throw new DsmApiException("unable to get size for objectStore " + objectStoreId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,16 @@ import java.util.Queue;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.ApiDetails;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.ApiDetailsResponse;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetailResponse;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetails;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceInfo;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceSearchResponse;
|
import eu.dnetlib.openaire.dsm.domain.DatasourceSearchResponse;
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetExtended;
|
import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails;
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetResponse;
|
import eu.dnetlib.openaire.exporter.model.dsm.ApiDetailsResponse;
|
||||||
import eu.dnetlib.openaire.dsm.domain.Header;
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailResponse;
|
||||||
import eu.dnetlib.openaire.dsm.domain.SimpleResponse;
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetExtended;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetResponse;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.Header;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.SimpleResponse;
|
||||||
|
|
||||||
public class ResponseUtils {
|
public class ResponseUtils {
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package eu.dnetlib.openaire.dsm.dao;
|
package eu.dnetlib.openaire.dsm.dao;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
import eu.dnetlib.openaire.vocabularies.Vocabulary;
|
import eu.dnetlib.openaire.exporter.model.vocabularies.Vocabulary;
|
||||||
|
|
||||||
public interface VocabularyClient {
|
public interface VocabularyClient {
|
||||||
|
|
||||||
Vocabulary getCountries() throws DsmException;
|
Vocabulary getCountries() throws DsmApiException;
|
||||||
|
|
||||||
Vocabulary getDatasourceTypologies() throws DsmException;
|
Vocabulary getDatasourceTypologies() throws DsmApiException;
|
||||||
|
|
||||||
void dropCache();
|
void dropCache();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package eu.dnetlib.openaire.dsm.dao;
|
package eu.dnetlib.openaire.dsm.dao;
|
||||||
|
|
||||||
import eu.dnetlib.DnetOpenaireExporterProperties;
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
|
||||||
import eu.dnetlib.openaire.vocabularies.Vocabulary;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -13,6 +10,10 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import eu.dnetlib.DnetOpenaireExporterProperties;
|
||||||
|
import eu.dnetlib.openaire.exporter.exceptions.DsmApiException;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.vocabularies.Vocabulary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by claudio on 15/09/2017.
|
* Created by claudio on 15/09/2017.
|
||||||
*/
|
*/
|
||||||
|
@ -26,24 +27,22 @@ public class VocabularyClientImpl implements VocabularyClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable("vocabularies-cache")
|
@Cacheable("vocabularies-cache")
|
||||||
public Vocabulary getCountries() throws DsmException {
|
public Vocabulary getCountries() throws DsmApiException {
|
||||||
return _getVocabulary(config.getVocabularies().getCountriesEndpoint(), Vocabulary.class);
|
return _getVocabulary(config.getVocabularies().getCountriesEndpoint(), Vocabulary.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable("vocabularies-cache")
|
@Cacheable("vocabularies-cache")
|
||||||
public Vocabulary getDatasourceTypologies() throws DsmException {
|
public Vocabulary getDatasourceTypologies() throws DsmApiException {
|
||||||
return _getVocabulary(config.getVocabularies().getDatasourceTypologiesEndpoint(), Vocabulary.class);
|
return _getVocabulary(config.getVocabularies().getDatasourceTypologiesEndpoint(), Vocabulary.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T _getVocabulary(final String endpoint, Class<T> clazz) throws DsmException {
|
private <T> T _getVocabulary(final String endpoint, final Class<T> clazz) throws DsmApiException {
|
||||||
final RestTemplate rt = new RestTemplate();
|
final RestTemplate rt = new RestTemplate();
|
||||||
log.info("get vocabulary from " + endpoint);
|
log.info("get vocabulary from " + endpoint);
|
||||||
final ResponseEntity<T> rsp = rt.getForEntity(endpoint, clazz);
|
final ResponseEntity<T> rsp = rt.getForEntity(endpoint, clazz);
|
||||||
|
|
||||||
if (!rsp.getStatusCode().is2xxSuccessful()) {
|
if (!rsp.getStatusCode().is2xxSuccessful()) { throw new DsmApiException(rsp.getStatusCodeValue(), "unable to read content from " + endpoint); }
|
||||||
throw new DsmException(rsp.getStatusCodeValue(), "unable to read content from " + endpoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rsp.getBody();
|
return rsp.getBody();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,14 @@ import org.springframework.beans.BeanWrapperImpl;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions;
|
import eu.dnetlib.data.transform.xml.AbstractDNetXsltFunctions;
|
||||||
import eu.dnetlib.openaire.dsm.domain.ApiDetails;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetails;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetailsUpdate;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceSnippetExtended;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.OrganizationDetails;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.OrganizationDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.OrganizationDbEntry;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetailsUpdate;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceSnippetExtended;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.OrganizationDetails;
|
||||||
|
|
||||||
public class DsmMappingUtils {
|
public class DsmMappingUtils {
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.util.List;
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.Response;
|
||||||
|
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
public class DatasourceResponse<T> extends Response {
|
public class DatasourceResponse<T> extends Response {
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceInfo;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.Response;
|
||||||
|
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
public class DatasourceSearchResponse extends Response {
|
public class DatasourceSearchResponse extends Response {
|
||||||
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
package eu.dnetlib.openaire.dsm.domain;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by claudio on 29/11/2016.
|
|
||||||
*/
|
|
||||||
@JsonAutoDetect
|
|
||||||
public class TransformationInfo extends AggregationInfo {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +1,11 @@
|
||||||
package eu.dnetlib.openaire.funders.domain;
|
package eu.dnetlib.openaire.funders;
|
||||||
|
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.model.funders.ExtendedFunderDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.funders.FundingStream;
|
||||||
import eu.dnetlib.openaire.funders.domain.db.FunderDbEntry;
|
import eu.dnetlib.openaire.funders.domain.db.FunderDbEntry;
|
||||||
import eu.dnetlib.openaire.funders.domain.db.FundingPathDbEntry;
|
import eu.dnetlib.openaire.funders.domain.db.FundingPathDbEntry;
|
||||||
import org.dom4j.Document;
|
import org.dom4j.Document;
|
|
@ -8,9 +8,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.funders.domain.ConversionUtils;
|
import eu.dnetlib.openaire.exporter.exceptions.FundersApiException;
|
||||||
import eu.dnetlib.openaire.funders.domain.ExtendedFunderDetails;
|
import eu.dnetlib.openaire.exporter.model.funders.ExtendedFunderDetails;
|
||||||
import eu.dnetlib.openaire.funders.domain.FunderDetails;
|
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConditionalOnProperty(value = "openaire.exporter.enable.funders", havingValue = "true")
|
@ConditionalOnProperty(value = "openaire.exporter.enable.funders", havingValue = "true")
|
||||||
|
|
|
@ -13,8 +13,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.common.AbstractExporterController;
|
import eu.dnetlib.openaire.common.AbstractExporterController;
|
||||||
import eu.dnetlib.openaire.funders.domain.ExtendedFunderDetails;
|
import eu.dnetlib.openaire.exporter.exceptions.FundersApiException;
|
||||||
import eu.dnetlib.openaire.funders.domain.FunderDetails;
|
import eu.dnetlib.openaire.exporter.model.funders.ExtendedFunderDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
|
|
@ -22,7 +22,6 @@ management.endpoints.web.base-path = /
|
||||||
management.endpoints.web.path-mapping.prometheus = metrics
|
management.endpoints.web.path-mapping.prometheus = metrics
|
||||||
management.endpoints.web.path-mapping.health = health
|
management.endpoints.web.path-mapping.health = health
|
||||||
|
|
||||||
|
|
||||||
# ENABLE / DISABLE CONTROLLERS
|
# ENABLE / DISABLE CONTROLLERS
|
||||||
openaire.exporter.enable.dsm = true
|
openaire.exporter.enable.dsm = true
|
||||||
openaire.exporter.enable.community = true
|
openaire.exporter.enable.community = true
|
||||||
|
|
|
@ -15,7 +15,8 @@ openaire.exporter.cxfClientConnectTimeout = 60000
|
||||||
openaire.exporter.cxfClientReceiveTimeout = 120000
|
openaire.exporter.cxfClientReceiveTimeout = 120000
|
||||||
|
|
||||||
# JDBC
|
# JDBC
|
||||||
openaire.exporter.jdbc.url = jdbc:postgresql://localhost:5432/dnet_openaireplus
|
#openaire.exporter.jdbc.url = jdbc:postgresql://localhost:5432/dnet_openaireplus
|
||||||
|
openaire.exporter.jdbc.url = jdbc:postgresql://localhost:5432/dev_openaire_8280
|
||||||
openaire.exporter.jdbc.user = dnetapi
|
openaire.exporter.jdbc.user = dnetapi
|
||||||
openaire.exporter.jdbc.pwd = dnetPwd
|
openaire.exporter.jdbc.pwd = dnetPwd
|
||||||
openaire.exporter.jdbc.minIdle = 1
|
openaire.exporter.jdbc.minIdle = 1
|
||||||
|
|
|
@ -19,6 +19,8 @@ import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Alessia Bardi on 2019-04-04.
|
* Created by Alessia Bardi on 2019-04-04.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,6 +2,10 @@ package eu.dnetlib.openaire.community.selectioncriteria;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import eu.dnetlib.data.bulktag.selectioncriteria.Selection;
|
import eu.dnetlib.data.bulktag.selectioncriteria.Selection;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.Constraint;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.Constraints;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
@ -13,6 +13,8 @@ import org.junit.jupiter.api.Test;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.model.context.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Alessia Bardi on 2019-04-04.
|
* Created by Alessia Bardi on 2019-04-04.
|
||||||
*
|
*
|
||||||
|
|
|
@ -21,9 +21,9 @@ import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.DsmException;
|
import eu.dnetlib.enabling.datasources.common.DsmException;
|
||||||
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
|
import eu.dnetlib.openaire.dsm.dao.utils.DsmMappingUtils;
|
||||||
import eu.dnetlib.openaire.dsm.domain.DatasourceDetails;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.DatasourceDbEntry;
|
||||||
import eu.dnetlib.openaire.vocabularies.Country;
|
import eu.dnetlib.openaire.exporter.model.dsm.DatasourceDetails;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.vocabularies.Country;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@WebMvcTest(DsmApiController.class)
|
@WebMvcTest(DsmApiController.class)
|
||||||
|
|
|
@ -5,8 +5,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.ApiDetails;
|
|
||||||
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
|
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.dsm.ApiDetails;
|
||||||
|
|
||||||
class DsmMappingUtilsTest {
|
class DsmMappingUtilsTest {
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ import org.junit.jupiter.api.Test;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.context.Context;
|
|
||||||
import eu.dnetlib.openaire.context.ContextMappingUtils;
|
import eu.dnetlib.openaire.context.ContextMappingUtils;
|
||||||
import eu.dnetlib.openaire.funders.domain.FunderDetails;
|
import eu.dnetlib.openaire.exporter.model.context.Context;
|
||||||
|
import eu.dnetlib.openaire.exporter.model.funders.FunderDetails;
|
||||||
|
|
||||||
public class FunderContextClientTest {
|
public class FunderContextClientTest {
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>apps</artifactId>
|
<artifactId>apps</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>dnet-applications</artifactId>
|
<artifactId>dnet-applications</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>apps</artifactId>
|
<artifactId>apps</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,9 @@ public class ScholixControllerV1 extends AbstractDnetController {
|
||||||
@GetMapping("/linksFromPublisher")
|
@GetMapping("/linksFromPublisher")
|
||||||
@Timed(value = "scholix.v1.linksFromPublisher", description = "Time taken to return links on Version 1.0 of Scholix collected from a publisher")
|
@Timed(value = "scholix.v1.linksFromPublisher", description = "Time taken to return links on Version 1.0 of Scholix collected from a publisher")
|
||||||
public List<ScholixV1> linksFromPublisher(
|
public List<ScholixV1> linksFromPublisher(
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a publisher", required = true) final String publisher,
|
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "The page number") @RequestParam(required = false) final Integer page) throws ScholixException {
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a publisher", required = true) final String publisher,
|
||||||
|
@Parameter(in = ParameterIn.QUERY, description = "The page number") @RequestParam(required = false) final Integer page) throws ScholixException {
|
||||||
|
|
||||||
final int currentPage = page != null ? page : 0;
|
final int currentPage = page != null ? page : 0;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import eu.dnetlib.common.controller.AbstractDnetController;
|
import eu.dnetlib.common.controller.AbstractDnetController;
|
||||||
|
@ -34,15 +35,24 @@ public class ScholixControllerV2 extends AbstractDnetController {
|
||||||
@Operation(summary = "Get Scholix Links")
|
@Operation(summary = "Get Scholix Links")
|
||||||
@GetMapping("/Links")
|
@GetMapping("/Links")
|
||||||
public PageResultType links(
|
public PageResultType links(
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a LinkProvider") final String linkProvider,
|
@RequestParam(required = false)
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target pid") final String targetPid,
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a LinkProvider") final String linkProvider,
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target pid type") final String targetPidType,
|
@RequestParam(required = false)
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target published in a Publisher named targetPublisher") final String targetPublisher,
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target pid") final String targetPid,
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target type (literature, dataset, unknown)") final String targetType,
|
@RequestParam(required = false)
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source pid") final String sourcePid,
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target pid type") final String targetPidType,
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source pid type") final String sourcePidType,
|
@RequestParam(required = false)
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source published in a Publisher named sourcePublisher") final String sourcePublisher,
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target published in a Publisher named targetPublisher") final String targetPublisher,
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source type (literature, dataset, unknown)") final String sourceType,
|
@RequestParam(required = false)
|
||||||
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a target type (literature, dataset, unknown)") final String targetType,
|
||||||
|
@RequestParam(required = false)
|
||||||
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source pid") final String sourcePid,
|
||||||
|
@RequestParam(required = false)
|
||||||
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source pid type") final String sourcePidType,
|
||||||
|
@RequestParam(required = false)
|
||||||
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source published in a Publisher named sourcePublisher") final String sourcePublisher,
|
||||||
|
@RequestParam(required = false)
|
||||||
|
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships having a source type (literature, dataset, unknown)") final String sourceType,
|
||||||
// @Parameter(in = ParameterIn.QUERY,
|
// @Parameter(in = ParameterIn.QUERY,
|
||||||
// description = "Filter scholix Links having collected after this date") String harvestedAfter,
|
// description = "Filter scholix Links having collected after this date") String harvestedAfter,
|
||||||
@Parameter(in = ParameterIn.QUERY, description = "select page of result") final Integer page) throws Exception {
|
@Parameter(in = ParameterIn.QUERY, description = "select page of result") final Integer page) throws Exception {
|
||||||
|
|
|
@ -27,7 +27,7 @@ management.metrics.distribution.percentiles.http.server.requests=0.5, 0.9, 0.95,
|
||||||
|
|
||||||
#scholix.elastic.clusterNodes = 10.19.65.51:9200,10.19.65.52:9200,10.19.65.53:9200,10.19.65.54:9200
|
#scholix.elastic.clusterNodes = 10.19.65.51:9200,10.19.65.52:9200,10.19.65.53:9200,10.19.65.54:9200
|
||||||
scholix.elastic.clusterNodes = localhost:9200
|
scholix.elastic.clusterNodes = localhost:9200
|
||||||
scholix.elastic.indexName = dli_scholix
|
scholix.elastic.indexName = dli_shadow_scholix
|
||||||
scholix.elastic.socketTimeout = 60000
|
scholix.elastic.socketTimeout = 60000
|
||||||
scholix.elastic.connectionTimeout= 60000
|
scholix.elastic.connectionTimeout= 60000
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>cmd-line-apps</artifactId>
|
<artifactId>cmd-line-apps</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>dnet-applications</artifactId>
|
<artifactId>dnet-applications</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>libs</artifactId>
|
<artifactId>libs</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
<artifactId>libs</artifactId>
|
<artifactId>libs</artifactId>
|
||||||
<version>3.3.3-SNAPSHOT</version>
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,233 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Maven2 Start Up Batch script
|
||||||
|
#
|
||||||
|
# Required ENV vars:
|
||||||
|
# ------------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# M2_HOME - location of maven2's installed home dir
|
||||||
|
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
# e.g. to debug Maven itself, use
|
||||||
|
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||||
|
|
||||||
|
if [ -f /etc/mavenrc ] ; then
|
||||||
|
. /etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$HOME/.mavenrc" ] ; then
|
||||||
|
. "$HOME/.mavenrc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OS specific support. $var _must_ be set to either true or false.
|
||||||
|
cygwin=false;
|
||||||
|
darwin=false;
|
||||||
|
mingw=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN*) cygwin=true ;;
|
||||||
|
MINGW*) mingw=true;;
|
||||||
|
Darwin*) darwin=true
|
||||||
|
#
|
||||||
|
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
||||||
|
# for the new JDKs provided by Oracle.
|
||||||
|
#
|
||||||
|
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
|
||||||
|
#
|
||||||
|
# Apple JDKs
|
||||||
|
#
|
||||||
|
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
|
||||||
|
#
|
||||||
|
# Apple JDKs
|
||||||
|
#
|
||||||
|
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
|
||||||
|
#
|
||||||
|
# Oracle JDKs
|
||||||
|
#
|
||||||
|
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
|
||||||
|
#
|
||||||
|
# Apple JDKs
|
||||||
|
#
|
||||||
|
export JAVA_HOME=`/usr/libexec/java_home`
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
if [ -r /etc/gentoo-release ] ; then
|
||||||
|
JAVA_HOME=`java-config --jre-home`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$M2_HOME" ] ; then
|
||||||
|
## resolve links - $0 may be a link to maven's home
|
||||||
|
PRG="$0"
|
||||||
|
|
||||||
|
# need this for relative symlinks
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG="`dirname "$PRG"`/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
saveddir=`pwd`
|
||||||
|
|
||||||
|
M2_HOME=`dirname "$PRG"`/..
|
||||||
|
|
||||||
|
# make it fully qualified
|
||||||
|
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||||
|
|
||||||
|
cd "$saveddir"
|
||||||
|
# echo Using m2 at $M2_HOME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Migwn, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $mingw ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||||
|
# TODO classpath?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
javaExecutable="`which javac`"
|
||||||
|
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||||
|
# readlink(1) is not available as standard on Solaris 10.
|
||||||
|
readLink=`which readlink`
|
||||||
|
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||||
|
if $darwin ; then
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||||
|
else
|
||||||
|
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||||
|
fi
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||||
|
JAVA_HOME="$javaHome"
|
||||||
|
export JAVA_HOME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVACMD" ] ; then
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="`which java`"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||||
|
echo " We cannot execute $JAVACMD" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
echo "Warning: JAVA_HOME environment variable is not set."
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# traverses directory structure from process work directory to filesystem root
|
||||||
|
# first directory with .mvn subdirectory is considered project base directory
|
||||||
|
find_maven_basedir() {
|
||||||
|
local basedir=$(pwd)
|
||||||
|
local wdir=$(pwd)
|
||||||
|
while [ "$wdir" != '/' ] ; do
|
||||||
|
if [ -d "$wdir"/.mvn ] ; then
|
||||||
|
basedir=$wdir
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
wdir=$(cd "$wdir/.."; pwd)
|
||||||
|
done
|
||||||
|
echo "${basedir}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# concatenates all lines of a file
|
||||||
|
concat_lines() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
echo "$(tr -s '\n' ' ' < "$1")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
|
||||||
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||||
|
|
||||||
|
# Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
# work with both Windows and non-Windows executions.
|
||||||
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||||
|
export MAVEN_CMD_LINE_ARGS
|
||||||
|
|
||||||
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
exec "$JAVACMD" \
|
||||||
|
$MAVEN_OPTS \
|
||||||
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
|
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
|
${WRAPPER_LAUNCHER} "$@"
|
|
@ -0,0 +1,145 @@
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
|
@REM distributed with this work for additional information
|
||||||
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
|
@REM "License"); you may not use this file except in compliance
|
||||||
|
@REM with the License. You may obtain a copy of the License at
|
||||||
|
@REM
|
||||||
|
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@REM
|
||||||
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
|
@REM software distributed under the License is distributed on an
|
||||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
@REM KIND, either express or implied. See the License for the
|
||||||
|
@REM specific language governing permissions and limitations
|
||||||
|
@REM under the License.
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Maven2 Start Up Batch script
|
||||||
|
@REM
|
||||||
|
@REM Required ENV vars:
|
||||||
|
@REM JAVA_HOME - location of a JDK home dir
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@REM M2_HOME - location of maven2's installed home dir
|
||||||
|
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||||
|
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
|
||||||
|
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
@REM e.g. to debug Maven itself, use
|
||||||
|
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||||
|
@echo off
|
||||||
|
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
|
||||||
|
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||||
|
|
||||||
|
@REM set %HOME% to equivalent of $HOME
|
||||||
|
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||||
|
|
||||||
|
@REM Execute a user defined script before this one
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||||
|
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
||||||
|
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
||||||
|
:skipRcPre
|
||||||
|
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
set ERROR_CODE=0
|
||||||
|
|
||||||
|
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
@REM ==== START VALIDATION ====
|
||||||
|
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME not found in your environment. >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
:OkJHome
|
||||||
|
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||||
|
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
@REM ==== END VALIDATION ====
|
||||||
|
|
||||||
|
:init
|
||||||
|
|
||||||
|
set MAVEN_CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||||
|
@REM Fallback to current working directory if not found.
|
||||||
|
|
||||||
|
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||||
|
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||||
|
|
||||||
|
set EXEC_DIR=%CD%
|
||||||
|
set WDIR=%EXEC_DIR%
|
||||||
|
:findBaseDir
|
||||||
|
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||||
|
cd ..
|
||||||
|
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||||
|
set WDIR=%CD%
|
||||||
|
goto findBaseDir
|
||||||
|
|
||||||
|
:baseDirFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
goto endDetectBaseDir
|
||||||
|
|
||||||
|
:baseDirNotFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
|
||||||
|
:endDetectBaseDir
|
||||||
|
|
||||||
|
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||||
|
|
||||||
|
@setlocal EnableExtensions EnableDelayedExpansion
|
||||||
|
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||||
|
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||||
|
|
||||||
|
:endReadAdditionalConfig
|
||||||
|
|
||||||
|
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||||
|
|
||||||
|
set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar""
|
||||||
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:error
|
||||||
|
set ERROR_CODE=1
|
||||||
|
|
||||||
|
:end
|
||||||
|
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||||
|
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
||||||
|
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
||||||
|
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
||||||
|
:skipRcPost
|
||||||
|
|
||||||
|
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||||
|
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
||||||
|
|
||||||
|
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
||||||
|
|
||||||
|
exit /B %ERROR_CODE%
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
|
<artifactId>libs</artifactId>
|
||||||
|
<version>3.4.1-SNAPSHOT</version>
|
||||||
|
<relativePath>../</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>dnet-exporter-model</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>dnet-exporter-model</name>
|
||||||
|
<description>Model classes for D-Net Exporter API</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-common</artifactId>
|
||||||
|
<version>1.6.10</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.persistence</groupId>
|
||||||
|
<artifactId>jakarta.persistence-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-junit-jupiter</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -1,13 +1,7 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.exceptions;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
|
||||||
public class CommunityException extends Exception {
|
public class CommunityException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,11 +1,5 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.exceptions;
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@ResponseStatus(value = HttpStatus.NOT_FOUND)
|
|
||||||
public class CommunityNotFoundException extends Exception {
|
public class CommunityNotFoundException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,13 +1,7 @@
|
||||||
package eu.dnetlib.openaire.context;
|
package eu.dnetlib.openaire.exporter.exceptions;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
|
||||||
public class ContextException extends Exception {
|
public class ContextException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,11 +1,5 @@
|
||||||
package eu.dnetlib.openaire.context;
|
package eu.dnetlib.openaire.exporter.exceptions;
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@ResponseStatus(value = HttpStatus.NOT_FOUND)
|
|
||||||
public class ContextNotFoundException extends Exception {
|
public class ContextNotFoundException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -0,0 +1,36 @@
|
||||||
|
package eu.dnetlib.openaire.exporter.exceptions;
|
||||||
|
|
||||||
|
public class DsmApiException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8173126561260106405L;
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
|
||||||
|
public DsmApiException(final int code, final String msg) {
|
||||||
|
super(msg);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DsmApiException(final int code, final Throwable e) {
|
||||||
|
super(e);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DsmApiException(final int code, final String msg, final Throwable e) {
|
||||||
|
super(msg, e);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DsmApiException(final String msg) {
|
||||||
|
this(500, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(final int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.funders;
|
package eu.dnetlib.openaire.exporter.exceptions;
|
||||||
|
|
||||||
public class FundersApiException extends Exception {
|
public class FundersApiException extends Exception {
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import com.google.gson.Gson;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria;
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
|
@ -90,7 +91,11 @@ public class CommunityContentprovider {
|
||||||
|
|
||||||
public String toJson() {
|
public String toJson() {
|
||||||
if (selectioncriteria == null) { return ""; }
|
if (selectioncriteria == null) { return ""; }
|
||||||
return new Gson().toJson(selectioncriteria);
|
try {
|
||||||
|
return new ObjectMapper().writeValueAsString(selectioncriteria);
|
||||||
|
} catch (final JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toXML() {
|
public String toXML() {
|
|
@ -1,10 +1,11 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
|
@ -19,6 +20,15 @@ public class CommunityDetails extends CommunitySummary {
|
||||||
@Schema(description = "list of subjects (keywords) that characterise this community")
|
@Schema(description = "list of subjects (keywords) that characterise this community")
|
||||||
private List<String> subjects;
|
private List<String> subjects;
|
||||||
|
|
||||||
|
@Schema(description = "list of fos that characterise this community")
|
||||||
|
private List<String> fos;
|
||||||
|
|
||||||
|
@Schema(description = "list of sdg that characterise this community")
|
||||||
|
private List<String> sdg;
|
||||||
|
|
||||||
|
@Schema(description = "list of advanced criteria to associate results to this community")
|
||||||
|
private SelectionCriteria advancedConstraint;
|
||||||
|
|
||||||
public CommunityDetails() {}
|
public CommunityDetails() {}
|
||||||
|
|
||||||
public CommunityDetails(final CommunitySummary summary) {
|
public CommunityDetails(final CommunitySummary summary) {
|
||||||
|
@ -52,4 +62,28 @@ public class CommunityDetails extends CommunitySummary {
|
||||||
public void setLastUpdateDate(final Date lastUpdateDate) {
|
public void setLastUpdateDate(final Date lastUpdateDate) {
|
||||||
this.lastUpdateDate = lastUpdateDate;
|
this.lastUpdateDate = lastUpdateDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getFos() {
|
||||||
|
return fos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFos(final List<String> fos) {
|
||||||
|
this.fos = fos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getSdg() {
|
||||||
|
return sdg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSdg(final List<String> sdg) {
|
||||||
|
this.sdg = sdg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionCriteria getAdvancedConstraint() {
|
||||||
|
return advancedConstraint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdvancedConstraint(final SelectionCriteria advancedConstraint) {
|
||||||
|
this.advancedConstraint = advancedConstraint;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
|
import eu.dnetlib.openaire.exporter.model.community.selectioncriteria.SelectionCriteria;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
|
@ -24,6 +25,15 @@ public class CommunityWritableProperties {
|
||||||
@Schema(description = "list of subjects (keywords) that characterise this community")
|
@Schema(description = "list of subjects (keywords) that characterise this community")
|
||||||
private List<String> subjects;
|
private List<String> subjects;
|
||||||
|
|
||||||
|
@Schema(description = "list of fos that characterise this community")
|
||||||
|
private List<String> fos;
|
||||||
|
|
||||||
|
@Schema(description = "list of sdg that characterise this community")
|
||||||
|
private List<String> sdg;
|
||||||
|
|
||||||
|
@Schema(description = "Advanced constraint for the association of results to the community")
|
||||||
|
private SelectionCriteria advancedConstraint;
|
||||||
|
|
||||||
@Schema(description = "status of the community, drives its visibility")
|
@Schema(description = "status of the community, drives its visibility")
|
||||||
private CommunityStatus status;
|
private CommunityStatus status;
|
||||||
|
|
||||||
|
@ -39,9 +49,36 @@ public class CommunityWritableProperties {
|
||||||
p.setSubjects(details.getSubjects());
|
p.setSubjects(details.getSubjects());
|
||||||
p.setStatus(details.getStatus());
|
p.setStatus(details.getStatus());
|
||||||
p.setMainZenodoCommunity(details.getZenodoCommunity());
|
p.setMainZenodoCommunity(details.getZenodoCommunity());
|
||||||
|
p.setFos(details.getFos());
|
||||||
|
p.setSdg(details.getSdg());
|
||||||
|
p.setAdvancedConstraint(details.getAdvancedConstraint());
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getFos() {
|
||||||
|
return fos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFos(final List<String> fos) {
|
||||||
|
this.fos = fos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getSdg() {
|
||||||
|
return sdg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSdg(final List<String> sdg) {
|
||||||
|
this.sdg = sdg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionCriteria getAdvancedConstraint() {
|
||||||
|
return advancedConstraint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdvancedConstraint(final SelectionCriteria advancedConstraint) {
|
||||||
|
this.advancedConstraint = advancedConstraint;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community;
|
package eu.dnetlib.openaire.exporter.model.community;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community.selectioncriteria;
|
package eu.dnetlib.openaire.exporter.model.community.selectioncriteria;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.community.selectioncriteria;
|
package eu.dnetlib.openaire.exporter.model.community.selectioncriteria;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,10 +1,11 @@
|
||||||
package eu.dnetlib.openaire.community.selectioncriteria;
|
package eu.dnetlib.openaire.exporter.model.community.selectioncriteria;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import com.google.gson.Gson;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
public class SelectionCriteria implements Serializable {
|
public class SelectionCriteria implements Serializable {
|
||||||
|
@ -27,7 +28,11 @@ public class SelectionCriteria implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SelectionCriteria fromJson(final String json) {
|
public static SelectionCriteria fromJson(final String json) {
|
||||||
return new Gson().fromJson(json, SelectionCriteria.class);
|
try {
|
||||||
|
return new ObjectMapper().readValue(json, SelectionCriteria.class);
|
||||||
|
} catch (final JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.context;
|
package eu.dnetlib.openaire.exporter.model.context;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.context;
|
package eu.dnetlib.openaire.exporter.model.context;
|
||||||
|
|
||||||
public class CategorySummary {
|
public class CategorySummary {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.context;
|
package eu.dnetlib.openaire.exporter.model.context;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.context;
|
package eu.dnetlib.openaire.exporter.model.context;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.context;
|
package eu.dnetlib.openaire.exporter.model.context;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -44,8 +44,6 @@ public class Context {
|
||||||
return categories;
|
return categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Context setId(final String id) {
|
public Context setId(final String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
return this;
|
return this;
|
||||||
|
@ -66,17 +64,15 @@ public class Context {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Date getLastUpdateDate() {
|
public Date getLastUpdateDate() {
|
||||||
return lastUpdateDate;
|
return lastUpdateDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Context setLastUpdateDate(Date lastUpdateDate) {
|
public Context setLastUpdateDate(final Date lastUpdateDate) {
|
||||||
this.lastUpdateDate = lastUpdateDate;
|
this.lastUpdateDate = lastUpdateDate;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Context setParams(final Map<String, List<Param>> params) {
|
public Context setParams(final Map<String, List<Param>> params) {
|
||||||
this.params = params;
|
this.params = params;
|
||||||
return this;
|
return this;
|
||||||
|
@ -88,4 +84,3 @@ public class Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.context;
|
package eu.dnetlib.openaire.exporter.model.context;
|
||||||
|
|
||||||
public class ContextSummary {
|
public class ContextSummary {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.context;
|
package eu.dnetlib.openaire.exporter.model.context;
|
||||||
|
|
||||||
public class Param {
|
public class Param {
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
|
@JsonAutoDetect
|
||||||
|
@Deprecated
|
||||||
|
public class AggregationHistoryResponseV1 extends Response {
|
||||||
|
|
||||||
|
private List<AggregationInfoV1> aggregationInfo;
|
||||||
|
|
||||||
|
public AggregationHistoryResponseV1(final List<AggregationInfoV1> aggregationInfo) {
|
||||||
|
super();
|
||||||
|
this.aggregationInfo = aggregationInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AggregationInfoV1> getAggregationInfo() {
|
||||||
|
return aggregationInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAggregationInfo(final List<AggregationInfoV1> aggregationInfo) {
|
||||||
|
this.aggregationInfo = aggregationInfo;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,17 +1,15 @@
|
||||||
package eu.dnetlib.openaire.dsm.domain;
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
|
|
||||||
|
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
public class AggregationHistoryResponse extends Response {
|
public class AggregationHistoryResponseV2 extends Response {
|
||||||
|
|
||||||
private List<AggregationInfo> aggregationInfo;
|
private List<AggregationInfo> aggregationInfo;
|
||||||
|
|
||||||
public AggregationHistoryResponse(final List<AggregationInfo> aggregationInfo) {
|
public AggregationHistoryResponseV2(final List<AggregationInfo> aggregationInfo) {
|
||||||
super();
|
super();
|
||||||
this.aggregationInfo = aggregationInfo;
|
this.aggregationInfo = aggregationInfo;
|
||||||
}
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
|
public abstract class AggregationInfo {
|
||||||
|
|
||||||
|
private int numberOfRecords;
|
||||||
|
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
private AggregationStage aggregationStage;
|
||||||
|
|
||||||
|
private boolean indexedVersion = false;
|
||||||
|
|
||||||
|
private boolean completedSuccessfully = true;
|
||||||
|
|
||||||
|
public AggregationInfo() {}
|
||||||
|
|
||||||
|
public int getNumberOfRecords() {
|
||||||
|
return numberOfRecords;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumberOfRecords(final int numberOfRecords) {
|
||||||
|
this.numberOfRecords = numberOfRecords;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(final String date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AggregationStage getAggregationStage() {
|
||||||
|
return aggregationStage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAggregationStage(final AggregationStage aggregationStage) {
|
||||||
|
this.aggregationStage = aggregationStage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIndexedVersion() {
|
||||||
|
return indexedVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexedVersion(final boolean indexedVersion) {
|
||||||
|
this.indexedVersion = indexedVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCompletedSuccessfully() {
|
||||||
|
return completedSuccessfully;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompletedSuccessfully(final boolean completedSuccessfully) {
|
||||||
|
this.completedSuccessfully = completedSuccessfully;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
|
public class AggregationInfoV1 extends AggregationInfo {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@JsonIgnore
|
||||||
|
public boolean isCompletedSuccessfully() {
|
||||||
|
return super.isCompletedSuccessfully();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
|
public enum AggregationStage {
|
||||||
|
|
||||||
|
COLLECT,
|
||||||
|
TRANSFORM;
|
||||||
|
|
||||||
|
public static AggregationStage parse(final String s) {
|
||||||
|
switch (s) {
|
||||||
|
case "collect":
|
||||||
|
case "collection":
|
||||||
|
case "COLLECT":
|
||||||
|
case "COLLECTION":
|
||||||
|
return AggregationStage.COLLECT;
|
||||||
|
case "transform":
|
||||||
|
case "transformation":
|
||||||
|
case "TRANSFORM":
|
||||||
|
case "TRANSFORMATION":
|
||||||
|
case "transformDatasets":
|
||||||
|
case "transformPublications":
|
||||||
|
return AggregationStage.TRANSFORM;
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("invalid AggregationStage: " + s);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.dsm.domain;
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
|
@ -1,12 +1,9 @@
|
||||||
package eu.dnetlib.openaire.dsm.domain;
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
|
|
||||||
|
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
public class ApiDetailsResponse extends Response {
|
public class ApiDetailsResponse extends Response {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.dsm.domain;
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.dnetlib.openaire.dsm.domain;
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
public class ApiParamDetails {
|
public class ApiParamDetails {
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
package eu.dnetlib.openaire.dsm.domain;
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by claudio on 29/11/2016.
|
* Created by claudio on 29/11/2016.
|
||||||
*/
|
*/
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
public class CollectionInfo extends AggregationInfo {
|
@Deprecated
|
||||||
|
public class CollectionInfoV1 extends AggregationInfoV1 {
|
||||||
|
|
||||||
private CollectionMode collectionMode;
|
private CollectionMode collectionMode;
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package eu.dnetlib.openaire.exporter.model.dsm;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by claudio on 29/11/2016.
|
||||||
|
*/
|
||||||
|
@JsonAutoDetect
|
||||||
|
public class CollectionInfoV2 extends AggregationInfo {
|
||||||
|
|
||||||
|
private CollectionMode collectionMode;
|
||||||
|
|
||||||
|
public CollectionMode getCollectionMode() {
|
||||||
|
return collectionMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCollectionMode(final CollectionMode collectionMode) {
|
||||||
|
this.collectionMode = collectionMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue