Compare commits

..

94 Commits

Author SHA1 Message Date
Diamantis Tziotzios e8aef281d4 Merge branch 'Development' 2024-02-22 11:09:31 +02:00
Diamantis Tziotzios 00c6978594 no message 2024-02-22 11:07:51 +02:00
Diamantis Tziotzios 3adb518e61 fixes 2024-02-14 22:10:15 +02:00
Konstantina Galouni eb74ef86b9 rich-text-editor.component.ts: Removed "backgroundColor" from toolbarHiddenButtons & added in customClasses "Highlight" option with custom "highlight" class | _type.scss: Added rules for "blockquote" and ".highlight" (added by rich text editor). 2024-02-13 13:23:13 +02:00
Diamantis Tziotzios a1ee9c82bc fixes 2024-01-31 17:55:08 +02:00
Diamantis Tziotzios 5e5bd39313 no message 2024-01-30 13:26:31 +02:00
Diamantis Tziotzios 5e99cef60e default blueprint update 2024-01-24 16:25:46 +02:00
Diamantis Tziotzios cc7edc2f49 final fixes for #9384 #9153 #9409 #9420 2024-01-24 16:17:06 +02:00
Diamantis Tziotzios a1849c64ca Merge branch 'Development' of https://code-repo.d4science.org/MaDgiK-CITE/argos into Development
# Conflicts:
#	dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor-blueprint.component.ts
2024-01-24 14:48:38 +02:00
Diamantis Tziotzios 192220161b fixes 2024-01-24 14:47:37 +02:00
George Kalampokis 87758c3e9a Fix various issues with adding/removing Dataset Templates 2024-01-24 14:31:46 +02:00
Diamantis Tziotzios 83342f5afa docx template update 2024-01-17 17:49:52 +02:00
Diamantis Tziotzios 65cdb3b6ea fixes for #9384 #9153 #9162 #9265 2024-01-17 16:50:12 +02:00
Diamantis Tziotzios 536ba9b900 Fixes for #9152 #9153 #9162 #9265 #9266 #9311 #9312 2024-01-09 09:42:58 +02:00
Alexandros Mandilaras 6bd3302788 sql script fix 2023-11-23 15:16:11 +02:00
Diamantis Tziotzios 4970f5812f fix issues #9152 #9153 #9204 #9208 2023-11-23 13:15:50 +02:00
Diamantis Tziotzios 9fed92dbcb fixes for #9109 #9146 #9148 #9149 #9152 #9153 #9156 #9157 #9158 #9160 #9162 #9163 #9164 #9166 2023-11-03 13:24:01 +02:00
Diamantis Tziotzios 44dab9c19a gitignore changes 2023-11-01 09:41:22 +02:00
Alexandros Mandilaras 54f911d826 typo fixes in greek and english translations 2023-10-23 10:12:17 +03:00
Diamantis Tziotzios 9879050eab cleanup 2023-10-19 17:28:36 +03:00
Diamantis Tziotzios 8a41a7dcd9 Fixes for #9033 #9107 #9105 #9105 2023-10-19 17:27:37 +03:00
Diamantis Tziotzios d60cc144d5 #9033 Description Templates - change "Other" API label to "Custom" 2023-10-18 16:10:12 +03:00
Georgios Kakaletris 9c37e5a073 Update 'README.md' 2023-10-18 12:31:03 +02:00
Georgios Kakaletris 444c1aacb1 Update 'README.md' 2023-10-18 12:27:40 +02:00
Diamantis Tziotzios 59d7383947 added basque contributors at static pages 2023-10-17 13:48:50 +03:00
Diamantis Tziotzios 6caa1af134 Added Basque language 2023-10-16 18:21:22 +03:00
George Kalampokis 74a6019a72 Fix some styling and compilation errors 2023-10-10 12:10:52 +03:00
George Kalampokis 5c903c0f48 Add missing files 2023-10-10 12:04:06 +03:00
George Kalampokis ec8f6a6d48 Add Authentication support for the remote fetcher and rework dataset template's autocomplete sources 2023-10-10 12:03:59 +03:00
Bernaldo Mihasi ecd86f413a show prefilling pop up if only at least one dataset profile has enabled prefilling property 2023-10-06 11:22:23 +03:00
Bernaldo Mihasi c238615b50 add enable prefilling property in description templates 2023-10-06 09:36:35 +03:00
Bernaldo Mihasi 10d0f1fb0e make word list labels and delete icons in finalized description templates disabled 2023-10-05 17:47:00 +03:00
Bernaldo Mihasi 846405435c bug fixes 2023-10-05 09:33:28 +03:00
Bernaldo Mihasi dfc9e14003 update i18n 2023-10-04 17:03:50 +03:00
Bernaldo Mihasi bc1894586b 1) update dmp blueprint listing table view, 2) create clone functionality for dmp blueprints, 3) section description is not required in editor, 4) in the deletion of a dmp blueprint check if any dmps are accosiated with it 2023-10-04 09:43:16 +03:00
Bernaldo Mihasi 2bf0a857bc bug fixes: 1) when creating description template type check only for non deleted types, 2) dmp docx/pdf export: check if system fields exist 3) when creating/updating dmp check if value for extra fields is set, 4) when unchecking the 'Description Templates' checkbox in the blueprint editor, clear any templates selected 2023-10-02 13:57:00 +03:00
Bernaldo Mihasi 3d10e8ad28 add type attribute in xml import/export of a description template 2023-10-02 10:14:14 +03:00
Bernaldo Mihasi 53b61853e1 bug fixes 2023-10-02 09:34:58 +03:00
Bernaldo Mihasi d644b1dc91 [wip] dmp xml upload changes, including section and extra fields information 2023-10-02 09:34:21 +03:00
Diamantis Tziotzios 50c96ef821 Merge branch 'Development' 2023-06-20 09:39:15 +03:00
Konstantina Galouni 0adc7044ab h2020.docx: [Bug fix] Updated image of Argos in h2020.docx DMP template | DataManagementPlanManager.java & DatasetManager.java: Added parameter "isDataset" in fillFirstPage() | WordBuilder.java: [Bug fix] Added parameter isDataset in fillFirstPage() and added some checks in description.
(cherry picked from commit c9b4b35e39)
2023-05-09 10:33:44 +03:00
Konstantina Galouni 13e62fd409 h2020.docx & WordBuilder.java: Updated h2020.docx DMP template and added export of DMP description.
(cherry picked from commit 28c1c9b71d)
2023-03-14 10:23:35 +02:00
Diamantis Tziotzios 7185b5d117 Merge commit '180e02c829a8fb35056124d5afdbec3835a94b62' 2023-02-28 16:08:32 +02:00
George Kalampokis 5f131b9823 Remove thread sleeps when trying to load config files and removed principal from Exception Handling Controller 2022-12-06 14:34:11 +02:00
Diamantis Tziotzios 93320f7c94 Merge branch 'Development' 2022-11-22 15:03:08 +02:00
Diamantis Tziotzios 876d99ce38 Merge commit '18dcabbac2599d35246f91204efbb25238106565' 2022-11-03 14:20:16 +02:00
George Kalampokis 7a71110033 Fix critical issue with open file handle leak on user guide folder
(cherry picked from commit fa723c07ae)
2022-07-28 17:14:13 +03:00
Diamantis Tziotzios 14c267c97e Merge branch 'Development'
# Conflicts:
#	dmp-backend/web/src/main/resources/config/application-production.properties
2022-05-13 11:58:34 +03:00
Diamantis Tziotzios b04b35d62b Merge branch 'Development'
# Conflicts:
#	dmp-backend/web/src/main/resources/RDACommonStandards.txt
2022-02-25 12:19:29 +02:00
Diamantis Tziotzios 7a8375b988 Merge commit '2cb985c23c4ceda99efc78bcc8e77b3eceeb0bcf'
# Conflicts:
#	dmp-backend/elastic/src/main/java/eu/eudat/elastic/criteria/DatasetCriteria.java
#	dmp-backend/elastic/src/main/java/eu/eudat/elastic/entities/Dataset.java
#	dmp-backend/elastic/src/main/java/eu/eudat/elastic/entities/Dmp.java
#	dmp-backend/elastic/src/main/java/eu/eudat/elastic/repository/DatasetRepository.java
#	dmp-backend/elastic/src/main/java/eu/eudat/elastic/repository/DmpRepository.java
#	dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java
#	dmp-backend/web/src/main/java/eu/eudat/logic/mapper/elastic/criteria/DmpCriteriaMapper.java
#	dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java
#	dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java
2021-12-09 12:18:39 +02:00
Diamantis Tziotzios 895dbcf098 Revert "user guide path fix"
This reverts commit bd15b1e2c7.
2021-07-07 20:39:41 +03:00
Diamantis Tziotzios bd15b1e2c7 user guide path fix 2021-07-07 20:39:22 +03:00
George Kalampokis faabd343a9 Improve error handling
(cherry picked from commit d5cd90814a)
2021-07-06 13:41:09 +03:00
George Kalampokis e5a929f259 Fix issues with xml import and issues with zenodo deposit
(cherry picked from commit efe177f0b1)
2021-07-06 13:40:15 +03:00
George Kalampokis d1fc10854c Fix issue with zenodo depositions
(cherry picked from commit c57e10a033)
2021-07-06 12:15:49 +03:00
George Kalampokis 2537923dc0 Fix various critical issues
(cherry picked from commit 244bfa5c54)
2021-07-05 11:10:11 +03:00
George Kalampokis c1adbe283a Improvements over MS Word Document export
(cherry picked from commit 4e3b98f1ff)
2021-06-30 18:48:20 +03:00
George Kalampokis 1c365a191e Minor Update
(cherry picked from commit 295750684f)
2021-06-30 18:48:13 +03:00
Kristian Ntavidi 82c5586067 Dataset and dmp overview fix.
* Fix edit issue when multiple users have ownership of the same dmp/dataset.

