Initial Commit
This commit is contained in:
commit
6af47452e9
|
@ -0,0 +1,2 @@
|
|||
.idea/
|
||||
target/
|
|
@ -0,0 +1,36 @@
|
|||
####################################### Build stage #######################################
|
||||
FROM maven:3.9-eclipse-temurin-21-alpine AS build-stage
|
||||
|
||||
ARG MAVEN_ACCOUNT_USR
|
||||
ARG MAVEN_ACCOUNT_PSW
|
||||
ARG REVISION
|
||||
ARG PROFILE
|
||||
ARG DEV_PROFILE_URL
|
||||
ENV server_username=$MAVEN_ACCOUNT_USR
|
||||
ENV server_password=$MAVEN_ACCOUNT_PSW
|
||||
|
||||
COPY pom.xml /build/
|
||||
COPY core /build/core/
|
||||
COPY web /build/web/
|
||||
COPY settings.xml /root/.m2/settings.xml
|
||||
RUN rm -f /build/web/src/main/resources/config/app.env
|
||||
RUN rm -f /build/web/src/main/resources/config/*-dev.yml
|
||||
# RUN rm -f /build/web/src/main/resources/logging/*.xml
|
||||
|
||||
WORKDIR /build/
|
||||
|
||||
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline
|
||||
# Build project
|
||||
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package
|
||||
|
||||
######################################## Run Stage ########################################
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
|
||||
ARG PROFILE
|
||||
ARG REVISION
|
||||
ENV SERVER_PORT=8080
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
COPY --from=build-stage /build/web/target/file-transformer-xml-web-${REVISION}.jar /app/file-transformer-xml-web-web.jar
|
||||
|
||||
ENTRYPOINT ["java","-Dspring.config.additional-location=file:/config/","-Dspring.profiles.active=${PROFILE}","-Djava.security.egd=file:/dev/./urandom","-jar","/app/file-transformer-xml-web.jar"]
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019-2020 OpenAIRE AMKE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,9 @@
|
|||
# Using XML File Transformer with Argos
|
||||
|
||||
The repository-file-transformer-xml module implements the [https://code-repo.d4science.org/MaDgiK-CITE/file-transformer-base](https://) interface for the Xml file format.
|
||||
|
||||
## Setup
|
||||
|
||||
After creating the jar from the project, environment variables should be set since they are used in the application.properties
|
||||
1) STORAGE_TMP_ZENODO - a temporary storage needed
|
||||
2) CONFIGURATION_ZENODO - path to json file which includes the configuration for the repository
|
|
@ -0,0 +1,428 @@
|
|||
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
|
||||
Do Not Translate or Localize
|
||||
|
||||
This component uses third party material from the projects listed below.
|
||||
The original copyright notice and the license under which CITE
|
||||
received such third party material are set forth below. CITE
|
||||
reserves all other rights not expressly granted, whether by
|
||||
implication, estoppel or otherwise.
|
||||
|
||||
In the event that we accidentally failed to list a required notice, please
|
||||
bring it to our attention. Post an issue or email us: reception@cite.gr
|
||||
|
||||
1. spring-boot-starter-parent
|
||||
2. spring-boot-starter-web
|
||||
3. json
|
||||
4. file-transformer-base
|
||||
|
||||
spring-boot-starter-parent NOTICES, INFORMATION, AND LICENSE BEGIN HERE
|
||||
=========================================
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed 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.
|
||||
=========================================
|
||||
END OF spring-boot-starter-parent NOTICES, INFORMATION, AND LICENSE
|
||||
|
||||
spring-boot-starter-web NOTICES, INFORMATION, AND LICENSE BEGIN HERE
|
||||
=========================================
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed 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.
|
||||
=========================================
|
||||
END OF spring-boot-starter-web NOTICES, INFORMATION, AND LICENSE
|
|
@ -0,0 +1,55 @@
|
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>gr.cite.opendmp</groupId>
|
||||
<artifactId>file-transformer-xml-parent</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>file-transformer-xml</artifactId>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<maven.compiler.release>21</maven.compiler.release>
|
||||
<revision>1.0.0-SNAPSHOT</revision>
|
||||
<transformer-base.version>0.0.3</transformer-base.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>gr.cite.opendmp</groupId>
|
||||
<artifactId>file-transformer-base</artifactId>
|
||||
<version>${transformer-base.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-core -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
package eu.eudat.file.transformer.configuration;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(FileStorageProperties.class)
|
||||
public class FileStorageConfiguration {
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.file.transformer.configuration;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
|
||||
@ConfigurationProperties(prefix = "file.storage")
|
||||
public class FileStorageProperties {
|
||||
private final String temp;
|
||||
private final String transientPath;
|
||||
|
||||
@ConstructorBinding
|
||||
public FileStorageProperties(String temp, String transientPath) {
|
||||
this.temp = temp;
|
||||
this.transientPath = transientPath;
|
||||
}
|
||||
|
||||
public String getTemp() {
|
||||
return temp;
|
||||
}
|
||||
|
||||
public String getTransientPath() {
|
||||
return transientPath;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
package eu.eudat.file.transformer.executor;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import eu.eudat.file.transformer.configuration.FileStorageProperties;
|
||||
import eu.eudat.file.transformer.enums.ReferenceType;
|
||||
import eu.eudat.file.transformer.interfaces.FileTransformerClient;
|
||||
import eu.eudat.file.transformer.interfaces.FileTransformerConfiguration;
|
||||
import eu.eudat.file.transformer.models.description.DescriptionFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.description.DescriptionXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.dmp.DmpFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.dmp.DmpReferenceFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.dmp.DmpXmlModel;
|
||||
import eu.eudat.file.transformer.models.dmpblueprint.DmpBlueprintFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.misc.FileEnvelope;
|
||||
import eu.eudat.file.transformer.models.misc.FileFormat;
|
||||
import eu.eudat.file.transformer.models.reference.ReferenceFileTransformerModel;
|
||||
import eu.eudat.file.transformer.utils.mapper.DMPXmlMapper;
|
||||
import eu.eudat.file.transformer.utils.mapper.DescriptionXmlMapper;
|
||||
import eu.eudat.file.transformer.utils.service.storage.FileStorageService;
|
||||
import jakarta.xml.bind.JAXBContext;
|
||||
import jakarta.xml.bind.Marshaller;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.management.InvalidApplicationException;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class XmlFileTransformer implements FileTransformerClient {
|
||||
private final static Logger logger = LoggerFactory.getLogger(XmlFileTransformer.class);
|
||||
private final ObjectMapper mapper;
|
||||
private final FileStorageService fileStorageService;
|
||||
private final FileStorageProperties fileStorageProperties;
|
||||
|
||||
@Autowired
|
||||
public XmlFileTransformer(FileStorageService fileStorageService, FileStorageProperties fileStorageProperties) {
|
||||
this.fileStorageService = fileStorageService;
|
||||
this.fileStorageProperties = fileStorageProperties;
|
||||
mapper = new XmlMapper();
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
|
||||
}
|
||||
@Override
|
||||
public FileEnvelope exportDmp(DmpFileTransformerModel dmpXmlModel) throws InvalidApplicationException, IOException {
|
||||
|
||||
List<ReferenceFileTransformerModel> grants = new ArrayList<>();
|
||||
if (dmpXmlModel.getDmpReferences() != null) {
|
||||
grants = dmpXmlModel.getDmpReferences().stream().map(DmpReferenceFileTransformerModel::getReference).filter(referenceFileModel -> referenceFileModel.getType().equals(ReferenceType.Grants)).toList();
|
||||
}
|
||||
|
||||
try {
|
||||
DmpXmlModel xmlModel = DMPXmlMapper.toXml(dmpXmlModel);
|
||||
JAXBContext content = JAXBContext.newInstance(DmpXmlModel.class);
|
||||
Marshaller marshaller = content.createMarshaller();
|
||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
||||
ByteArrayOutputStream xmlDoc = new ByteArrayOutputStream();
|
||||
marshaller.marshal(xmlModel, xmlDoc);
|
||||
String fileRef = fileStorageService.storeFile(xmlDoc.toByteArray());
|
||||
FileEnvelope fileEnvelope = new FileEnvelope();
|
||||
fileEnvelope.setFile(fileRef);
|
||||
//TODO
|
||||
if (!grants.isEmpty() && grants.get(0) != null && grants.get(0).getLabel() != null) {
|
||||
fileEnvelope.setFilename("DMP_" + grants.get(0).getLabel() + "_" + dmpXmlModel.getVersion() + ".xml");
|
||||
} else {
|
||||
fileEnvelope.setFilename("DMP_" + dmpXmlModel.getLabel() + "_" + dmpXmlModel.getVersion() + ".xml");
|
||||
}
|
||||
return fileEnvelope;
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileEnvelope exportDescription(DescriptionFileTransformerModel descriptionXmlModel, String format) throws InvalidApplicationException, IOException {
|
||||
try {
|
||||
DescriptionXmlModel xmlModel = DescriptionXmlMapper.toXml(descriptionXmlModel);
|
||||
JAXBContext content = JAXBContext.newInstance(DmpXmlModel.class);
|
||||
Marshaller marshaller = content.createMarshaller();
|
||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
||||
ByteArrayOutputStream xmlDoc = new ByteArrayOutputStream();
|
||||
marshaller.marshal(xmlModel, xmlDoc);
|
||||
String fileRef = fileStorageService.storeFile(xmlDoc.toByteArray());
|
||||
FileEnvelope fileEnvelope = new FileEnvelope();
|
||||
fileEnvelope.setFile(fileRef);
|
||||
//TODO
|
||||
/* if (!grants.isEmpty() && grants.get(0) != null && grants.get(0).getLabel() != null) {
|
||||
fileEnvelope.setFilename("DMP_" + grants.get(0).getLabel() + "_" + dmpFileTransformerModel.getVersion() + ".xml");
|
||||
}
|
||||
else */
|
||||
{
|
||||
fileEnvelope.setFilename("Description_" + descriptionXmlModel.getLabel() + "_" + descriptionXmlModel.getDmp().getVersion() + ".xml");
|
||||
}
|
||||
return fileEnvelope;
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DmpFileTransformerModel importDmp(FileEnvelope fileEnvelope) {
|
||||
/*try { //TODO
|
||||
String jsonString = String.valueOf(this.fileStorageService.readFile(fileEnvelope.getFile()));
|
||||
RDAModel rda = mapper.readValue(jsonString, RDAModel.class);
|
||||
DmpFileTransformerModel model = this.dmpRDAMapper.toEntity(rda.getDmp(), )
|
||||
} catch (JsonProcessingException e) {
|
||||
|
||||
}*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptionFileTransformerModel importDescription(FileEnvelope fileEnvelope) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileTransformerConfiguration getConfiguration() {
|
||||
List<FileFormat> supportedFormats = List.of(new FileFormat("xml", true, "fa-file-code-o"));
|
||||
FileTransformerConfiguration configuration = new FileTransformerConfiguration();
|
||||
configuration.setFileTransformerId("xml");
|
||||
configuration.setExportVariants(supportedFormats);
|
||||
configuration.setImportVariants(supportedFormats);
|
||||
return configuration;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package eu.eudat.file.transformer.models.description;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import eu.eudat.file.transformer.models.reference.ReferenceXmlModel;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DescriptionReferenceXmlModel {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private ReferenceXmlModel reference;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ReferenceXmlModel getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(ReferenceXmlModel reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.file.transformer.models.description;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import eu.eudat.file.transformer.models.tag.TagXmlModel;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DescriptionTagXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private TagXmlModel tagXmlModel;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TagXmlModel getTagFileTransformerModel() {
|
||||
return tagXmlModel;
|
||||
}
|
||||
|
||||
public void setTagFileTransformerModel(TagXmlModel tagXmlModel) {
|
||||
this.tagXmlModel = tagXmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package eu.eudat.file.transformer.models.description;
|
||||
|
||||
import eu.eudat.file.transformer.enums.DescriptionStatus;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateXmlModel;
|
||||
import eu.eudat.file.transformer.models.dmp.DmpXmlModel;
|
||||
import eu.eudat.file.transformer.models.user.UserXmlModel;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@XmlRootElement(name = "description")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DescriptionXmlModel {
|
||||
|
||||
@XmlAttribute
|
||||
private UUID id;
|
||||
private String label;
|
||||
private String description;
|
||||
private UserXmlModel createdBy;
|
||||
private Instant createdAt;
|
||||
private Instant updatedAt;
|
||||
private Instant finalizedAt;
|
||||
private List<DescriptionReferenceXmlModel> descriptionReferenceXmlModels;
|
||||
private List<DescriptionTagXmlModel> descriptionTagXmlModels;
|
||||
private DescriptionTemplateXmlModel descriptionTemplate;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public UserXmlModel getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(UserXmlModel createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Instant getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Instant updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public Instant getFinalizedAt() {
|
||||
return finalizedAt;
|
||||
}
|
||||
|
||||
public void setFinalizedAt(Instant finalizedAt) {
|
||||
this.finalizedAt = finalizedAt;
|
||||
}
|
||||
|
||||
public List<DescriptionReferenceXmlModel> getDescriptionReferenceFileTransformerModels() {
|
||||
return descriptionReferenceXmlModels;
|
||||
}
|
||||
|
||||
public void setDescriptionReferenceFileTransformerModels(List<DescriptionReferenceXmlModel> descriptionReferenceXmlModels) {
|
||||
this.descriptionReferenceXmlModels = descriptionReferenceXmlModels;
|
||||
}
|
||||
|
||||
public List<DescriptionTagXmlModel> getDescriptionTagFileTransformerModels() {
|
||||
return descriptionTagXmlModels;
|
||||
}
|
||||
|
||||
public void setDescriptionTagFileTransformerModels(List<DescriptionTagXmlModel> descriptionTagXmlModels) {
|
||||
this.descriptionTagXmlModels = descriptionTagXmlModels;
|
||||
}
|
||||
|
||||
public DescriptionTemplateXmlModel getDescriptionTemplate() {
|
||||
return descriptionTemplate;
|
||||
}
|
||||
|
||||
public void setDescriptionTemplate(DescriptionTemplateXmlModel descriptionTemplate) {
|
||||
this.descriptionTemplate = descriptionTemplate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DescriptionTemplateTypeFileTransformerModel {
|
||||
|
||||
private UUID id;
|
||||
private String name;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.DefinitionXmlModel;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DescriptionTemplateXmlModel {
|
||||
private UUID id;
|
||||
private String label;
|
||||
private String description;
|
||||
private Short version;
|
||||
private String language;
|
||||
private DescriptionTemplateTypeFileTransformerModel type;
|
||||
private DefinitionXmlModel definition;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Short getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Short version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public DescriptionTemplateTypeFileTransformerModel getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(DescriptionTemplateTypeFileTransformerModel type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public DefinitionXmlModel getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(DefinitionXmlModel definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlType(namespace = "description-template")
|
||||
public class DefinitionXmlModel {
|
||||
|
||||
private List<PageXmlModel> pages;
|
||||
|
||||
public List<PageXmlModel> getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(List<PageXmlModel> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FieldSetXmlModel {
|
||||
|
||||
private String id;
|
||||
private Integer ordinal;
|
||||
private String numbering;
|
||||
private String title;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
private String additionalInformation;
|
||||
private MultiplicityXmlModel multiplicity;
|
||||
private Boolean hasCommentField;
|
||||
private List<FieldXmlModel> fields;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getExtendedDescription() {
|
||||
return extendedDescription;
|
||||
}
|
||||
|
||||
public void setExtendedDescription(String extendedDescription) {
|
||||
this.extendedDescription = extendedDescription;
|
||||
}
|
||||
|
||||
public String getAdditionalInformation() {
|
||||
return additionalInformation;
|
||||
}
|
||||
|
||||
public void setAdditionalInformation(String additionalInformation) {
|
||||
this.additionalInformation = additionalInformation;
|
||||
}
|
||||
|
||||
public MultiplicityXmlModel getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
public void setMultiplicity(MultiplicityXmlModel multiplicityXmlModel) {
|
||||
this.multiplicity = multiplicityXmlModel;
|
||||
}
|
||||
|
||||
public Boolean getHasCommentField() {
|
||||
return hasCommentField;
|
||||
}
|
||||
|
||||
public void setHasCommentField(Boolean hasCommentField) {
|
||||
this.hasCommentField = hasCommentField;
|
||||
}
|
||||
|
||||
public List<FieldXmlModel> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setFields(List<FieldXmlModel> fieldXmlModels) {
|
||||
this.fields = fieldXmlModels;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldValidationType;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata.BaseFieldDataXmlModel;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlType(namespace = "description-template")
|
||||
public class FieldXmlModel {
|
||||
|
||||
private String id;
|
||||
private Integer ordinal;
|
||||
private String numbering; //TODO maybe remove
|
||||
private List<String> schematics;
|
||||
private String defaultValue;
|
||||
private List<RuleXmlModel> visibilityRules;
|
||||
private List<FieldValidationType> validations;
|
||||
private Boolean includeInExport;
|
||||
private BaseFieldDataXmlModel data;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public List<String> getSchematics() {
|
||||
return schematics;
|
||||
}
|
||||
|
||||
public void setSchematics(List<String> schematics) {
|
||||
this.schematics = schematics;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public List<RuleXmlModel> getVisibilityRules() {
|
||||
return visibilityRules;
|
||||
}
|
||||
|
||||
public void setVisibilityRules(List<RuleXmlModel> visibilityRuleXmlModels) {
|
||||
this.visibilityRules = visibilityRuleXmlModels;
|
||||
}
|
||||
|
||||
public List<FieldValidationType> getValidations() {
|
||||
return validations;
|
||||
}
|
||||
|
||||
public void setValidations(List<FieldValidationType> validations) {
|
||||
this.validations = validations;
|
||||
}
|
||||
|
||||
public Boolean getIncludeInExport() {
|
||||
return includeInExport;
|
||||
}
|
||||
|
||||
public void setIncludeInExport(Boolean includeInExport) {
|
||||
this.includeInExport = includeInExport;
|
||||
}
|
||||
|
||||
public BaseFieldDataXmlModel getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(BaseFieldDataXmlModel data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition;
|
||||
|
||||
public class MultiplicityXmlModel {
|
||||
|
||||
private Integer min;
|
||||
private Integer max;
|
||||
private String placeholder;
|
||||
private Boolean tableView;
|
||||
|
||||
public Integer getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(Integer min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public Integer getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(Integer max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public String getPlaceholder() {
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
public void setPlaceholder(String placeholder) {
|
||||
this.placeholder = placeholder;
|
||||
}
|
||||
|
||||
public Boolean getTableView() {
|
||||
return tableView;
|
||||
}
|
||||
|
||||
public void setTableView(Boolean tableView) {
|
||||
this.tableView = tableView;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition;
|
||||
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name ="page")
|
||||
public class PageXmlModel {
|
||||
private String id;
|
||||
private Integer ordinal;
|
||||
private String title;
|
||||
private List<SectionXmlModel> sections;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public List<SectionXmlModel> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<SectionXmlModel> sectionXmlModels) {
|
||||
this.sections = sectionXmlModels;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition;
|
||||
|
||||
public class RuleXmlModel {
|
||||
|
||||
private String target;
|
||||
private String value;
|
||||
|
||||
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(String target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition;
|
||||
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlType(namespace = "description-template")
|
||||
public class SectionXmlModel {
|
||||
|
||||
private String id;
|
||||
private Integer ordinal;
|
||||
private Boolean defaultVisibility;
|
||||
private Boolean multiplicity;
|
||||
private String numbering; //TODO maybe remove
|
||||
private String title;
|
||||
private String description;
|
||||
private String extendedDescription; //TODO maybe remove
|
||||
private List<SectionXmlModel> sections;
|
||||
private List<FieldSetXmlModel> fieldSets;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public Boolean getDefaultVisibility() {
|
||||
return defaultVisibility;
|
||||
}
|
||||
|
||||
public void setDefaultVisibility(Boolean defaultVisibility) {
|
||||
this.defaultVisibility = defaultVisibility;
|
||||
}
|
||||
|
||||
public Boolean getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
public void setMultiplicity(Boolean multiplicity) {
|
||||
this.multiplicity = multiplicity;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getExtendedDescription() {
|
||||
return extendedDescription;
|
||||
}
|
||||
|
||||
public void setExtendedDescription(String extendedDescription) {
|
||||
this.extendedDescription = extendedDescription;
|
||||
}
|
||||
|
||||
public List<SectionXmlModel> getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public void setSections(List<SectionXmlModel> sectionXmlModels) {
|
||||
this.sections = sectionXmlModels;
|
||||
}
|
||||
|
||||
public List<FieldSetXmlModel> getFieldSets() {
|
||||
return fieldSets;
|
||||
}
|
||||
|
||||
public void setFieldSets(List<FieldSetXmlModel> fieldSetXmlModels) {
|
||||
this.fieldSets = fieldSetXmlModels;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = FieldType.Names.Autocomplete)
|
||||
public class AutoCompleteDataXmlModel extends BaseFieldDataXmlModel {
|
||||
private Boolean multiAutoComplete;
|
||||
private List<AutoCompleteSingleDataXmlModel> autoCompleteSingleDataXmlModelList;
|
||||
|
||||
public Boolean getMultiAutoComplete() { return multiAutoComplete; }
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) { this.multiAutoComplete = multiAutoComplete; }
|
||||
|
||||
public List<AutoCompleteSingleDataXmlModel> getAutoCompleteSingleDataList() {
|
||||
return autoCompleteSingleDataXmlModelList;
|
||||
}
|
||||
|
||||
public void setAutoCompleteSingleDataList(List<AutoCompleteSingleDataXmlModel> autoCompleteSingleDataXmlModelList) {
|
||||
this.autoCompleteSingleDataXmlModelList = autoCompleteSingleDataXmlModelList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
public class AutoCompleteSingleDataXmlModel {
|
||||
|
||||
private String url;
|
||||
private ComboBoxOptionXmlModel autoCompleteOptions;
|
||||
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public ComboBoxOptionXmlModel getAutoCompleteOptions() {
|
||||
return autoCompleteOptions;
|
||||
}
|
||||
|
||||
public void setAutoCompleteOptions(ComboBoxOptionXmlModel autoCompleteOptions) {
|
||||
this.autoCompleteOptions = autoCompleteOptions;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import jakarta.xml.bind.annotation.XmlSeeAlso;
|
||||
import jakarta.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@XmlTransient
|
||||
@XmlSeeAlso({AutoCompleteDataXmlModel.class,
|
||||
LabelAndMultiplicityFieldDataXmlModel.class,
|
||||
LabelFieldDataXmlModel.class,
|
||||
ExternalDatasetDataXmlModel.class,
|
||||
RadioBoxDataXmlModel.class,
|
||||
UploadDataXmlModel.class,
|
||||
WordListDataXmlModel.class})
|
||||
/*@JsonTypeInfo(
|
||||
use = JsonTypeInfo.Id.NAME,
|
||||
include = JsonTypeInfo.As.PROPERTY,
|
||||
property = "fieldType",
|
||||
visible = true)
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = AutoCompleteDataXmlModel.class, name = FieldType.Names.Autocomplete),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.BooleanDecision),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.InternalDmpDatasets),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.InternalDmpDmps),
|
||||
@JsonSubTypes.Type(value = LabelFieldDataXmlModel.class, name = FieldType.Names.CheckBox),
|
||||
@JsonSubTypes.Type(value = LabelFieldDataXmlModel.class, name = FieldType.Names.DatePicker),
|
||||
@JsonSubTypes.Type(value = ExternalDatasetDataXmlModel.class, name = FieldType.Names.ExternalDatasets),
|
||||
@JsonSubTypes.Type(value = LabelFieldDataXmlModel.class, name = FieldType.Names.FreeText),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.Licenses),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.Organizations),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.Publications),
|
||||
@JsonSubTypes.Type(value = RadioBoxDataXmlModel.class, name = FieldType.Names.RadioBox),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.Registries),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.InternalDmpResearchers),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.Researchers),
|
||||
@JsonSubTypes.Type(value = LabelFieldDataXmlModel.class, name = FieldType.Names.RichTextarea),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.Services),
|
||||
@JsonSubTypes.Type(value = LabelFieldDataXmlModel.class, name = FieldType.Names.Tags),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.Taxonomies),
|
||||
@JsonSubTypes.Type(value = LabelFieldDataXmlModel.class, name = FieldType.Names.TextArea),
|
||||
@JsonSubTypes.Type(value = UploadDataXmlModel.class, name = FieldType.Names.Upload),
|
||||
@JsonSubTypes.Type(value = LabelFieldDataXmlModel.class, name = FieldType.Names.Validation),
|
||||
@JsonSubTypes.Type(value = LabelFieldDataXmlModel.class, name = FieldType.Names.DatasetIdentifier),
|
||||
@JsonSubTypes.Type(value = LabelFieldDataXmlModel.class, name = FieldType.Names.Currency),
|
||||
@JsonSubTypes.Type(value = WordListDataXmlModel.class, name = FieldType.Names.Wordlist),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.DataRepositories),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.JournalRepositories),
|
||||
@JsonSubTypes.Type(value = LabelAndMultiplicityFieldDataXmlModel.class, name = FieldType.Names.Publications),
|
||||
})*/
|
||||
public abstract class BaseFieldDataXmlModel {
|
||||
|
||||
private String label;
|
||||
private FieldType fieldType;
|
||||
private String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public FieldType getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(FieldType fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
public class ComboBoxOptionXmlModel {
|
||||
private String label;
|
||||
private String value;
|
||||
private String source;
|
||||
private String uri;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldDataExternalDatasetType;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = FieldType.Names.ExternalDatasets)
|
||||
public class ExternalDatasetDataXmlModel extends LabelAndMultiplicityFieldDataXmlModel {
|
||||
private FieldDataExternalDatasetType type;
|
||||
|
||||
public FieldDataExternalDatasetType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(FieldDataExternalDatasetType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlSeeAlso;
|
||||
import jakarta.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@XmlSeeAlso({ExternalDatasetDataXmlModel.class})
|
||||
|
||||
public class LabelAndMultiplicityFieldDataXmlModel extends BaseFieldDataXmlModel {
|
||||
private Boolean multiAutoComplete;
|
||||
|
||||
public Boolean getMultiAutoComplete() {
|
||||
return multiAutoComplete;
|
||||
}
|
||||
|
||||
public void setMultiAutoComplete(Boolean multiAutoComplete) {
|
||||
this.multiAutoComplete = multiAutoComplete;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "labelFieldData")
|
||||
public class LabelFieldDataXmlModel extends BaseFieldDataXmlModel {
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = FieldType.Names.RadioBox)
|
||||
public class RadioBoxDataXmlModel extends BaseFieldDataXmlModel {
|
||||
|
||||
private List<RadioBoxOptionXmlModel> options;
|
||||
|
||||
public List<RadioBoxOptionXmlModel> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<RadioBoxOptionXmlModel> options) {
|
||||
this.options = options;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
public class RadioBoxOptionXmlModel {
|
||||
private String label;
|
||||
private String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = FieldType.Names.Upload)
|
||||
public class UploadDataXmlModel extends BaseFieldDataXmlModel {
|
||||
private List<UploadOptionXmlModel> types;
|
||||
|
||||
public List<UploadOptionXmlModel> getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void setTypes(List<UploadOptionXmlModel> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
private Integer maxFileSizeInMB;
|
||||
|
||||
public Integer getMaxFileSizeInMB() {
|
||||
return maxFileSizeInMB;
|
||||
}
|
||||
|
||||
public void setMaxFileSizeInMB(Integer maxFileSizeInMB) {
|
||||
this.maxFileSizeInMB = maxFileSizeInMB;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
public class UploadOptionXmlModel {
|
||||
private String label;
|
||||
private String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata;
|
||||
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = FieldType.Names.Wordlist)
|
||||
public class WordListDataXmlModel extends BaseFieldDataXmlModel {
|
||||
private List<ComboBoxOptionXmlModel> options;
|
||||
private Boolean multiList;
|
||||
|
||||
public List<ComboBoxOptionXmlModel> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(List<ComboBoxOptionXmlModel> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public Boolean getMultiList() {
|
||||
return multiList;
|
||||
}
|
||||
|
||||
public void setMultiList(Boolean multiList) {
|
||||
this.multiList = multiList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package eu.eudat.file.transformer.models.dmp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import eu.eudat.file.transformer.models.reference.ReferenceXmlModel;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class DmpReferenceXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private ReferenceXmlModel reference;
|
||||
private String data;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ReferenceXmlModel getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(ReferenceXmlModel reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package eu.eudat.file.transformer.models.dmp;
|
||||
|
||||
import eu.eudat.file.transformer.enums.DmpUserRole;
|
||||
import eu.eudat.file.transformer.models.user.UserXmlModel;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class DmpUserXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private UserXmlModel user;
|
||||
private DmpUserRole role;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UserXmlModel getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(UserXmlModel user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public DmpUserRole getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(DmpUserRole role) {
|
||||
this.role = role;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,187 @@
|
|||
package eu.eudat.file.transformer.models.dmp;
|
||||
|
||||
import eu.eudat.file.transformer.enums.DmpAccessType;
|
||||
import eu.eudat.file.transformer.enums.DmpStatus;
|
||||
import eu.eudat.file.transformer.enums.DmpVersionStatus;
|
||||
import eu.eudat.file.transformer.models.description.DescriptionXmlModel;
|
||||
import eu.eudat.file.transformer.models.dmpblueprint.DmpBlueprintXmlModel;
|
||||
import eu.eudat.file.transformer.models.entitydoi.EntityDoiXmlModel;
|
||||
import eu.eudat.file.transformer.models.user.UserXmlModel;
|
||||
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "DMP")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DmpXmlModel {
|
||||
|
||||
@XmlAttribute
|
||||
private UUID id;
|
||||
private String label;
|
||||
private String description;
|
||||
@XmlAttribute
|
||||
private Short version;
|
||||
private String properties;
|
||||
private Instant createdAt;
|
||||
private Instant updatedAt;
|
||||
private Instant finalizedAt;
|
||||
private Instant publishedAt;
|
||||
private UserXmlModel creator;
|
||||
private DmpAccessType accessType;
|
||||
private DmpBlueprintXmlModel blueprint;
|
||||
private String language;
|
||||
private Instant publicAfter;
|
||||
private List<DmpReferenceXmlModel> dmpReferences;
|
||||
private List<DmpUserXmlModel> dmpUsers;
|
||||
private List<DescriptionXmlModel> descriptions;
|
||||
private List<EntityDoiXmlModel> entityDois;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Short getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Short version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(String properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Instant getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Instant updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public Instant getFinalizedAt() {
|
||||
return finalizedAt;
|
||||
}
|
||||
|
||||
public void setFinalizedAt(Instant finalizedAt) {
|
||||
this.finalizedAt = finalizedAt;
|
||||
}
|
||||
|
||||
public Instant getPublishedAt() {
|
||||
return publishedAt;
|
||||
}
|
||||
|
||||
public void setPublishedAt(Instant publishedAt) {
|
||||
this.publishedAt = publishedAt;
|
||||
}
|
||||
|
||||
public UserXmlModel getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(UserXmlModel creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public DmpAccessType getAccessType() {
|
||||
return accessType;
|
||||
}
|
||||
|
||||
public void setAccessType(DmpAccessType accessType) {
|
||||
this.accessType = accessType;
|
||||
}
|
||||
|
||||
public DmpBlueprintXmlModel getBlueprint() {
|
||||
return blueprint;
|
||||
}
|
||||
|
||||
public void setBlueprint(DmpBlueprintXmlModel blueprint) {
|
||||
this.blueprint = blueprint;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public Instant getPublicAfter() {
|
||||
return publicAfter;
|
||||
}
|
||||
|
||||
public void setPublicAfter(Instant publicAfter) {
|
||||
this.publicAfter = publicAfter;
|
||||
}
|
||||
|
||||
public List<DmpReferenceXmlModel> getDmpReferences() {
|
||||
return dmpReferences;
|
||||
}
|
||||
|
||||
public void setDmpReferences(List<DmpReferenceXmlModel> dmpReferences) {
|
||||
this.dmpReferences = dmpReferences;
|
||||
}
|
||||
|
||||
public List<DmpUserXmlModel> getDmpUsers() {
|
||||
return dmpUsers;
|
||||
}
|
||||
|
||||
public void setDmpUsers(List<DmpUserXmlModel> dmpUsers) {
|
||||
this.dmpUsers = dmpUsers;
|
||||
}
|
||||
|
||||
public List<DescriptionXmlModel> getDescriptions() {
|
||||
return descriptions;
|
||||
}
|
||||
|
||||
public void setDescriptions(List<DescriptionXmlModel> descriptions) {
|
||||
this.descriptions = descriptions;
|
||||
}
|
||||
|
||||
public List<EntityDoiXmlModel> getEntityDois() {
|
||||
return entityDois;
|
||||
}
|
||||
|
||||
public void setEntityDois(List<EntityDoiXmlModel> entityDois) {
|
||||
this.entityDois = entityDois;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package eu.eudat.file.transformer.models.dmpblueprint;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import eu.eudat.file.transformer.models.dmpblueprint.definition.DefinitionXmlModel;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "blueprint")
|
||||
public class DmpBlueprintXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private String label;
|
||||
private DefinitionXmlModel definitionXmlModel;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public DefinitionXmlModel getDefinitionFileTransformerModel() {
|
||||
return definitionXmlModel;
|
||||
}
|
||||
|
||||
public void setDefinitionFileTransformerModel(DefinitionXmlModel definitionXmlModel) {
|
||||
this.definitionXmlModel = definitionXmlModel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.file.transformer.models.dmpblueprint.definition;
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XmlType(namespace = "dmp-blueprint")
|
||||
public class DefinitionXmlModel {
|
||||
|
||||
private List<SectionXmlModel> sectionXmlModels;
|
||||
|
||||
public List<SectionXmlModel> getSections() {
|
||||
return sectionXmlModels;
|
||||
}
|
||||
|
||||
public void setSections(List<SectionXmlModel> sectionXmlModels) {
|
||||
this.sectionXmlModels = sectionXmlModels;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package eu.eudat.file.transformer.models.dmpblueprint.definition;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class DescriptionTemplateXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private UUID descriptionTemplateId;
|
||||
private String label;
|
||||
private Integer minMultiplicity;
|
||||
private Integer maxMultiplicity;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getDescriptionTemplateId() {
|
||||
return descriptionTemplateId;
|
||||
}
|
||||
|
||||
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
||||
this.descriptionTemplateId = descriptionTemplateId;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public Integer getMinMultiplicity() {
|
||||
return minMultiplicity;
|
||||
}
|
||||
|
||||
public void setMinMultiplicity(Integer minMultiplicity) {
|
||||
this.minMultiplicity = minMultiplicity;
|
||||
}
|
||||
|
||||
public Integer getMaxMultiplicity() {
|
||||
return maxMultiplicity;
|
||||
}
|
||||
|
||||
public void setMaxMultiplicity(Integer maxMultiplicity) {
|
||||
this.maxMultiplicity = maxMultiplicity;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package eu.eudat.file.transformer.models.dmpblueprint.definition;
|
||||
|
||||
import eu.eudat.file.transformer.enums.DmpBlueprintExtraFieldDataType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "ExtraField")
|
||||
public class ExtraFieldXmlModel extends FieldXmlModel {
|
||||
|
||||
private DmpBlueprintExtraFieldDataType dataType;
|
||||
|
||||
public DmpBlueprintExtraFieldDataType getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(DmpBlueprintExtraFieldDataType dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package eu.eudat.file.transformer.models.dmpblueprint.definition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import eu.eudat.file.transformer.enums.DmpBlueprintFieldCategory;
|
||||
import jakarta.xml.bind.annotation.XmlSeeAlso;
|
||||
import jakarta.xml.bind.annotation.XmlTransient;
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlTransient
|
||||
@XmlSeeAlso({ExtraFieldXmlModel.class, SystemFieldXmlModel.class})
|
||||
@XmlType(namespace = "dmp-blueprint")
|
||||
/*@JsonTypeInfo(
|
||||
use = JsonTypeInfo.Id.NAME,
|
||||
include = JsonTypeInfo.As.PROPERTY,
|
||||
property = "category",
|
||||
visible = true)
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = SystemFieldXmlModel.class, name = "0"),
|
||||
@JsonSubTypes.Type(value = ExtraFieldXmlModel.class, name = "1")
|
||||
})*/
|
||||
public abstract class FieldXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private DmpBlueprintFieldCategory category;
|
||||
private String label;
|
||||
private String placeholder;
|
||||
private String description;
|
||||
private Integer ordinal;
|
||||
private Boolean required;
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public DmpBlueprintFieldCategory getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(DmpBlueprintFieldCategory category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getPlaceholder() {
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
public void setPlaceholder(String placeholder) {
|
||||
this.placeholder = placeholder;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public Boolean isRequired() {
|
||||
return required;
|
||||
}
|
||||
|
||||
public void setRequired(Boolean required) {
|
||||
this.required = required;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package eu.eudat.file.transformer.models.dmpblueprint.definition;
|
||||
|
||||
|
||||
import jakarta.xml.bind.annotation.XmlType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlType(namespace = "dmp-blueprint")
|
||||
public class SectionXmlModel {
|
||||
private UUID id;
|
||||
private String description;
|
||||
private String label;
|
||||
private Integer ordinal;
|
||||
private Boolean hasTemplates;
|
||||
private List<FieldXmlModel> fieldXmlModels;
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public Boolean getHasTemplates() {
|
||||
return hasTemplates;
|
||||
}
|
||||
|
||||
public void setHasTemplates(Boolean hasTemplates) {
|
||||
this.hasTemplates = hasTemplates;
|
||||
}
|
||||
|
||||
public List<FieldXmlModel> getFields() {
|
||||
return fieldXmlModels;
|
||||
}
|
||||
|
||||
public void setFields(List<FieldXmlModel> fieldXmlModels) {
|
||||
this.fieldXmlModels = fieldXmlModels;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package eu.eudat.file.transformer.models.dmpblueprint.definition;
|
||||
|
||||
import eu.eudat.file.transformer.enums.DmpBlueprintSystemFieldType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "SystemField")
|
||||
public class SystemFieldXmlModel extends FieldXmlModel {
|
||||
|
||||
private DmpBlueprintSystemFieldType systemFieldType;
|
||||
|
||||
public DmpBlueprintSystemFieldType getSystemFieldType() {
|
||||
return systemFieldType;
|
||||
}
|
||||
|
||||
public void setSystemFieldType(DmpBlueprintSystemFieldType systemFieldType) {
|
||||
this.systemFieldType = systemFieldType;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package eu.eudat.file.transformer.models.entitydoi;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "entityDOI")
|
||||
public class EntityDoiXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private String repositoryId;
|
||||
private String doi;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRepositoryId() {
|
||||
return repositoryId;
|
||||
}
|
||||
|
||||
public void setRepositoryId(String repositoryId) {
|
||||
this.repositoryId = repositoryId;
|
||||
}
|
||||
|
||||
public String getDoi() {
|
||||
return doi;
|
||||
}
|
||||
|
||||
public void setDoi(String doi) {
|
||||
this.doi = doi;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package eu.eudat.file.transformer.models.reference;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DefinitionXmlModel {
|
||||
private List<FieldXmlModel> fields;
|
||||
|
||||
public List<FieldXmlModel> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setFields(List<FieldXmlModel> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package eu.eudat.file.transformer.models.reference;
|
||||
|
||||
public class FieldXmlModel {
|
||||
|
||||
private String code;
|
||||
private String value;
|
||||
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package eu.eudat.file.transformer.models.reference;
|
||||
|
||||
|
||||
import eu.eudat.file.transformer.enums.ReferenceSourceType;
|
||||
import eu.eudat.file.transformer.enums.ReferenceType;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "Reference")
|
||||
public class ReferenceXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private String label;
|
||||
private ReferenceType type;
|
||||
private String description;
|
||||
private DefinitionXmlModel definition;
|
||||
private String reference;
|
||||
private String abbreviation;
|
||||
private String source;
|
||||
private ReferenceSourceType sourceType;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public ReferenceType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ReferenceType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public DefinitionXmlModel getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(DefinitionXmlModel definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public ReferenceSourceType getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
public void setSourceType(ReferenceSourceType sourceType) {
|
||||
this.sourceType = sourceType;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.file.transformer.models.tag;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "tag")
|
||||
public class TagXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private String label;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package eu.eudat.file.transformer.models.user;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@XmlRootElement(name = "user")
|
||||
public class UserXmlModel {
|
||||
|
||||
private UUID id;
|
||||
private String name;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package eu.eudat.file.transformer.utils.mapper;
|
||||
|
||||
import eu.eudat.file.transformer.models.dmp.DmpFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.dmp.DmpXmlModel;
|
||||
|
||||
public class DMPXmlMapper {
|
||||
|
||||
public static DmpXmlModel toXml(DmpFileTransformerModel fileModel) {
|
||||
DmpXmlModel xmlModel = new DmpXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setDescription(fileModel.getDescription());
|
||||
xmlModel.setBlueprint(DmpBlueprintXmlMapper.toXml(fileModel.getBlueprint()));
|
||||
xmlModel.setCreator(UserXmlMapper.toXml(fileModel.getCreator()));
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setDescriptions(fileModel.getDescriptions().stream().map(DescriptionXmlMapper::toXml).toList());
|
||||
xmlModel.setAccessType(fileModel.getAccessType());
|
||||
xmlModel.setCreatedAt(fileModel.getCreatedAt());
|
||||
xmlModel.setDmpUsers(fileModel.getDmpUsers().stream().map(DmpUserXmlMapper::toXml).toList());
|
||||
xmlModel.setLanguage(fileModel.getLanguage());
|
||||
xmlModel.setVersion(fileModel.getVersion());
|
||||
if (fileModel.getEntityDois() != null) {
|
||||
xmlModel.setEntityDois(fileModel.getEntityDois().stream().map(EntityDoiXmlMapper::toXml).toList());
|
||||
}
|
||||
xmlModel.setProperties(fileModel.getProperties());
|
||||
xmlModel.setPublicAfter(fileModel.getPublicAfter());
|
||||
xmlModel.setUpdatedAt(fileModel.getUpdatedAt());
|
||||
xmlModel.setPublishedAt(fileModel.getPublishedAt());
|
||||
xmlModel.setDmpReferences(fileModel.getDmpReferences().stream().map(DmpReferenceXmlMapper::toXml).toList());
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package eu.eudat.file.transformer.utils.mapper;
|
||||
|
||||
import eu.eudat.file.transformer.models.description.DescriptionReferenceFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.description.DescriptionReferenceXmlModel;
|
||||
import eu.eudat.file.transformer.utils.mapper.reference.ReferenceXmlMapper;
|
||||
|
||||
public class DescriptionReferenceXmlMapper {
|
||||
|
||||
public static DescriptionReferenceXmlModel toXml(DescriptionReferenceFileTransformerModel fileModel) {
|
||||
DescriptionReferenceXmlModel xmlModel = new DescriptionReferenceXmlModel();
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setReference(ReferenceXmlMapper.toXml(fileModel.getReference()));
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package eu.eudat.file.transformer.utils.mapper;
|
||||
|
||||
import eu.eudat.file.transformer.models.description.DescriptionTagFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.description.DescriptionTagXmlModel;
|
||||
import eu.eudat.file.transformer.models.tag.TagFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.tag.TagXmlModel;
|
||||
|
||||
public class DescriptionTagXmlMapper {
|
||||
|
||||
public static DescriptionTagXmlModel toXml(DescriptionTagFileTransformerModel fileModel) {
|
||||
DescriptionTagXmlModel xmlModel = new DescriptionTagXmlModel();
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setTagFileTransformerModel(toTagXml(fileModel.getTagFileTransformerModel()));
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static TagXmlModel toTagXml(TagFileTransformerModel fileModel) {
|
||||
TagXmlModel xmlModel = new TagXmlModel();
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.file.transformer.utils.mapper;
|
||||
|
||||
import eu.eudat.file.transformer.models.description.DescriptionFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.description.DescriptionXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateXmlModel;
|
||||
import eu.eudat.file.transformer.utils.mapper.descriptiontemplate.DescriptionTemplateXmlMapper;
|
||||
|
||||
public class DescriptionXmlMapper {
|
||||
|
||||
public static DescriptionXmlModel toXml(DescriptionFileTransformerModel fileModel) {
|
||||
DescriptionXmlModel xmlModel = new DescriptionXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setDescription(fileModel.getDescription());
|
||||
xmlModel.setCreatedAt(fileModel.getCreatedAt());
|
||||
xmlModel.setUpdatedAt(fileModel.getUpdatedAt());
|
||||
xmlModel.setFinalizedAt(fileModel.getFinalizedAt());
|
||||
xmlModel.setDescriptionTemplate(DescriptionTemplateXmlMapper.toXml(fileModel.getDescriptionTemplate()));
|
||||
xmlModel.setCreatedBy(UserXmlMapper.toXml(fileModel.getCreatedBy()));
|
||||
if (fileModel.getDescriptionReferenceFileTransformerModels() != null) {
|
||||
xmlModel.setDescriptionReferenceFileTransformerModels(fileModel.getDescriptionReferenceFileTransformerModels().stream().map(DescriptionReferenceXmlMapper::toXml).toList());
|
||||
}
|
||||
if (fileModel.getDescriptionTagFileTransformerModels() != null) {
|
||||
xmlModel.setDescriptionTagFileTransformerModels(fileModel.getDescriptionTagFileTransformerModels().stream().map(DescriptionTagXmlMapper::toXml).toList());
|
||||
}
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package eu.eudat.file.transformer.utils.mapper;
|
||||
|
||||
import eu.eudat.file.transformer.enums.DmpBlueprintFieldCategory;
|
||||
import eu.eudat.file.transformer.models.dmpblueprint.DmpBlueprintFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.dmpblueprint.DmpBlueprintXmlModel;
|
||||
import eu.eudat.file.transformer.models.dmpblueprint.definition.*;
|
||||
|
||||
public class DmpBlueprintXmlMapper {
|
||||
|
||||
public static DmpBlueprintXmlModel toXml(DmpBlueprintFileTransformerModel fileModel) {
|
||||
DmpBlueprintXmlModel xmlModel = new DmpBlueprintXmlModel();
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setDefinitionFileTransformerModel(toDefinitionXml(fileModel.getDefinitionFileTransformerModel()));
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static DefinitionXmlModel toDefinitionXml(DefinitionFileTransformerModel fileModel) {
|
||||
DefinitionXmlModel xmlModel = new DefinitionXmlModel();
|
||||
xmlModel.setSections(fileModel.getSections().stream().map(DmpBlueprintXmlMapper::toSectionXml).toList());
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static SectionXmlModel toSectionXml(SectionFileTransformerModel fileModel) {
|
||||
SectionXmlModel xmlModel = new SectionXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setDescription(fileModel.getDescription());
|
||||
xmlModel.setHasTemplates(fileModel.getHasTemplates());
|
||||
xmlModel.setOrdinal(fileModel.getOrdinal());
|
||||
xmlModel.setFields(fileModel.getFields().stream().map(DmpBlueprintXmlMapper::toFieldXml).toList());
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static FieldXmlModel toFieldXml(FieldFileTransformerModel fileModel) {
|
||||
FieldXmlModel xmlModel = switch (fileModel) {
|
||||
case SystemFieldFileTransformerModel sm -> new SystemFieldXmlModel();
|
||||
case ExtraFieldFileTransformerModelFileTransformerModel sm -> new ExtraFieldXmlModel();
|
||||
default -> null;
|
||||
};
|
||||
|
||||
if (xmlModel != null) {
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setCategory(fileModel.getCategory());
|
||||
xmlModel.setPlaceholder(fileModel.getPlaceholder());
|
||||
xmlModel.setDescription(fileModel.getDescription());
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setOrdinal(fileModel.getOrdinal());
|
||||
}
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package eu.eudat.file.transformer.utils.mapper;
|
||||
|
||||
import eu.eudat.file.transformer.models.dmp.DmpReferenceFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.dmp.DmpReferenceXmlModel;
|
||||
import eu.eudat.file.transformer.utils.mapper.reference.ReferenceXmlMapper;
|
||||
|
||||
public class DmpReferenceXmlMapper {
|
||||
|
||||
public static DmpReferenceXmlModel toXml(DmpReferenceFileTransformerModel fileModel) {
|
||||
DmpReferenceXmlModel xmlModel = new DmpReferenceXmlModel();
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setData(fileModel.getData());
|
||||
xmlModel.setReference(ReferenceXmlMapper.toXml(fileModel.getReference()));
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package eu.eudat.file.transformer.utils.mapper;
|
||||
|
||||
import eu.eudat.file.transformer.models.dmp.DmpUserFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.dmp.DmpUserXmlModel;
|
||||
|
||||
public class DmpUserXmlMapper {
|
||||
|
||||
public static DmpUserXmlModel toXml(DmpUserFileTransformerModel fileModel) {
|
||||
DmpUserXmlModel xmlModel = new DmpUserXmlModel();
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setRole(fileModel.getRole());
|
||||
xmlModel.setUser(UserXmlMapper.toXml(fileModel.getUser()));
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package eu.eudat.file.transformer.utils.mapper;
|
||||
|
||||
import eu.eudat.file.transformer.models.entitydoi.EntityDoiFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.entitydoi.EntityDoiXmlModel;
|
||||
|
||||
public class EntityDoiXmlMapper {
|
||||
|
||||
public static EntityDoiXmlModel toXml(EntityDoiFileTransformerModel fileModel) {
|
||||
EntityDoiXmlModel xmlModel = new EntityDoiXmlModel();
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setDoi(fileModel.getDoi());
|
||||
xmlModel.setRepositoryId(fileModel.getRepositoryId());
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package eu.eudat.file.transformer.utils.mapper;
|
||||
|
||||
import eu.eudat.file.transformer.models.user.UserFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.user.UserXmlModel;
|
||||
|
||||
public class UserXmlMapper {
|
||||
|
||||
public static UserXmlModel toXml(UserFileTransformerModel fileModel) {
|
||||
UserXmlModel xmlModel = new UserXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setName(fileModel.getName());
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,179 @@
|
|||
package eu.eudat.file.transformer.utils.mapper.descriptiontemplate;
|
||||
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.*;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata.*;
|
||||
|
||||
public class DescriptionTemplateXmlMapper {
|
||||
|
||||
public static DescriptionTemplateXmlModel toXml(DescriptionTemplateFileTransformerModel fileModel) {
|
||||
DescriptionTemplateXmlModel xmlModel = new DescriptionTemplateXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setDescription(fileModel.getDescription());
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setType(fileModel.getType());
|
||||
xmlModel.setLanguage(fileModel.getLanguage());
|
||||
xmlModel.setVersion(fileModel.getVersion());
|
||||
xmlModel.setDefinition(toDefinitionXml(fileModel.getDefinition()));
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static DefinitionXmlModel toDefinitionXml(DefinitionFileTransformerModel fileModel) {
|
||||
DefinitionXmlModel xmlModel = new DefinitionXmlModel();
|
||||
|
||||
xmlModel.setPages(fileModel.getPages().stream().map(DescriptionTemplateXmlMapper::toPageXml).toList());
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static PageXmlModel toPageXml(PageFileTransformerModel fileModel) {
|
||||
PageXmlModel xmlModel = new PageXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setOrdinal(fileModel.getOrdinal());
|
||||
xmlModel.setTitle(fileModel.getTitle());
|
||||
xmlModel.setSections(fileModel.getSections().stream().map(DescriptionTemplateXmlMapper::toSectionXml).toList());
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static SectionXmlModel toSectionXml(SectionFileTransformerModel fileModel) {
|
||||
SectionXmlModel xmlModel = new SectionXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setDescription(fileModel.getDescription());
|
||||
if (fileModel.getSections() != null) {
|
||||
xmlModel.setSections(fileModel.getSections().stream().map(DescriptionTemplateXmlMapper::toSectionXml).toList());
|
||||
}
|
||||
if (fileModel.getFieldSets() != null) {
|
||||
xmlModel.setFieldSets(fileModel.getFieldSets().stream().map(DescriptionTemplateXmlMapper::toFieldSetXml).toList());xmlModel.setExtendedDescription(fileModel.getExtendedDescription());
|
||||
}
|
||||
xmlModel.setTitle(fileModel.getTitle());
|
||||
xmlModel.setOrdinal(fileModel.getOrdinal());
|
||||
xmlModel.setDefaultVisibility(fileModel.getDefaultVisibility());
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static FieldSetXmlModel toFieldSetXml(FieldSetFileTransformerModel fileModel) {
|
||||
FieldSetXmlModel xmlModel = new FieldSetXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setTitle(fileModel.getTitle());
|
||||
xmlModel.setDescription(fileModel.getDescription());
|
||||
xmlModel.setExtendedDescription(fileModel.getExtendedDescription());
|
||||
xmlModel.setOrdinal(fileModel.getOrdinal());
|
||||
xmlModel.setAdditionalInformation(fileModel.getAdditionalInformation());
|
||||
xmlModel.setHasCommentField(fileModel.getHasCommentField());
|
||||
xmlModel.setNumbering(fileModel.getNumbering());
|
||||
xmlModel.setFields(fileModel.getFields().stream().map(DescriptionTemplateXmlMapper::toFieldXml).toList());
|
||||
if (fileModel.getMultiplicity() != null) {
|
||||
xmlModel.setMultiplicity(toMultiplicityXml(fileModel.getMultiplicity()));
|
||||
}
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static FieldXmlModel toFieldXml(FieldFileTransformerModel fileModel) {
|
||||
FieldXmlModel xmlModel = new FieldXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setDefaultValue(fileModel.getDefaultValue());
|
||||
xmlModel.setNumbering(fileModel.getNumbering());
|
||||
xmlModel.setOrdinal(fileModel.getOrdinal());
|
||||
xmlModel.setSchematics(fileModel.getSchematics());
|
||||
xmlModel.setValidations(fileModel.getValidations());
|
||||
xmlModel.setIncludeInExport(fileModel.getIncludeInExport());
|
||||
if (fileModel.getData() != null) {
|
||||
xmlModel.setData(toDataXml(fileModel.getData()));
|
||||
}
|
||||
xmlModel.setVisibilityRules(fileModel.getVisibilityRules().stream().map(DescriptionTemplateXmlMapper::toRuleXml).toList());
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static BaseFieldDataXmlModel toDataXml(BaseFieldDataFileTransformerModel fileModel) {
|
||||
BaseFieldDataXmlModel xmlModel = switch (fileModel.getFieldType()) {
|
||||
case ORGANIZATIONS,
|
||||
LICENSES,
|
||||
PUBLICATIONS,
|
||||
BOOLEAN_DECISION,
|
||||
INTERNAL_DMP_ENTRIES_DATASETS,
|
||||
INTERNAL_DMP_ENTRIES_DMPS,
|
||||
REGISTRIES,
|
||||
INTERNAL_DMP_ENTRIES_RESEARCHERS,
|
||||
RESEARCHERS,
|
||||
SERVICES,
|
||||
TAXONOMIES,
|
||||
DATA_REPOSITORIES,
|
||||
JOURNAL_REPOSITORIES -> new LabelAndMultiplicityFieldDataXmlModel();
|
||||
case AUTO_COMPLETE -> new AutoCompleteDataXmlModel();
|
||||
case CHECK_BOX,
|
||||
DATE_PICKER,
|
||||
FREE_TEXT,
|
||||
RICH_TEXT_AREA,
|
||||
TAGS,
|
||||
TEXT_AREA,
|
||||
VALIDATION,
|
||||
DATASET_IDENTIFIER,
|
||||
CURRENCY -> new LabelFieldDataXmlModel();
|
||||
case UPLOAD -> new UploadDataXmlModel();
|
||||
case WORD_LIST -> new WordListDataXmlModel();
|
||||
case RADIO_BOX -> new RadioBoxDataXmlModel();
|
||||
case EXTERNAL_DATASETS -> new ExternalDatasetDataXmlModel();
|
||||
default -> null;
|
||||
};
|
||||
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setValue(fileModel.getValue());
|
||||
xmlModel.setFieldType(fileModel.getFieldType());
|
||||
switch (xmlModel) {
|
||||
case ExternalDatasetDataXmlModel sm -> sm.setType(((ExternalDatasetDataFileTransformerModel)fileModel).getType());
|
||||
case LabelAndMultiplicityFieldDataXmlModel sm -> sm.setMultiAutoComplete(((LabelAndMultiplicityFieldDataFileTransformerModel)fileModel).getMultiAutoComplete());
|
||||
case AutoCompleteDataXmlModel sm -> {
|
||||
AutoCompleteDataFileTransformerModel fm = ((AutoCompleteDataFileTransformerModel) fileModel);
|
||||
sm.setMultiAutoComplete(fm.getMultiAutoComplete());
|
||||
sm.setAutoCompleteSingleDataList(fm.getAutoCompleteSingleDataList().stream().map(FieldDataXmlMapper::toAutocompleteXml).toList());
|
||||
|
||||
}
|
||||
case UploadDataXmlModel sm -> {
|
||||
UploadDataFileTransformerModel fm = ((UploadDataFileTransformerModel) fileModel);
|
||||
sm.setMaxFileSizeInMB(fm.getMaxFileSizeInMB());
|
||||
sm.setTypes(fm.getTypes().stream().map(FieldDataXmlMapper::toUploadXml).toList());
|
||||
}
|
||||
case WordListDataXmlModel sm -> {
|
||||
WordListDataFileTransformerModel fm = (WordListDataFileTransformerModel) fileModel;
|
||||
sm.setMultiList(fm.getMultiList());
|
||||
sm.setOptions(fm.getOptions().stream().map(FieldDataXmlMapper::toComboBoxXml).toList());
|
||||
}
|
||||
case RadioBoxDataXmlModel sm -> {
|
||||
RadioBoxDataFileTransformerModel fm = (RadioBoxDataFileTransformerModel) fileModel;
|
||||
sm.setOptions(fm.getOptions().stream().map(FieldDataXmlMapper::toRadioBoxXml).toList());
|
||||
}
|
||||
default -> {}
|
||||
}
|
||||
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static RuleXmlModel toRuleXml(RuleFileTransformerModel fileModel) {
|
||||
RuleXmlModel xmlModel = new RuleXmlModel();
|
||||
xmlModel.setTarget(fileModel.getTarget());
|
||||
xmlModel.setValue(fileModel.getValue());
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static MultiplicityXmlModel toMultiplicityXml(MultiplicityFileTransformerModel fileModel) {
|
||||
MultiplicityXmlModel xmlModel = new MultiplicityXmlModel();
|
||||
|
||||
xmlModel.setMax(fileModel.getMax());
|
||||
xmlModel.setMin(fileModel.getMin());
|
||||
xmlModel.setPlaceholder(fileModel.getPlaceholder());
|
||||
xmlModel.setTableView(fileModel.getTableView());
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package eu.eudat.file.transformer.utils.mapper.descriptiontemplate;
|
||||
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata.*;
|
||||
|
||||
public class FieldDataXmlMapper {
|
||||
|
||||
public static AutoCompleteSingleDataXmlModel toAutocompleteXml(AutoCompleteSingleDataFileTransformerModel fileModel) {
|
||||
AutoCompleteSingleDataXmlModel xmlModel = new AutoCompleteSingleDataXmlModel();
|
||||
|
||||
xmlModel.setUrl(fileModel.getUrl());
|
||||
xmlModel.setAutoCompleteOptions(toComboBoxXml(fileModel.getAutoCompleteOptions()));
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
public static ComboBoxOptionXmlModel toComboBoxXml(ComboBoxOptionFileTransformerModel fileModel) {
|
||||
ComboBoxOptionXmlModel xmlModel = new ComboBoxOptionXmlModel();
|
||||
|
||||
xmlModel.setUri(fileModel.getUri());
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setValue(fileModel.getValue());
|
||||
xmlModel.setSource(fileModel.getSource());
|
||||
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
public static UploadOptionXmlModel toUploadXml(UploadOptionFileTransformerModel fileModel) {
|
||||
UploadOptionXmlModel xmlModel = new UploadOptionXmlModel();
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setValue(fileModel.getValue());
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
public static RadioBoxOptionXmlModel toRadioBoxXml(RadioBoxOptionFileTransformerModel fileModel) {
|
||||
RadioBoxOptionXmlModel xmlModel = new RadioBoxOptionXmlModel();
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setValue(fileModel.getValue());
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package eu.eudat.file.transformer.utils.mapper.reference;
|
||||
|
||||
import eu.eudat.file.transformer.models.reference.DefinitionFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.reference.DefinitionXmlModel;
|
||||
import eu.eudat.file.transformer.models.reference.FieldFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.reference.FieldXmlModel;
|
||||
|
||||
public class DefinitionXmlMapper {
|
||||
|
||||
public static DefinitionXmlModel toXml(DefinitionFileTransformerModel fileModel) {
|
||||
DefinitionXmlModel xmlModel = new DefinitionXmlModel();
|
||||
xmlModel.setFields(fileModel.getFields().stream().map(DefinitionXmlMapper::toFieldXml).toList());
|
||||
return xmlModel;
|
||||
}
|
||||
|
||||
private static FieldXmlModel toFieldXml(FieldFileTransformerModel fileModel) {
|
||||
FieldXmlModel xmlModel = new FieldXmlModel();
|
||||
xmlModel.setCode(fileModel.getCode());
|
||||
xmlModel.setValue(fileModel.getValue());
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.file.transformer.utils.mapper.reference;
|
||||
|
||||
import eu.eudat.file.transformer.models.reference.ReferenceFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.reference.ReferenceXmlModel;
|
||||
|
||||
public class ReferenceXmlMapper {
|
||||
|
||||
public static ReferenceXmlModel toXml(ReferenceFileTransformerModel fileModel) {
|
||||
ReferenceXmlModel xmlModel = new ReferenceXmlModel();
|
||||
|
||||
xmlModel.setId(fileModel.getId());
|
||||
xmlModel.setLabel(fileModel.getLabel());
|
||||
xmlModel.setDescription(fileModel.getDescription());
|
||||
xmlModel.setReference(fileModel.getReference());
|
||||
xmlModel.setAbbreviation(fileModel.getAbbreviation());
|
||||
xmlModel.setSource(fileModel.getSource());
|
||||
xmlModel.setType(fileModel.getType());
|
||||
xmlModel.setSourceType(fileModel.getSourceType());
|
||||
if (fileModel.getDefinition() != null) {
|
||||
xmlModel.setDefinition(DefinitionXmlMapper.toXml(fileModel.getDefinition()));
|
||||
}
|
||||
return xmlModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package eu.eudat.file.transformer.utils.service.storage;
|
||||
|
||||
import eu.eudat.file.transformer.configuration.FileStorageProperties;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.*;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
public class FileStorageService {
|
||||
private final static Logger logger = LoggerFactory.getLogger(FileStorageService.class);
|
||||
|
||||
private final FileStorageProperties properties;
|
||||
|
||||
@Autowired
|
||||
public FileStorageService(FileStorageProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public String storeFile(byte[] data) {
|
||||
try {
|
||||
String fileName = UUID.randomUUID().toString();
|
||||
Path storagePath = Paths.get(properties.getTransientPath() + "/" + fileName);
|
||||
Files.write(storagePath, data, StandardOpenOption.CREATE_NEW);
|
||||
return fileName;
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] readFile(String fileRef) {
|
||||
try (FileInputStream inputStream = new FileInputStream(properties.getTransientPath() + "/" + fileRef)) {
|
||||
return inputStream.readAllBytes();
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return new byte[1];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package eu.eudat.file.transformer.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.file.transformer.enums.FieldType;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.*;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata.ExternalDatasetDataXmlModel;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ExportXmlBuilder {
|
||||
|
||||
public File build(DefinitionXmlModel pagedDatasetProfile, UUID datasetProfileId, Environment environment) throws IOException {
|
||||
|
||||
File xmlFile = new File(environment.getProperty("temp.temp") + UUID.randomUUID() + ".xml");
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(xmlFile, true));
|
||||
Document xmlDoc = XmlBuilder.getDocument();
|
||||
Element root = xmlDoc.createElement("root");
|
||||
Element datasetProfile = xmlDoc.createElement("datasetProfileId");
|
||||
datasetProfile.setTextContent(datasetProfileId.toString());
|
||||
root.appendChild(datasetProfile);
|
||||
root.appendChild(createPages(pagedDatasetProfile.getPages(), xmlDoc));
|
||||
xmlDoc.appendChild(root);
|
||||
String xml = XmlBuilder.generateXml(xmlDoc);
|
||||
writer.write(xml);
|
||||
writer.close();
|
||||
return xmlFile;
|
||||
}
|
||||
|
||||
public Element createPages(List<PageXmlModel> pagesModel, Document element) {
|
||||
Element pages = element.createElement("pages");
|
||||
pagesModel.forEach(item -> {
|
||||
Element page = element.createElement("page");
|
||||
page.appendChild(createSections(item.getSections(), element));
|
||||
pages.appendChild(page);
|
||||
});
|
||||
return pages;
|
||||
}
|
||||
|
||||
private Element createSections(List<SectionXmlModel> sections, Document element) {
|
||||
Element elementSections = element.createElement("sections");
|
||||
sections.forEach(section -> {
|
||||
Element elementSection = element.createElement("section");
|
||||
/*if (visibilityRuleService.isElementVisible(section.getId()))*/ {
|
||||
elementSection.appendChild(createSections(section.getSections(), element));
|
||||
elementSection.appendChild(createCompositeFields(section.getFieldSets(), element));
|
||||
elementSections.appendChild(elementSection);
|
||||
}
|
||||
});
|
||||
return elementSections;
|
||||
}
|
||||
|
||||
private Element createCompositeFields(List<FieldSetXmlModel> compositeFields, Document element) {
|
||||
Element elementComposites = element.createElement("composite-fields");
|
||||
compositeFields.forEach(compositeField -> {
|
||||
/*if (visibilityRuleService.isElementVisible(compositeField.getId()) && hasVisibleFields(compositeField, visibilityRuleService))*/ {
|
||||
Element composite = element.createElement("composite-field");
|
||||
composite.setAttribute("id", compositeField.getId());
|
||||
if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty()) {
|
||||
Element title = element.createElement("title");
|
||||
title.setTextContent(compositeField.getTitle());
|
||||
composite.appendChild(title);
|
||||
}
|
||||
if (compositeField.getDescription() != null && !compositeField.getDescription().isEmpty()) {
|
||||
Element title = element.createElement("description");
|
||||
title.setTextContent(compositeField.getDescription());
|
||||
composite.appendChild(title);
|
||||
}
|
||||
composite.appendChild(createFields(compositeField.getFields(), element));
|
||||
if(compositeField.getHasCommentField()){
|
||||
Element comment = element.createElement("comment");
|
||||
comment.setTextContent(compositeField.getExtendedDescription());
|
||||
composite.appendChild(comment);
|
||||
}
|
||||
elementComposites.appendChild(composite);
|
||||
|
||||
}
|
||||
});
|
||||
return elementComposites;
|
||||
}
|
||||
|
||||
private Element createFields(List<FieldXmlModel> fields, Document element) {
|
||||
Element elementFields = element.createElement("fields");
|
||||
fields.forEach(field -> {
|
||||
/*if (visibilityRuleService.isElementVisible(field.getId()))*/ {
|
||||
Element elementField = element.createElement("field");
|
||||
elementField.setAttribute("id", field.getId());
|
||||
if (field.getData() != null && field.getData().getFieldType().equals(FieldType.EXTERNAL_DATASETS)) {
|
||||
elementField.setAttribute("type", ((ExternalDatasetDataXmlModel)field.getData()).getType().getValue());
|
||||
}
|
||||
if (field.getData() != null && field.getData().getValue() != null) {
|
||||
Element valueField = element.createElement("value");
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
|
||||
List<Map<String, Object>> jsonArray = mapper.readValue(field.getData().getValue(), new TypeReference<>() {});
|
||||
// JSONArray jsonArray = new JSONArray(field.getValue().toString());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean firstTime = true;
|
||||
for (Map<String, Object> jsonElement: jsonArray) {
|
||||
if (!firstTime) {
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(jsonElement.get("label") != null ? jsonElement.get("label") : jsonElement.get("name"));
|
||||
firstTime = false;
|
||||
|
||||
}
|
||||
/*for (int i = 0; i < jsonArray.length(); i++) {
|
||||
sb.append(jsonArray.getJSONObject(i).get("label").toString());
|
||||
if (i != jsonArray.length() - 1) sb.append(", ");
|
||||
}*/
|
||||
valueField.setTextContent(sb.toString());
|
||||
} catch (IOException ex) {
|
||||
try {
|
||||
Map<String, Object> jsonElement = mapper.readValue(field.getData().getValue(), new TypeReference<>() {});
|
||||
valueField.setTextContent((jsonElement.get("label") != null ? jsonElement.get("label").toString() : jsonElement.get("name") != null ? jsonElement.get("name").toString() : ""));
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
valueField.setTextContent(DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.systemDefault()).format(Instant.parse(field.getData().getValue())));
|
||||
} catch (Exception exc) {
|
||||
valueField.setTextContent(field.getData().getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
elementField.appendChild(valueField);
|
||||
}
|
||||
elementFields.appendChild(elementField);
|
||||
}
|
||||
});
|
||||
return elementFields;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package eu.eudat.file.transformer.xml;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
|
||||
|
||||
public class XmlBuilder {
|
||||
private static final Logger logger = LoggerFactory.getLogger(XmlBuilder.class);
|
||||
|
||||
public static Document getDocument() {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder;
|
||||
try {
|
||||
docBuilder = docFactory.newDocumentBuilder();
|
||||
Document doc = docBuilder.newDocument();
|
||||
return doc;
|
||||
} catch (ParserConfigurationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String generateXml(Document doc) {
|
||||
TransformerFactory tFact = TransformerFactory.newInstance();
|
||||
Transformer trans;
|
||||
try {
|
||||
trans = tFact.newTransformer();
|
||||
StringWriter writer = new StringWriter();
|
||||
StreamResult result = new StreamResult(writer);
|
||||
DOMSource source = new DOMSource(doc);
|
||||
trans.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
trans.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
|
||||
trans.transform(source, result);
|
||||
return writer.toString();
|
||||
} catch (TransformerException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Document fromXml(String xml) {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder;
|
||||
try {
|
||||
docBuilder = docFactory.newDocumentBuilder();
|
||||
InputSource inputStream = new InputSource(new StringReader(xml));
|
||||
Document doc = docBuilder.parse(inputStream);
|
||||
return doc;
|
||||
} catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Element getNodeFromListByTagName(NodeList list, String tagName) {
|
||||
for (int temp = 0; temp < list.getLength(); temp++) {
|
||||
Node element = list.item(temp);
|
||||
if (element.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (element.getNodeName().equals(tagName)) return (Element) element;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.file.transformer.xml;
|
||||
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public interface XmlSerializable<T> {
|
||||
Element toXml(Document doc);
|
||||
|
||||
T fromXml(Element item);
|
||||
}
|
|
@ -0,0 +1,340 @@
|
|||
package eu.eudat.file.transformer.xml.datasetProfileXml;
|
||||
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.FieldXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.FieldSetXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.PageXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.SectionXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata.*;
|
||||
import eu.eudat.file.transformer.xml.XmlBuilder;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class ExportXmlBuilderDatasetProfile {
|
||||
|
||||
|
||||
public File build(DescriptionTemplateXmlModel datasetProfile, Environment environment) throws IOException {
|
||||
|
||||
File xmlFile = new File(environment.getProperty("temp.temp") + UUID.randomUUID() + ".xml");
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(xmlFile, true));
|
||||
Document xmlDoc = XmlBuilder.getDocument();
|
||||
// Element root = xmlDoc.createElement("root");
|
||||
// root.appendChild(createPages(datasetProfile.getPages(), datasetProfile.getSections(), xmlDoc));
|
||||
|
||||
xmlDoc.appendChild(createPages(datasetProfile.getDefinition().getPages(), xmlDoc));
|
||||
Element pages = (Element)xmlDoc.getFirstChild();
|
||||
pages.setAttribute("description", datasetProfile.getDescription());
|
||||
pages.setAttribute("language", datasetProfile.getLanguage());
|
||||
pages.setAttribute("type", datasetProfile.getType().getName());
|
||||
String xml = XmlBuilder.generateXml(xmlDoc);
|
||||
writer.write(xml);
|
||||
writer.close();
|
||||
return xmlFile;
|
||||
}
|
||||
|
||||
public Element createPages(List<PageXmlModel> datasetProfilePages, Document element) {
|
||||
Element pages = element.createElement("pages");
|
||||
datasetProfilePages.forEach(item -> {
|
||||
Element page = element.createElement("page");
|
||||
page.setAttribute("id", "" + item.getId());
|
||||
page.setAttribute("ordinal", "" + item.getOrdinal());
|
||||
page.setAttribute("title", "" + item.getTitle());
|
||||
Element elementSections = element.createElement("sections");
|
||||
page.appendChild(createSections(item.getSections(), element, elementSections));
|
||||
|
||||
pages.appendChild(page);
|
||||
});
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
public Element createSections(List<SectionXmlModel> sections, Document element, Element elementSections) {
|
||||
// if (sections.getSections() != null) {
|
||||
for (SectionXmlModel section : sections) {
|
||||
if (section.getSections() != null && !section.getSections().isEmpty()) {
|
||||
Element elementSectionsChild = element.createElement("section");
|
||||
elementSections.appendChild(createSections(section.getSections(), element, elementSectionsChild));
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
elementSections.setAttribute("defaultVisibility", "" + section.getDefaultVisibility());
|
||||
elementSections.setAttribute("id", "" + section.getId());
|
||||
elementSections.setAttribute("ordinal", "" + section.getOrdinal());
|
||||
|
||||
if (section.getFieldSets() != null && !section.getFieldSets().isEmpty()) {
|
||||
elementSections.appendChild(createFieldSet(section.getFieldSets(), element));
|
||||
}
|
||||
|
||||
if (section.getNumbering() != null) {
|
||||
Element numbering = element.createElement("numbering");
|
||||
numbering.setTextContent(section.getNumbering());
|
||||
elementSections.appendChild(numbering);
|
||||
}
|
||||
if (section.getDescription() != null) {
|
||||
Element description = element.createElement("description");
|
||||
description.setTextContent(section.getDescription());
|
||||
elementSections.appendChild(description);
|
||||
}
|
||||
if (section.getTitle() != null) {
|
||||
Element title = element.createElement("title");
|
||||
title.setTextContent(section.getTitle());
|
||||
elementSections.appendChild(title);
|
||||
}
|
||||
}
|
||||
|
||||
return elementSections;
|
||||
}
|
||||
|
||||
public Element createFieldSet(List<FieldSetXmlModel> fieldSet, Document element) {
|
||||
Element elementFieldSets = element.createElement("field-Sets");
|
||||
fieldSet.forEach(field -> {
|
||||
Element composite = element.createElement("field-Set");
|
||||
composite.setAttribute("id", field.getId());
|
||||
composite.setAttribute("ordinal", "" + field.getOrdinal());
|
||||
|
||||
if (field.getNumbering() != null) {
|
||||
Element numbering = element.createElement("numbering");
|
||||
numbering.setTextContent(field.getNumbering());
|
||||
composite.appendChild(numbering);
|
||||
}
|
||||
Element commentField = element.createElement("CommentField");
|
||||
commentField.setTextContent("" + field.getHasCommentField());
|
||||
composite.appendChild(commentField);
|
||||
|
||||
composite.appendChild(createFields(field.getFields(), element));
|
||||
|
||||
if (field.getMultiplicity() != null) {
|
||||
Element multiplicity = element.createElement("multiplicity");
|
||||
multiplicity.setAttribute("max", "" + field.getMultiplicity().getMax());
|
||||
multiplicity.setAttribute("min", "" + field.getMultiplicity().getMin());
|
||||
multiplicity.setAttribute("placeholder", field.getMultiplicity().getPlaceholder());
|
||||
multiplicity.setAttribute("tableView", String.valueOf(field.getMultiplicity().getTableView()));
|
||||
composite.appendChild(multiplicity);
|
||||
}
|
||||
if (field.getTitle() != null && !field.getTitle().isEmpty()) {
|
||||
Element title = element.createElement("title");
|
||||
title.setTextContent(field.getTitle());
|
||||
composite.appendChild(title);
|
||||
}
|
||||
if (field.getDescription() != null && !field.getDescription().isEmpty()) {
|
||||
Element title = element.createElement("description");
|
||||
title.setTextContent(field.getDescription());
|
||||
composite.appendChild(title);
|
||||
}
|
||||
if (field.getExtendedDescription() != null && !field.getExtendedDescription().isEmpty()) {
|
||||
Element extendedDescription = element.createElement("extendedDescription");
|
||||
extendedDescription.setTextContent(field.getExtendedDescription());
|
||||
composite.appendChild(extendedDescription);
|
||||
}
|
||||
if (field.getAdditionalInformation() != null && !field.getAdditionalInformation().isEmpty()) {
|
||||
Element additionalInformation = element.createElement("additionalInformation");
|
||||
additionalInformation.setTextContent(field.getAdditionalInformation());
|
||||
composite.appendChild(additionalInformation);
|
||||
}
|
||||
|
||||
|
||||
elementFieldSets.appendChild(composite);
|
||||
});
|
||||
return elementFieldSets;
|
||||
}
|
||||
|
||||
|
||||
public Element createFields(List<FieldXmlModel> fields, Document element) {
|
||||
Element elementFields = element.createElement("fields");
|
||||
fields.forEach(field -> {
|
||||
Element elementField = element.createElement("field");
|
||||
elementField.setAttribute("id", field.getId());
|
||||
elementField.setAttribute("ordinal", "" + field.getOrdinal());
|
||||
|
||||
if (field.getNumbering() != null) {
|
||||
Element numbering = element.createElement("numbering");
|
||||
numbering.setTextContent(field.getNumbering());
|
||||
elementField.appendChild(numbering);
|
||||
}
|
||||
if (field.getSchematics() != null) {
|
||||
Element schematics = element.createElement("schematics");
|
||||
field.getSchematics().forEach(schematic -> {
|
||||
Element schematicChild = element.createElement("schematic");
|
||||
schematicChild.setTextContent(schematic);
|
||||
schematics.appendChild(schematicChild);
|
||||
});
|
||||
elementField.appendChild(schematics);
|
||||
}
|
||||
if (field.getValidations() != null) {
|
||||
Element validations = element.createElement("validations");
|
||||
field.getValidations().forEach(validation -> {
|
||||
Element validationChild = element.createElement("validation");
|
||||
validationChild.setAttribute("type", "" + validation);
|
||||
validations.appendChild(validationChild);
|
||||
});
|
||||
elementField.appendChild(validations);
|
||||
}
|
||||
if (field.getDefaultValue() != null) {
|
||||
Element defaultValue = element.createElement("defaultValue");
|
||||
defaultValue.setAttribute("type", field.getData().getFieldType().getValue());
|
||||
defaultValue.setAttribute("value", field.getData().getValue());
|
||||
elementField.appendChild(defaultValue);
|
||||
}
|
||||
if (field.getVisibilityRules() != null) {
|
||||
Element visible = element.createElement("visible");
|
||||
//visible.setAttribute("style", "" + field.getData()..getStyle());
|
||||
field.getVisibilityRules().forEach(rule -> {
|
||||
Element ruleChild = element.createElement("rule");
|
||||
ruleChild.setAttribute("target", "" + rule.getTarget());
|
||||
Element ruleChildValue = element.createElement("value");
|
||||
ruleChildValue.setTextContent(rule.getValue());
|
||||
ruleChild.appendChild(ruleChildValue);
|
||||
visible.appendChild(ruleChild);
|
||||
|
||||
});
|
||||
elementField.appendChild(visible);
|
||||
}
|
||||
/* if (field.getViewStyle() != null) {
|
||||
Element viewStyle = element.createElement("viewStyle");
|
||||
viewStyle.setAttribute("cssClass", field.getViewStyle().getCssClass());
|
||||
viewStyle.setAttribute("renderStyle", field.getViewStyle().getFieldType().getValue());
|
||||
elementField.appendChild(viewStyle);
|
||||
}*/
|
||||
|
||||
if (field.getData() != null) {
|
||||
Element dataOut = element.createElement("data");
|
||||
switch (field.getData().getFieldType()) {
|
||||
case WORD_LIST:
|
||||
{
|
||||
WordListDataXmlModel wordListDataEntityObject = (WordListDataXmlModel) field.getData();
|
||||
dataOut.setAttribute("label", wordListDataEntityObject.getLabel());
|
||||
dataOut.setAttribute("type", wordListDataEntityObject.getFieldType().getValue());
|
||||
dataOut.setAttribute("multiList", wordListDataEntityObject.getMultiList().toString());
|
||||
Element options = element.createElement("options");
|
||||
wordListDataEntityObject.getOptions().forEach(optionChildFor -> {
|
||||
Element optionChild = element.createElement("option");
|
||||
optionChild.setAttribute("label", optionChildFor.getLabel());
|
||||
optionChild.setAttribute("value", optionChildFor.getValue());
|
||||
options.appendChild(optionChild);
|
||||
});
|
||||
dataOut.appendChild(options);
|
||||
break;
|
||||
}
|
||||
case AUTO_COMPLETE:
|
||||
{
|
||||
AutoCompleteDataXmlModel autoCompleteDataEntityObject = (AutoCompleteDataXmlModel) field.getData();
|
||||
dataOut.setAttribute("label", autoCompleteDataEntityObject.getLabel());
|
||||
dataOut.setAttribute("type", autoCompleteDataEntityObject.getFieldType().getValue());
|
||||
dataOut.setAttribute("multiAutoComplete", autoCompleteDataEntityObject.getMultiAutoComplete().toString());
|
||||
for (AutoCompleteSingleDataXmlModel singleData: autoCompleteDataEntityObject.getAutoCompleteSingleDataList()) {
|
||||
Element singleItem = element.createElement("autocompleteSingle");
|
||||
//singleItem.setAttribute("optionsRoot", singleData.getAutoCompleteOptions());
|
||||
singleItem.setAttribute("url", singleData.getUrl());
|
||||
singleItem.setAttribute("source", singleData.getAutoCompleteOptions().getSource());
|
||||
//singleItem.setAttribute("autoCompleteType", Integer.toString(singleData.getAutoCompleteOptions().));
|
||||
if (singleData.getAutoCompleteOptions() != null) {
|
||||
Element optionChild = element.createElement("option");
|
||||
optionChild.setAttribute("label", singleData.getAutoCompleteOptions().getLabel());
|
||||
optionChild.setAttribute("value", singleData.getAutoCompleteOptions().getValue());
|
||||
singleItem.appendChild(optionChild);
|
||||
}
|
||||
dataOut.appendChild(singleItem);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UPLOAD:
|
||||
UploadDataXmlModel uploadEntityObject = (UploadDataXmlModel) field.getData();
|
||||
dataOut.setAttribute("label", uploadEntityObject.getLabel());
|
||||
dataOut.setAttribute("maxFileSizeInMB", String.valueOf(uploadEntityObject.getMaxFileSizeInMB()));
|
||||
Element types = element.createElement("types");
|
||||
uploadEntityObject.getTypes().forEach(type -> {
|
||||
Element optionChild = element.createElement("option");
|
||||
optionChild.setAttribute("label", type.getLabel());
|
||||
optionChild.setAttribute("value", type.getValue());
|
||||
types.appendChild(optionChild);
|
||||
});
|
||||
dataOut.appendChild(types);
|
||||
break;
|
||||
case BOOLEAN_DECISION:
|
||||
//BooleanDes booleanDecisionDataEntityObject = (BooleanDecisionDataEntity) field.getData();
|
||||
dataOut.setAttribute("label", field.getData().getLabel());
|
||||
break;
|
||||
case RADIO_BOX:
|
||||
RadioBoxDataXmlModel radioBoxDataEntityObject = (RadioBoxDataXmlModel) field.getData();
|
||||
dataOut.setAttribute("label", radioBoxDataEntityObject.getLabel());
|
||||
|
||||
Element options = element.createElement("options");
|
||||
radioBoxDataEntityObject.getOptions().forEach(optionChildFor -> {
|
||||
Element optionChild = element.createElement("option");
|
||||
optionChild.setAttribute("label", optionChildFor.getLabel());
|
||||
optionChild.setAttribute("value", optionChildFor.getValue());
|
||||
options.appendChild(optionChild);
|
||||
});
|
||||
dataOut.appendChild(options);
|
||||
break;
|
||||
case CHECK_BOX:
|
||||
case FREE_TEXT:
|
||||
case TEXT_AREA:
|
||||
case RICH_TEXT_AREA:
|
||||
case DATE_PICKER:
|
||||
case DATASET_IDENTIFIER:
|
||||
case CURRENCY:
|
||||
case TAGS:
|
||||
dataOut.setAttribute("label", field.getData().getLabel());
|
||||
break;
|
||||
/*case INTERNAL_DMP_ENTRIES_DMPS:
|
||||
//ExternalDatasetDataFileTransformerModel internalDmpEntitiesData = (ExternalDatasetDataFileTransformerModel) field.getData();
|
||||
dataOut.setAttribute("label", field.getData().getLabel());
|
||||
dataOut.setAttribute("type", field.getData().getFieldType().getValue());
|
||||
switch (internalDmpEntitiesData.getFieldSubType()) {
|
||||
case Researchers:
|
||||
ResearcherAutoCompleteDataEntity researchersAutoCompleteData = (ResearcherAutoCompleteDataEntity) internalDmpEntitiesData;
|
||||
dataOut.setAttribute("multiAutocomplete", researchersAutoCompleteData.getMultiAutoComplete().toString());
|
||||
break;
|
||||
case Datasets:
|
||||
DatasetAutoCompleteDataEntity datasetAutoCompleteDataEntity = (DatasetAutoCompleteDataEntity) internalDmpEntitiesData;
|
||||
dataOut.setAttribute("multiAutocomplete", datasetAutoCompleteDataEntity.getMultiAutoComplete().toString());
|
||||
break;
|
||||
case Dmps:
|
||||
DmpAutoCompleteDataEntity dmpAutoCompleteDataEntity = (DmpAutoCompleteDataEntity) internalDmpEntitiesData;
|
||||
dataOut.setAttribute("multiAutocomplete", dmpAutoCompleteDataEntity.getMultiAutoComplete().toString());
|
||||
break;
|
||||
}
|
||||
break;*/
|
||||
case EXTERNAL_DATASETS:
|
||||
ExternalDatasetDataXmlModel externalDatasetDataEntity = (ExternalDatasetDataXmlModel) field.getData();
|
||||
dataOut.setAttribute("label", externalDatasetDataEntity.getLabel());
|
||||
dataOut.setAttribute("multiAutocomplete", externalDatasetDataEntity.getMultiAutoComplete().toString());
|
||||
dataOut.setAttribute("type", externalDatasetDataEntity.getType().getValue());
|
||||
break;
|
||||
case DATA_REPOSITORIES:
|
||||
case JOURNAL_REPOSITORIES:
|
||||
case PUB_REPOSITORIES:
|
||||
case TAXONOMIES:
|
||||
case LICENSES:
|
||||
case SERVICES:
|
||||
case REGISTRIES:
|
||||
case VALIDATION:
|
||||
case RESEARCHERS:
|
||||
case PUBLICATIONS:
|
||||
case ORGANIZATIONS:
|
||||
LabelAndMultiplicityFieldDataXmlModel dataRepositoryDataEntity = (LabelAndMultiplicityFieldDataXmlModel) field.getData();
|
||||
dataOut.setAttribute("label", dataRepositoryDataEntity.getLabel());
|
||||
dataOut.setAttribute("multiAutocomplete", dataRepositoryDataEntity.getMultiAutoComplete().toString());
|
||||
break;
|
||||
|
||||
}
|
||||
elementField.appendChild(dataOut);
|
||||
}
|
||||
|
||||
elementFields.appendChild(elementField);
|
||||
});
|
||||
return elementFields;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package eu.eudat.file.transformer.xml.datasetProfileXml;
|
||||
|
||||
import jakarta.xml.bind.JAXBContext;
|
||||
import jakarta.xml.bind.JAXBException;
|
||||
import jakarta.xml.bind.Unmarshaller;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ImportXmlBuilderDatasetProfile {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ImportXmlBuilderDatasetProfile.class);
|
||||
|
||||
/*public DescriptionTemplateImportExport build(File xmlFile) throws IOException {
|
||||
DescriptionTemplateImportExport descriptionTemplateImportXml = new DescriptionTemplateImportExport();
|
||||
JAXBContext jaxbContext = null;
|
||||
try {
|
||||
jaxbContext = JAXBContext.newInstance(DescriptionTemplateImportExport.class);
|
||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||
descriptionTemplateImportXml = (DescriptionTemplateImportExport) unmarshaller.unmarshal(xmlFile);
|
||||
} catch (JAXBException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return descriptionTemplateImportXml;
|
||||
}*/
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<groupId>gr.cite.opendmp</groupId>
|
||||
<artifactId>file-transformer-xml-parent</artifactId>
|
||||
<version>${revision}</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<maven.compiler.release>21</maven.compiler.release>
|
||||
<revision>1.0.0-SNAPSHOT</revision>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<modules>
|
||||
<module>core</module>
|
||||
<module>web</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,29 @@
|
|||
<settings>
|
||||
<servers>
|
||||
<server>
|
||||
<id>ossrh</id>
|
||||
<username>${server_username}</username>
|
||||
<password>${server_password}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>dev</id>
|
||||
<username>${server_username}</username>
|
||||
<password>${server_password}</password>
|
||||
</server>
|
||||
</servers>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dev</id>
|
||||
<name>Dev Profile</name>
|
||||
<url>${devProfileUrl}</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
</settings>
|
|
@ -0,0 +1,59 @@
|
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>gr.cite.opendmp</groupId>
|
||||
<artifactId>file-transformer-xml-parent</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>file-transformer-xml-web</artifactId>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<maven.compiler.release>21</maven.compiler.release>
|
||||
<revision>1.0.0-SNAPSHOT</revision>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>gr.cite.opendmp</groupId>
|
||||
<artifactId>file-transformer-xml</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>oidc-authn</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gr.cite</groupId>
|
||||
<artifactId>cache</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,16 @@
|
|||
package eu.eudat.file.transformer;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {
|
||||
"eu.eudat.file.transformer.*",
|
||||
"gr.cite.tools",
|
||||
"gr.cite.commons"
|
||||
})
|
||||
public class FileTransformerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FileTransformerApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package eu.eudat.file.transformer.config;
|
||||
|
||||
import gr.cite.commons.web.oidc.configuration.WebSecurityProperties;
|
||||
import gr.cite.commons.web.oidc.configuration.filter.ApiKeyFilter;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManagerResolver;
|
||||
import org.springframework.security.config.Customizer;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfiguration {
|
||||
|
||||
private final ApiKeyFilter apiKeyFilter;
|
||||
private final WebSecurityProperties webSecurityProperties;
|
||||
private final AuthenticationManagerResolver<HttpServletRequest> authenticationManagerResolver;
|
||||
|
||||
@Autowired
|
||||
public SecurityConfiguration(ApiKeyFilter apiKeyFilter, WebSecurityProperties webSecurityProperties, AuthenticationManagerResolver<HttpServletRequest> authenticationManagerResolver) {
|
||||
this.apiKeyFilter = apiKeyFilter;
|
||||
this.webSecurityProperties = webSecurityProperties;
|
||||
this.authenticationManagerResolver = authenticationManagerResolver;
|
||||
}
|
||||
|
||||
@Bean
|
||||
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
if (webSecurityProperties.isEnabled()) {
|
||||
http.csrf(AbstractHttpConfigurer::disable)
|
||||
.cors(Customizer.withDefaults())
|
||||
.addFilterBefore(apiKeyFilter, AbstractPreAuthenticatedProcessingFilter.class)
|
||||
.authorizeHttpRequests(authorizationManagerRequestMatcherRegistry -> authorizationManagerRequestMatcherRegistry
|
||||
.requestMatchers(buildAntPatterns(webSecurityProperties.getAuthorizedEndpoints())).authenticated()
|
||||
.requestMatchers(buildAntPatterns(webSecurityProperties.getAllowedEndpoints())).anonymous())
|
||||
.sessionManagement(httpSecuritySessionManagementConfigurer -> httpSecuritySessionManagementConfigurer.sessionCreationPolicy(SessionCreationPolicy.NEVER))
|
||||
.oauth2ResourceServer(oauth2 -> oauth2.authenticationManagerResolver(authenticationManagerResolver));
|
||||
return http.build();
|
||||
} else {
|
||||
return http.csrf(AbstractHttpConfigurer::disable)
|
||||
.cors(Customizer.withDefaults())
|
||||
.authorizeHttpRequests(authorizationManagerRequestMatcherRegistry ->
|
||||
authorizationManagerRequestMatcherRegistry.anyRequest().anonymous())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
private String[] buildAntPatterns(Set<String> endpoints) {
|
||||
if (endpoints == null) {
|
||||
return new String[0];
|
||||
}
|
||||
return endpoints.stream()
|
||||
.filter(endpoint -> endpoint != null && !endpoint.isBlank())
|
||||
.map(endpoint -> "/" + stripUnnecessaryCharacters(endpoint) + "/**")
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
|
||||
private String stripUnnecessaryCharacters(String endpoint) {
|
||||
endpoint = endpoint.strip();
|
||||
if (endpoint.startsWith("/")) {
|
||||
endpoint = endpoint.substring(1);
|
||||
}
|
||||
if (endpoint.endsWith("/")) {
|
||||
endpoint = endpoint.substring(0, endpoint.length() - 1);
|
||||
}
|
||||
return endpoint;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package eu.eudat.file.transformer.controller;
|
||||
|
||||
import eu.eudat.file.transformer.interfaces.FileTransformerClient;
|
||||
import eu.eudat.file.transformer.interfaces.FileTransformerConfiguration;
|
||||
import eu.eudat.file.transformer.models.description.DescriptionFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.description.DescriptionXmlModel;
|
||||
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.dmp.DmpFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.dmp.DmpXmlModel;
|
||||
import eu.eudat.file.transformer.models.dmpblueprint.DmpBlueprintFileTransformerModel;
|
||||
import eu.eudat.file.transformer.models.misc.FileEnvelope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/file")
|
||||
public class FileTransformerController {
|
||||
|
||||
private final FileTransformerClient fileTransformerExecutor;
|
||||
|
||||
@Autowired
|
||||
public FileTransformerController(FileTransformerClient fileTransformerExecutor) {
|
||||
this.fileTransformerExecutor = fileTransformerExecutor;
|
||||
}
|
||||
|
||||
@PostMapping("/export/dmp")
|
||||
public FileEnvelope exportDmp(@RequestBody DmpFileTransformerModel dmpDepositModel) throws Exception {
|
||||
return fileTransformerExecutor.exportDmp(dmpDepositModel);
|
||||
}
|
||||
|
||||
@PostMapping("/export/description")
|
||||
public FileEnvelope exportDescription(@RequestBody DescriptionFileTransformerModel descriptionXmlModel, @RequestParam(value = "format",required = false)String format, @RequestParam(value = "descriptionId",required = false) String descriptionId) throws Exception {
|
||||
return fileTransformerExecutor.exportDescription(descriptionXmlModel, format);
|
||||
}
|
||||
|
||||
@PostMapping("/import/dmp")
|
||||
public DmpFileTransformerModel importFileToDmp(@RequestBody FileEnvelope fileEnvelope) {
|
||||
return fileTransformerExecutor.importDmp(fileEnvelope);
|
||||
}
|
||||
|
||||
@PostMapping("/import/description")
|
||||
public DescriptionFileTransformerModel importFileToDescription(@RequestBody FileEnvelope fileEnvelope) {
|
||||
return fileTransformerExecutor.importDescription(fileEnvelope);
|
||||
}
|
||||
|
||||
@GetMapping("/formats")
|
||||
public FileTransformerConfiguration getSupportedFormats() {
|
||||
return fileTransformerExecutor.getConfiguration();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
spring:
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
config:
|
||||
import: optional:classpath:config/app.env[.properties], optional:file:../config/app.env[.properties],
|
||||
optional:classpath:config/server.yml[.yml], optional:classpath:config/server-${spring.profiles.active}.yml[.yml], optional:file:../config/server-${spring.profiles.active}.yml[.yml],
|
||||
optional:classpath:config/storage.yml[.yml], optional:classpath:config/storage-${spring.profiles.active}.yml[.yml], optional:file:../config/storage-${spring.profiles.active}.yml[.yml],
|
||||
optional:classpath:config/security.yml[.yml], optional:classpath:config/security-${spring.profiles.active}.yml[.yml], optional:file:../config/security-${spring.profiles.active}.yml[.yml],
|
||||
optional:classpath:config/cache.yml[.yml], optional:classpath:config/cache-${spring.profiles.active}.yml[.yml], optional:file:../config/cache-${spring.profiles.active}.yml[.yml],
|
||||
optional:classpath:config/pdf.yml[.yml], optional:classpath:config/pdf-${spring.profiles.active}.yml[.yml], optional:file:../config/pdf-${spring.profiles.active}.yml[.yml]
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
cache:
|
||||
manager:
|
||||
fallbackToNoOpCache: true
|
||||
caffeineCaches:
|
||||
- names: [ "apikey" ]
|
||||
allowNullValues: true
|
||||
initialCapacity: 100
|
||||
maximumSize: 500
|
||||
enableRecordStats: false
|
||||
expireAfterWriteMinutes: 10
|
||||
expireAfterAccessMinutes: 10
|
||||
refreshAfterWriteMinutes: 10
|
||||
mapCaches:
|
||||
apiKey:
|
||||
name: apikey
|
||||
keyPattern: resolve_$keyhash$:v0
|
|
@ -0,0 +1,3 @@
|
|||
pdf:
|
||||
converter:
|
||||
url: ${PDF_CONVERTER_URL:}
|
|
@ -0,0 +1,20 @@
|
|||
web:
|
||||
security:
|
||||
enabled: true
|
||||
authorized-endpoints: [ api ]
|
||||
allowed-endpoints: [ health ]
|
||||
idp:
|
||||
api-key:
|
||||
enabled: true
|
||||
authorization-header: Authorization
|
||||
client-id: ${IDP_APIKEY_CLIENT_ID:}
|
||||
client-secret: ${IDP_APIKEY_CLIENT_SECRET:}
|
||||
scope: ${IDP_APIKEY_SCOPE:}
|
||||
resource:
|
||||
token-type: JWT #| opaque
|
||||
opaque:
|
||||
client-id: ${IDP_OPAQUE_CLIENT_ID:}
|
||||
client-secret: ${IDP_OPAQUE_CLIENT_SECRET:}
|
||||
jwt:
|
||||
claims: [ role, x-role ]
|
||||
issuer-uri: ${IDP_ISSUER_URI:}
|
|
@ -0,0 +1,12 @@
|
|||
server:
|
||||
port: 8087
|
||||
tomcat:
|
||||
threads:
|
||||
max: 20
|
||||
max-connections: 10000
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
|
@ -0,0 +1,4 @@
|
|||
file:
|
||||
storage:
|
||||
temp: ${TEMP_PATH}
|
||||
transient-path: ${TRANSIENT_PATH}
|
Loading…
Reference in New Issue