(cherry picked from commit fd9d35aad3)
2021-06-30 13:38:53 +03:00
George Kalampokis 04f230dff1 Fix critical issue with dataset's copy dropdown
(cherry picked from commit d1e3aae36d)
2021-06-30 12:52:32 +03:00
George Kalampokis 72d88d9db4 Fix listing issues and improve elastic query
(cherry picked from commit dcd7f24cac)
2021-06-29 14:25:38 +03:00
George Kalampokis 143a4c0214 Reduce severity
(cherry picked from commit 03b7699973)
2021-06-25 19:31:45 +03:00
George Kalampokis e7e5ed02b3 Add query db fallback for DMPs
(cherry picked from commit d1df83f689)
2021-06-25 19:28:29 +03:00
George Kalampokis b5fcc5971e Fix various library issues with postgres and elastic
(cherry picked from commit 4a4042d621)
2021-06-25 12:46:09 +03:00
Diamantis Tziotzios c16c35225f Merge branch 'Development' 2021-06-25 08:50:27 +03:00
Diamantis Tziotzios f5d266554b Merge commit 'ca91c14114b8994d41fdf2b97fc6d1a4d82ffa4e' 2021-05-19 14:22:47 +03:00
Diamantis Tziotzios db31597fc0 Merge branch 'Development' 2020-10-07 10:58:45 +03:00
Diamantis Tziotzios 9f5054668e Merge branch 'Development'
* Development: (72 commits)
  splash screen fixes
  splash spell error fix
  Properly remove associate Collaborators from a DMP
  splash changes
  Fixed issue with DMP filter on public datasets
  Fixed issue when using the copy dataset dialog
  Minor styling improvement over DMP Overview
  Code clean up
  Add support for newer versions of java (11) (expirimental)
  Add Zenodo file visibility field for DMP (ref #274)
  Fixed issue not passing DMP Extra Properties on clones and new Versions
  Add DMP Zenodo license field (ref #274)
  more splash screen changes
  Allow splash to send contact emails
  splash screen changes
  Hide Uri field on Dataset Editor (ref #275)
  When logging in remove the cookie consent popup
  Fixed minor issues with RDA Mapping
  Add currency field type for dataset templates
  Add DMP language a placeholder on UI
  ...

# Conflicts:
#	dmp-backend/web/src/main/resources/RDACommonStandards.txt
#	dmp-backend/web/src/main/resources/config/application-production.properties
2020-07-03 11:00:07 +03:00
George Kalampokis 38986ef67b no message 2020-06-16 17:58:31 +03:00
Diamantis Tziotzios bff260b85b config file changes 2020-06-16 17:54:50 +03:00
George Kalampokis 9519300dc4 Removed deprecated configurations and added additional RDA Common Standards for dataset Templates
(cherry picked from commit 5b0a66ce06)
2020-05-29 12:07:59 +03:00
George Kalampokis 9373d3e038 Fixed logback paths
(cherry picked from commit 33ec8b81c0)
2020-05-20 15:39:27 +03:00
dtziotzios d971f02a94 Merge branch 'Development'
# Conflicts:
#	dmp-backend/web/src/main/java/eu/eudat/controllers/DMPs.java
#	dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java
2020-05-13 17:29:52 +03:00
Georgios Kakaletris d3915e26e7 Update LICENSE 2020-05-09 00:03:50 +02:00
George Kalampokis c028aad615 Fixed and improved file export system
(cherry picked from commit 71ccd76896)
2020-04-02 18:44:40 +03:00
Diamantis Tziotzios 4ee39074a3 Merge commit '8ca2b912d40ece8bf0fbcda5c49f1ef7f5f6fdfd' 2020-04-02 13:33:08 +03:00
Diamantis Tziotzios 1b4952a909 Merge branch 'Development' 2020-01-31 18:26:27 +02:00
Diamantis Tziotzios 3ada5a0d3d Merge branch 'Development' 2019-11-26 11:41:02 +02:00
Diamantis Tziotzios 63ee865dd9 Merge commit 'c8358f22dd5d108b7f270f97724d6bab1582c2c5' 2019-11-22 18:08:55 +02:00
Diamantis Tziotzios 2a52138124 Merge branch 'Development' 2019-09-17 18:47:39 +03:00
Diamantis Tziotzios 7cf64c18f2 Merge branch 'Development' 2019-09-17 11:31:58 +03:00
Diamantis Tziotzios 71d317bab7 license file 2019-06-19 08:59:52 +02:00
Ioannis Kalyvas cd8b3448f5 Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot 2018-06-28 12:39:39 +03:00
Ioannis Kalyvas c3d4cb6fdd no message 2018-06-28 12:33:43 +03:00
Ioannis Kalyvas b0ccac191f no message 2018-03-06 17:33:55 +02:00
Ioannis Kalyvas 3b1f37ef22 no message 2018-03-06 17:27:24 +02:00
Ioannis Kalyvas b8e040ee94 Merge branch 'master' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot
# Conflicts:
#	dmp-backend/src/main/java/eu/eudat/helpers/Transformers.java
2018-03-06 17:21:46 +02:00
Ioannis Kalyvas 50444a0b73 Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot
# Conflicts:
#	dmp-backend/src/main/java/eu/eudat/helpers/Transformers.java
#	dmp-frontend/src/index.html
2018-03-06 17:02:13 +02:00
Diamantis Tziotzios 85bdb7fad1 Merge branch 'Development'
# Conflicts:
#	dmp-backend/src/main/java/eu/eudat/helpers/Transformers.java
2018-02-12 10:23:41 +02:00
annabakouli b2e49fbb8a no message 2018-01-18 12:55:35 +02:00
Diamantis Tziotzios bfc6b63067 Merge branch 'Development'
# Conflicts:
#	dmp-backend/src/main/java/rest/entities/DMPs.java
#	dmp-backend/src/main/java/rest/entities/DataRepositories.java
#	dmp-backend/src/main/java/rest/entities/DatasetProfiles.java
#	dmp-backend/src/main/java/rest/entities/Datasets.java
#	dmp-backend/src/main/java/rest/entities/DmpProfiles.java
#	dmp-backend/src/main/java/rest/entities/Organisations.java
#	dmp-backend/src/main/java/rest/entities/Projects.java
#	dmp-backend/src/main/java/rest/entities/Registries.java
#	dmp-backend/src/main/java/rest/entities/Researchers.java
#	dmp-backend/src/main/java/rest/entities/Services.java
#	dmp-backend/src/main/java/rest/entities/Users.java
#	dmp-frontend/src/app/app.component.ts
#	dmp-frontend/src/app/login/googgle-sign-in/googgle-sign-in.component.ts
#	dmp-frontend/src/assets/custom.js
#	dmp-frontend/src/index.html
2018-01-18 12:45:51 +02:00
Nikolaos Laskaris 9941c96dc2 Minor edits 2017-11-27 16:08:13 +02:00
Nikolaos Laskaris 06272c79da -- 2017-11-23 17:34:35 +02:00
Nikolaos Laskaris a00eec68d8 fixed glitches of google-sign-in component 2017-11-23 13:13:20 +02:00
6162 changed files with 256307 additions and 427691 deletions

5
.env Normal file
View File

@ -0,0 +1,5 @@
PROFILE=docker
# Version of Elastic products
ELK_VERSION=7.17.4
STACK_VERSION=7.17.4

65
.gitignore vendored
View File

@ -1,32 +1,32 @@
dmp-frontend/dist.7z
.idea/
*.iml
backend/src/main/ui-resources/static/vendor.bundle.js.map
backend/src/main/ui-resources/static/vendor.bundle.js
backend/src/main/ui-resources/static/unauthorized.module.chunk.js.map
backend/src/main/ui-resources/static/unauthorized.module.chunk.js
backend/src/main/ui-resources/static/styles.bundle.js.map
backend/src/main/ui-resources/static/styles.bundle.js
backend/src/main/ui-resources/static/polyfills.bundle.js.map
backend/src/main/ui-resources/static/polyfills.bundle.js
backend/src/main/ui-resources/static/main.bundle.js.map
backend/src/main/ui-resources/static/main.bundle.js
backend/src/main/ui-resources/static/lang/en.json
backend/src/main/ui-resources/static/inline.bundle.js.map
backend/src/main/ui-resources/static/inline.bundle.js
backend/src/main/ui-resources/static/index.html
backend/src/main/ui-resources/static/favicon.ico
backend/src/main/ui-resources/static/assets/lang/en.json
dmp-backend/src/main/ui-resources/static/vendor.bundle.js.map
dmp-backend/src/main/ui-resources/static/vendor.bundle.js
dmp-backend/src/main/ui-resources/static/unauthorized.module.chunk.js.map
dmp-backend/src/main/ui-resources/static/unauthorized.module.chunk.js
dmp-backend/src/main/ui-resources/static/styles.bundle.js.map
dmp-backend/src/main/ui-resources/static/styles.bundle.js
dmp-backend/src/main/ui-resources/static/polyfills.bundle.js.map
dmp-backend/src/main/ui-resources/static/polyfills.bundle.js
dmp-backend/src/main/ui-resources/static/main.bundle.js.map
dmp-backend/src/main/ui-resources/static/main.bundle.js
dmp-backend/src/main/ui-resources/static/lang/en.json
dmp-backend/src/main/ui-resources/static/inline.bundle.js.map
dmp-backend/src/main/ui-resources/static/inline.bundle.js
dmp-backend/src/main/ui-resources/static/index.html
dmp-backend/src/main/ui-resources/static/favicon.ico
dmp-backend/src/main/ui-resources/static/assets/lang/en.json
dmp-frontend/new 3.xml
backend/src/main/ui-resources/static/
backend/web/target/
dmp-backend/src/main/ui-resources/static/
dmp-backend/web/target/
*.class
backend/web/src/main/ui-resources/static/
backend/data/target/data-1.0-SNAPSHOT.jar
backend/data/target/
backend/queryable/target/
backend/elastic/target/
backend/queryengine/target/
dmp-backend/web/src/main/ui-resources/static/
dmp-backend/data/target/data-1.0-SNAPSHOT.jar
dmp-backend/data/target/
dmp-backend/queryable/target/
dmp-backend/elastic/target/
dmp-backend/queryengine/target/
*.tar
*.gz
final/
@ -38,7 +38,7 @@ dmp-frontend/.vscode/
dmp-frontend/package-lock.json
backend/logging/target/
dmp-backend/logging/target/
ELK.Docker/shared/data-elk/
# Eclipse
@ -46,15 +46,6 @@ ELK.Docker/shared/data-elk/
.settings/
bin/
*.classpath
.run
openDMP/backend/uploads/
openDMP/backend/tmp/
logs/
backend/web/src/main/resources/certificates/
/storage/
backend/target/classes/
backend/core/target/maven-archiver/
backend/node_modules/.yarn-integrity
dmp-frontend/.nx/
notification-service/notification-web/src/main/resources/config/app.env
backend/web/src/main/resources/config/app.env
openDMP/dmp-backend/uploads/
openDMP/dmp-backend/tmp/
dmp-frontend/.angular/

3
ELK.Docker/.env Normal file
View File

@ -0,0 +1,3 @@
ELK_VERSION=7.6.0
# Leave blank to use the "basic" image flavours, which include X-Pack.
# see https://www.elastic.co/subscriptions

2
ELK.Docker/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf

21
ELK.Docker/LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Anthony Lapenna
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.

4
ELK.Docker/README.md Normal file
View File

@ -0,0 +1,4 @@
Init default users and retrieve passwords
1) connect to elasticsearch container with docker exec -it elastichsearch /bin/bash
2) run ./bin/elasticsearch-setup-passwords auto >./data/passwords.txt (press y and enter when the console shows nothing)

View File

@ -0,0 +1,87 @@
version: '2.4'
services:
elasticsearch:
user: 1002:1002 #develuser
restart: unless-stopped
mem_limit: 2048m
environment:
- cluster.name=open-dmp-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xmx1024m -Xms1024m"
- xpack.license.self_generated.type=basic
- xpack.monitoring.collection.enabled=true
- xpack.security.enabled=true
ulimits:
nproc: 65535
memlock:
soft: -1
hard: -1
volumes:
- ./shared/config-elk/elasticsearch/config/log4j2.properties:/usr/share/elasticsearch/config/log4j2.properties:ro
- ./shared/config-elk/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
- ./shared/data-elk/elasticsearch-01-data:/usr/share/elasticsearch/data
- ./shared/data-elk/elasticsearch-01-log:/usr/share/elasticsearch/logs
#ports:
# - 51056:9200
# - 51057:9300
ports:
- "9200:9200"
expose:
- "9300"
networks:
open-dmp-elk-network:
logstash:
# user: 1002:1002 #develuser
volumes:
- ./shared/config-elk/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
- ./shared/config-elk/logstash/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro
- ./shared/config-elk/logstash/config/log4j2.properties:/usr/share/logstash/config/log4j2.properties:ro
- ./shared/config-elk/logstash/pipeline:/usr/share/logstash/pipeline:ro
- ./shared/config-elk/logstash/logstash/templates:/usr/share/logstash/templates
- ./shared/data-elk/logstash-log:/usr/share/logstash/logs
- ./shared/data-elk/logstash-queue:/usr/share/logstash/queue
- ./shared/data-elk/logstash-dead_letter_queue:/usr/share/logstash/dead_letter_queue
expose:
- "31311"
- "31312"
restart: on-failure
mem_limit: 2048m
environment:
- LS_JAVA_OPTS=-Xmx1024m -Xms1024m
- xpack.license.self_generated.type=basic
- xpack.security.enabled=true
networks:
open-dmp-elk-network:
kibana:
# user: 1002:1002 #develuser
mem_limit: 512m
environment:
- xpack.license.self_generated.type=basic
- xpack.security.enabled=true
volumes:
- ./shared/config-elk/kibana/config:/usr/share/kibana/config:ro
#- ./shared/config-elk/kibana/certificates:/usr/share/kibana/certificates
restart: unless-stopped
ports:
- "51058:5601"
networks:
- open-dmp-elk-network
filebeat:
restart: unless-stopped
mem_limit: 256m
#command: [ "-e=false" ] # to overwrite the -e that disables logging to file!
volumes:
- ./shared/config-elk/filebeat/config/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
- ~/openDMP/logs:/usr/share/filebeat/log_data/dmp/
- ./shared/data-elk/filebeat-log:/usr/share/filebeat/logs
- ./shared/data-elk/filebeat-data:/usr/share/filebeat/data #For windows if we mount the data directory we get "Writing of registry returned error: sync /usr/share/filebeat/data/registry/filebeat: invalid argument."
networks:
- open-dmp-elk-network
networks:
open-dmp-elk-network:

View File

@ -0,0 +1,43 @@
version: '2.4'
services:
elasticsearch:
image: ${DOCKER_REGISTRY}elasticsearch
container_name: elasticsearch
build:
context: elasticsearch/
args:
ELK_VERSION: $ELK_VERSION
healthcheck:
# test: curl --cacert /usr/share/elasticsearch/config/certificates/ca/ca.crt -s https://localhost:9200 >/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi
interval: 30s
timeout: 10s
retries: 5
logstash:
image: ${DOCKER_REGISTRY}logstash
container_name: logstash
build:
context: logstash/
args:
ELK_VERSION: $ELK_VERSION
depends_on:
- elasticsearch
kibana:
image: ${DOCKER_REGISTRY}kibana
build:
context: kibana/
args:
ELK_VERSION: $ELK_VERSION
depends_on:
- elasticsearch
filebeat:
image: ${DOCKER_REGISTRY}filebeat
build:
context: filebeat/
args:
ELK_VERSION: $ELK_VERSION
depends_on:
- logstash

View File

@ -0,0 +1,22 @@
ARG ELK_VERSION
# https://github.com/elastic/elasticsearch-docker
FROM docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu && \
/usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-phonetic
RUN groupmod -g 1002 elasticsearch
RUN usermod -u 1002 -g 1002 elasticsearch
RUN chown -R elasticsearch /usr/share/elasticsearch
RUN sed -i -e 's/--userspec=1000/--userspec=1002/g' \
-e 's/UID 1000/UID 1002/' \
-e 's/chown -R 1000/chown -R 1002/' /usr/local/bin/docker-entrypoint.sh
RUN chown elasticsearch /usr/local/bin/docker-entrypoint.sh
ENV JAVA_HOME /usr/share/elasticsearch/jdk
# RUN mkdir /usr/share/elasticsearch/custom-plugins
# COPY plugins/elasticsearch-analysis-greeklish-7.5.1.zip /usr/share/elasticsearch/custom-plugins/elasticsearch-analysis-greeklish-7.5.1.zip
# RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install file:///usr/share/elasticsearch/custom-plugins/elasticsearch-analysis-greeklish-7.5.1.zip

View File

@ -0,0 +1,15 @@
ARG ELK_VERSION
FROM docker.elastic.co/beats/filebeat:${ELK_VERSION}
# USER root
# RUN groupmod -g 1002 filebeat
# RUN usermod -u 1002 -g 1002 filebeat
# RUN chown -R filebeat /usr/share/filebeat
# RUN sed -i -e 's/--userspec=1000/--userspec=1002/g' \
# -e 's/UID 1000/UID 1002/' \
# -e 's/chown -R 1000/chown -R 1002/' /usr/local/bin/docker-entrypoint
# RUN chown filebeat /usr/local/bin/docker-entrypoint
# USER 1002:1002

View File

@ -0,0 +1,15 @@
ARG ELK_VERSION
# https://github.com/elastic/kibana-docker
FROM docker.elastic.co/kibana/kibana:${ELK_VERSION}
# USER root
# RUN groupmod -g 1002 kibana
# RUN usermod -g 1002 root
# RUN usermod -u 1002 -g 1002 kibana
# RUN chown -R kibana /usr/share/kibana
# USER 1002:1002
# Add your kibana plugins setup here
# Example: RUN kibana-plugin install <name|url>

View File

@ -0,0 +1,20 @@
ARG ELK_VERSION
# https://github.com/elastic/logstash-docker
FROM docker.elastic.co/logstash/logstash:${ELK_VERSION}
# USER root
# RUN groupmod -g 1002 logstash
# RUN usermod -u 1002 -g 1002 logstash
# RUN chown -R logstash /usr/share/logstash
# RUN sed -i -e 's/--userspec=1000/--userspec=1002/g' \
# -e 's/UID 1000/UID 1002/' \
# -e 's/chown -R 1000/chown -R 1002/' /usr/local/bin/docker-entrypoint
# RUN chown logstash /usr/local/bin/docker-entrypoint
# USER 1002:1002
# Add your logstash plugins setup here
# Example: RUN logstash-plugin install logstash-filter-json
RUN logstash-plugin update logstash-input-beats
RUN logstash-plugin update logstash-filter-grok

3
ELK.Docker/old/.env Normal file
View File

@ -0,0 +1,3 @@
TAG=6.3.1
ELASTIC_VERSION=6.3.1
ELASTIC_PASSWORD=changeme

1
ELK.Docker/old/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
**/*~

View File

@ -0,0 +1,7 @@
---
language: python
python: ['3.5']
script: make
sudo: required
services: ['docker']

201
ELK.Docker/old/LICENSE Normal file
View File

@ -0,0 +1,201 @@
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.

30
ELK.Docker/old/Makefile Normal file
View File

@ -0,0 +1,30 @@
SHELL=/bin/bash
ifndef ELASTIC_VERSION
ELASTIC_VERSION := $(shell awk 'BEGIN { FS = "[= ]" } /^ELASTIC_VERSION=/ { print $$2 }' .env)
endif
export ELASTIC_VERSION
ifndef GIT_BRANCH
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
endif
TARGETS := apm-server elasticsearch logstash kibana beats
images: $(TARGETS)
push: $(TARGETS:%=%-push)
clean: $(TARGETS:%=%-clean)
$(TARGETS): $(TARGETS:%=%-checkout)
(cd stack/$@ && make)
$(TARGETS:%=%-push): $(TARGETS:%=%-checkout)
(cd stack/$(@:%-push=%) && make push)
$(TARGETS:%=%-checkout):
test -d stack/$(@:%-checkout=%) || \
git clone https://github.com/elastic/$(@:%-checkout=%)-docker.git stack/$(@:%-checkout=%)
(cd stack/$(@:%-checkout=%) && git fetch && git reset --hard && git checkout origin/$(GIT_BRANCH))
$(TARGETS:%=%-clean):
rm -rf stack/$(@:%-clean=%)

25
ELK.Docker/old/README.md Normal file
View File

@ -0,0 +1,25 @@
# stack-docker
This example Docker Compose configuration demonstrates many components of the
Elastic Stack, all running on a single machine under Docker.
## Prerequisites
- Docker and Compose. Windows and Mac users get Compose installed automatically
with Docker. Linux users can:
```
pip install docker-compose
```
- At least 4GiB of RAM for the containers. Windows and Mac users _must_
configure their Docker virtual machine to have more than the default 2 GiB of
RAM:
![Docker VM memory settings](screenshots/docker-vm-memory-settings.png)
## Starting the stack
Try `docker-compose up` to create a demonstration Elastic Stack with
Elasticsearch, Kibana, Logstash, Auditbeat, Metricbeat, Filebeat, Packetbeat,
and Heartbeat.
Point a browser at [`http://localhost:5601`](http://localhost:5601) to see the results.
Log in with `elastic` / `changeme`.

View File

@ -0,0 +1,28 @@
input {
http {
port => 31311 # default: 8080
}
}
filter {
grok{
match => { "message" => "%{GREEDYDATA:request}"}
}
json{
source => "request"
target => "parsed"
}
split{
field=>"entries"
}
}
output {
elasticsearch {
hosts => [ 'elasticsearch' ]
user => 'elastic'
password => 'changeme'
index => "data-management-plan-%{[entries][indexType]}-%{+YYYY.MM.dd}"
}
}

View File

@ -0,0 +1,171 @@
---
version: '3'
services:
# The environment variable "TAG" is used throughout this file to
# specify the version of the images to run. The default is set in the
# '.env' file in this folder. It can be overridden with any normal
# technique for setting environment variables, for example:
#
# TAG=6.0.0-beta1 docker-compose up
#
# REF: https://docs.docker.com/compose/compose-file/#variable-substitution
#
# Also be sure to set the ELASTIC_VERSION variable. For released versions,
# ${TAG} and ${ELASTIC_VERSION} will be identical, but for pre-release
# versions, ${TAG} might contain an extra build identifier, like
# "6.0.0-beta1-3eab5b40", so a full invocation might look like:
#
# ELASTIC_VERSION=6.0.0-beta1 TAG=6.0.0-beta1-3eab5b40 docker-compose up
#
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}
container_name: elasticsearch
#volumes:
# - esdata:/usr/share/elasticsearch/data
environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1', 'ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
ports: ['0.0.0.0:9200:9200']
networks: ['stack']
kibana:
image: docker.elastic.co/kibana/kibana:${TAG}
container_name: kibana
ports: ['0.0.0.0:5601:5601']
networks: ['stack']
depends_on: ['elasticsearch']
logstash:
image: docker.elastic.co/logstash/logstash:${TAG}
container_name: logstash
# Provide a simple pipeline configuration for Logstash with a bind-mounted file.
volumes:
- ./config/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
ports: ['0.0.0.0:31311:31311']
networks: ['stack']
depends_on: ['elasticsearch', 'setup_logstash']
filebeat:
image: docker.elastic.co/beats/filebeat:${TAG}
container_name: filebeat
command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
# If the host system has logs at "/var/log", mount them at "/mnt/log"
# inside the container, where Filebeat can find them.
# volumes: ['/var/log:/mnt/log:ro']
networks: ['stack']
depends_on: ['elasticsearch', 'setup_filebeat']
heartbeat:
image: docker.elastic.co/beats/heartbeat:${TAG}
container_name: heartbeat
command: -e -E 'output.elasticsearch.password=${ELASTIC_PASSWORD}'
networks: ['stack']
depends_on: ['elasticsearch', 'setup_heartbeat']
# Run a short-lived container to set up Logstash.
setup_logstash:
image: centos:7
container_name: setup_logstash
volumes: ['./scripts/setup-logstash.sh:/usr/local/bin/setup-logstash.sh:ro']
# The script may have CR/LF line endings if using Docker for Windows, so
# make sure that they don't confuse Bash.
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-logstash.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['elasticsearch']
setup_kibana:
image: centos:7
container_name: setup_kibana
volumes: ['./scripts/setup-kibana.sh:/usr/local/bin/setup-kibana.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-kibana.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['elasticsearch']
setup_filebeat:
image: docker.elastic.co/beats/filebeat:${TAG}
container_name: setup_filebeat
volumes: ['./scripts/setup-beat.sh:/usr/local/bin/setup-beat.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-beat.sh | tr -d "\r" | bash -s filebeat']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['kibana']
setup_heartbeat:
image: docker.elastic.co/beats/heartbeat:${TAG}
container_name: setup_heartbeat
volumes: ['./scripts/setup-beat.sh:/usr/local/bin/setup-beat.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-beat.sh | tr -d "\r" | bash -s heartbeat']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
networks: ['stack']
depends_on: ['kibana']
##########################DOCSBOX######################################################################
# web:
# restart: always
# build: ./docsbox-master/docsbox
# expose:
# - "8000"
# links:
# - redis:redis
# volumes:
# - docsbox:/home/docsbox
# - media:/home/docsbox/media
# command: gunicorn -b :8000 docsbox:app
# networks: ['stack']
#
# rqworker:
# restart: always
# build: ./docsbox-master/docsbox
# links:
# - redis:redis
# volumes:
# - web
# command: rq worker -c docsbox.settings
# networks: ['stack']
#
# rqscheduler:
# restart: always
# build: ./docsbox-master/docsbox
# links:
# - redis:redis
# volumes:
# - web
# command: rqscheduler -H redis -p 6379 -d 0
# networks: ['stack']
#
# nginx:
# restart: always
# build: ./docsbox-master/nginx/
# ports:
# - "81:80"
# volumes:
# - web
# links:
# - web:web
# networks: ['stack']
#
# redis:
# restart: always
# image: redis:latest
# expose:
# - "6379"
# volumes:
# - redisdata:/data
# networks: ['stack']
##########################SETTIGNS######################################################################
volumes:
#esdata:
#driver: local
redisdata:
driver: local
docsbox:
driver: local
media:
driver: local
networks: {stack: {}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail
beat=$1
until curl -s http://kibana:5601; do
sleep 2
done
sleep 5
# Load the sample dashboards for the Beat.
# REF: https://www.elastic.co/guide/en/beats/metricbeat/master/metricbeat-sample-dashboards.html
${beat} setup \
-E setup.kibana.host=kibana \
-E setup.kibana.username=elastic \
-E setup.kibana.password=${ELASTIC_PASSWORD} \
-E output.elasticsearch.password=${ELASTIC_PASSWORD}

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
es_url=http://elastic:${ELASTIC_PASSWORD}@elasticsearch:9200
# Wait for Elasticsearch to start up before doing anything.
until curl -s $es_url -o /dev/null; do
sleep 1
done

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
es_url=http://elastic:${ELASTIC_PASSWORD}@elasticsearch:9200
# Wait for Elasticsearch to start up before doing anything.
until curl -s $es_url -o /dev/null; do
sleep 1
done

2
ELK.Docker/old/stack/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!/.gitignore

View File

@ -0,0 +1,20 @@
---
## Default Elasticsearch configuration from elasticsearch-docker.
## from https://github.com/elastic/elasticsearch-docker/blob/master/build/elasticsearch/elasticsearch.yml
#
network.host: 0.0.0.0
# minimum_master_nodes need to be explicitly set when bound on a public IP
# set to 1 to allow single node clusters
# Details: https://github.com/elastic/elasticsearch/pull/17288
# discovery.zen.minimum_master_nodes: 1
## Use single node discovery in order to disable production mode and avoid bootstrap checks
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
#
discovery.type: single-node
## Search Guard
#
cluster.routing.allocation.disk.watermark.flood_stage: 99%

View File

@ -0,0 +1,179 @@
#https://github.com/elastic/elasticsearch/blob/7.4/distribution/src/config/log4j2.properties
status = error
# log action execution errors for easier debugging
logger.action.name = org.elasticsearch.action
logger.action.level = debug
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
######## Server JSON ############################
appender.rolling.type = RollingFile
appender.rolling.name = rolling
appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_server.json
appender.rolling.layout.type = ESJsonLayout
appender.rolling.layout.type_name = server
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.json.gz
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size = 128MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.fileIndex = nomax
appender.rolling.strategy.action.type = Delete
appender.rolling.strategy.action.basepath = ${sys:es.logs.base_path}
appender.rolling.strategy.action.condition.type = IfFileName
appender.rolling.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-*
appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize
appender.rolling.strategy.action.condition.nested_condition.exceeds = 2GB
################################################
######## Server - old style pattern ###########
appender.rolling_old.type = RollingFile
appender.rolling_old.name = rolling_old
appender.rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}.log
appender.rolling_old.layout.type = PatternLayout
appender.rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
appender.rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.log.gz
appender.rolling_old.policies.type = Policies
appender.rolling_old.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling_old.policies.time.interval = 1
appender.rolling_old.policies.time.modulate = true
appender.rolling_old.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling_old.policies.size.size = 128MB
appender.rolling_old.strategy.type = DefaultRolloverStrategy
appender.rolling_old.strategy.fileIndex = nomax
appender.rolling_old.strategy.action.type = Delete
appender.rolling_old.strategy.action.basepath = ${sys:es.logs.base_path}
appender.rolling_old.strategy.action.condition.type = IfFileName
appender.rolling_old.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-*
appender.rolling_old.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize
appender.rolling_old.strategy.action.condition.nested_condition.exceeds = 2GB
################################################
rootLogger.level = info
rootLogger.appenderRef.console.ref = console
rootLogger.appenderRef.rolling.ref = rolling
rootLogger.appenderRef.rolling_old.ref = rolling_old
######## Deprecation JSON #######################
appender.deprecation_rolling.type = RollingFile
appender.deprecation_rolling.name = deprecation_rolling
appender.deprecation_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.json
appender.deprecation_rolling.layout.type = ESJsonLayout
appender.deprecation_rolling.layout.type_name = deprecation
appender.deprecation_rolling.layout.esmessagefields=x-opaque-id
appender.deprecation_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation-%i.json.gz
appender.deprecation_rolling.policies.type = Policies
appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.deprecation_rolling.policies.size.size = 1GB
appender.deprecation_rolling.strategy.type = DefaultRolloverStrategy
appender.deprecation_rolling.strategy.max = 4
#################################################
######## Deprecation - old style pattern #######
appender.deprecation_rolling_old.type = RollingFile
appender.deprecation_rolling_old.name = deprecation_rolling_old
appender.deprecation_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.log
appender.deprecation_rolling_old.layout.type = PatternLayout
appender.deprecation_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
appender.deprecation_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
_deprecation-%i.log.gz
appender.deprecation_rolling_old.policies.type = Policies
appender.deprecation_rolling_old.policies.size.type = SizeBasedTriggeringPolicy
appender.deprecation_rolling_old.policies.size.size = 1GB
appender.deprecation_rolling_old.strategy.type = DefaultRolloverStrategy
appender.deprecation_rolling_old.strategy.max = 4
#################################################
logger.deprecation.name = org.elasticsearch.deprecation
logger.deprecation.level = warn
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
logger.deprecation.appenderRef.deprecation_rolling_old.ref = deprecation_rolling_old
logger.deprecation.additivity = false
######## Search slowlog JSON ####################
appender.index_search_slowlog_rolling.type = RollingFile
appender.index_search_slowlog_rolling.name = index_search_slowlog_rolling
appender.index_search_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs\
.cluster_name}_index_search_slowlog.json
appender.index_search_slowlog_rolling.layout.type = ESJsonLayout
appender.index_search_slowlog_rolling.layout.type_name = index_search_slowlog
appender.index_search_slowlog_rolling.layout.esmessagefields=message,took,took_millis,total_hits,types,stats,search_type,total_shards,source,id
appender.index_search_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs\
.cluster_name}_index_search_slowlog-%i.json.gz
appender.index_search_slowlog_rolling.policies.type = Policies
appender.index_search_slowlog_rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.index_search_slowlog_rolling.policies.size.size = 1GB
appender.index_search_slowlog_rolling.strategy.type = DefaultRolloverStrategy
appender.index_search_slowlog_rolling.strategy.max = 4
#################################################
######## Search slowlog - old style pattern ####
appender.index_search_slowlog_rolling_old.type = RollingFile
appender.index_search_slowlog_rolling_old.name = index_search_slowlog_rolling_old
appender.index_search_slowlog_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
_index_search_slowlog.log
appender.index_search_slowlog_rolling_old.layout.type = PatternLayout
appender.index_search_slowlog_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
appender.index_search_slowlog_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
_index_search_slowlog-%i.log.gz
appender.index_search_slowlog_rolling_old.policies.type = Policies
appender.index_search_slowlog_rolling_old.policies.size.type = SizeBasedTriggeringPolicy
appender.index_search_slowlog_rolling_old.policies.size.size = 1GB
appender.index_search_slowlog_rolling_old.strategy.type = DefaultRolloverStrategy
appender.index_search_slowlog_rolling_old.strategy.max = 4
#################################################
logger.index_search_slowlog_rolling.name = index.search.slowlog
logger.index_search_slowlog_rolling.level = trace
logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling.ref = index_search_slowlog_rolling
logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling_old.ref = index_search_slowlog_rolling_old
logger.index_search_slowlog_rolling.additivity = false
######## Indexing slowlog JSON ##################
appender.index_indexing_slowlog_rolling.type = RollingFile
appender.index_indexing_slowlog_rolling.name = index_indexing_slowlog_rolling
appender.index_indexing_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
_index_indexing_slowlog.json
appender.index_indexing_slowlog_rolling.layout.type = ESJsonLayout
appender.index_indexing_slowlog_rolling.layout.type_name = index_indexing_slowlog
appender.index_indexing_slowlog_rolling.layout.esmessagefields=message,took,took_millis,doc_type,id,routing,source
appender.index_indexing_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
_index_indexing_slowlog-%i.json.gz
appender.index_indexing_slowlog_rolling.policies.type = Policies
appender.index_indexing_slowlog_rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.index_indexing_slowlog_rolling.policies.size.size = 1GB
appender.index_indexing_slowlog_rolling.strategy.type = DefaultRolloverStrategy
appender.index_indexing_slowlog_rolling.strategy.max = 4
#################################################
######## Indexing slowlog - old style pattern ##
appender.index_indexing_slowlog_rolling_old.type = RollingFile
appender.index_indexing_slowlog_rolling_old.name = index_indexing_slowlog_rolling_old
appender.index_indexing_slowlog_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
_index_indexing_slowlog.log
appender.index_indexing_slowlog_rolling_old.layout.type = PatternLayout
appender.index_indexing_slowlog_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
appender.index_indexing_slowlog_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
_index_indexing_slowlog-%i.log.gz
appender.index_indexing_slowlog_rolling_old.policies.type = Policies
appender.index_indexing_slowlog_rolling_old.policies.size.type = SizeBasedTriggeringPolicy
appender.index_indexing_slowlog_rolling_old.policies.size.size = 1GB
appender.index_indexing_slowlog_rolling_old.strategy.type = DefaultRolloverStrategy
appender.index_indexing_slowlog_rolling_old.strategy.max = 4
#################################################
logger.index_indexing_slowlog.name = index.indexing.slowlog.index
logger.index_indexing_slowlog.level = trace
logger.index_indexing_slowlog.appenderRef.index_indexing_slowlog_rolling.ref = index_indexing_slowlog_rolling
logger.index_indexing_slowlog.appenderRef.index_indexing_slowlog_rolling_old.ref = index_indexing_slowlog_rolling_old
logger.index_indexing_slowlog.additivity = false

View File

@ -0,0 +1,16 @@
#filebeat.registry_file: /usr/share/filebeat/registry
filebeat.inputs:
- type: log
paths:
- /usr/share/filebeat/log_data/dmp/openDMP*.log
tags: ["audit"]
enabled: true
reload.enabled: true
reload.period: 10s
multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
multiline.negate: true
multiline.match: after
output.logstash:
hosts: ["logstash:31312"]
bulk_max_size: 128

View File

@ -0,0 +1,17 @@
---
## Default Kibana configuration from kibana-docker.
## from https://github.com/elastic/kibana-docker/blob/master/build/kibana/config/kibana.yml
#
server.name: kibana
server.host: "0"
## Custom configuration
#
#server.basePath: "/eformslogs"
elasticsearch.hosts: [ "http://elasticsearch:9200" ]
#elasticsearch.ssl.certificateAuthorities: [ "/usr/share/kibana/certificate_authorities/ca.crt" ]
elasticsearch.username: "kibana"
elasticsearch.password: ""
server.ssl.enabled: false
#server.ssl.key: "/usr/share/kibana/certificates/kibana.key"
#server.ssl.certificate: "/usr/share/kibana/certificates/kibana.crt"

View File

@ -0,0 +1,103 @@
#https://github.com/elastic/logstash/blob/7.4/config/log4j2.properties
status = error
name = LogstashPropertiesConfig
appender.console.type = Console
appender.console.name = plain_console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c]%notEmpty{[%X{pipeline.id}]} %m%n
appender.json_console.type = Console
appender.json_console.name = json_console
appender.json_console.layout.type = JSONLayout
appender.json_console.layout.compact = true
appender.json_console.layout.eventEol = true
appender.rolling.type = RollingFile
appender.rolling.name = plain_rolling
appender.rolling.fileName = ${sys:ls.logs}/logstash-${sys:ls.log.format}.log
appender.rolling.filePattern = ${sys:ls.logs}/logstash-${sys:ls.log.format}-%d{yyyy-MM-dd}-%i.log.gz
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c]%notEmpty{[%X{pipeline.id}]} %m%n
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size = 100MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 30
appender.json_rolling.type = RollingFile
appender.json_rolling.name = json_rolling
appender.json_rolling.fileName = ${sys:ls.logs}/logstash-${sys:ls.log.format}.log
appender.json_rolling.filePattern = ${sys:ls.logs}/logstash-${sys:ls.log.format}-%d{yyyy-MM-dd}-%i.log.gz
appender.json_rolling.policies.type = Policies
appender.json_rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.json_rolling.policies.time.interval = 1
appender.json_rolling.policies.time.modulate = true
appender.json_rolling.layout.type = JSONLayout
appender.json_rolling.layout.compact = true
appender.json_rolling.layout.eventEol = true
appender.json_rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.json_rolling.policies.size.size = 100MB
appender.json_rolling.strategy.type = DefaultRolloverStrategy
appender.json_rolling.strategy.max = 30
rootLogger.level = ${sys:ls.log.level}
rootLogger.appenderRef.console.ref = ${sys:ls.log.format}_console
rootLogger.appenderRef.rolling.ref = ${sys:ls.log.format}_rolling
# Slowlog
appender.console_slowlog.type = Console
appender.console_slowlog.name = plain_console_slowlog
appender.console_slowlog.layout.type = PatternLayout
appender.console_slowlog.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %m%n
appender.json_console_slowlog.type = Console
appender.json_console_slowlog.name = json_console_slowlog
appender.json_console_slowlog.layout.type = JSONLayout
appender.json_console_slowlog.layout.compact = true
appender.json_console_slowlog.layout.eventEol = true
appender.rolling_slowlog.type = RollingFile
appender.rolling_slowlog.name = plain_rolling_slowlog
appender.rolling_slowlog.fileName = ${sys:ls.logs}/logstash-slowlog-${sys:ls.log.format}.log
appender.rolling_slowlog.filePattern = ${sys:ls.logs}/logstash-slowlog-${sys:ls.log.format}-%d{yyyy-MM-dd}-%i.log.gz
appender.rolling_slowlog.policies.type = Policies
appender.rolling_slowlog.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling_slowlog.policies.time.interval = 1
appender.rolling_slowlog.policies.time.modulate = true
appender.rolling_slowlog.layout.type = PatternLayout
appender.rolling_slowlog.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %m%n
appender.rolling_slowlog.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling_slowlog.policies.size.size = 100MB
appender.rolling_slowlog.strategy.type = DefaultRolloverStrategy
appender.rolling_slowlog.strategy.max = 30
appender.json_rolling_slowlog.type = RollingFile
appender.json_rolling_slowlog.name = json_rolling_slowlog
appender.json_rolling_slowlog.fileName = ${sys:ls.logs}/logstash-slowlog-${sys:ls.log.format}.log
appender.json_rolling_slowlog.filePattern = ${sys:ls.logs}/logstash-slowlog-${sys:ls.log.format}-%d{yyyy-MM-dd}-%i.log.gz
appender.json_rolling_slowlog.policies.type = Policies
appender.json_rolling_slowlog.policies.time.type = TimeBasedTriggeringPolicy
appender.json_rolling_slowlog.policies.time.interval = 1
appender.json_rolling_slowlog.policies.time.modulate = true
appender.json_rolling_slowlog.layout.type = JSONLayout
appender.json_rolling_slowlog.layout.compact = true
appender.json_rolling_slowlog.layout.eventEol = true
appender.json_rolling_slowlog.policies.size.type = SizeBasedTriggeringPolicy
appender.json_rolling_slowlog.policies.size.size = 100MB
appender.json_rolling_slowlog.strategy.type = DefaultRolloverStrategy
appender.json_rolling_slowlog.strategy.max = 30
logger.slowlog.name = slowlog
logger.slowlog.level = trace
logger.slowlog.appenderRef.console_slowlog.ref = ${sys:ls.log.format}_console_slowlog
logger.slowlog.appenderRef.rolling_slowlog.ref = ${sys:ls.log.format}_rolling_slowlog
logger.slowlog.additivity = false
logger.licensereader.name = logstash.licensechecker.licensereader
logger.licensereader.level = error

View File

@ -0,0 +1,10 @@
---
## Default Logstash configuration from logstash-docker.
## from https://github.com/elastic/logstash-docker/blob/master/build/logstash/config/logstash-oss.yml
#
http.host: "0.0.0.0"
config.reload.automatic: true
config.reload.interval: 300s
path.queue: /usr/share/logstash/queue
path.dead_letter_queue: /usr/share/logstash/dead_letter_queue
xpack.monitoring.elasticsearch.password:

View File

@ -0,0 +1,18 @@
- pipeline.id: open_dmp_beats
queue.type: persisted
queue.max_bytes: 50mb
dead_letter_queue.enable: true
path.config: "/usr/share/logstash/pipeline/open_dmp_beats.conf"
queue.checkpoint.writes: 32
- pipeline.id: open_dmp_main
queue.type: persisted
queue.max_bytes: 50mb
dead_letter_queue.enable: true
path.config: "/usr/share/logstash/pipeline/open_dmp_main.conf"
queue.checkpoint.writes: 32
- pipeline.id: open_dmp_send_to_elastic
queue.type: persisted
queue.max_bytes: 50mb
dead_letter_queue.enable: true
path.config: "/usr/share/logstash/pipeline/open_dmp_send_to_elastic.conf"
queue.checkpoint.writes: 32

View File

@ -0,0 +1,14 @@
input {
beats {
port => 31312
ssl => false
client_inactivity_timeout => 3000
}
}
filter {
}
output {
pipeline { send_to => open_dmp_main }
}

View File

@ -0,0 +1,19 @@
input {
pipeline { address => open_dmp_main }
}
filter {
grok {
match => { "message" => "(?<timestamp>%{DATE} %{TIME})%{SPACE}%{LOGLEVEL:level} %{NUMBER:pid} --- \[%{DATA:thread}\] %{DATA:class}%{SPACE}: %{GREEDYDATA:logmessage}" }
}
if "_grokparsefailure" not in [tags] {
mutate
{
remove_field => [ "message" ]
}
}
}
output {
pipeline { send_to => open_dmp_send_to_elastic }
}

View File

@ -0,0 +1,19 @@
input {
pipeline { address => open_dmp_send_to_elastic }
}
filter {
}
output {
elasticsearch {
hosts => "elasticsearch:9200"
user => elastic
password =>
index =>"opendmp.logs"
#manage_template => true
#template => "/usr/share/logstash/templates/audit/openDMP.json"
#template_name => "cite.elas.openDMP-audit*"
#template_overwrite => true
}
}

66
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,66 @@
def pipelineContext = [:]
pipeline {
agent any
options {
skipDefaultCheckout(true)
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Build API') {
steps {
script {
pipelineContext.apiImage = docker.build("open-dmp-api:${env.BUILD_ID}", "-f dmp-backend/Dockerfile.CI dmp-backend/")
}
}
}
stage('Build WebApp') {
steps {
script {
pipelineContext.webappImage = docker.build("open-dmp-webapp:${env.BUILD_ID}", "-f dmp-frontend/Dockerfile.CI dmp-frontend/")
}
}
}
//stage('SonarQube analysis') {
// steps {
// script {
// def scannerHome = tool 'SonarQube Scanner 4.3';
// withSonarQubeEnv('SonarQube') { // If you have configured more than one global server connection, you can specify its name
// sh "${scannerHome}/bin/sonar-scanner"
// }
// }
// }
//}
//// waiting for sonar results based into the configured web hook in Sonar server which push the status back to jenkins
//stage('SonarQube scan result check') {
// steps {
// timeout(time: 2, unit: 'MINUTES') {
// retry(3) {
// script {
// def qg = waitForQualityGate()
// if (qg.status != 'OK') {
// error "Pipeline aborted due to quality gate failure: ${qg.status}"
// }
// }
// }
// }
// }
//}
stage('Pushing to Docker Registry') {
steps {
script {
docker.withRegistry('http://drepo.local.cite.gr', 'b2c651c1-9a3b-4a98-a6da-e1dd7a20f512') {
pipelineContext.apiImage.push()
pipelineContext.webappImage.push()
}
}
}
}
}
}

View File

@ -1,3 +1,9 @@
**Important note: The deployment, troubleshooting, maintenance and operation of on-premises / self-served OpenDMP instances for development, testing or production use, shall be the sole responsibility of the adopter. No support is guaranteed by OpenDMP implentation team for issues that may be encountered during deployment, extension or operation of such installations.**
**Documentation is provided on a best-effort basis for the code and processes around the development, deployment and operation of OpenDMP. If you find any misalignment of the actual processes with the related documentation, please let us know so that the misalignment is addressed for the benefit of future adopters.**
# Using Docker Compose with Argos
ARGOS is an open extensible service that simplifies the management, validation, monitoring and maintenance and of Data Management Plans. It allows actors (researchers, managers, supervisors etc) to create actionable DMPs that may be freely exchanged among infrastructures for carrying out specific aspects of the Data management process in accordance with the intentions and commitment of Data owners.

View File

@ -1,39 +0,0 @@
####################################### 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
ENV server_username=$MAVEN_ACCOUNT_USR
ENV server_password=$MAVEN_ACCOUNT_PSW
ARG CITE_MAVEN_REPO_URL
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/*-devel.yml
RUN rm -f /build/web/src/main/resources/logging/*.xml
WORKDIR /build/
#RUN mvn package -q
RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean
RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install
# Build project
RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package
######################################## Run Stage ########################################
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
ARG PROFILE
ARG REVISION
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
COPY --from=build-stage /build/web/target/web-${REVISION}.jar /app/app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROFILE}", "-Dspring.config.additional-location=file:/config/", "-jar", "/app/app.jar"]

View File

@ -1,29 +0,0 @@
####################################### Build stage #######################################
FROM maven:3.9-eclipse-temurin-21-alpine
ARG MAVEN_ACCOUNT_USR
ARG MAVEN_ACCOUNT_PSW
ARG REVISION
ARG PROFILE
ARG ORACLE_URL
ARG ORACLE_TOKEN
ENV server_username=$MAVEN_ACCOUNT_USR
ENV server_password=$MAVEN_ACCOUNT_PSW
ARG CITE_MAVEN_REPO_URL
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/*-devel.yml
RUN rm -f /build/web/src/main/resources/logging/*.xml
COPY oracle.local.cite.gr.crt $JAVA_HOME/conf/security
RUN cd "$JAVA_HOME"/conf/security && keytool -cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias oraclecert -file oracle.local.cite.gr.crt
WORKDIR /build/
RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean
RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install
RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package
RUN mvn sonar:sonar -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} -Dsonar.projectKey=OpenDMP:backend-api -Dsonar.login=${ORACLE_TOKEN} -Dsonar.host.url=${ORACLE_URL} -Dsonar.projectName='OpenDMP API'

View File

@ -1,114 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>core</artifactId>
<version>${revision}</version>
<parent>
<groupId>org.opencdmp</groupId>
<artifactId>opencdmp-backend</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties>
<java.version>21</java.version>
<maven.compiler.release>21</maven.compiler.release>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>1.0.0-SNAPSHOT</revision>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>gr.cite</groupId>
<artifactId>validation</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>gr.cite</groupId>
<artifactId>oidc-authz</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.opencdmp</groupId>
<artifactId>repositorydepositbase</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>org.opencdmp</groupId>
<artifactId>common-models</artifactId>
<version>0.0.19</version>
</dependency>
<dependency>
<groupId>gr.cite</groupId>
<artifactId>data-tools</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>org.opencdmp</groupId>
<artifactId>file-transformer-base</artifactId>
<version>0.0.24</version>
</dependency>
<dependency>
<groupId>gr.cite</groupId>
<artifactId>elastic</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>gr.cite</groupId>
<artifactId>queue-inbox</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>gr.cite</groupId>
<artifactId>queue-outbox</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>gr.cite</groupId>
<artifactId>oidc-authn</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>gr.cite</groupId>
<artifactId>keycloak-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,188 +0,0 @@
package org.opencdmp.audit;
import gr.cite.tools.logging.EventId;
public class AuditableAction {
public static final EventId DescriptionTemplateType_Query = new EventId(1000, "DescriptionTemplateType_Query");
public static final EventId DescriptionTemplateType_Lookup = new EventId(1001, "DescriptionTemplateType_Lookup");
public static final EventId DescriptionTemplateType_Persist = new EventId(1002, "DescriptionTemplateType_Persist");
public static final EventId DescriptionTemplateType_Delete = new EventId(1003, "DescriptionTemplateType_Delete");
public static final EventId EntityDoi_Query = new EventId(2000, "EntityDoi_Query");
public static final EventId EntityDoi_Lookup = new EventId(2001, "EntityDoi_Lookup");
public static final EventId EntityDoi_Persist = new EventId(2002, "EntityDoi_Persist");
public static final EventId EntityDoi_Delete = new EventId(2003, "EntityDoi_Delete");
public static final EventId PlanBlueprint_Query = new EventId(3000, "PlanBlueprint_Query");
public static final EventId PlanBlueprint_Lookup = new EventId(3001, "PlanBlueprint_Lookup");
public static final EventId PlanBlueprint_Persist = new EventId(3002, "PlanBlueprint_Persist");
public static final EventId PlanBlueprint_Delete = new EventId(3003, "PlanBlueprint_Delete");
public static final EventId PlanBlueprint_Clone = new EventId(3004, "PlanBlueprint_Clone");
public static final EventId PlanBlueprint_PersistNewVersion = new EventId(3005, "PlanBlueprint_PersistNewVersion");
public static final EventId PlanBlueprint_GetXml = new EventId(3006, "PlanBlueprint_GetXml");
public static final EventId PlanBlueprint_Import = new EventId(3007, "PlanBlueprint_Import");
public static final EventId User_Settings_Query = new EventId(4000, "User_Settings_Query");
public static final EventId User_Settings_Lookup = new EventId(4001, "User_Settings_Lookup");
public static final EventId User_Settings_Persist = new EventId(4002, "User_Settings_Persist");
public static final EventId User_Settings_Delete = new EventId(4003, "User_Settings_Delete");
public static final EventId Plan_Query = new EventId(5000, "Plan_Query");
public static final EventId Plan_Lookup = new EventId(5001, "Plan_Lookup");
public static final EventId Plan_Persist = new EventId(5002, "Plan_Persist");
public static final EventId Plan_Delete = new EventId(5003, "Plan_Delete");
public static final EventId Plan_Clone = new EventId(5004, "Plan_Clone");
public static final EventId Plan_PersistNewVersion = new EventId(5005, "Plan_PersistNewVersion");
public static final EventId Plan_Assign_Users = new EventId(5006, "Plan_Assign_Users");
public static final EventId Plan_RemoveUser = new EventId(5007, "Plan_RemoveUser");
public static final EventId Plan_Invite_Users = new EventId(5008, "Plan_Invite_Users");
public static final EventId Plan_Invite_Accept = new EventId(5009, "Plan_Invite_Accept");
public static final EventId Plan_PublicQuery = new EventId(5010, "Plan_PublicQuery");
public static final EventId Plan_Export = new EventId(5011, "Plan_Export");
public static final EventId Plan_PublicLookup = new EventId(5012, "Plan_PublicLookup");
public static final EventId Plan_Finalize = new EventId(5013, "Plan_Finalize");
public static final EventId Plan_Undo_Finalize = new EventId(5014, "Plan_Undo_Finalize");
public static final EventId Plan_Validate = new EventId(5015, "Plan_Validate");
public static final EventId Plan_GetXml = new EventId(5016, "Plan_GetXml");
public static final EventId Plan_Import = new EventId(5017, "Plan_Import");
public static final EventId Description_Query = new EventId(6000, "Description_Query");
public static final EventId Description_Lookup = new EventId(6001, "Description_Lookup");
public static final EventId Description_Persist = new EventId(6002, "Description_Persist");
public static final EventId Description_Delete = new EventId(6003, "Description_Delete");
public static final EventId Description_PublicQuery = new EventId(6004, "Description_PublicQuery");
public static final EventId Description_PublicLookup = new EventId(6005, "Description_PublicLookup");
public static final EventId Description_PersistStatus = new EventId(6006, "Description_PersistStatus");
public static final EventId Description_UploadFieldFiles = new EventId(6007, "Description_UploadFieldFiles");
public static final EventId Description_GetFieldFile = new EventId(6008, "Description_GetFieldFile");
public static final EventId Description_Validate = new EventId(6009, "Description_Validate");
public static final EventId Description_GetDescriptionSectionPermissions = new EventId(6010, "Description_GetDescriptionSectionPermissions");
public static final EventId Description_UpdateDescriptionTemplate = new EventId(6011, "Description_UpdateDescriptionTemplate");
public static final EventId Reference_Query = new EventId(7000, "Reference_Query");
public static final EventId Reference_Lookup = new EventId(7001, "Reference_Lookup");
public static final EventId Reference_Persist = new EventId(7002, "Reference_Persist");
public static final EventId Reference_Delete = new EventId(7003, "Reference_Delete");
public static final EventId Reference_Search = new EventId(7004, "Reference_Search");
public static final EventId DescriptionTemplate_Query = new EventId(8000, "DescriptionTemplate_Query");
public static final EventId DescriptionTemplate_Lookup = new EventId(8001, "DescriptionTemplate_Lookup");
public static final EventId DescriptionTemplate_Persist = new EventId(8002, "DescriptionTemplate_Persist");
public static final EventId DescriptionTemplate_Delete = new EventId(8003, "DescriptionTemplate_Delete");
public static final EventId DescriptionTemplate_Clone = new EventId(8004, "DescriptionTemplate_Clone");
public static final EventId DescriptionTemplate_PersistNewVersion = new EventId(8005, "DescriptionTemplate_PersistNewVersion");
public static final EventId DescriptionTemplate_GetXml = new EventId(8006, "DescriptionTemplate_GetXml");
public static final EventId DescriptionTemplate_Import = new EventId(8007, "DescriptionTemplate_Import");
public static final EventId SupportiveMaterial_Query = new EventId(9000, "SupportiveMaterial_Query");
public static final EventId SupportiveMaterial_Lookup = new EventId(9001, "SupportiveMaterial_Lookup");
public static final EventId SupportiveMaterial_Persist = new EventId(9002, "SupportiveMaterial_Persist");
public static final EventId SupportiveMaterial_Delete = new EventId(9003, "SupportiveMaterial_Delete");
public static final EventId ReferenceType_Query = new EventId(10000, "ReferenceType_Query");
public static final EventId ReferenceType_Lookup = new EventId(10001, "ReferenceType_Lookup");
public static final EventId ReferenceType_Persist = new EventId(10002, "ReferenceType_Persist");
public static final EventId ReferenceType_Delete = new EventId(10003, "ReferenceType_Delete");
public static final EventId User_Query = new EventId(11000, "User_Query");
public static final EventId User_Lookup = new EventId(11001, "User_Lookup");
public static final EventId User_Persist = new EventId(11002, "User_Persist");
public static final EventId User_Delete = new EventId(11003, "User_Delete");
public static final EventId User_LookupByEmail = new EventId(11004, "User_LookupByEmail");
public static final EventId User_ExportCsv = new EventId(11005, "User_ExportCsv");
public static final EventId User_PersistRoles = new EventId(11006, "User_PersistRoles");
public static final EventId User_LanguageMine = new EventId(11007, "User_LanguageMine");
public static final EventId User_TimezoneMine = new EventId(11008, "User_TimezoneMine");
public static final EventId User_CultureMine = new EventId(11009, "User_CultureMine");
public static final EventId User_MergeRequest = new EventId(11010, "User_MergeRequest");
public static final EventId User_MergeConfirm = new EventId(11011, "User_MergeConfirm");
public static final EventId User_RemoveCredentialRequest = new EventId(11012, "User_RemoveCredentialRequest");
public static final EventId User_RemoveCredentialConfirm = new EventId(11013, "User_RemoveCredentialConfirm");
public static final EventId User_PlanAssociatedQuery = new EventId(11014, "User_PlanAssociatedQuery");
public static final EventId User_AllowMergeAccount = new EventId(11015, "User_AllowMergeAccount");
public static final EventId User_InviteToTenant = new EventId(11016, "User_InviteToTenant");
public static final EventId User_InviteToTenantConfirm = new EventId(11017, "User_InviteToTenantConfirm");
public static final EventId Tenant_Query = new EventId(12000, "Tenant_Query");
public static final EventId Tenant_Lookup = new EventId(12001, "Tenant_Lookup");
public static final EventId Tenant_Persist = new EventId(12002, "Tenant_Persist");
public static final EventId Tenant_Delete = new EventId(12003, "Tenant_Delete");
public static final EventId Language_Query = new EventId(13000, "Language_Query");
public static final EventId Language_Lookup = new EventId(13001, "Language_Lookup");
public static final EventId Language_Persist = new EventId(13002, "Language_Persist");
public static final EventId Language_Delete = new EventId(13003, "Language_Delete");
public static final EventId StorageFile_Download = new EventId(14000, "StorageFile_Download");
public static final EventId StorageFile_Upload = new EventId(14001, "StorageFile_Upload");
public static final EventId StorageFile_Query = new EventId(14002, "StorageFile_Query");
public static final EventId Dashboard_MyRecentActivityItems = new EventId(15000, "Dashboard_MyRecentActivityItems");
public static final EventId Dashboard_MyDashboardStatistics = new EventId(15001, "Dashboard_MyDashboardStatistics");
public static final EventId Dashboard_PublicDashboardStatistics = new EventId(15002, "Dashboard_PublicDashboardStatistics");
public static final EventId Notification_Persist = new EventId(16000, "Notification_Persist");
public static final EventId Lock_Query = new EventId(17000, "Lock_Query");
public static final EventId Lock_Lookup = new EventId(17001, "Lock_Lookup");
public static final EventId Lock_Persist = new EventId(17002, "Lock_Persist");
public static final EventId Lock_Delete = new EventId(17003, "Lock_Delete");
public static final EventId Lock_IsLocked = new EventId(17004, "Lock_IsLocked");
public static final EventId Lock_UnLocked = new EventId(17005, "Lock_UnLocked");
public static final EventId Lock_Touched = new EventId(17006, "Lock_Touched");
public static final EventId Lock_Locked = new EventId(17007, "Lock_Locked");
public static final EventId Deposit_GetAvailableRepositories = new EventId(18000, "Deposit_GetAvailableRepositories");
public static final EventId Deposit_GetAccessToken = new EventId(18001, "Deposit_GetAccessToken");
public static final EventId Deposit_Deposit = new EventId(18002, "Deposit_Deposit");
public static final EventId Deposit_GetLogo = new EventId(18003, "Deposit_GetLogo");
public static final EventId Deposit_GetRepository = new EventId(18004, "Deposit_GetRepository");
public static final EventId Tag_Query = new EventId(19000, "Tag_Query");
public static final EventId Tag_Lookup = new EventId(19001, "Tag_Lookup");
public static final EventId Tag_Persist = new EventId(19002, "Tag_Persist");
public static final EventId Tag_Delete = new EventId(19003, "Tag_Delete");
public static final EventId FileTransformer_GetAvailableConfigurations = new EventId(20000, "FileTransformer_GetAvailableConfigurations");
public static final EventId ContactSupport_Sent = new EventId(210000, "ContactSupport_Sent");
public static final EventId ContactSupport_PublicSent = new EventId(210001, "ContactSupport_PublicSent");
public static final EventId Maintenance_GenerateElastic = new EventId(220000, "Maintenance_GenerateElastic");
public static final EventId Maintenance_ClearElastic = new EventId(230000, "Maintenance_ClearElastic");
public static final EventId Maintenance_SendUserTouchEvents = new EventId(230001, "Maintenance_SendUserTouchEvents");
public static final EventId Maintenance_SendTenantTouchEvents = new EventId(230002, "Maintenance_SendTenantTouchEvents");
public static final EventId Maintenance_SendPlanTouchEvents = new EventId(230003, "Maintenance_SendPlanTouchEvents");
public static final EventId Maintenance_SendDescriptionTouchEvents = new EventId(230004, "Maintenance_SendDescriptionTouchEvents");
public static final EventId Principal_Lookup = new EventId(240000, "Principal_Lookup");
public static final EventId Principal_MyTenants = new EventId(240001, "Principal_MyTenants");
public static final EventId GetSemantics = new EventId(250000, "GetSemantics");
public static final EventId PrefillingSource_Query = new EventId(260000, "PrefillingSource_Query");
public static final EventId PrefillingSource_Lookup = new EventId(260001, "PrefillingSource_Lookup");
public static final EventId PrefillingSource_Persist = new EventId(260002, "PrefillingSource_Persist");
public static final EventId PrefillingSource_Delete = new EventId(260003, "PrefillingSource_Delete");
public static final EventId PrefillingSource_Generate = new EventId(260004, "PrefillingSource_Generate");
public static final EventId TenantConfiguration_Query = new EventId(270000, "TenantConfiguration_Query");
public static final EventId TenantConfiguration_Lookup = new EventId(270001, "TenantConfiguration_Lookup");
public static final EventId TenantConfiguration_Persist = new EventId(270002, "TenantConfiguration_Persist");
public static final EventId TenantConfiguration_Delete = new EventId(270003, "TenantConfiguration_Delete");
public static final EventId TenantConfiguration_LookupByType = new EventId(270004, "TenantConfiguration_LookupByType");
public static final EventId Annotation_Created_Notify = new EventId(280000, "Annotation_Created_Notify");
public static final EventId UsageLimit_Query = new EventId(290000, "UsageLimit_Query");
public static final EventId UsageLimit_Lookup = new EventId(290001, "UsageLimit_Lookup");
public static final EventId UsageLimit_Persist = new EventId(290002, "UsageLimit_Persist");
public static final EventId UsageLimit_Delete = new EventId(290003, "UsageLimit_Delete");
}

View File

@ -1,40 +0,0 @@
package org.opencdmp.authorization;
import gr.cite.commons.web.authz.policy.AuthorizationRequirement;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class AffiliatedAuthorizationRequirement implements AuthorizationRequirement {
private final Set<String> requiredPermissions;
private final boolean matchAll;
public AffiliatedAuthorizationRequirement(Set<String> requiredPermissions) {
this(false, requiredPermissions);
}
public AffiliatedAuthorizationRequirement(String... requiredPermissions) {
this(false, requiredPermissions);
}
public AffiliatedAuthorizationRequirement(boolean matchAll, Set<String> requiredPermissions) {
this.matchAll = matchAll;
this.requiredPermissions = requiredPermissions;
}
public AffiliatedAuthorizationRequirement(boolean matchAll, String... requiredPermissions) {
this.requiredPermissions = new HashSet<>();
this.matchAll = matchAll;
this.requiredPermissions.addAll(Arrays.stream(requiredPermissions).distinct().toList());
}
public Set<String> getRequiredPermissions() {
return this.requiredPermissions;
}
public boolean getMatchAll() {
return this.matchAll;
}
}

View File

@ -1,33 +0,0 @@
package org.opencdmp.authorization;
import gr.cite.commons.web.authz.policy.AuthorizationResource;
import org.opencdmp.commons.enums.PlanUserRole;
import org.opencdmp.commons.enums.UserDescriptionTemplateRole;
import java.util.HashSet;
public class AffiliatedResource extends AuthorizationResource {
private HashSet<PlanUserRole> planUserRoles;
private HashSet<UserDescriptionTemplateRole> userDescriptionTemplateRoles;
public AffiliatedResource() {
this.planUserRoles = new HashSet<>();
this.userDescriptionTemplateRoles = new HashSet<>();
}
public HashSet<PlanUserRole> getPlanUserRoles() {
return this.planUserRoles;
}
public void setPlanUserRoles(HashSet<PlanUserRole> planUserRoles) {
this.planUserRoles = planUserRoles;
}
public HashSet<UserDescriptionTemplateRole> getUserDescriptionTemplateRoles() {
return this.userDescriptionTemplateRoles;
}
public void setUserDescriptionTemplateRoles(HashSet<UserDescriptionTemplateRole> userDescriptionTemplateRoles) {
this.userDescriptionTemplateRoles = userDescriptionTemplateRoles;
}
}

View File

@ -1,18 +0,0 @@
package org.opencdmp.authorization;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration("AppAuthorizationConfiguration")
@EnableConfigurationProperties(AuthorizationProperties.class)
public class AuthorizationConfiguration {
private final AuthorizationProperties authorizationProperties;
public AuthorizationConfiguration(AuthorizationProperties authorizationProperties) {
this.authorizationProperties = authorizationProperties;
}
public AuthorizationProperties getAuthorizationProperties() {
return this.authorizationProperties;
}
}

View File

@ -1,9 +0,0 @@
package org.opencdmp.authorization;
import java.util.EnumSet;
public enum AuthorizationFlags {
None, Permission, PlanAssociated, Public, Owner, DescriptionTemplateAssociated;
public static final EnumSet<AuthorizationFlags> AllExceptPublic = EnumSet.of(PlanAssociated, Permission, Owner, DescriptionTemplateAssociated);
public static final EnumSet<AuthorizationFlags> All = EnumSet.of(PlanAssociated, Permission, Owner, Public);
}

View File

@ -1,83 +0,0 @@
package org.opencdmp.authorization;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;
@ConfigurationProperties(prefix = "authorization")
public class AuthorizationProperties {
private List<String> globalAdminRoles;
private String adminRole;
private String tenantAdminRole;
private String globalUserRole;
private String tenantUserRole;
private Boolean autoAssignGlobalAdminToNewTenants;
private List<String> allowedTenantRoles;
private List<String> allowedGlobalRoles;
public List<String> getGlobalAdminRoles() {
return this.globalAdminRoles;
}
public void setGlobalAdminRoles(List<String> globalAdminRoles) {
this.globalAdminRoles = globalAdminRoles;
}
public String getAdminRole() {
return this.adminRole;
}
public void setAdminRole(String adminRole) {
this.adminRole = adminRole;
}
public String getTenantAdminRole() {
return this.tenantAdminRole;
}
public void setTenantAdminRole(String tenantAdminRole) {
this.tenantAdminRole = tenantAdminRole;
}
public String getGlobalUserRole() {
return this.globalUserRole;
}
public void setGlobalUserRole(String globalUserRole) {
this.globalUserRole = globalUserRole;
}
public String getTenantUserRole() {
return this.tenantUserRole;
}
public void setTenantUserRole(String tenantUserRole) {
this.tenantUserRole = tenantUserRole;
}
public Boolean getAutoAssignGlobalAdminToNewTenants() {
return this.autoAssignGlobalAdminToNewTenants;
}
public void setAutoAssignGlobalAdminToNewTenants(Boolean autoAssignGlobalAdminToNewTenants) {
this.autoAssignGlobalAdminToNewTenants = autoAssignGlobalAdminToNewTenants;
}
public List<String> getAllowedTenantRoles() {
return this.allowedTenantRoles;
}
public void setAllowedTenantRoles(List<String> allowedTenantRoles) {
this.allowedTenantRoles = allowedTenantRoles;
}
public List<String> getAllowedGlobalRoles() {
return this.allowedGlobalRoles;
}
public void setAllowedGlobalRoles(List<String> allowedGlobalRoles) {
this.allowedGlobalRoles = allowedGlobalRoles;
}
}

View File

@ -1,9 +0,0 @@
package org.opencdmp.authorization;
public class ClaimNames {
public static final String ExternalProviderName = "ExternalProviderName";
public static final String TenantCodesClaimName = "TenantCodes";
public static final String TenantClaimName = "x-tenant";
public static final String GlobalRolesClaimName = "GlobalRoles";
public static final String TenantRolesClaimName = "TenantRoles";
}

View File

@ -1,6 +0,0 @@
package org.opencdmp.authorization;
import gr.cite.commons.web.authz.policy.AuthorizationRequirement;
public class OwnedAuthorizationRequirement implements AuthorizationRequirement {
}

View File

@ -1,26 +0,0 @@
package org.opencdmp.authorization;
import gr.cite.commons.web.authz.policy.AuthorizationResource;
import java.util.List;
import java.util.UUID;
public class OwnedResource extends AuthorizationResource {
private List<UUID> userIds;
public OwnedResource(UUID userId) {
this(List.of(userId));
}
public OwnedResource(List<UUID> userIds) {
this.userIds = userIds;
}
public List<UUID> getUserIds() {
return userIds;
}
public void setUserIds(List<UUID> userIds) {
this.userIds = userIds;
}
}

View File

@ -1,243 +0,0 @@
package org.opencdmp.authorization;
public final class Permission {
/////
public static String DeferredAffiliation = "DeferredAffiliation";
//Public
public static String PublicBrowseDescription = "PublicBrowseDescription";
public static String PublicBrowseDescriptionTemplate = "PublicBrowseDescriptionTemplate";
public static String PublicBrowsePlan = "PublicBrowsePlan";
public static String PublicBrowsePlanReference = "PublicBrowsePlanReference";
public static String PublicBrowsePlanUser = "PublicBrowsePlanUser";
public static String PublicBrowseReference = "PublicBrowseReference";
public static String PublicBrowseUser = "PublicBrowseUser";
public static String PublicBrowseDashboardStatistics = "PublicBrowseDashboardStatistics";
public static String PublicSendContactSupport = "PublicSendContactSupport";
public static String PublicBrowseReferenceType = "PublicBrowseReferenceType";
public static String PublicClonePlan = "PublicClonePlan";
public static String PublicCloneDescription = "PublicCloneDescription";
//Elastic
public static String ManageElastic = "ManageElastic";
//Queue Events
public static String ManageQueueEvents = "ManageQueueEvents";
//Deposit
public static String BrowseDeposit = "BrowseDeposit";
public static String EditDeposit = "BrowseDeposit";
//Language
public static String BrowseLanguage = "BrowseLanguage";
public static String EditLanguage = "EditLanguage";
public static String DeleteLanguage = "DeleteLanguage";
//NotificationTemplate
public static String BrowseNotificationTemplate = "BrowseNotificationTemplate";
public static String EditNotificationTemplate = "EditNotificationTemplate";
public static String DeleteNotificationTemplate = "DeleteNotificationTemplate";
//Language
public static String BrowseStatistics = "BrowseStatistics";
public static String BrowsePublicStatistics = "BrowsePublicStatistics";
//DescriptionTemplate
public static String BrowseDescriptionTemplate = "BrowseDescriptionTemplate";
public static String EditDescriptionTemplate = "EditDescriptionTemplate";
public static String DeleteDescriptionTemplate = "DeleteDescriptionTemplate";
public static String CloneDescriptionTemplate = "CloneDescriptionTemplate";
public static String CreateNewVersionDescriptionTemplate = "CreateNewVersionDescriptionTemplate";
public static String ImportDescriptionTemplate = "ImportDescriptionTemplate";
public static String ExportDescriptionTemplate = "ExportDescriptionTemplate";
//User
public static String BrowseUser = "BrowseUser";
public static String EditUser = "EditUser";
public static String DeleteUser = "DeleteUser";
public static String ExportUsers = "ExportUsers";
public static String EditTenantUserRole = "EditTenantUserRole";
public static String InviteTenantUser = "InviteTenantUser";
public static String BrowsePlanAssociatedUser = "BrowsePlanAssociatedUser";
//StorageFile
public static String BrowseStorageFile = "BrowseStorageFile";
public static String EditStorageFile = "EditStorageFile";
public static String DeleteStorageFile = "DeleteStorageFile";
//DescriptionTemplateType
public static String BrowseDescriptionTemplateType = "BrowseDescriptionTemplateType";
public static String EditDescriptionTemplateType = "EditDescriptionTemplateType";
public static String DeleteDescriptionTemplateType = "DeleteDescriptionTemplateType";
//Plan
public static String BrowsePlan = "BrowsePlan";
public static String EditPlan = "EditPlan";
public static String NewPlan = "NewPlan";
public static String DepositPlan = "DepositPlan";
public static String DeletePlan = "DeletePlan";
public static String ClonePlan = "ClonePlan";
public static String ExportPlan = "ExportPlan";
public static String CreateNewVersionPlan = "CreateNewVersionPlan";
public static String FinalizePlan = "FinalizePlan";
public static String UndoFinalizePlan = "UndoFinalizePlan";
public static String AssignPlanUsers = "AssignPlanUsers";
public static String InvitePlanUsers = "InvitePlanUsers";
//PlanBlueprint
public static String BrowsePlanBlueprint = "BrowsePlanBlueprint";
public static String EditPlanBlueprint = "EditPlanBlueprint";
public static String DeletePlanBlueprint = "DeletePlanBlueprint";
public static String ClonePlanBlueprint = "ClonePlanBlueprint";
public static String CreateNewVersionPlanBlueprint = "CreateNewVersionPlanBlueprint";
public static String ExportPlanBlueprint = "ExportPlanBlueprint";
public static String ImportPlanBlueprint = "ImportPlanBlueprint";
//PlanDescriptionTemplate
public static String BrowsePlanDescriptionTemplate = "BrowsePlanDescriptionTemplate";
public static String EditPlanDescriptionTemplate = "EditPlanDescriptionTemplate";
public static String DeletePlanDescriptionTemplate = "DeletePlanDescriptionTemplate";
//PlanUser
public static String BrowsePlanUser = "BrowsePlanUser";
public static String EditPlanUser = "EditPlanUser";
public static String DeletePlanUser = "DeletePlanUser";
//Description
public static String BrowseDescription = "BrowseDescription";
public static String ReviewDescription = "ReviewDescription";
public static String EditDescription = "EditDescription";
public static String FinalizeDescription = "FinalizeDescription";
public static String DeleteDescription = "DeleteDescription";
public static String CloneDescription = "CloneDescription";
public static String ExportDescription = "ExportDescription";
//DescriptionTag
public static String BrowseDescriptionTag = "BrowseDescriptionTag";
public static String EditDescriptionTag = "EditDescriptionTag";
public static String DeleteDescriptionTag = "DeleteDescriptionTag";
//DescriptionTemplateType
public static String BrowseEntityDoi = "BrowseEntityDoi";
public static String EditEntityDoi = "EditEntityDoi";
public static String DeleteEntityDoi = "DeleteEntityDoi";
//UserSettings
public static String BrowseUserSettings = "BrowseUserSettings";
public static String EditUserSettings = "EditUserSettings";
public static String DeleteUserSettings = "DeleteUserSettings";
//Reference
public static String BrowseReference = "BrowseReference";
public static String BrowseExternalReference = "BrowseExternalReference";
public static String EditReference = "EditReference";
public static String DeleteReference = "DeleteReference";
//Tag
public static String BrowseTag = "BrowseTag";
public static String EditTag = "EditTag";
public static String DeleteTag = "DeleteTag";
//PlanReference
public static String BrowsePlanReference = "BrowsePlanReference";
public static String EditPlanReference = "EditPlanReference";
public static String DeletePlanReference = "DeletePlanReference";
//DescriptionReference
public static String BrowseDescriptionReference = "BrowseDescriptionReference";
public static String EditDescriptionReference = "EditDescriptionReference";
public static String DeleteDescriptionReference = "DeleteDescriptionReference";
//SupportiveMaterial
public static String BrowseSupportiveMaterial = "BrowseSupportiveMaterial";
public static String EditSupportiveMaterial= "EditSupportiveMaterial";
public static String DeleteSupportiveMaterial = "DeleteSupportiveMaterial";
//ReferenceType
public static String BrowseReferenceType = "BrowseReferenceType";
public static String EditReferenceType= "EditReferenceType";
public static String DeleteReferenceType = "DeleteReferenceType";
//Tenant
public static String BrowseTenant = "BrowseTenant";
public static String EditTenant= "EditTenant";
public static String DeleteTenant = "DeleteTenant";
public static String AllowNoTenant = "AllowNoTenant";
//TenantConfiguration
public static String BrowseTenantConfiguration = "BrowseTenantConfiguration";
public static String EditTenantConfiguration = "EditTenantConfiguration";
public static String DeleteTenantConfiguration = "DeleteTenantConfiguration";
//TenantUser
public static String BrowseTenantUser = "BrowseTenantUser";
public static String EditTenantUser = "EditTenantUser";
public static String DeleteTenantUser = "DeleteTenantUser";
//Prefilling
public static String BrowsePrefilling = "BrowsePrefilling";
//Lock
public static String BrowseLock = "BrowseLock";
public static String EditLock = "EditLock";
public static String DeleteLock = "DeleteLock";
//ContactSupport
public static String SendContactSupport = "SendContactSupport";
//ActionConfirmation
public static String BrowseActionConfirmation = "BrowseActionConfirmation";
public static String EditActionConfirmation = "EditActionConfirmation";
public static String DeleteActionConfirmation = "DeleteActionConfirmation";
//PrefillingSource
public static String BrowsePrefillingSource = "BrowsePrefillingSource";
public static String EditPrefillingSource= "EditPrefillingSource";
public static String DeletePrefillingSource = "DeletePrefillingSource";
//UsageLimit
public static String BrowseUsageLimit = "BrowseUsageLimit";
public static String EditUsageLimit = "EditUsageLimit";
public static String DeleteUsageLimit = "DeleteUsageLimit";
//NotificationTemplate
public static String BrowseStatus = "BrowseStatus";
public static String EditStatus = "EditStatus";
public static String DeleteStatus = "DeleteStatus";
// UI Pages
public static String ViewDescriptionTemplateTypePage = "ViewDescriptionTemplateTypePage";
public static String ViewMaintenancePage = "ViewMaintenancePage";
public static String ViewNotificationPage = "ViewNotificationPage";
public static String ViewNotificationTemplatePage = "ViewNotificationTemplatePage";
public static String ViewSupportiveMaterialPage = "ViewSupportiveMaterialPage";
public static String ViewLanguagePage = "ViewLanguagePage";
public static String ViewUserPage = "ViewUserPage";
public static String ViewTenantUserPage = "ViewTenantUserPage";
public static String ViewTenantPage = "ViewTenantPage";
public static String ViewPrefillingSourcePage = "ViewPrefillingSourcePage";
public static String ViewReferenceTypePage = "ViewReferenceTypePage";
public static String ViewReferencePaPlge = "ViewReferencePage";
public static String ViewEntityLockPage = "ViewEntityLockPage";
public static String ViewUsageLimitPage = "ViewUsageLimitPage";
public static String ViewDescriptionTemplatePage = "ViewDescriptionTemplatePage";
public static String ViewPlanBlueprintPage = "ViewPlanBlueprintPage";
public static String ViewPublicDescriptionPage = "ViewPublicDescriptionPage";
public static String ViewPublicPlanPage = "ViewPublicPlanPage";
public static String ViewMyDescriptionPage = "ViewMyDescriptionPage";
public static String ViewMyPlanPage = "ViewMyPlanPage";
public static String ViewHomePage = "ViewHomePage";
public static String ViewMineInAppNotificationPage = "ViewMineInAppNotificationPage";
public static String ViewTenantConfigurationPage = "ViewTenantConfigurationPage";
public static String ViewStatusPage = "ViewStatusPage";
}

View File

@ -1,40 +0,0 @@
package org.opencdmp.authorization;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.service.deposit.DepositServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
public class PermissionNameProvider {
private static final Logger logger = LoggerFactory.getLogger(PermissionNameProvider.class);
private final List<String> permissions;
public PermissionNameProvider(ConventionService conventionService) {
this.permissions = new ArrayList<>();
Class<Permission> clazz = Permission.class;
for (Field f : clazz.getDeclaredFields()) {
if (Modifier.isStatic(f.getModifiers())) {
try {
Object value = f.get(null);
if (value != null && !conventionService.isNullOrEmpty((String)value)) this.permissions.add((String)value);
} catch (Exception e) {
logger.error("Can not load permission " + f.getName() + " " + e.getMessage());
}
}
}
}
public List<String> getPermissions() {
return permissions;
}
}

View File

@ -1,10 +0,0 @@
package org.opencdmp.authorization.authorizationcontentresolver;
import gr.cite.tools.cache.CacheOptions;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "cache.affiliation")
public class AffiliationCacheOptions extends CacheOptions {
}

View File

@ -1,106 +0,0 @@
package org.opencdmp.authorization.authorizationcontentresolver;
import gr.cite.tools.cache.CacheService;
import org.opencdmp.authorization.AffiliatedResource;
import org.opencdmp.convention.ConventionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Locale;
import java.util.UUID;
@Service
public class AffiliationCacheService extends CacheService<AffiliationCacheService.AffiliationCacheValue> {
public static class AffiliationCacheValue {
public AffiliationCacheValue() {
}
public AffiliationCacheValue(UUID tenantId, UUID userId, UUID entityId, String entityType, AffiliatedResource affiliatedResource) {
this.userId = userId;
this.tenantId = tenantId;
this.entityId = entityId;
this.entityType = entityType;
this.affiliatedResource = affiliatedResource;
}
private UUID userId;
private UUID tenantId;
private UUID entityId;
private String entityType;
private AffiliatedResource affiliatedResource;
public UUID getUserId() {
return this.userId;
}
public void setUserId(UUID userId) {
this.userId = userId;
}
public UUID getTenantId() {
return this.tenantId;
}
public void setTenantId(UUID tenantId) {
this.tenantId = tenantId;
}
public UUID getEntityId() {
return this.entityId;
}
public void setEntityId(UUID entityId) {
this.entityId = entityId;
}
public String getEntityType() {
return this.entityType;
}
public void setEntityType(String entityType) {
this.entityType = entityType;
}
public AffiliatedResource getAffiliatedResource() {
return this.affiliatedResource;
}
public void setAffiliatedResource(AffiliatedResource affiliatedResource) {
this.affiliatedResource = affiliatedResource;
}
}
private final ConventionService conventionService;
@Autowired
public AffiliationCacheService(AffiliationCacheOptions options, ConventionService conventionService) {
super(options);
this.conventionService = conventionService;
}
@Override
protected Class<AffiliationCacheValue> valueClass() {
return AffiliationCacheValue.class;
}
@Override
public String keyOf(AffiliationCacheValue value) {
return this.buildKey(value.getTenantId(), value.getUserId(), value.getEntityId(), value.getEntityType());
}
public String buildKey(UUID tenantId, UUID userId, UUID entityId, String entityType) {
if (userId == null) throw new IllegalArgumentException("userId id is required");
if (entityId == null) throw new IllegalArgumentException("entityId id is required");
if (this.conventionService.isNullOrEmpty(entityType)) throw new IllegalArgumentException("entityType id is required");
HashMap<String, String> keyParts = new HashMap<>();
keyParts.put("$user$", userId.toString().replace("-", "").toLowerCase(Locale.ROOT));
keyParts.put("$tenant$", tenantId == null ? "" : userId.toString().replace("-", "").toLowerCase(Locale.ROOT));
keyParts.put("$entity$", entityId.toString().replace("-", "").toLowerCase(Locale.ROOT));
keyParts.put("$type$", entityType);
return this.generateKey(keyParts);
}
}

View File

@ -1,29 +0,0 @@
package org.opencdmp.authorization.authorizationcontentresolver;
import org.opencdmp.authorization.AffiliatedResource;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public interface AuthorizationContentResolver {
List<String> getPermissionNames();
AffiliatedResource planAffiliation(UUID id);
Map<UUID, AffiliatedResource> plansAffiliation(List<UUID> ids);
AffiliatedResource descriptionTemplateAffiliation(UUID id);
Map<UUID, AffiliatedResource> descriptionTemplateAffiliation(List<UUID> ids);
boolean hasAtLeastOneDescriptionTemplateAffiliation();
AffiliatedResource descriptionAffiliation(UUID id);
Map<UUID, AffiliatedResource> descriptionsAffiliation(List<UUID> ids);
AffiliatedResource descriptionsAffiliationBySection(UUID planId, UUID sectionId);
Map<UUID, AffiliatedResource> descriptionsAffiliationBySections(UUID planId, List<UUID> sectionIds);
}

View File

@ -1,293 +0,0 @@
package org.opencdmp.authorization.authorizationcontentresolver;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.fieldset.BaseFieldSet;
import gr.cite.tools.logging.LoggerService;
import org.opencdmp.authorization.AffiliatedResource;
import org.opencdmp.authorization.PermissionNameProvider;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.commons.scope.tenant.TenantScope;
import org.opencdmp.commons.scope.user.UserScope;
import org.opencdmp.data.*;
import org.opencdmp.model.PlanDescriptionTemplate;
import org.opencdmp.model.PlanUser;
import org.opencdmp.model.UserDescriptionTemplate;
import org.opencdmp.model.description.Description;
import org.opencdmp.query.DescriptionQuery;
import org.opencdmp.query.PlanDescriptionTemplateQuery;
import org.opencdmp.query.PlanUserQuery;
import org.opencdmp.query.UserDescriptionTemplateQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.context.annotation.RequestScope;
import javax.management.InvalidApplicationException;
import java.util.*;
import java.util.stream.Collectors;
@Service
@RequestScope
public class AuthorizationContentResolverImpl implements AuthorizationContentResolver {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(AuthorizationContentResolverImpl.class));
private static final Logger log = LoggerFactory.getLogger(AuthorizationContentResolverImpl.class);
private final QueryFactory queryFactory;
private final UserScope userScope;
private final TenantScope tenantScope;
private final AffiliationCacheService affiliationCacheService;
private final PermissionNameProvider permissionNameProvider;
private final TenantEntityManager tenantEntityManager;
public AuthorizationContentResolverImpl(QueryFactory queryFactory, UserScope userScope, TenantScope tenantScope, AffiliationCacheService affiliationCacheService, PermissionNameProvider permissionNameProvider, TenantEntityManager tenantEntityManager) {
this.queryFactory = queryFactory;
this.userScope = userScope;
this.tenantScope = tenantScope;
this.affiliationCacheService = affiliationCacheService;
this.permissionNameProvider = permissionNameProvider;
this.tenantEntityManager = tenantEntityManager;
}
@Override
public List<String> getPermissionNames() {
return this.permissionNameProvider.getPermissions();
}
@Override
public AffiliatedResource planAffiliation(UUID id) {
return this.plansAffiliation(List.of(id)).getOrDefault(id, new AffiliatedResource());
}
@Override
public Map<UUID, AffiliatedResource> plansAffiliation(List<UUID> ids){
UUID userId = this.userScope.getUserIdSafe();
Map<UUID, AffiliatedResource> affiliatedResources = new HashMap<>();
for (UUID id : ids){
affiliatedResources.put(id, new AffiliatedResource());
}
if (userId == null || !this.userScope.isSet()) return affiliatedResources;
List<UUID> idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, PlanEntity.class.getSimpleName());
if (idsToResolve.isEmpty()) return affiliatedResources;
List<PlanUserEntity> planUsers;
try {
this.tenantEntityManager.loadExplicitTenantFilters();
planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(ids).sectionIsEmpty(true).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._plan));
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
} finally {
try {
this.tenantEntityManager.reloadTenantFilters();
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
}
}
for (PlanUserEntity planUser : planUsers){
affiliatedResources.get(planUser.getPlanId()).getPlanUserRoles().add(planUser.getRole());
}
this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, PlanEntity.class.getSimpleName());
return affiliatedResources;
}
@Override
public AffiliatedResource descriptionTemplateAffiliation(UUID id) {
return this.descriptionTemplateAffiliation(List.of(id)).getOrDefault(id, new AffiliatedResource());
}
@Override
public Map<UUID, AffiliatedResource> descriptionTemplateAffiliation(List<UUID> ids){
UUID userId = this.userScope.getUserIdSafe();
Map<UUID, AffiliatedResource> affiliatedResources = new HashMap<>();
for (UUID id : ids){
affiliatedResources.put(id, new AffiliatedResource());
}
if (userId == null || !this.userScope.isSet()) return affiliatedResources;
List<UUID> idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, DescriptionTemplateEntity.class.getSimpleName());
if (idsToResolve.isEmpty()) return affiliatedResources;
List<UserDescriptionTemplateEntity> userDescriptionTemplates;
try {
this.tenantEntityManager.loadExplicitTenantFilters();
userDescriptionTemplates = this.queryFactory.query(UserDescriptionTemplateQuery.class).disableTracking().descriptionTemplateIds(ids).userIds(userId).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(UserDescriptionTemplate._role).ensure(UserDescriptionTemplate._descriptionTemplate));
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
} finally {
try {
this.tenantEntityManager.reloadTenantFilters();
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
}
}
for (UserDescriptionTemplateEntity planUser : userDescriptionTemplates){
affiliatedResources.get(planUser.getDescriptionTemplateId()).getUserDescriptionTemplateRoles().add(planUser.getRole());
}
this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, DescriptionTemplateEntity.class.getSimpleName());
return affiliatedResources;
}
@Override
public boolean hasAtLeastOneDescriptionTemplateAffiliation(){
UUID userId = this.userScope.getUserIdSafe();
if (userId == null || !this.userScope.isSet()) return false;
//TODO: investigate if we want to use cache
boolean hasAny;
try {
this.tenantEntityManager.loadExplicitTenantFilters();
hasAny = this.queryFactory.query(UserDescriptionTemplateQuery.class).disableTracking().userIds(userId).isActive(IsActive.Active).count() > 0;
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
} finally {
try {
this.tenantEntityManager.reloadTenantFilters();
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
}
}
return hasAny;
}
@Override
public AffiliatedResource descriptionAffiliation(UUID id) {
return this.descriptionsAffiliation(List.of(id)).getOrDefault(id, new AffiliatedResource());
}
@Override
public Map<UUID, AffiliatedResource> descriptionsAffiliation(List<UUID> ids){
UUID userId = this.userScope.getUserIdSafe();
Map<UUID, AffiliatedResource> affiliatedResources = new HashMap<>();
for (UUID id : ids){
affiliatedResources.put(id, new AffiliatedResource());
}
if (userId == null || !this.userScope.isSet()) return affiliatedResources;
List<UUID> idsToResolve = this.getAffiliatedFromCache(ids, userId, affiliatedResources, DescriptionEntity.class.getSimpleName());
if (idsToResolve.isEmpty()) return affiliatedResources;
List<PlanDescriptionTemplateEntity> planDescriptionTemplateEntities;
List<PlanUserEntity> planUsers;
List<DescriptionEntity> descriptionEntities;
try {
this.tenantEntityManager.loadExplicitTenantFilters();
descriptionEntities = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(ids).collectAs(new BaseFieldSet().ensure(Description._id).ensure(Description._planDescriptionTemplate).ensure(Description._plan));
planDescriptionTemplateEntities = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().ids(descriptionEntities.stream().map(DescriptionEntity::getPlanDescriptionTemplateId).distinct().toList()).collectAs(new BaseFieldSet().ensure(PlanDescriptionTemplate._id).ensure(PlanDescriptionTemplate._sectionId));
planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().descriptionIds(ids).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._sectionId).ensure(PlanUser._plan));
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
} finally {
try {
this.tenantEntityManager.reloadTenantFilters();
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
}
}
Map<UUID, PlanDescriptionTemplateEntity> planDescriptionTemplateEntityMap = planDescriptionTemplateEntities == null ? new HashMap<>() : planDescriptionTemplateEntities.stream().collect(Collectors.toMap(PlanDescriptionTemplateEntity::getId, x-> x));
Map<UUID, List<PlanUserEntity>> planUsersMap = planUsers.stream().collect(Collectors.groupingBy(PlanUserEntity::getPlanId));
for (DescriptionEntity description : descriptionEntities){
List<PlanUserEntity> planDescriptionUsers = planUsersMap.getOrDefault(description.getPlanId(), new ArrayList<>());
for (PlanUserEntity planUser : planDescriptionUsers) {
if (planUser.getSectionId() == null) affiliatedResources.get(description.getId()).getPlanUserRoles().add(planUser.getRole());
else {
PlanDescriptionTemplateEntity planDescriptionTemplateEntity = planDescriptionTemplateEntityMap.getOrDefault(description.getPlanDescriptionTemplateId(), null);
if (planDescriptionTemplateEntity != null && planUser.getSectionId().equals(planDescriptionTemplateEntity.getSectionId())){
affiliatedResources.get(description.getId()).getPlanUserRoles().add(planUser.getRole());
}
}
}
}
this.ensureAffiliatedInCache(idsToResolve, userId, affiliatedResources, DescriptionEntity.class.getSimpleName());
return affiliatedResources;
}
@Override
public AffiliatedResource descriptionsAffiliationBySection(UUID planId, UUID sectionId){
return this.descriptionsAffiliationBySections(planId, List.of(sectionId)).getOrDefault(sectionId, new AffiliatedResource());
}
@Override
public Map<UUID, AffiliatedResource> descriptionsAffiliationBySections(UUID planId, List<UUID> sectionIds){
UUID userId = this.userScope.getUserIdSafe();
Map<UUID, AffiliatedResource> affiliatedResources = new HashMap<>();
for (UUID id : sectionIds){
affiliatedResources.put(id, new AffiliatedResource());
}
if (userId == null || !this.userScope.isSet()) return affiliatedResources;
List<PlanUserEntity> planUsers;
try {
this.tenantEntityManager.loadExplicitTenantFilters();
planUsers = this.queryFactory.query(PlanUserQuery.class).disableTracking().planIds(planId).userIds(userId).isActives(IsActive.Active).collectAs(new BaseFieldSet().ensure(PlanUser._role).ensure(PlanUser._sectionId).ensure(PlanUser._plan));
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
} finally {
try {
this.tenantEntityManager.reloadTenantFilters();
} catch (InvalidApplicationException e) {
log.error(e.getMessage(), e);
throw new MyApplicationException(e.getMessage());
}
}
for (UUID sectionId : sectionIds.stream().distinct().toList()){
List<PlanUserEntity> planSectionUsers = planUsers.stream().filter(x-> x.getSectionId() == null || x.getSectionId().equals(sectionId)).toList();
for (PlanUserEntity planUser : planSectionUsers) {
if (planUser.getSectionId() == null) affiliatedResources.get(sectionId).getPlanUserRoles().add(planUser.getRole());
else {
if (planUser.getSectionId().equals(sectionId)){
affiliatedResources.get(sectionId).getPlanUserRoles().add(planUser.getRole());
}
}
}
}
return affiliatedResources;
}
private List<UUID> getAffiliatedFromCache(List<UUID> ids, UUID userId, Map<UUID, AffiliatedResource> affiliatedResources, String entityType) {
List<UUID> idsToResolve = new ArrayList<>();
for (UUID id : ids){
AffiliationCacheService.AffiliationCacheValue cacheValue = null;
try {
cacheValue = this.affiliationCacheService.lookup(this.affiliationCacheService.buildKey(this.tenantScope.isSet() ? this.tenantScope.getTenant(): null, userId, id, entityType));
} catch (InvalidApplicationException e) {
throw new RuntimeException(e);
}
if (cacheValue != null) affiliatedResources.put(id, cacheValue.getAffiliatedResource());
else idsToResolve.add(id);
}
return idsToResolve;
}
private void ensureAffiliatedInCache(List<UUID> idsToResolve, UUID userId, Map<UUID, AffiliatedResource> affiliatedResources, String entityType) {
for (UUID id : idsToResolve){
AffiliatedResource affiliatedResource = affiliatedResources.getOrDefault(id, null);
if (affiliatedResource != null) {
AffiliationCacheService.AffiliationCacheValue cacheValue = null;
try {
cacheValue = new AffiliationCacheService.AffiliationCacheValue(this.tenantScope.isSet() ? this.tenantScope.getTenant(): null, userId, id, entityType, affiliatedResource);
} catch (InvalidApplicationException e) {
throw new RuntimeException(e);
}
this.affiliationCacheService.put(cacheValue);
}
}
}
}

View File

@ -1,56 +0,0 @@
package org.opencdmp.commons;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public class JsonHandlingService {
private final ObjectMapper objectMapper;
public JsonHandlingService() {
this.objectMapper = new ObjectMapper();
this.objectMapper.registerModule(new JavaTimeModule());
}
public String toJson(Object item) throws JsonProcessingException {
if (item == null) return null;
return this.objectMapper.writeValueAsString(item);
}
public String toJsonSafe(Object item) {
if (item == null) return null;
try {
return this.objectMapper.writeValueAsString(item);
} catch (Exception ex) {
return null;
}
}
public <T> T fromJson(Class<T> type, String json) throws JsonProcessingException {
if (json == null) return null;
return this.objectMapper.readValue(json, type);
}
public HashMap<String, String> mapFromJson(String json) throws JsonProcessingException {
ObjectReader reader = this.objectMapper.readerFor(Map.class);
return reader.readValue(json);
}
public <T> T fromJsonSafe(Class<T> type, String json) {
if (json == null) return null;
try {
return this.objectMapper.readValue(json, type);
} catch (Exception ex) {
return null;
}
}
}

View File

@ -1,103 +0,0 @@
package org.opencdmp.commons;
import com.fasterxml.jackson.core.JsonProcessingException;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.Unmarshaller;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.management.InvalidApplicationException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
public class XmlHandlingService {
public String generateXml(Document doc) throws TransformerException {
TransformerFactory tFact = TransformerFactory.newInstance();
Transformer 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();
}
public String toXml(Object item) throws JAXBException {
JAXBContext context = JAXBContext.newInstance(item.getClass());
Marshaller marshaller = context.createMarshaller();
StringWriter out = new StringWriter();
marshaller.marshal(item, out);
return out.toString();
}
public String toXmlSafe(Object item) {
if (item == null) return null;
try {
return this.toXml(item);
} catch (Exception ex) {
return null;
}
}
public <T> T fromXml(Class<T> type, String xmlString) throws JAXBException, InstantiationException, IllegalAccessException, ParserConfigurationException, IOException, SAXException {
JAXBContext jaxbContext = JAXBContext.newInstance(type);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
return (T) jaxbUnmarshaller.unmarshal(new StringReader(xmlString));
}
public <T> T fromXmlSafe(Class<T> type, String xmlString) {
if (xmlString == null) return null;
try {
return this.fromXml(type, xmlString);
} catch (Exception ex) {
return null;
}
}
// public <T extends XmlSerializable<T>> T xmlSerializableFromXml(Class<T> type, String xmlString) throws JAXBException, InstantiationException, IllegalAccessException, ParserConfigurationException, IOException, SAXException {
// T object = type.newInstance();
// return (T) object.fromXml(this.getDocument(xmlString).getDocumentElement());
// }
//
// public <T extends XmlSerializable<T>> T xmlSerializableFromXmlSafe(Class<T> type, String xmlString) {
// if (xmlString == null) return null;
// try {
// return this.xmlSerializableFromXml(type, xmlString);
// } catch (Exception ex) {
// return null;
// }
// }
public Document getDocument(String xml) throws ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
InputSource inputStream = new InputSource(new StringReader(xml));
return docBuilder.parse(inputStream);
}
public Document getDocument() throws ParserConfigurationException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
return docBuilder.newDocument();
}
}

View File

@ -1,32 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum ActionConfirmationStatus implements DatabaseEnum<Short> {
Requested((short) 0),
Accepted((short) 1);
private final Short value;
ActionConfirmationStatus(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, ActionConfirmationStatus> map = EnumUtils.getEnumValueMap(ActionConfirmationStatus.class);
public static ActionConfirmationStatus of(Short i) {
return map.get(i);
}
}

View File

@ -1,34 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum ActionConfirmationType implements DatabaseEnum<Short> {
MergeAccount((short) 0),
RemoveCredential((short) 1),
PlanInvitation((short) 2),
UserInviteToTenant ((short) 3);
private final Short value;
ActionConfirmationType(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return this.value;
}
private static final Map<Short, ActionConfirmationType> map = EnumUtils.getEnumValueMap(ActionConfirmationType.class);
public static ActionConfirmationType of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum ContactInfoType implements DatabaseEnum<Short> {
Email((short) 0);
private final Short value;
ContactInfoType(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, ContactInfoType> map = EnumUtils.getEnumValueMap(ContactInfoType.class);
public static ContactInfoType of(Short i) {
return map.get(i);
}
}

View File

@ -1,31 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum DescriptionStatus implements DatabaseEnum<Short> {
Draft((short) 0),
Finalized((short) 1),
Canceled((short) 2);
private final Short value;
DescriptionStatus(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, DescriptionStatus> map = EnumUtils.getEnumValueMap(DescriptionStatus.class);
public static DescriptionStatus of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum DescriptionTemplateStatus implements DatabaseEnum<Short> {
Draft((short) 0),
Finalized((short) 1);
private final Short value;
DescriptionTemplateStatus(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, DescriptionTemplateStatus> map = EnumUtils.getEnumValueMap(DescriptionTemplateStatus.class);
public static DescriptionTemplateStatus of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum DescriptionTemplateTypeStatus implements DatabaseEnum<Short> {
Draft((short) 0),
Finalized((short) 1);
private final Short value;
DescriptionTemplateTypeStatus(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, DescriptionTemplateTypeStatus> map = EnumUtils.getEnumValueMap(DescriptionTemplateTypeStatus.class);
public static DescriptionTemplateTypeStatus of(Short i) {
return map.get(i);
}
}

View File

@ -1,32 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum DescriptionTemplateVersionStatus implements DatabaseEnum<Short> {
Current((short) 0),
Previous((short) 1),
NotFinalized((short) 2);
private final Short value;
DescriptionTemplateVersionStatus(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, DescriptionTemplateVersionStatus> map = EnumUtils.getEnumValueMap(DescriptionTemplateVersionStatus.class);
public static DescriptionTemplateVersionStatus of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum DescriptionValidationOutput implements DatabaseEnum<Short> {
Valid((short) 1),
Invalid((short) 2);
private final Short value;
DescriptionValidationOutput(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, DescriptionValidationOutput> map = EnumUtils.getEnumValueMap(DescriptionValidationOutput.class);
public static DescriptionValidationOutput of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum EntityType implements DatabaseEnum<Short> {
Plan((short) 0);
private final Short value;
EntityType(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, EntityType> map = EnumUtils.getEnumValueMap(EntityType.class);
public static EntityType of(Short i) {
return map.get(i);
}
}

View File

@ -1,16 +0,0 @@
package org.opencdmp.commons.enums;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.HashMap;
import java.util.Map;
public class EnumUtils {
public static <EnumType extends Enum<EnumType> & DatabaseEnum<EnumValue>, EnumValue> Map<EnumValue, EnumType> getEnumValueMap(Class<EnumType> enumType){
HashMap<EnumValue, EnumType> map = new HashMap<>();
for (EnumType v : enumType.getEnumConstants()) {
map.put(v.getValue(), v);
}
return map;
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import jakarta.xml.bind.annotation.XmlEnumValue;
import java.util.Map;
public enum ExternalFetcherApiHTTPMethodType implements DatabaseEnum<Short> {
@XmlEnumValue(value = "0")
GET((short) 0),
@XmlEnumValue(value = "1")
POST((short) 1);
private final Short value;
ExternalFetcherApiHTTPMethodType(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, ExternalFetcherApiHTTPMethodType> map = EnumUtils.getEnumValueMap(ExternalFetcherApiHTTPMethodType.class);
public static ExternalFetcherApiHTTPMethodType of(Short i) {
return map.get(i);
}
}

View File

@ -1,35 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import jakarta.xml.bind.annotation.XmlEnumValue;
import java.util.Map;
public enum ExternalFetcherSourceType implements DatabaseEnum<Short> {
@XmlEnumValue(value = "0")
API((short) 0),
@XmlEnumValue(value = "1")
STATIC((short) 1);
private final Short value;
public static class Names {
public static final String API = "api";
public static final String STATIC = "static";
}
ExternalFetcherSourceType(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, ExternalFetcherSourceType> map = EnumUtils.getEnumValueMap(ExternalFetcherSourceType.class);
public static ExternalFetcherSourceType of(Short i) {
return map.get(i);
}
}

View File

@ -1,89 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum FieldType implements DatabaseEnum<String> {
SELECT(Names.Select),
BOOLEAN_DECISION(Names.BooleanDecision),
RADIO_BOX(Names.RadioBox),
INTERNAL_ENTRIES_PLANS(Names.InternalEntitiesPlans),
INTERNAL_ENTRIES_DESCRIPTIONS(Names.InternalEntitiesDescriptions),
CHECK_BOX(Names.CheckBox),
FREE_TEXT(Names.FreeText),
TEXT_AREA(Names.TextArea),
RICH_TEXT_AREA(Names.RichTextarea),
UPLOAD(Names.Upload),
DATE_PICKER(Names.DatePicker),
TAGS(Names.Tags),
REFERENCE_TYPES(Names.ReferenceTypes),
DATASET_IDENTIFIER(Names.DatasetIdentifier),
VALIDATION(Names.Validation);
private final String value;
public static class Names {
public static final String Select = "select";
public static final String BooleanDecision = "booleanDecision";
public static final String RadioBox = "radiobox";
public static final String InternalEntitiesPlans = "internalEntitiesPlans";
public static final String InternalEntitiesDescriptions = "internalEntitiesDescriptions";
public static final String CheckBox = "checkBox";
public static final String FreeText = "freetext";
public static final String TextArea = "textarea";
public static final String RichTextarea = "richTextarea";
public static final String Upload = "upload";
public static final String DatePicker = "datePicker";
public static final String Tags = "tags";
public static final String DatasetIdentifier = "datasetIdentifier";
public static final String Validation = "validation";
public static final String ReferenceTypes = "referenceTypes";
}
FieldType(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return this.value;
}
private static final Map<String, FieldType> map = EnumUtils.getEnumValueMap(FieldType.class);
public static FieldType of(String i) {
return map.get(i);
}
public static boolean isReferenceType(FieldType fieldType){
return fieldType.equals(FieldType.REFERENCE_TYPES);
}
public static boolean isTextType(FieldType fieldType){
return fieldType.equals(FieldType.FREE_TEXT) || fieldType.equals(FieldType.TEXT_AREA) ||
fieldType.equals(FieldType.RICH_TEXT_AREA) || fieldType.equals(FieldType.UPLOAD) ||
fieldType.equals(FieldType.RADIO_BOX);
}
public static boolean isTextListType(FieldType fieldType){
return fieldType.equals(FieldType.SELECT) || fieldType.equals(FieldType.INTERNAL_ENTRIES_PLANS) ||
fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS);
}
public static boolean isTagType(FieldType fieldType){
return fieldType.equals(FieldType.TAGS);
}
public static boolean isDateType(FieldType fieldType){
return fieldType.equals(FieldType.DATE_PICKER);
}
public static boolean isBooleanType(FieldType fieldType){
return fieldType.equals(FieldType.BOOLEAN_DECISION) || fieldType.equals(FieldType.CHECK_BOX);
}
public static boolean isExternalIdentifierType(FieldType fieldType){
return fieldType.equals(FieldType.VALIDATION) || fieldType.equals(FieldType.DATASET_IDENTIFIER) ;
}
}

View File

@ -1,33 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public enum FieldValidationType implements DatabaseEnum<Short> {
None((short) 0),
Required((short) 1),
Url((short) 2);
private final Short value;
FieldValidationType(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, FieldValidationType> map = EnumUtils.getEnumValueMap(FieldValidationType.class);
public static FieldValidationType of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum IsActive implements DatabaseEnum<Short> {
Inactive((short) 0),
Active((short) 1);
private final Short value;
IsActive(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, IsActive> map = EnumUtils.getEnumValueMap(IsActive.class);
public static IsActive of(Short i) {
return map.get(i);
}
}

View File

@ -1,29 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum LockTargetType implements DatabaseEnum<Short> {
Plan((short) 0),
Description((short) 1),
PlanBlueprint((short) 2),
DescriptionTemplate((short) 3);
private final Short value;
LockTargetType(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, LockTargetType> map = EnumUtils.getEnumValueMap(LockTargetType.class);
public static LockTargetType of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanAccessType implements DatabaseEnum<Short> {
Public((short) 0), Restricted((short) 1);
private final Short value;
PlanAccessType(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, PlanAccessType> map = EnumUtils.getEnumValueMap(PlanAccessType.class);
public static PlanAccessType of(Short i) {
return map.get(i);
}
}

View File

@ -1,45 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanBlueprintExtraFieldDataType implements DatabaseEnum<Short> {
Text((short) 0),
RichTex((short) 1),
Date((short) 2),
Number((short) 3),
;
private final Short value;
PlanBlueprintExtraFieldDataType(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, PlanBlueprintExtraFieldDataType> map = EnumUtils.getEnumValueMap(PlanBlueprintExtraFieldDataType.class);
public static PlanBlueprintExtraFieldDataType of(Short i) {
return map.get(i);
}
public static boolean isTextType(PlanBlueprintExtraFieldDataType fieldType){
return fieldType.equals(PlanBlueprintExtraFieldDataType.Text) || fieldType.equals(PlanBlueprintExtraFieldDataType.RichTex);
}
public static boolean isDateType(PlanBlueprintExtraFieldDataType fieldType){
return fieldType.equals(PlanBlueprintExtraFieldDataType.Date);
}
public static boolean isNumberType(PlanBlueprintExtraFieldDataType fieldType){
return fieldType.equals(PlanBlueprintExtraFieldDataType.Number);
}
}

View File

@ -1,35 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanBlueprintFieldCategory implements DatabaseEnum<Short> {
System((short) 0),
Extra((short) 1),
ReferenceType((short) 2);
public static class Names {
public static final String System = "system";
public static final String Extra = "extra";
public static final String ReferenceType = "referenceType";
}
private final Short value;
PlanBlueprintFieldCategory(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, PlanBlueprintFieldCategory> map = EnumUtils.getEnumValueMap(PlanBlueprintFieldCategory.class);
public static PlanBlueprintFieldCategory of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanBlueprintStatus implements DatabaseEnum<Short> {
Draft((short) 0),
Finalized((short) 1);
private final Short value;
PlanBlueprintStatus(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, PlanBlueprintStatus> map = EnumUtils.getEnumValueMap(PlanBlueprintStatus.class);
public static PlanBlueprintStatus of(Short i) {
return map.get(i);
}
}

View File

@ -1,32 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanBlueprintSystemFieldType implements DatabaseEnum<Short> {
Title((short)0),
Description((short)1),
Language((short)2),
Contact((short)3),
AccessRights((short)4),
User((short)5);
private final Short value;
PlanBlueprintSystemFieldType(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, PlanBlueprintSystemFieldType> map = EnumUtils.getEnumValueMap(PlanBlueprintSystemFieldType.class);
public static PlanBlueprintSystemFieldType of(Short i) {
return map.get(i);
}
}

View File

@ -1,32 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanBlueprintVersionStatus implements DatabaseEnum<Short> {
Current((short) 0),
Previous((short) 1),
NotFinalized((short) 2);
private final Short value;
PlanBlueprintVersionStatus(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, PlanBlueprintVersionStatus> map = EnumUtils.getEnumValueMap(PlanBlueprintVersionStatus.class);
public static PlanBlueprintVersionStatus of(Short i) {
return map.get(i);
}
}

View File

@ -1,31 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanStatus implements DatabaseEnum<Short> {
Draft((short) 0), Finalized((short) 1);
private final Short value;
PlanStatus(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, PlanStatus> map = EnumUtils.getEnumValueMap(PlanStatus.class);
public static PlanStatus of(Short i) {
return map.get(i);
}
}

View File

@ -1,33 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanUserRole implements DatabaseEnum<Short> {
Owner((short) 0),
Viewer((short) 1),
DescriptionContributor((short) 2),
Reviewer((short) 3);
private final Short value;
PlanUserRole(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return this.value;
}
private static final Map<Short, PlanUserRole> map = EnumUtils.getEnumValueMap(PlanUserRole.class);
public static PlanUserRole of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanValidationOutput implements DatabaseEnum<Short> {
Valid((short) 1),
Invalid((short) 2);
private final Short value;
PlanValidationOutput(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, PlanValidationOutput> map = EnumUtils.getEnumValueMap(PlanValidationOutput.class);
public static PlanValidationOutput of(Short i) {
return map.get(i);
}
}

View File

@ -1,32 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum PlanVersionStatus implements DatabaseEnum<Short> {
Current((short) 0),
Previous((short) 1),
NotFinalized((short) 2);
private final Short value;
PlanVersionStatus(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, PlanVersionStatus> map = EnumUtils.getEnumValueMap(PlanVersionStatus.class);
public static PlanVersionStatus of(Short i) {
return map.get(i);
}
}

View File

@ -1,36 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.HashMap;
import java.util.Map;
public enum ProviderType implements DatabaseEnum<Integer> {
Google (1),
Facebook ( 2),
Twitter ( 3),
LinkedIn (4),
NativeLogin ( 5),
B2Access ( 6),
ORCID (7),
OpenAire ( 8),
Configurable ( 9),
Zenodo (10),
Keycloack ( 128);
private final Integer value;
ProviderType(Integer value) {
this.value = value;
}
@JsonValue
public Integer getValue() { return this.value; }
private static final Map<Integer, ProviderType> map = EnumUtils.getEnumValueMap(ProviderType.class);
public static ProviderType of(Integer i) {
return map.get(i);
}
}

View File

@ -1,31 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum RecentActivityItemType implements DatabaseEnum<Short> {
Plan((short) 0),
Description((short) 1);
private final Short value;
RecentActivityItemType(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, RecentActivityItemType> map = EnumUtils.getEnumValueMap(RecentActivityItemType.class);
public static RecentActivityItemType of(Short i) {
return map.get(i);
}
}

View File

@ -1,31 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum RecentActivityOrder implements DatabaseEnum<Short> {
UpdatedAt((short) 0),
Label((short) 1),
Status((short) 2);
private final Short value;
RecentActivityOrder(Short value) {
this.value = value;
}
@Override
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, RecentActivityOrder> map = EnumUtils.getEnumValueMap(RecentActivityOrder.class);
public static RecentActivityOrder of(Short i) {
return map.get(i);
}
}

View File

@ -1,27 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum ReferenceFieldDataType implements DatabaseEnum<Short> {
Text((short) 0),
Date((short) 1);
private final Short value;
ReferenceFieldDataType(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, ReferenceFieldDataType> map = EnumUtils.getEnumValueMap(ReferenceFieldDataType.class);
public static ReferenceFieldDataType of(Short i) {
return map.get(i);
}
}

View File

@ -1,28 +0,0 @@
package org.opencdmp.commons.enums;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum ReferenceSourceType implements DatabaseEnum<Short> {
Internal((short) 0),
External((short) 1);
private final Short value;
ReferenceSourceType(Short value) {
this.value = value;
}
@Override
public Short getValue() {
return value;
}
private static final Map<Short, ReferenceSourceType> map = EnumUtils.getEnumValueMap(ReferenceSourceType.class);
public static ReferenceSourceType of(Short i) {
return map.get(i);
}
}

View File

@ -1,30 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum StorageFilePermission implements DatabaseEnum<Short> {
Read((short) 0),
Write((short) 1);
private final Short value;
StorageFilePermission(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, StorageFilePermission> map = EnumUtils.getEnumValueMap(StorageFilePermission.class);
public static StorageFilePermission of(Short i) {
return map.get(i);
}
}

View File

@ -1,32 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum StorageType implements DatabaseEnum<Short> {
Temp((short) 0),
Main((short) 1),
Transformer((short)2),
Deposit((short)3);
private final Short value;
StorageType(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, StorageType> map = EnumUtils.getEnumValueMap(StorageType.class);
public static StorageType of(Short i) {
return map.get(i);
}
}

View File

@ -1,32 +0,0 @@
package org.opencdmp.commons.enums;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum SupportiveMaterialFieldType implements DatabaseEnum<Short> {
Faq((short) 0),
About((short) 1),
Glossary((short) 2),
TermsOfService((short) 3),
UserGuide((short) 4),
CookiePolicy((short) 5);
private final Short value;
SupportiveMaterialFieldType(Short value) {
this.value = value;
}
@Override
public Short getValue() {
return value;
}
private static final Map<Short, SupportiveMaterialFieldType> map = EnumUtils.getEnumValueMap(SupportiveMaterialFieldType.class);
public static SupportiveMaterialFieldType of(Short i) {
return map.get(i);
}
}

View File

@ -1,33 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum TenantConfigurationType implements DatabaseEnum<Short> {
DepositPlugins((short) 0),
FileTransformerPlugins((short) 1),
DefaultUserLocale((short) 2),
Logo((short) 3),
CssColors((short) 4);
private final Short value;
TenantConfigurationType(Short value) {
this.value = value;
}
@JsonValue
public Short getValue() {
return value;
}
private static final Map<Short, TenantConfigurationType> map = EnumUtils.getEnumValueMap(TenantConfigurationType.class);
public static TenantConfigurationType of(Short i) {
return map.get(i);
}
}

View File

@ -1,44 +0,0 @@
package org.opencdmp.commons.enums;
import com.fasterxml.jackson.annotation.JsonValue;
import org.opencdmp.data.converters.enums.DatabaseEnum;
import java.util.Map;
public enum UsageLimitTargetMetric implements DatabaseEnum<String> {
USER_COUNT(TargetMetrics.UserCount),
PLAN_COUNT(TargetMetrics.PlanCount),
BLUEPRINT_COUNT(TargetMetrics.BlueprintCount),
DESCRIPTION_COUNT(TargetMetrics.DescriptionCount),
DESCRIPTION_TEMPLATE_COUNT(TargetMetrics.DescriptionTemplateCount),
DESCRIPTION_TEMPLATE_TYPE_COUNT(TargetMetrics.DescriptionTemplateTypeCount),
PREFILLING_SOURCES_COUNT(TargetMetrics.PrefillingSourcesCount),
REFERENCE_TYPE_COUNT(TargetMetrics.ReferenceTypeCount);
private final String value;
public static class TargetMetrics {
public static final String UserCount = "user_count";
public static final String PlanCount = "plan_count";
public static final String BlueprintCount = "blueprint_count";
public static final String DescriptionCount = "description_count";
public static final String DescriptionTemplateCount = "description_template_count";
public static final String DescriptionTemplateTypeCount = "description_template_type_count";
public static final String PrefillingSourcesCount = "prefilling_sources_count";
public static final String ReferenceTypeCount = "reference_type_count";
}
UsageLimitTargetMetric(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return this.value;
}
private static final Map<String, UsageLimitTargetMetric> map = EnumUtils.getEnumValueMap(UsageLimitTargetMetric.class);
public static UsageLimitTargetMetric of(String i) {
return map.get(i);
}
}

Some files were not shown because too many files have changed in this diff Show More