Compare commits
74 Commits
Author | SHA1 | Date |
---|---|---|
luca.frosini | ce3c4af8eb | |
Luca Frosini | 8427224976 | |
Luca Frosini | 8eb0e30897 | |
Luca Frosini | 54b20686aa | |
Luca Frosini | 10b4c7dbf6 | |
Luca Frosini | d1ff03affc | |
Luca Frosini | f985363878 | |
Luca Frosini | abb21c3988 | |
Luca Frosini | 9e3bdeff3b | |
Luca Frosini | 84781a9a8d | |
Luca Frosini | 9f8e8a5f5e | |
Luca Frosini | 98eda28a8e | |
Luca Frosini | f00306cbb6 | |
Luca Frosini | 0fd88f657c | |
Luca Frosini | 9f182ededd | |
Luca Frosini | dd8874178d | |
Luca Frosini | 40ea1235d9 | |
Luca Frosini | ca752576bc | |
Luca Frosini | 587c0971ad | |
Luca Frosini | 3f29a00f05 | |
Luca Frosini | 13e9f7309e | |
Luca Frosini | 490619efe7 | |
Luca Frosini | 044d2edd05 | |
Luca Frosini | d6d373a94c | |
Luca Frosini | c28f0dcd65 | |
Luca Frosini | dbad160e36 | |
Luca Frosini | 6d37e4b939 | |
Luca Frosini | 75b55cc8bb | |
Luca Frosini | 2f284188c2 | |
Luca Frosini | 8d2ce659b3 | |
Luca Frosini | d61fbf77ef | |
Luca Frosini | 2083dfb95e | |
Luca Frosini | 8b710aef9b | |
Luca Frosini | 13097d3ab9 | |
Luca Frosini | d316a10887 | |
Luca Frosini | f08534b53f | |
Luca Frosini | 312f3945a5 | |
Luca Frosini | 1103c11626 | |
Luca Frosini | 745aaf417d | |
Luca Frosini | 0458379cb4 | |
Luca Frosini | 503a66596b | |
Luca Frosini | 51c91a3878 | |
Luca Frosini | 5c1e3bc164 | |
Luca Frosini | f6a7857875 | |
Luca Frosini | a9a927ab97 | |
Luca Frosini | ce0d1dd1a2 | |
Luca Frosini | 1940ec02b9 | |
Luca Frosini | 315287e885 | |
Luca Frosini | 1319930380 | |
Luca Frosini | 932cc783f5 | |
Luca Frosini | 2b984aa712 | |
Luca Frosini | eac93b33c5 | |
Luca Frosini | 0480a58130 | |
Luca Frosini | a9894c18a2 | |
Luca Frosini | e18d427efd | |
Luca Frosini | ac22e2dddb | |
Luca Frosini | 92b68df8c5 | |
Luca Frosini | 22d311d807 | |
Luca Frosini | 2b06179f12 | |
Luca Frosini | 8e0bdf0df3 | |
Luca Frosini | 0c0892337d | |
Luca Frosini | 043d55e2bb | |
Luca Frosini | 42b608d019 | |
Luca Frosini | ed467d1160 | |
Luca Frosini | 0e39b9aa85 | |
Luca Frosini | 255357bac4 | |
Luca Frosini | 1f60fa9f12 | |
Luca Frosini | 9105f4ba52 | |
lucio.lelii | 3519fc2888 | |
Luca Frosini | a2233d4de1 | |
Luca Frosini | 8d6214de7b | |
Luca Frosini | daede10445 | |
Luca Frosini | fbcbf7975c | |
Fabio Sinibaldi | b7a6b02820 |
|
@ -1,3 +1,4 @@
|
||||||
target
|
target
|
||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
|
/.DS_Store
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/org.eclipse.jdt.core.prefs
|
|
@ -1,4 +1,6 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
encoding//src/main/java=UTF-8
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
encoding//src/test/java=UTF-8
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding//src/test/resources=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
|
@ -1,12 +1,23 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
<wb-module deploy-name="grsf-publisher-ws">
|
|
||||||
|
<wb-module deploy-name="grsf-publisher-ws-1.12.1-SNAPSHOT">
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
<dependent-module archiveName="grsf-common-library-1.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/grsf-common-library/grsf-common-library">
|
<dependent-module archiveName="storagehub-model-1.1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/storagehub-model/storagehub-model">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="common-gcube-calls-1.3.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/common-gcube-calls/common-gcube-calls">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
|
||||||
<property name="context-root" value="grsf-publisher-ws"/>
|
<property name="context-root" value="grsf-publisher-ws"/>
|
||||||
|
|
||||||
<property name="java-output-path" value="/grsf-publisher-ws/target/classes"/>
|
<property name="java-output-path" value="/grsf-publisher-ws/target/classes"/>
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
</project-modules>
|
</project-modules>
|
||||||
|
|
62
CHANGELOG.md
62
CHANGELOG.md
|
@ -3,8 +3,38 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.13.3]
|
||||||
|
|
||||||
## [v1-12-0] [r4.24.0] - 2020-06-19
|
- Adding support for "FAO SDG 14.4.1 Questionnaire" source [#23670]
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.13.2]
|
||||||
|
|
||||||
|
- Migrated request to social-service-client [#23679]
|
||||||
|
- Added "Assessment Methods" as Group [#23409]
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.13.1]
|
||||||
|
|
||||||
|
- Aligned code and wiki to the new requirements [#23167]
|
||||||
|
- Changed group assign strategy [#23211] [#23215]
|
||||||
|
- Tag are added also to legacy records [#23216]
|
||||||
|
- Fixed code which generated groups id from name [#23215]
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.13.0]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added support to not include in records time dependant metadata [#21995]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Switched dependency management to gcube-bom 2.0.0
|
||||||
|
- Migrated code to storagehub [#21432]
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.12.0] - 2020-06-19
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
@ -12,19 +42,19 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
- [#19166] Added support for GRSF_pre VRE with the behaviour of GRSF Admin
|
- [#19166] Added support for GRSF_pre VRE with the behaviour of GRSF Admin
|
||||||
|
|
||||||
## [v1-11-0] - 2020-03-30
|
## [v1.11.0] - 2020-03-30
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- [#18293] Traceability flag is assigned only to Fishery records
|
- [#18293] Traceability flag is assigned only to Fishery records
|
||||||
|
|
||||||
## [v1-10-0] - 2019-11-11
|
## [v1.10.0] - 2019-11-11
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- [#17965] Tags longer than 100 characters are truncated instead of skipped
|
- [#17965] Tags longer than 100 characters are truncated instead of skipped
|
||||||
|
|
||||||
## [v1-9-0] - 2019-05-27
|
## [v1.9.0] - 2019-05-27
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -36,19 +66,19 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
- [#16395] Title is updated according to Stock/Fishery Name
|
- [#16395] Title is updated according to Stock/Fishery Name
|
||||||
|
|
||||||
## [v1-8-0] - 2019-02-26
|
## [v1.8.0] - 2019-02-26
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- [#12861] The sources in GRSF VRE are calculated using 'database_sources' field
|
- [#12861] The sources in GRSF VRE are calculated using 'database_sources' field
|
||||||
|
|
||||||
## [v1-7-0] - 2018-10-10
|
## [v1.7.0] - 2018-10-10
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- [#12510] Fixed pom to exclude libraries already provided by the container
|
- [#12510] Fixed pom to exclude libraries already provided by the container
|
||||||
|
|
||||||
## [v1-6-0] - 2018-07-18
|
## [v1.6.0] - 2018-07-18
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -63,47 +93,47 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
- [#11968] Changed 'State and trend of Marine Resource' to 'State and Trend'
|
- [#11968] Changed 'State and trend of Marine Resource' to 'State and Trend'
|
||||||
- [#11969] Changed 'Scientific advice' to 'Scientific Advice'
|
- [#11969] Changed 'Scientific advice' to 'Scientific Advice'
|
||||||
|
|
||||||
## [v1-5-0] - 2017-01-10
|
## [v1.5.0] - 2017-01-10
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Model enhancements
|
- Model enhancements
|
||||||
|
|
||||||
## [v1-4-0] - 2017-11-02
|
## [v1.4.0] - 2017-11-02
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Some fixes and improvements: added a common library between service and management widget
|
- Some fixes and improvements: added a common library between service and management widget
|
||||||
|
|
||||||
## [v1-3-0] - 2017-08-01
|
## [v1.3.0] - 2017-08-01
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Model upgrade
|
- Model upgrade
|
||||||
|
|
||||||
## [v1-2-0] - 2017-07-01
|
## [v1.2.0] - 2017-07-01
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- [#8719] Model changed
|
- [#8719] Model changed
|
||||||
|
|
||||||
## [v1-1-2] - 2017-05-15
|
## [v1.1.2] - 2017-05-15
|
||||||
|
|
||||||
- [#8719] Updates for ticket
|
- [#8719] Updates for ticket
|
||||||
- Minor fixes
|
- Minor fixes
|
||||||
|
|
||||||
## [v1-1-1] - 2017-04-02
|
## [v1.1.1] - 2017-04-02
|
||||||
|
|
||||||
- Minor fixes
|
- Minor fixes
|
||||||
|
|
||||||
## [v1-1-0] - 2017-02-28
|
## [v1.1.0] - 2017-02-28
|
||||||
|
|
||||||
- Model update
|
- Model update
|
||||||
|
|
||||||
## [v1-0-1] - 2017-02-10
|
## [v1.0.1] - 2017-02-10
|
||||||
|
|
||||||
- Minor fixes
|
- Minor fixes
|
||||||
|
|
||||||
## [v1-0-0] - 2016-12-10
|
## [v1.0.0] - 2016-12-10
|
||||||
|
|
||||||
- First Release
|
- First Release
|
||||||
|
|
71
pom.xml
71
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.data-catalogue</groupId>
|
<groupId>org.gcube.data-catalogue</groupId>
|
||||||
<artifactId>grsf-publisher-ws</artifactId>
|
<artifactId>grsf-publisher-ws</artifactId>
|
||||||
<version>1.12.0</version>
|
<version>1.13.3</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>grsf-publisher-ws</name>
|
<name>grsf-publisher-ws</name>
|
||||||
<description>Utility library to publish GRSF products on GRSF catalogue.</description>
|
<description>Utility library to publish GRSF products on GRSF catalogue.</description>
|
||||||
|
@ -19,13 +19,14 @@
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<version.jersey>2.22.4</version.jersey>
|
<version.jersey>2.22.4</version.jersey>
|
||||||
<version.jackson>2.6.0</version.jackson>
|
<version.jackson>2.8.11</version.jackson>
|
||||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
<distroDirectory>distro</distroDirectory>
|
<distroDirectory>distro</distroDirectory>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<jsoup.version>1.10.1</jsoup.version>
|
<jsoup.version>1.10.1</jsoup.version>
|
||||||
<serviceClass>DataPublishing</serviceClass>
|
<serviceClass>DataPublishing</serviceClass>
|
||||||
|
<maven.compiler.release>8</maven.compiler.release>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -35,18 +36,11 @@
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.distribution</groupId>
|
|
||||||
<artifactId>gcube-bom</artifactId>
|
|
||||||
<version>1.3.1</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>gcube-smartgears-bom</artifactId>
|
<artifactId>gcube-smartgears-bom</artifactId>
|
||||||
<version>1.0.2</version>
|
<version>2.2.0</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -57,7 +51,16 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.data-catalogue</groupId>
|
<groupId>org.gcube.data-catalogue</groupId>
|
||||||
<artifactId>grsf-common-library</artifactId>
|
<artifactId>grsf-common-library</artifactId>
|
||||||
<version>[1-0-0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>storagehub-client-library</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.social-networking</groupId>
|
||||||
|
<artifactId>social-service-client</artifactId>
|
||||||
|
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -107,12 +110,7 @@
|
||||||
<artifactId>authorization-client</artifactId>
|
<artifactId>authorization-client</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.common</groupId>
|
|
||||||
<artifactId>home-library-jcr</artifactId>
|
|
||||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
<artifactId>common-authorization</artifactId>
|
<artifactId>common-authorization</artifactId>
|
||||||
|
@ -121,32 +119,26 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.containers</groupId>
|
<groupId>org.glassfish.jersey.containers</groupId>
|
||||||
<artifactId>jersey-container-servlet-core</artifactId>
|
<artifactId>jersey-container-servlet-core</artifactId>
|
||||||
<version>${version.jersey}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.media</groupId>
|
<groupId>org.glassfish.jersey.media</groupId>
|
||||||
<artifactId>jersey-media-json-jackson</artifactId>
|
<artifactId>jersey-media-json-jackson</artifactId>
|
||||||
<version>${version.jersey}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.media</groupId>
|
<groupId>org.glassfish.jersey.media</groupId>
|
||||||
<artifactId>jersey-media-json-processing</artifactId>
|
<artifactId>jersey-media-json-processing</artifactId>
|
||||||
<version>${version.jersey}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.media</groupId>
|
<groupId>org.glassfish.jersey.media</groupId>
|
||||||
<artifactId>jersey-media-multipart</artifactId>
|
<artifactId>jersey-media-multipart</artifactId>
|
||||||
<version>${version.jersey}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.media</groupId>
|
<groupId>org.glassfish.jersey.media</groupId>
|
||||||
<artifactId>jersey-media-sse</artifactId>
|
<artifactId>jersey-media-sse</artifactId>
|
||||||
<version>${version.jersey}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.ext</groupId>
|
<groupId>org.glassfish.jersey.ext</groupId>
|
||||||
<artifactId>jersey-bean-validation</artifactId>
|
<artifactId>jersey-bean-validation</artifactId>
|
||||||
<version>${version.jersey}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
|
@ -164,39 +156,26 @@
|
||||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||||
<version>${version.jackson}</version>
|
<version>${version.jackson}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-annotations</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<!-- SmartGears -->
|
<!-- SmartGears -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-smartgears</artifactId>
|
<artifactId>common-smartgears</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.common</groupId>
|
|
||||||
<artifactId>home-library</artifactId>
|
|
||||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
|
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
|
||||||
<artifactId>jersey-test-framework-provider-jetty</artifactId>
|
<artifactId>jersey-test-framework-provider-jetty</artifactId>
|
||||||
<version>2.23.2</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Added to support Java 11 JDK -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- END Added to support Java 11 JDK -->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -21,8 +21,8 @@ public @interface Group {
|
||||||
String condition() default "";
|
String condition() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this value is set, it is the name of the group (apart the source, i.e. "grsf", "ram", "firms", "fishsource" that will be prepended) to which the
|
* If this value is set, it is used as name of the group in place of the filed value.
|
||||||
* record needs to be put.
|
* (apart the source, i.e. "grsf", "ram", "firms", "fishsource" that will be prepended depending on prependSourceToGroupName)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String groupNameOverValue() default "";
|
String groupNameOverValue() default "";
|
||||||
|
@ -32,6 +32,6 @@ public @interface Group {
|
||||||
* Set to false to avoid source prepending
|
* Set to false to avoid source prepending
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean prependSourceToGroupName() default true;
|
boolean prependSourceToGroupName() default false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,12 +202,18 @@ public abstract class Base {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Base [catalogId=" + catalogId + ", description=" + description
|
return "Base ["
|
||||||
+ ", license=" + license + ", author=" + author
|
+ "catalogId=" + catalogId
|
||||||
+ ", authorContact=" + authorContact + ", version=" + version
|
+ ", description=" + description
|
||||||
+ ", maintainer=" + maintainer + ", maintainerContact="
|
+ ", license=" + license
|
||||||
+ maintainerContact + ", extrasFields=" + extrasFields
|
+ ", author=" + author
|
||||||
+ ", extrasResources=" + extrasResources + "]";
|
+ ", authorContact=" + authorContact
|
||||||
|
+ ", version=" + version
|
||||||
|
+ ", maintainer=" + maintainer
|
||||||
|
+ ", maintainerContact=" + maintainerContact
|
||||||
|
+ ", extrasFields=" + extrasFields
|
||||||
|
+ ", extrasResources=" + extrasResources
|
||||||
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -28,13 +28,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class Common extends Base{
|
public abstract class Common extends Base {
|
||||||
|
|
||||||
@JsonProperty(Constants.DATA_OWNER_JSON_KEY)
|
@JsonProperty(Constants.DATA_OWNER_JSON_KEY)
|
||||||
@CustomField(key=Constants.DATA_OWNER_CUSTOM_KEY)
|
@CustomField(key=Constants.DATA_OWNER_CUSTOM_KEY)
|
||||||
private List<String> dataOwner;
|
private List<String> dataOwner;
|
||||||
|
|
||||||
@JsonProperty(Constants.DATABASE_SOURCES_JSON_KEY)
|
@JsonProperty(Constants.DATABASE_SOURCES_JSON_KEY)
|
||||||
|
@CustomField(key=Constants.DATABASE_SOURCES_CUSTOM_KEY)
|
||||||
@CkanResource
|
@CkanResource
|
||||||
@Valid
|
@Valid
|
||||||
private List<Resource<Sources>> databaseSources;
|
private List<Resource<Sources>> databaseSources;
|
||||||
|
@ -54,7 +55,7 @@ public abstract class Common extends Base{
|
||||||
|
|
||||||
@JsonProperty(Constants.SDG_FLAG_JSON_KEY)
|
@JsonProperty(Constants.SDG_FLAG_JSON_KEY)
|
||||||
@CustomField(key=Constants.SDG_FLAG_CUSTOM_KEY)
|
@CustomField(key=Constants.SDG_FLAG_CUSTOM_KEY)
|
||||||
@Group(condition="true", groupNameOverValue=Constants.SDG_FLAG_GROUP_NAME) // record is added to group grsf-sdg-flag if sdg Flag is true
|
@Group(condition="true", groupNameOverValue=Constants.SDG_FLAG_GROUP_NAME, prependSourceToGroupName=false) // record is added to group grsf-sdg-flag if sdg Flag is true
|
||||||
private Boolean sdgFlag;
|
private Boolean sdgFlag;
|
||||||
|
|
||||||
@JsonProperty(Constants.STATUS_OF_THE_GRSF_RECORD_JSON_KEY)
|
@JsonProperty(Constants.STATUS_OF_THE_GRSF_RECORD_JSON_KEY)
|
||||||
|
@ -88,10 +89,6 @@ public abstract class Common extends Base{
|
||||||
@CustomField(key=Constants.SIMILAR_GRSF_RECORDS_CUSTOM_KEY)
|
@CustomField(key=Constants.SIMILAR_GRSF_RECORDS_CUSTOM_KEY)
|
||||||
private List<SimilarRecordBean> similarGRSFRecords;
|
private List<SimilarRecordBean> similarGRSFRecords;
|
||||||
|
|
||||||
@JsonProperty(Constants.SIMILAR_SOURCE_RECORDS_JSON_KEY)
|
|
||||||
@CustomField(key=Constants.SIMILAR_SOURCE_RECORDS_CUSTOM_KEY)
|
|
||||||
private List<SimilarRecordBean> similarSourceRecords;
|
|
||||||
|
|
||||||
// automatically set
|
// automatically set
|
||||||
@CustomField(key=Constants.DOMAIN_CUSTOM_KEY)
|
@CustomField(key=Constants.DOMAIN_CUSTOM_KEY)
|
||||||
private String domain;
|
private String domain;
|
||||||
|
@ -113,7 +110,11 @@ public abstract class Common extends Base{
|
||||||
@JsonProperty(Constants.CONNECTED_JSON_KEY)
|
@JsonProperty(Constants.CONNECTED_JSON_KEY)
|
||||||
@CustomField(key=Constants.CONNECTED_CUSTOM_KEY)
|
@CustomField(key=Constants.CONNECTED_CUSTOM_KEY)
|
||||||
private List<String> connectedBeans;
|
private List<String> connectedBeans;
|
||||||
|
|
||||||
|
@JsonProperty(Constants.CONNECTIONS_INDICATOR)
|
||||||
|
@Tag
|
||||||
|
private String connectionsIndicator;
|
||||||
|
|
||||||
@JsonProperty(Constants.ANNOTATION_PUBLISHER_JSON_KEY)
|
@JsonProperty(Constants.ANNOTATION_PUBLISHER_JSON_KEY)
|
||||||
@CustomField(key=Constants.ANNOTATION_PUBLISHER_CUSTOM_KEY)
|
@CustomField(key=Constants.ANNOTATION_PUBLISHER_CUSTOM_KEY)
|
||||||
private List<AnnotationBean> annotations;
|
private List<AnnotationBean> annotations;
|
||||||
|
@ -122,10 +123,6 @@ public abstract class Common extends Base{
|
||||||
@Tag
|
@Tag
|
||||||
private String similaritiesIndicator;
|
private String similaritiesIndicator;
|
||||||
|
|
||||||
@JsonProperty(Constants.CONNECTIONS_INDICATOR)
|
|
||||||
@Tag
|
|
||||||
private String connectionsIndicator;
|
|
||||||
|
|
||||||
@JsonProperty(Constants.CITATION_JSON_KEY)
|
@JsonProperty(Constants.CITATION_JSON_KEY)
|
||||||
@CustomField(key=Constants.CITATION_CUSTOM_KEY)
|
@CustomField(key=Constants.CITATION_CUSTOM_KEY)
|
||||||
private String citation;
|
private String citation;
|
||||||
|
@ -180,7 +177,6 @@ public abstract class Common extends Base{
|
||||||
this.landings = landings;
|
this.landings = landings;
|
||||||
this.species = species;
|
this.species = species;
|
||||||
this.similarGRSFRecords = similarGRSFRecords;
|
this.similarGRSFRecords = similarGRSFRecords;
|
||||||
this.similarSourceRecords = similarSourceRecords;
|
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.managementBodyAuthorities = managementBodyAuthorities;
|
this.managementBodyAuthorities = managementBodyAuthorities;
|
||||||
|
@ -228,6 +224,7 @@ public abstract class Common extends Base{
|
||||||
public void setRefersTo(List<RefersToBean> refersTo) {
|
public void setRefersTo(List<RefersToBean> refersTo) {
|
||||||
this.refersTo = refersTo;
|
this.refersTo = refersTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Resource<Sources>> getDatabaseSources() {
|
public List<Resource<Sources>> getDatabaseSources() {
|
||||||
return databaseSources;
|
return databaseSources;
|
||||||
}
|
}
|
||||||
|
@ -300,14 +297,6 @@ public abstract class Common extends Base{
|
||||||
this.similarGRSFRecords = similarGRSFRecords;
|
this.similarGRSFRecords = similarGRSFRecords;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SimilarRecordBean> getSimilarSourceRecords() {
|
|
||||||
return similarSourceRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSimilarSourceRecords(List<SimilarRecordBean> similarSourceRecords) {
|
|
||||||
this.similarSourceRecords = similarSourceRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSpatial() {
|
public String getSpatial() {
|
||||||
return spatial;
|
return spatial;
|
||||||
}
|
}
|
||||||
|
@ -367,17 +356,28 @@ public abstract class Common extends Base{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Common [dataOwner=" + dataOwner + ", databaseSources="
|
return super.toString() + " - Common ["
|
||||||
+ databaseSources + ", sourceOfInformation="
|
+ " dataOwner=" + dataOwner
|
||||||
+ sourceOfInformation + ", refersTo=" + refersTo
|
+ ", databaseSources=" + databaseSources
|
||||||
+ ", shortName=" + shortName + ", sdgFlag=" + sdgFlag + ", status="
|
+ ", sourceOfInformation=" + sourceOfInformation
|
||||||
+ status + ", systemType=" + systemType + ", catches="
|
+ ", refersTo=" + refersTo
|
||||||
+ catches + ", landings=" + landings + ", species=" + species
|
+ ", shortName=" + shortName
|
||||||
|
+ ", sdgFlag=" + sdgFlag
|
||||||
|
+ ", status=" + status
|
||||||
|
+ ", systemType=" + systemType
|
||||||
|
+ ", catches=" + catches
|
||||||
|
+ ", landings=" + landings
|
||||||
|
+ ", species=" + species
|
||||||
+ ", similarGRSFRecords=" + similarGRSFRecords
|
+ ", similarGRSFRecords=" + similarGRSFRecords
|
||||||
+ ", similarSourceRecords=" + similarSourceRecords
|
+ ", domain=" + domain
|
||||||
+ ", domain=" + domain + ", uuid=" + uuid
|
+ ", uuid=" + uuid
|
||||||
+ ", managementBodyAuthorities=" + managementBodyAuthorities
|
+ ", managementBodyAuthorities=" + managementBodyAuthorities
|
||||||
+ ", spatial=" + spatial + ", connectedBeans=" + connectedBeans
|
+ ", spatial=" + spatial
|
||||||
+ ", annotations=" + annotations + "]";
|
+ ", connectedBeans=" + connectedBeans
|
||||||
|
+ ", annotations=" + annotations
|
||||||
|
+ ", similaritiesIndicator=" + similaritiesIndicator
|
||||||
|
+ ", connectionsIndicator=" + connectionsIndicator
|
||||||
|
+ ", citation=" + citation
|
||||||
|
+ "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,38 +21,35 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
*/
|
*/
|
||||||
public class FisheryRecord extends Common {
|
public class FisheryRecord extends Common {
|
||||||
|
|
||||||
@JsonProperty(Constants.TRACEABILITY_FLAG_JSON_KEY)
|
|
||||||
@CustomField(key=Constants.TRACEABILITY_FLAG_CUSTOM_KEY)
|
|
||||||
@Group(condition="true", groupNameOverValue=Constants.TRACEABILITY_FLAG_GROUP_NAME) // record is added to group grsf-traceability-flag if Traceability Flag is true
|
|
||||||
private Boolean traceabilityFlag;
|
|
||||||
|
|
||||||
@JsonProperty(Constants.FISHERY_NAME_JSON_KEY)
|
@JsonProperty(Constants.FISHERY_NAME_JSON_KEY)
|
||||||
|
@CustomField(key=Constants.FISHERY_NAME_CUSTOM_KEY)
|
||||||
@NotNull(message="fishery_name cannot be null")
|
@NotNull(message="fishery_name cannot be null")
|
||||||
@Size(min=1, message="fishery_name cannot be empty")
|
@Size(min=1, message="fishery_name cannot be empty")
|
||||||
@CustomField(key=Constants.FISHERY_NAME_CUSTOM_KEY)
|
|
||||||
private String fisheryName;
|
private String fisheryName;
|
||||||
|
|
||||||
@JsonProperty(Constants.GRSF_SEMANTIC_IDENTIFIER_JSON_KEY)
|
@JsonProperty(Constants.GRSF_SEMANTIC_IDENTIFIER_JSON_KEY)
|
||||||
@CustomField(key=Constants.GRSF_SEMANTIC_IDENTIFIER_CUSTOM_KEY)
|
@CustomField(key=Constants.GRSF_SEMANTIC_IDENTIFIER_CUSTOM_KEY)
|
||||||
private String fisheryId;
|
private String fisheryId;
|
||||||
|
|
||||||
|
@JsonProperty(Constants.TRACEABILITY_FLAG_JSON_KEY)
|
||||||
|
@CustomField(key=Constants.TRACEABILITY_FLAG_CUSTOM_KEY)
|
||||||
|
@Group(condition="true", groupNameOverValue=Constants.TRACEABILITY_FLAG_GROUP_NAME, prependSourceToGroupName=false) // record is added to group grsf-traceability-flag if Traceability Flag is true
|
||||||
|
private Boolean traceabilityFlag;
|
||||||
|
|
||||||
@JsonProperty(Constants.FISHING_AREA_JSON_KEY)
|
@JsonProperty(Constants.FISHING_AREA_JSON_KEY)
|
||||||
@CustomField(key=Constants.FISHING_AREA_CUSTOM_KEY)
|
@CustomField(key=Constants.FISHING_AREA_CUSTOM_KEY)
|
||||||
@Tag
|
@Tag
|
||||||
private List<String> fishingArea;
|
private List<String> fishingArea;
|
||||||
|
|
||||||
|
@JsonProperty(Constants.JURISDICTION_AREA_JSON_KEY)
|
||||||
|
@CustomField(key=Constants.JURISDICTION_AREA_CUSTOM_KEY)
|
||||||
|
@Tag
|
||||||
|
private List<String> jurisdictionArea;
|
||||||
|
|
||||||
@JsonProperty(Constants.RESOURCES_EXPLOITED_JSON_KEY)
|
@JsonProperty(Constants.RESOURCES_EXPLOITED_JSON_KEY)
|
||||||
@CustomField(key=Constants.RESOURCES_EXPLOITED_CUSTOM_KEY)
|
@CustomField(key=Constants.RESOURCES_EXPLOITED_CUSTOM_KEY)
|
||||||
private List<String> resourcesExploited;
|
private List<String> resourcesExploited;
|
||||||
|
|
||||||
@JsonProperty(Constants.JURISDICTION_AREA_JSON_KEY)
|
|
||||||
@CustomField(key=Constants.JURISDICTION_AREA_CUSTOM_KEY)
|
|
||||||
private List<String> jurisdictionArea;
|
|
||||||
|
|
||||||
@JsonProperty(Constants.PRODUCTION_SYSTEM_TYPE_JSON_KEY)
|
|
||||||
@CustomField(key=Constants.PRODUCTION_SYSTEM_TYPE_CUSTOM_KEY)
|
|
||||||
private List<Production_System_Type> productionSystemType;
|
|
||||||
|
|
||||||
@JsonProperty(Constants.FLAG_STATE_JSON_KEY)
|
@JsonProperty(Constants.FLAG_STATE_JSON_KEY)
|
||||||
@CustomField(key=Constants.FLAG_STATE_CUSTOM_KEY)
|
@CustomField(key=Constants.FLAG_STATE_CUSTOM_KEY)
|
||||||
@Tag
|
@Tag
|
||||||
|
@ -65,7 +62,6 @@ public class FisheryRecord extends Common {
|
||||||
|
|
||||||
@JsonProperty(Constants.GRSF_TYPE_JSON_KEY)
|
@JsonProperty(Constants.GRSF_TYPE_JSON_KEY)
|
||||||
@CustomField(key=Constants.GRSF_TYPE_CUSTOM_KEY)
|
@CustomField(key=Constants.GRSF_TYPE_CUSTOM_KEY)
|
||||||
@Group
|
|
||||||
@Tag
|
@Tag
|
||||||
private Fishery_Type type;
|
private Fishery_Type type;
|
||||||
|
|
||||||
|
@ -97,7 +93,6 @@ public class FisheryRecord extends Common {
|
||||||
this.fishingArea = fishingArea;
|
this.fishingArea = fishingArea;
|
||||||
this.resourcesExploited = resourcesExploited;
|
this.resourcesExploited = resourcesExploited;
|
||||||
this.jurisdictionArea = jurisdictionArea;
|
this.jurisdictionArea = jurisdictionArea;
|
||||||
this.productionSystemType = productionSystemType;
|
|
||||||
this.flagState = flagState;
|
this.flagState = flagState;
|
||||||
this.fishingGear = fishingGear;
|
this.fishingGear = fishingGear;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -165,15 +160,6 @@ public class FisheryRecord extends Common {
|
||||||
this.resourcesExploited = resourcesExploited;
|
this.resourcesExploited = resourcesExploited;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Production_System_Type> getProductionSystemType() {
|
|
||||||
return productionSystemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductionSystemType(
|
|
||||||
List<Production_System_Type> productionSystemType) {
|
|
||||||
this.productionSystemType = productionSystemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getFlagState() {
|
public List<String> getFlagState() {
|
||||||
return flagState;
|
return flagState;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +183,6 @@ public class FisheryRecord extends Common {
|
||||||
+ ", traceabilityFlag=" + traceabilityFlag
|
+ ", traceabilityFlag=" + traceabilityFlag
|
||||||
+ ", resourcesExploited=" + resourcesExploited
|
+ ", resourcesExploited=" + resourcesExploited
|
||||||
+ ", jurisdictionArea=" + jurisdictionArea
|
+ ", jurisdictionArea=" + jurisdictionArea
|
||||||
+ ", productionSystemType=" + productionSystemType
|
|
||||||
+ ", flagState=" + flagState + ", fishingGear=" + fishingGear
|
+ ", flagState=" + flagState + ", fishingGear=" + fishingGear
|
||||||
+ ", type=" + type + "]";
|
+ ", type=" + type + "]";
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
public class StockRecord extends Common{
|
public class StockRecord extends Common{
|
||||||
|
|
||||||
@JsonProperty(Constants.STOCK_NAME_JSON_KEY)
|
@JsonProperty(Constants.STOCK_NAME_JSON_KEY)
|
||||||
|
@CustomField(key=Constants.STOCK_NAME_CUSTOM_KEY)
|
||||||
@NotNull(message=Constants.STOCK_NAME_JSON_KEY + " cannot be null")
|
@NotNull(message=Constants.STOCK_NAME_JSON_KEY + " cannot be null")
|
||||||
@Size(min=2, message=Constants.STOCK_NAME_JSON_KEY + " cannot be empty")
|
@Size(min=2, message=Constants.STOCK_NAME_JSON_KEY + " cannot be empty")
|
||||||
@CustomField(key=Constants.STOCK_NAME_CUSTOM_KEY)
|
|
||||||
private String stockName;
|
private String stockName;
|
||||||
|
|
||||||
@JsonProperty(Constants.GRSF_SEMANTIC_IDENTIFIER_JSON_KEY)
|
@JsonProperty(Constants.GRSF_SEMANTIC_IDENTIFIER_JSON_KEY)
|
||||||
|
@ -46,6 +46,7 @@ public class StockRecord extends Common{
|
||||||
|
|
||||||
@JsonProperty(Constants.ASSESSMENT_METHODS_JSON_KEY)
|
@JsonProperty(Constants.ASSESSMENT_METHODS_JSON_KEY)
|
||||||
@CustomField(key=Constants.ASSESSMENT_METHODS_CUSTOM_KEY)
|
@CustomField(key=Constants.ASSESSMENT_METHODS_CUSTOM_KEY)
|
||||||
|
@Group(groupNameOverValue=Constants.ASSESSMENT_METHODS_CUSTOM_KEY, prependSourceToGroupName=false)
|
||||||
private List<String> assessmentMethods;
|
private List<String> assessmentMethods;
|
||||||
|
|
||||||
@JsonProperty(Constants.FIRMS_ABUNDANCE_LEVEL_JSON_KEY)
|
@JsonProperty(Constants.FIRMS_ABUNDANCE_LEVEL_JSON_KEY)
|
||||||
|
@ -99,8 +100,9 @@ public class StockRecord extends Common{
|
||||||
|
|
||||||
@JsonProperty(Constants.SCIENTIFIC_ADVICE_JSON_KEY)
|
@JsonProperty(Constants.SCIENTIFIC_ADVICE_JSON_KEY)
|
||||||
@CustomField(key=Constants.SCIENTIFIC_ADVICE_CUSTOM_KEY)
|
@CustomField(key=Constants.SCIENTIFIC_ADVICE_CUSTOM_KEY)
|
||||||
|
@TimeSeries
|
||||||
@Group(groupNameOverValue=Constants.SCIENTIFIC_ADVICE_CUSTOM_KEY, prependSourceToGroupName=false)
|
@Group(groupNameOverValue=Constants.SCIENTIFIC_ADVICE_CUSTOM_KEY, prependSourceToGroupName=false)
|
||||||
private List<String> scientificAdvice;
|
private List<TimeSeriesBean<String, Void>> scientificAdvice;
|
||||||
|
|
||||||
@JsonProperty(Constants.ASSESSOR_JSON_KEY)
|
@JsonProperty(Constants.ASSESSOR_JSON_KEY)
|
||||||
@CustomField(key=Constants.ASSESSOR_CUSTOM_KEY)
|
@CustomField(key=Constants.ASSESSOR_CUSTOM_KEY)
|
||||||
|
@ -108,7 +110,6 @@ public class StockRecord extends Common{
|
||||||
|
|
||||||
@JsonProperty(Constants.GRSF_TYPE_JSON_KEY)
|
@JsonProperty(Constants.GRSF_TYPE_JSON_KEY)
|
||||||
@CustomField(key=Constants.GRSF_TYPE_CUSTOM_KEY)
|
@CustomField(key=Constants.GRSF_TYPE_CUSTOM_KEY)
|
||||||
@Group
|
|
||||||
@Tag
|
@Tag
|
||||||
private Stock_Type type;
|
private Stock_Type type;
|
||||||
|
|
||||||
|
@ -146,7 +147,7 @@ public class StockRecord extends Common{
|
||||||
List<TimeSeriesBean<String, String>> fishingPressure,
|
List<TimeSeriesBean<String, String>> fishingPressure,
|
||||||
List<TimeSeriesBean<String, Void>> narrativeState,
|
List<TimeSeriesBean<String, Void>> narrativeState,
|
||||||
List<TimeSeriesBean<String, Void>> faoState,
|
List<TimeSeriesBean<String, Void>> faoState,
|
||||||
List<String> scientificAdvice, String assessor, Stock_Type type) {
|
List<TimeSeriesBean<String, Void>> scientificAdvice, String assessor, Stock_Type type) {
|
||||||
super();
|
super();
|
||||||
this.stockName = stockName;
|
this.stockName = stockName;
|
||||||
this.stockId = stockId;
|
this.stockId = stockId;
|
||||||
|
@ -262,11 +263,11 @@ public class StockRecord extends Common{
|
||||||
this.narrativeState = narrativeState;
|
this.narrativeState = narrativeState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getScientificAdvice() {
|
public List<TimeSeriesBean<String, Void>> getScientificAdvice() {
|
||||||
return scientificAdvice;
|
return scientificAdvice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScientificAdvice(List<String> scientificAdvice) {
|
public void setScientificAdvice(List<TimeSeriesBean<String, Void>> scientificAdvice) {
|
||||||
this.scientificAdvice = scientificAdvice;
|
this.scientificAdvice = scientificAdvice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ import eu.trentorise.opendata.jackan.model.CkanDataset;
|
||||||
* @author Costantino Perciante (ISTI - CNR)
|
* @author Costantino Perciante (ISTI - CNR)
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
@Path("{source:firms|FIRMS|grsf|GRSF|FishSource|fishsource}/fishery/")
|
@Path("{source:firms|FIRMS|grsf|GRSF|FishSource|fishsource|sdg|SDG}/fishery/")
|
||||||
public class GrsfPublisherFisheryService {
|
public class GrsfPublisherFisheryService {
|
||||||
|
|
||||||
// the context
|
// the context
|
||||||
|
@ -257,7 +257,7 @@ public class GrsfPublisherFisheryService {
|
||||||
String type = fisheryInCkan.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY);
|
String type = fisheryInCkan.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY);
|
||||||
|
|
||||||
if((fisheryInCkan.getOrganization().getName().equalsIgnoreCase(source)
|
if((fisheryInCkan.getOrganization().getName().equalsIgnoreCase(source)
|
||||||
|| fisheryInCkan.getOrganization().getName().toLowerCase().contains(source))
|
|| fisheryInCkan.getOrganization().getName().toLowerCase().startsWith(source.toLowerCase()))
|
||||||
&& Product_Type.FISHERY.getOrigName().equals(type)) {
|
&& Product_Type.FISHERY.getOrigName().equals(type)) {
|
||||||
|
|
||||||
logger.debug("Ok, this is a fishery of the right source, removing it");
|
logger.debug("Ok, this is a fishery of the right source, removing it");
|
||||||
|
@ -551,7 +551,7 @@ public class GrsfPublisherFisheryService {
|
||||||
|
|
||||||
// check system type
|
// check system type
|
||||||
boolean isGRSF = !record.getExtrasAsHashMap().get(Constants.SYSTEM_TYPE_CUSTOM_KEY)
|
boolean isGRSF = !record.getExtrasAsHashMap().get(Constants.SYSTEM_TYPE_CUSTOM_KEY)
|
||||||
.equals(Constants.SYSTEM_TYPE_FOR_SOURCES_VALUE);
|
.equals(Constants.SYSTEM_TYPE_LEGACY_RECORD);
|
||||||
|
|
||||||
if(!isGRSF)
|
if(!isGRSF)
|
||||||
throw new Exception("You are trying to modify a Legacy record!");
|
throw new Exception("You are trying to modify a Legacy record!");
|
||||||
|
|
|
@ -51,7 +51,7 @@ import eu.trentorise.opendata.jackan.model.CkanDataset;
|
||||||
* @author Costantino Perciante (ISTI - CNR)
|
* @author Costantino Perciante (ISTI - CNR)
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
@Path("{source:firms|FIRMS|ram|RAM|grsf|GRSF|FishSource|fishsource}/stock/")
|
@Path("{source:firms|FIRMS|ram|RAM|grsf|GRSF|FishSource|fishsource|sdg|SDG}/stock/")
|
||||||
public class GrsfPublisherStockService {
|
public class GrsfPublisherStockService {
|
||||||
|
|
||||||
// the context
|
// the context
|
||||||
|
@ -260,7 +260,7 @@ public class GrsfPublisherStockService {
|
||||||
// check it is in the right source and it is a stock
|
// check it is in the right source and it is a stock
|
||||||
String type = stockInCkan.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY);
|
String type = stockInCkan.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY);
|
||||||
if((stockInCkan.getOrganization().getName().equalsIgnoreCase(source)
|
if((stockInCkan.getOrganization().getName().equalsIgnoreCase(source)
|
||||||
|| stockInCkan.getOrganization().getName().toLowerCase().contains(source))
|
|| stockInCkan.getOrganization().getName().toLowerCase().startsWith(source.toLowerCase()))
|
||||||
&& Product_Type.STOCK.getOrigName().equals(type)) {
|
&& Product_Type.STOCK.getOrigName().equals(type)) {
|
||||||
|
|
||||||
logger.debug("Ok, this is a stock of the right type, removing it");
|
logger.debug("Ok, this is a stock of the right type, removing it");
|
||||||
|
@ -554,7 +554,7 @@ public class GrsfPublisherStockService {
|
||||||
|
|
||||||
// check system type
|
// check system type
|
||||||
boolean isGRSF = !record.getExtrasAsHashMap().get(Constants.SYSTEM_TYPE_CUSTOM_KEY)
|
boolean isGRSF = !record.getExtrasAsHashMap().get(Constants.SYSTEM_TYPE_CUSTOM_KEY)
|
||||||
.equals(Constants.SYSTEM_TYPE_FOR_SOURCES_VALUE);
|
.equals(Constants.SYSTEM_TYPE_LEGACY_RECORD);
|
||||||
|
|
||||||
if(!isGRSF)
|
if(!isGRSF)
|
||||||
throw new Exception("You are trying to modify a Legacy record!");
|
throw new Exception("You are trying to modify a Legacy record!");
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.beans.PropertyDescriptor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -36,7 +35,6 @@ import org.gcube.datacatalogue.common.Constants;
|
||||||
import org.gcube.datacatalogue.common.enums.Product_Type;
|
import org.gcube.datacatalogue.common.enums.Product_Type;
|
||||||
import org.gcube.datacatalogue.common.enums.Sources;
|
import org.gcube.datacatalogue.common.enums.Sources;
|
||||||
import org.gcube.datacatalogue.common.enums.Status;
|
import org.gcube.datacatalogue.common.enums.Status;
|
||||||
import org.gcube.datacatalogue.common.enums.Stock_Type;
|
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -219,6 +217,90 @@ public class CommonServiceUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String GROUP_SUFFIX = "-group";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a group name to its id on ckan
|
||||||
|
* @param origName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String getGroupIDOnCkan(String origName){
|
||||||
|
if(origName == null) {
|
||||||
|
throw new IllegalArgumentException("origName cannot be null");
|
||||||
|
}
|
||||||
|
String modified = origName.replaceAll("\\(", "");
|
||||||
|
modified = modified.replaceAll("\\)", "");
|
||||||
|
modified = modified.trim().toLowerCase().replaceAll("[^A-Za-z0-9-]", "-");
|
||||||
|
if(modified.startsWith("-")) {
|
||||||
|
modified = modified.substring(1);
|
||||||
|
}
|
||||||
|
if(modified.endsWith("-")) {
|
||||||
|
modified = modified.substring(0, modified.length() -1);
|
||||||
|
}
|
||||||
|
return modified;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getGroupId(String groupName) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append(groupName);
|
||||||
|
/*
|
||||||
|
* The "_group" suffix is added to all groups to
|
||||||
|
* avoid issues on groups and organizations having the same name
|
||||||
|
* e.g. RAM organization (id=ram) and RAM group (id=ram_group)
|
||||||
|
*/
|
||||||
|
if(!groupName.endsWith(GROUP_SUFFIX)) {
|
||||||
|
stringBuffer.append(GROUP_SUFFIX);
|
||||||
|
}
|
||||||
|
return getGroupIDOnCkan(stringBuffer.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addGroup(Group group, Sources source, String value, Set<String> groups) {
|
||||||
|
String conditionToCheck = group.condition();
|
||||||
|
String groupNameOverValue = group.groupNameOverValue();
|
||||||
|
boolean prependSource = group.prependSourceToGroupName();
|
||||||
|
|
||||||
|
boolean match = conditionToCheck.isEmpty() ? true
|
||||||
|
: value.matches(conditionToCheck);
|
||||||
|
|
||||||
|
if(match) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
if(prependSource) {
|
||||||
|
stringBuffer.append(source.getURLPath());
|
||||||
|
stringBuffer.append(" ");
|
||||||
|
}
|
||||||
|
if(groupNameOverValue.isEmpty()) {
|
||||||
|
stringBuffer.append(value);
|
||||||
|
}else {
|
||||||
|
stringBuffer.append(groupNameOverValue);
|
||||||
|
}
|
||||||
|
String groupId = getGroupId(stringBuffer.toString());
|
||||||
|
groups.add(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the record to the group of sources
|
||||||
|
* @param groups
|
||||||
|
* @param sourcesList
|
||||||
|
* @param productType
|
||||||
|
* @param sourceInPath
|
||||||
|
*/
|
||||||
|
private static void addRecordToGroups(Set<String> groups, Set<String> sourcesList, Product_Type productType, Sources sourceInPath) {
|
||||||
|
if(sourceInPath == Sources.GRSF) {
|
||||||
|
groups.add(getGroupId(Sources.GRSF.getURLPath())); // i.e. grsf_group
|
||||||
|
}else {
|
||||||
|
groups.add(getGroupId(Constants.SYSTEM_TYPE_LEGACY_RECORD)); // i.e. legacy_group
|
||||||
|
}
|
||||||
|
|
||||||
|
// evaluate the custom fields/tags, resources and groups
|
||||||
|
groups.add(getGroupId(productType.getOrigName())); //i.e. stock_group or fishery_group
|
||||||
|
|
||||||
|
for(String source : sourcesList) {
|
||||||
|
groups.add(getGroupId(source)); // i.e. firms_group, fishsource_group, ram_group
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the list of groups' names for this object
|
* Retrieve the list of groups' names for this object
|
||||||
*/
|
*/
|
||||||
|
@ -226,74 +308,22 @@ public class CommonServiceUtils {
|
||||||
Sources source) {
|
Sources source) {
|
||||||
if(field.isAnnotationPresent(Group.class)) {
|
if(field.isAnnotationPresent(Group.class)) {
|
||||||
Group group = field.getAnnotation(Group.class);
|
Group group = field.getAnnotation(Group.class);
|
||||||
String conditionToCheck = group.condition();
|
|
||||||
String groupNameOverValue = group.groupNameOverValue();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// See https://support.d4science.org/issues/11832
|
|
||||||
boolean assessmentUnit = false;
|
|
||||||
boolean prependSource = group.prependSourceToGroupName();
|
|
||||||
if(record instanceof StockRecord) {
|
|
||||||
StockRecord stockRecord = (StockRecord) record;
|
|
||||||
Stock_Type stock_Type = stockRecord.getType();
|
|
||||||
if(stock_Type != Stock_Type.Assessment_Unit) {
|
|
||||||
prependSource = false;
|
|
||||||
}else {
|
|
||||||
assessmentUnit = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// end patch for https://support.d4science.org/issues/11832
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Object f = new PropertyDescriptor(field.getName(), current).getReadMethod().invoke(record);
|
Object f = new PropertyDescriptor(field.getName(), current).getReadMethod().invoke(record);
|
||||||
if(f != null) {
|
if(f != null) {
|
||||||
if(f instanceof List<?>) {
|
if(f instanceof List<?>) {
|
||||||
List asList = ((List) f);
|
List asList = ((List) f);
|
||||||
if(!asList.isEmpty()) {
|
if(!asList.isEmpty()) {
|
||||||
|
|
||||||
logger.debug("The object annotated with @Group is a list. Adding ... ");
|
logger.debug("The object annotated with @Group is a list. Adding ... ");
|
||||||
|
// add all the available elements
|
||||||
// else add all the available elements
|
|
||||||
for(int i = 0; i < asList.size(); i++) {
|
for(int i = 0; i < asList.size(); i++) {
|
||||||
boolean match = conditionToCheck.isEmpty() ? true
|
String value = asList.get(i).toString().trim();
|
||||||
: asList.get(i).toString().trim().matches(conditionToCheck);
|
addGroup(group, source, value, groups);
|
||||||
if(match) {
|
|
||||||
String groupName = groupNameOverValue.isEmpty()
|
|
||||||
? HelperMethods.getGroupNameOnCkan(source.toString().toLowerCase() + "-"
|
|
||||||
+ asList.get(i).toString().trim())
|
|
||||||
: source.toString().toLowerCase() + "-" + groupNameOverValue;
|
|
||||||
if(assessmentUnit && !prependSource) {
|
|
||||||
groups.add(groupNameOverValue);
|
|
||||||
}else {
|
|
||||||
groups.add(groupName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
String value = f.toString().trim();
|
||||||
// also convert to the group name that should be on ckan
|
addGroup(group, source, value, groups);
|
||||||
boolean match = conditionToCheck.isEmpty() ? true
|
|
||||||
: f.toString().trim().matches(conditionToCheck);
|
|
||||||
if(match) {
|
|
||||||
|
|
||||||
String groupName = groupNameOverValue.isEmpty()
|
|
||||||
? HelperMethods.getGroupNameOnCkan(
|
|
||||||
source.toString().toLowerCase() + "-" + f.toString().trim())
|
|
||||||
: source.toString().toLowerCase() + "-" + groupNameOverValue;
|
|
||||||
|
|
||||||
if(assessmentUnit && !prependSource) {
|
|
||||||
groups.add(groupNameOverValue);
|
|
||||||
}else {
|
|
||||||
groups.add(groupName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +331,6 @@ public class CommonServiceUtils {
|
||||||
logger.error("Failed to read value for field " + field.getName() + " skipping", e);
|
logger.error("Failed to read value for field " + field.getName() + " skipping", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -513,13 +542,13 @@ public class CommonServiceUtils {
|
||||||
if(databaseSources!=null) {
|
if(databaseSources!=null) {
|
||||||
for(Resource<Sources> source : databaseSources) {
|
for(Resource<Sources> source : databaseSources) {
|
||||||
Sources sourceName = source.getName();
|
Sources sourceName = source.getName();
|
||||||
sourcesList.add(sourceName.getOrigName().toLowerCase());
|
sourcesList.add(sourceName.getURLPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// append to groups: we need to add this record to the correspondent group of the sources
|
addRecordToGroups(groups, sourcesList, productType, sourceInPath);
|
||||||
addRecordToGroupSources(groups, new ArrayList(sourcesList), productType, sourceInPath);
|
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
CommonServiceUtils.validateAggregatedRecord(record, sourceInPath);
|
CommonServiceUtils.validateAggregatedRecord(record, sourceInPath);
|
||||||
|
@ -532,57 +561,41 @@ public class CommonServiceUtils {
|
||||||
sourceInPath.equals(Sources.GRSF)
|
sourceInPath.equals(Sources.GRSF)
|
||||||
? productType.equals(Product_Type.FISHERY) ? ((FisheryRecord) record).getType().getOrigName()
|
? productType.equals(Product_Type.FISHERY) ? ((FisheryRecord) record).getType().getOrigName()
|
||||||
: ((StockRecord) record).getType().getOrigName()
|
: ((StockRecord) record).getType().getOrigName()
|
||||||
: Constants.SYSTEM_TYPE_FOR_SOURCES_VALUE);
|
: Constants.SYSTEM_TYPE_LEGACY_RECORD);
|
||||||
|
|
||||||
logger.debug("Domain is " + productType.getOrigName() + " and system type " + record.getSystemType());
|
logger.debug("Domain is " + productType.getOrigName() + " and system type " + record.getSystemType());
|
||||||
|
|
||||||
// evaluate the custom fields/tags, resources and groups
|
|
||||||
groups.add(sourceInPath.getOrigName().toLowerCase() + "-" + productType.getOrigName().toLowerCase()); //e.g. grsf-fishery
|
/*
|
||||||
boolean skipTags = !sourceInPath.equals(Sources.GRSF); // no tags for the Original records
|
* It has been decided to add tags also for legacy records see #23216
|
||||||
CommonServiceUtils.getTagsGroupsResourcesExtrasByRecord(tags, skipTags, groups, false, resources, false,
|
* boolean skipTags = !sourceInPath.equals(Sources.GRSF); // no tags for the Original records
|
||||||
|
*/
|
||||||
|
CommonServiceUtils.getTagsGroupsResourcesExtrasByRecord(tags, false, groups, false, resources, false,
|
||||||
customFields, record, username, sourceInPath);
|
customFields, record, username, sourceInPath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Add the record to the group of sources
|
// * Fetch the system:type property from a record
|
||||||
* @param groups
|
// * @param itemIdOrName
|
||||||
* @param sourcesList
|
// * @param apiKey
|
||||||
* @param productType
|
// * @return null on error
|
||||||
* @param sourceInPath
|
// * @throws Exception
|
||||||
*/
|
// */
|
||||||
private static void addRecordToGroupSources(Set<String> groups, List<String> sourcesList, Product_Type productType,
|
// public static String getSystemTypeValue(String itemIdOrName, String apiKey, String context) throws Exception {
|
||||||
Sources sourceInPath) {
|
// DataCatalogue catalog = HelperMethods.getDataCatalogueRunningInstance(context);
|
||||||
|
// CkanDataset dataset = catalog.getDataset(itemIdOrName, apiKey);
|
||||||
Collections.sort(sourcesList); // be sure the name are sorted because the groups have been generated this way
|
// if(dataset == null) {
|
||||||
String groupName = sourceInPath.getOrigName().toLowerCase() + "-" + productType.getOrigName().toLowerCase();
|
// throw new Exception("Unable to find record with id or name " + itemIdOrName);
|
||||||
for(String source : sourcesList) {
|
// }
|
||||||
groupName += "-" + source;
|
// String systemTypeValue = dataset.getExtrasAsHashMap().get(Constants.SYSTEM_TYPE_CUSTOM_KEY);
|
||||||
}
|
// if(systemTypeValue == null || systemTypeValue.isEmpty()) {
|
||||||
|
// throw new Exception(Constants.SYSTEM_TYPE_CUSTOM_KEY + " property not set in record " + itemIdOrName);
|
||||||
groups.add(groupName);
|
// }else {
|
||||||
}
|
// return systemTypeValue;
|
||||||
|
// }
|
||||||
/**
|
//
|
||||||
* Fetch the system:type property from a record
|
// }
|
||||||
* @param itemIdOrName
|
|
||||||
* @param apiKey
|
|
||||||
* @return null on error
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static String getSystemTypeValue(String itemIdOrName, String apiKey, String context) throws Exception {
|
|
||||||
|
|
||||||
DataCatalogue catalog = HelperMethods.getDataCatalogueRunningInstance(context);
|
|
||||||
CkanDataset dataset = catalog.getDataset(itemIdOrName, apiKey);
|
|
||||||
if(dataset == null)
|
|
||||||
throw new Exception("Unable to find record with id or name " + itemIdOrName);
|
|
||||||
String systemTypeValue = dataset.getExtrasAsHashMap().get(Constants.SYSTEM_TYPE_CUSTOM_KEY);
|
|
||||||
if(systemTypeValue == null || systemTypeValue.isEmpty())
|
|
||||||
throw new Exception(Constants.SYSTEM_TYPE_CUSTOM_KEY + " property not set in record " + itemIdOrName);
|
|
||||||
else
|
|
||||||
return systemTypeValue;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getRecordOrganization(String itemIdOrName, String apiKey, String context) throws Exception {
|
public static String getRecordOrganization(String itemIdOrName, String apiKey, String context) throws Exception {
|
||||||
DataCatalogue catalog = HelperMethods.getDataCatalogueRunningInstance(context);
|
DataCatalogue catalog = HelperMethods.getDataCatalogueRunningInstance(context);
|
||||||
|
@ -705,6 +718,6 @@ public class CommonServiceUtils {
|
||||||
return Constants.GRSF_PRE_ORGANIZATION_NAME;
|
return Constants.GRSF_PRE_ORGANIZATION_NAME;
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
return sourceInPath.getOrigName().toLowerCase();
|
return sourceInPath.getURLPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,6 @@ import static org.gcube.resources.discovery.icclient.ICFactory.client;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
@ -20,15 +19,11 @@ import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.InsufficientPrivilegesException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
|
||||||
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.FolderContainer;
|
||||||
|
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory;
|
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory;
|
||||||
import org.gcube.datacatalogue.common.caches.CacheImpl;
|
import org.gcube.datacatalogue.common.caches.CacheImpl;
|
||||||
|
@ -36,6 +31,7 @@ import org.gcube.datacatalogue.common.caches.CacheInterface;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.Query;
|
import org.gcube.resources.discovery.client.queries.api.Query;
|
||||||
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
||||||
|
import org.gcube.social_networking.social_networking_client_library.UserClient;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.safety.Whitelist;
|
import org.jsoup.safety.Whitelist;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -74,8 +70,10 @@ public abstract class HelperMethods {
|
||||||
public static final String MANAGE_CONTEX_KEY = "ManageVRE";
|
public static final String MANAGE_CONTEX_KEY = "ManageVRE";
|
||||||
public static final String PREVALIDATE_CONTEX_KEY = "PreValidateVRE";
|
public static final String PREVALIDATE_CONTEX_KEY = "PreValidateVRE";
|
||||||
public static final String PUBLIC_CONTEX_KEY = "PublicVRE";
|
public static final String PUBLIC_CONTEX_KEY = "PublicVRE";
|
||||||
private static final String CSV_MIME = "text/csv";
|
|
||||||
private static final String PATH_SEPARATOR = "/";
|
private static final String PATH_SEPARATOR = "/";
|
||||||
|
|
||||||
|
// This key is used in replaceFieldsKey() function to indicate to remove the metadata field
|
||||||
|
private static final String NONE_KEY = "none:none";
|
||||||
|
|
||||||
// caches
|
// caches
|
||||||
private static CacheInterface<String, String> userEmailCache = new CacheImpl<String, String>(1000 * 60 * 60 * 24);
|
private static CacheInterface<String, String> userEmailCache = new CacheImpl<String, String>(1000 * 60 * 60 * 24);
|
||||||
|
@ -83,27 +81,6 @@ public abstract class HelperMethods {
|
||||||
private static CacheInterface<String, Map<String, String>> namespacesCache = new CacheImpl<String, Map<String, String>>(1000 * 60 * 60 * 24);
|
private static CacheInterface<String, Map<String, String>> namespacesCache = new CacheImpl<String, Map<String, String>>(1000 * 60 * 60 * 24);
|
||||||
private static CacheInterface<String, DataCatalogue> catalogueCache = new CacheImpl<String, DataCatalogue>(1000 * 60 * 60 * 24);
|
private static CacheInterface<String, DataCatalogue> catalogueCache = new CacheImpl<String, DataCatalogue>(1000 * 60 * 60 * 24);
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a group name to its id on ckan
|
|
||||||
* @param origName
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getGroupNameOnCkan(String origName){
|
|
||||||
|
|
||||||
if(origName == null)
|
|
||||||
throw new IllegalArgumentException("origName cannot be null");
|
|
||||||
|
|
||||||
String modified = origName.trim().toLowerCase().replaceAll("[^A-Za-z0-9-]", "-");
|
|
||||||
if(modified.startsWith("-"))
|
|
||||||
modified = modified.substring(1);
|
|
||||||
if(modified.endsWith("-"))
|
|
||||||
modified = modified.substring(0, modified.length() -1);
|
|
||||||
|
|
||||||
logger.info("Group name generated is " + modified);
|
|
||||||
|
|
||||||
return modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the running instance of the data catalogue for this scope
|
* Retrieve the running instance of the data catalogue for this scope
|
||||||
* @return
|
* @return
|
||||||
|
@ -158,21 +135,18 @@ public abstract class HelperMethods {
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static String getUserEmail(String context, String token){
|
public static String getUserEmail(String context, String token) throws Exception{
|
||||||
|
|
||||||
// check in cache
|
// check in cache
|
||||||
String result = null;
|
String email = null;
|
||||||
if((result = (String) userEmailCache.get(token)) != null){
|
if((email = (String) userEmailCache.get(token)) != null){
|
||||||
return result;
|
return email;
|
||||||
}else{
|
}else{
|
||||||
String baseUrl = new GcoreEndPointReaderSocial(context).getBasePath();
|
UserClient userClient = new UserClient();
|
||||||
String url = baseUrl.endsWith("/") ? baseUrl + "users/getUserEmail?gcube-token=" + token :
|
email = userClient.getEmail();
|
||||||
baseUrl + "/users/getUserEmail?gcube-token=" + token;
|
userEmailCache.insert(token, email);
|
||||||
logger.debug("Request url is " + url);
|
|
||||||
result = executGETHttpRequest(url, 200);
|
|
||||||
userEmailCache.insert(token, result);
|
|
||||||
}
|
}
|
||||||
return result;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -182,21 +156,18 @@ public abstract class HelperMethods {
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static String getUserFullname(String context, String token){
|
public static String getUserFullname(String context, String token) throws Exception{
|
||||||
|
|
||||||
// check in cache
|
// check in cache
|
||||||
String result = null;
|
String fullName = null;
|
||||||
if((result = (String) userFullnameCache.get(token)) != null){
|
if((fullName = (String) userFullnameCache.get(token)) != null){
|
||||||
return result;
|
return fullName;
|
||||||
}else{
|
}else{
|
||||||
String baseUrl = new GcoreEndPointReaderSocial(context).getBasePath();
|
UserClient userClient = new UserClient();
|
||||||
String url = baseUrl.endsWith("/") ? baseUrl + "users/getUserFullname?gcube-token=" + token :
|
fullName = userClient.getFullName();
|
||||||
baseUrl + "/users/getUserFullname?gcube-token=" + token;
|
userFullnameCache.insert(token, fullName);
|
||||||
logger.debug("Request url is " + url);
|
|
||||||
result = executGETHttpRequest(url, 200);
|
|
||||||
userFullnameCache.insert(token, result);
|
|
||||||
}
|
}
|
||||||
return result;
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -258,29 +229,20 @@ public abstract class HelperMethods {
|
||||||
* @param csvFile
|
* @param csvFile
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ExternalFile uploadExternalFile(WorkspaceFolder resourceFormatFolder, String resourceToAttachName, String description, File csvFile) {
|
public static FileContainer uploadExternalFile(FolderContainer resourceFormatFolder, String resourceToAttachName, String description, File csvFile) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
try (InputStream is= new FileInputStream(csvFile)) {
|
||||||
|
FileContainer fileContainer = resourceFormatFolder.uploadFile(is , resourceToAttachName, description);
|
||||||
|
return fileContainer;
|
||||||
|
}
|
||||||
|
|
||||||
WorkspaceItem existsFile = resourceFormatFolder.find(resourceToAttachName);
|
} catch (StorageHubException she) {
|
||||||
|
logger.error("Failed to upload the file into the workspace shared folder for " + resourceToAttachName, she);
|
||||||
if(existsFile == null)
|
} catch (Exception e) {
|
||||||
return resourceFormatFolder.createExternalFileItem(resourceToAttachName, description, CSV_MIME, csvFile);
|
|
||||||
else{
|
|
||||||
InputStream targetStream = new FileInputStream(csvFile);
|
|
||||||
existsFile.updateItem(targetStream);
|
|
||||||
return (ExternalFile)existsFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (InsufficientPrivilegesException | ItemAlreadyExistException
|
|
||||||
| InternalErrorException e) {
|
|
||||||
logger.error("Failed to upload the file into the workspace shared folder for " + resourceToAttachName, e);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (ItemNotFoundException e) {
|
}
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,9 +253,10 @@ public abstract class HelperMethods {
|
||||||
* @param subPath
|
* @param subPath
|
||||||
* @return null if an error occurred
|
* @return null if an error occurred
|
||||||
*/
|
*/
|
||||||
public static WorkspaceFolder createOrGetSubFoldersByPath(WorkspaceFolder folder, String subPath){
|
public static FolderContainer createOrGetSubFoldersByPath(FolderContainer folder, String subPath){
|
||||||
|
|
||||||
WorkspaceFolder parentFolder = folder;
|
FolderContainer parentFolder = folder;
|
||||||
|
|
||||||
if(folder == null)
|
if(folder == null)
|
||||||
throw new IllegalArgumentException("Root folder is null!");
|
throw new IllegalArgumentException("Root folder is null!");
|
||||||
|
|
||||||
|
@ -312,8 +275,9 @@ public abstract class HelperMethods {
|
||||||
String[] splittedPaths = subPath.split(PATH_SEPARATOR);
|
String[] splittedPaths = subPath.split(PATH_SEPARATOR);
|
||||||
|
|
||||||
for (String path : splittedPaths) {
|
for (String path : splittedPaths) {
|
||||||
WorkspaceFolder createdFolder = getFolderOrCreate(parentFolder, path, "");
|
|
||||||
logger.debug("Created subfolder with path " + createdFolder.getPath());
|
FolderContainer createdFolder = getFolderOrCreate(parentFolder, path, "");
|
||||||
|
logger.debug("Created subfolder with path " + createdFolder.get().getPath());
|
||||||
parentFolder = createdFolder;
|
parentFolder = createdFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,23 +293,18 @@ public abstract class HelperMethods {
|
||||||
* Get a folder within the catalogue folder or create it if it doesn't exist.
|
* Get a folder within the catalogue folder or create it if it doesn't exist.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static WorkspaceFolder getFolderOrCreate(WorkspaceFolder folder, String relativePath, String descriptionFolder){
|
public static FolderContainer getFolderOrCreate(FolderContainer folder, String relativePath, String descriptionFolder){
|
||||||
WorkspaceFolder result = null;
|
|
||||||
|
FolderContainer result = null;
|
||||||
try {
|
try {
|
||||||
WorkspaceItem foundFolder = folder.find(relativePath);
|
result = folder.openByRelativePath(relativePath).asFolder();
|
||||||
if(foundFolder != null && foundFolder.isFolder())
|
|
||||||
result = (WorkspaceFolder)foundFolder;
|
|
||||||
|
|
||||||
if(result != null)
|
|
||||||
logger.debug("Folder found with name " + result.getName() + ", it has id " + result.getId());
|
|
||||||
else
|
|
||||||
throw new Exception("There is no folder with name " + relativePath + " under folder " + folder.getName());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.debug("Probably the folder doesn't exist");
|
logger.debug("Probably the folder doesn't exist");
|
||||||
try{
|
try{
|
||||||
result = folder.createFolder(relativePath, descriptionFolder);
|
result = folder.newFolder(relativePath, descriptionFolder);
|
||||||
} catch (InsufficientPrivilegesException | InternalErrorException | ItemAlreadyExistException e2) {
|
} catch (StorageHubException se) {
|
||||||
logger.error("Failed to get or generate this folder", e2);
|
logger.error("Failed to get or generate this folder", se);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -589,16 +548,18 @@ public abstract class HelperMethods {
|
||||||
|
|
||||||
if(namespaces.containsKey(entry.getKey())){
|
if(namespaces.containsKey(entry.getKey())){
|
||||||
usedKey = namespaces.get(entry.getKey());
|
usedKey = namespaces.get(entry.getKey());
|
||||||
}
|
} else{
|
||||||
else{
|
|
||||||
usedKey = entry.getKey();
|
usedKey = entry.getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isSourceRecord)
|
if(isSourceRecord) {
|
||||||
usedKey = usedKey.replace("GRSF", "").trim();
|
usedKey = usedKey.replace("GRSF", "").trim();
|
||||||
|
}
|
||||||
|
|
||||||
toReturn.put(usedKey, entry.getValue());
|
// When the replaced key is none the metadata field must be removed
|
||||||
|
if(usedKey.compareTo(NONE_KEY)!=0) {
|
||||||
|
toReturn.put(usedKey, entry.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.gcube.data_catalogue.grsf_publish_ws.utils.csv;
|
package org.gcube.data_catalogue.grsf_publish_ws.utils.csv;
|
||||||
|
|
||||||
import java.beans.IntrospectionException;
|
|
||||||
import java.beans.PropertyDescriptor;
|
import java.beans.PropertyDescriptor;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
@ -8,18 +7,11 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
|
||||||
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
|
||||||
import org.gcube.common.homelibrary.home.exceptions.UserNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.catalogue.WorkspaceCatalogue;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.FolderContainer;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||||
|
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.TimeSeries;
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.TimeSeries;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.Common;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.Common;
|
||||||
|
@ -42,13 +34,15 @@ public class ManageTimeSeriesThread extends Thread{
|
||||||
|
|
||||||
private static final String PATH_SEPARATOR = "/";
|
private static final String PATH_SEPARATOR = "/";
|
||||||
|
|
||||||
|
private static final String CATALOGUE_FOLDER = ".catalogue";
|
||||||
|
|
||||||
// Logger
|
// Logger
|
||||||
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(ManageTimeSeriesThread.class);
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(ManageTimeSeriesThread.class);
|
||||||
|
|
||||||
// try to attach the source at most CHANCES times ..
|
// try to attach the source at most CHANCES times ..
|
||||||
private static final int CHANCES = 10;
|
private static final int CHANCES = 10;
|
||||||
|
|
||||||
private static CacheInterface<String, WorkspaceCatalogue> vreFolderCache = new CacheImpl<String, WorkspaceCatalogue>(1000 * 60 * 60 * 24);
|
private static CacheInterface<String, FolderContainer> vreFolderCache = new CacheImpl<String, FolderContainer>(1000 * 60 * 60 * 24);
|
||||||
|
|
||||||
private static final int MAX_NAME_CSV_FILE_WITHOUT_MEASURE = 50;
|
private static final int MAX_NAME_CSV_FILE_WITHOUT_MEASURE = 50;
|
||||||
|
|
||||||
|
@ -96,17 +90,7 @@ public class ManageTimeSeriesThread extends Thread{
|
||||||
logger.error("Error was " + e.getMessage());
|
logger.error("Error was " + e.getMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
logger.error("Error was " + e.getMessage());
|
logger.error("Error was " + e.getMessage());
|
||||||
} catch (WorkspaceFolderNotFoundException e) {
|
} catch (StorageHubException e) {
|
||||||
logger.error("Error was " + e.getMessage());
|
|
||||||
} catch (ItemNotFoundException e) {
|
|
||||||
logger.error("Error was " + e.getMessage());
|
|
||||||
} catch (IntrospectionException e) {
|
|
||||||
logger.error("Error was " + e.getMessage());
|
|
||||||
} catch (InternalErrorException e) {
|
|
||||||
logger.error("Error was " + e.getMessage());
|
|
||||||
} catch (HomeNotFoundException e) {
|
|
||||||
logger.error("Error was " + e.getMessage());
|
|
||||||
} catch (UserNotFoundException e) {
|
|
||||||
logger.error("Error was " + e.getMessage());
|
logger.error("Error was " + e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error was " + e.getMessage());
|
logger.error("Error was " + e.getMessage());
|
||||||
|
@ -130,17 +114,26 @@ public class ManageTimeSeriesThread extends Thread{
|
||||||
if(record == null)
|
if(record == null)
|
||||||
throw new IllegalArgumentException("The given record is null!!");
|
throw new IllegalArgumentException("The given record is null!!");
|
||||||
|
|
||||||
|
StorageHubClient shClient = new StorageHubClient();
|
||||||
|
|
||||||
String token = SecurityTokenProvider.instance.get();
|
String token = SecurityTokenProvider.instance.get();
|
||||||
|
|
||||||
WorkspaceCatalogue catalogueFolder = null;
|
FolderContainer catalogueFolder = null;
|
||||||
|
|
||||||
|
//WorkspaceCatalogue catalogueFolder = null;
|
||||||
if((catalogueFolder = vreFolderCache.get(token)) == null){
|
if((catalogueFolder = vreFolderCache.get(token)) == null){
|
||||||
Workspace ws = HomeLibrary.getHomeManagerFactory().getHomeManager().getHome().getWorkspace();
|
//Workspace ws = HomeLibrary.getHomeManagerFactory().getHomeManager().getHome().getWorkspace();
|
||||||
WorkspaceSharedFolder vreFolder = ws.getVREFolderByScope(ScopeProvider.instance.get());
|
FolderContainer vreFolder = shClient.openVREFolder();
|
||||||
catalogueFolder = vreFolder.getVRECatalogue();
|
try {
|
||||||
|
catalogueFolder = vreFolder.openByRelativePath(CATALOGUE_FOLDER).asFolder();
|
||||||
|
}catch (StorageHubException e) {
|
||||||
|
catalogueFolder = vreFolder.newHiddenFolder(CATALOGUE_FOLDER, "catalogue folder");
|
||||||
|
}
|
||||||
|
|
||||||
vreFolderCache.insert(token, catalogueFolder);
|
vreFolderCache.insert(token, catalogueFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Catalogue folder in vre has path " + catalogueFolder.getPath());
|
logger.debug("Catalogue folder in vre has path " + catalogueFolder.get().getPath());
|
||||||
|
|
||||||
// the structure under the .catalogue will be as follows:
|
// the structure under the .catalogue will be as follows:
|
||||||
// .catalogue:
|
// .catalogue:
|
||||||
|
@ -167,7 +160,7 @@ public class ManageTimeSeriesThread extends Thread{
|
||||||
// the whole path of the directory is going to be...
|
// the whole path of the directory is going to be...
|
||||||
String csvDirectoryForThisProduct = recordTypeFolderName + PATH_SEPARATOR + firstLetter + PATH_SEPARATOR + replaceIllegalChars(uuidKB, "_") + PATH_SEPARATOR + CSVUtils.CSV_EXTENSION.replace(".", "");
|
String csvDirectoryForThisProduct = recordTypeFolderName + PATH_SEPARATOR + firstLetter + PATH_SEPARATOR + replaceIllegalChars(uuidKB, "_") + PATH_SEPARATOR + CSVUtils.CSV_EXTENSION.replace(".", "");
|
||||||
logger.debug("The path under which the time series are going to be saved is " + csvDirectoryForThisProduct);
|
logger.debug("The path under which the time series are going to be saved is " + csvDirectoryForThisProduct);
|
||||||
WorkspaceFolder csvFolder = HelperMethods.createOrGetSubFoldersByPath(catalogueFolder, csvDirectoryForThisProduct);
|
FolderContainer csvFolder = HelperMethods.createOrGetSubFoldersByPath(catalogueFolder, csvDirectoryForThisProduct);
|
||||||
|
|
||||||
if(csvFolder == null)
|
if(csvFolder == null)
|
||||||
logger.error("Failed to create directory where csv files will be deployed in the workspace!!");
|
logger.error("Failed to create directory where csv files will be deployed in the workspace!!");
|
||||||
|
@ -192,7 +185,7 @@ public class ManageTimeSeriesThread extends Thread{
|
||||||
String resourceToAttachOnCkanDescription = productName;
|
String resourceToAttachOnCkanDescription = productName;
|
||||||
|
|
||||||
CkanResourceBase ckanResource = null;
|
CkanResourceBase ckanResource = null;
|
||||||
ExternalFile createdFileOnWorkspace = null;
|
FileContainer createdFileOnWorkspace = null;
|
||||||
String[] relevantSources = new String[1];
|
String[] relevantSources = new String[1];
|
||||||
File csvFile = CSVUtils.listToCSV(asList, relevantSources);
|
File csvFile = CSVUtils.listToCSV(asList, relevantSources);
|
||||||
if(csvFile != null){
|
if(csvFile != null){
|
||||||
|
@ -212,7 +205,7 @@ public class ManageTimeSeriesThread extends Thread{
|
||||||
+ customAnnotation.key() + CSVUtils.CSV_EXTENSION, resourceToAttachOnCkanDescription, csvFile);
|
+ customAnnotation.key() + CSVUtils.CSV_EXTENSION, resourceToAttachOnCkanDescription, csvFile);
|
||||||
|
|
||||||
if(createdFileOnWorkspace != null){
|
if(createdFileOnWorkspace != null){
|
||||||
String publicUrlToSetOnCkan = createdFileOnWorkspace.getPublicLink(true);
|
String publicUrlToSetOnCkan = createdFileOnWorkspace.getPublicLink().toString();
|
||||||
|
|
||||||
// wait for patching..
|
// wait for patching..
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
<Resource version="0.4.x">
|
||||||
|
<ID>85480b75-62f5-4708-acd9-382b22cffc90</ID>
|
||||||
|
<Type>GenericResource</Type>
|
||||||
|
<Scopes>
|
||||||
|
<Scope>/d4science.research-infrastructures.eu/FARM/GRSF</Scope>
|
||||||
|
</Scopes>
|
||||||
|
<Profile>
|
||||||
|
<SecondaryType>ApplicationProfile</SecondaryType>
|
||||||
|
<Name>GRSF Fishery</Name>
|
||||||
|
<Description>GRSF mapping between fields and namespaces for Fishery
|
||||||
|
records</Description>
|
||||||
|
<Body>
|
||||||
|
<fields>
|
||||||
|
<field>
|
||||||
|
<originalKey>Data Owner</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Database Source</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Database Source</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Short Name</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Short Name</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Catch</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Landing</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Species</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Species</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Similar GRSF Record</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Similar GRSF Record</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Management Body/Authority</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Management Body/Authority</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Connected Record</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Connected Record</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Annotation</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Fishery Name</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:GRSF Fishery Name</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Semantic Identifier</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:GRSF Semantic Identifier
|
||||||
|
</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Traceability Flag</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Traceability Flag</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Fishing Area</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Fishing Area</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Jurisdiction Area</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Jurisdiction Area</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Resources Exploited</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Resources Exploited</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Flag State</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Flag State</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Fishing Gear</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Fishing Gear</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Type</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:GRSF Type</modifiedKey>
|
||||||
|
</field>
|
||||||
|
</fields>
|
||||||
|
</Body>
|
||||||
|
</Profile>
|
||||||
|
</Resource>
|
|
@ -0,0 +1,91 @@
|
||||||
|
<Resource version="0.4.x">
|
||||||
|
<ID>c3326373-c620-45e8-a7e3-a25a1a2a970b</ID>
|
||||||
|
<Type>GenericResource</Type>
|
||||||
|
<Scopes>
|
||||||
|
<Scope>/d4science.research-infrastructures.eu/FARM/GRSF_Admin</Scope>
|
||||||
|
<Scope>/d4science.research-infrastructures.eu/FARM</Scope>
|
||||||
|
</Scopes>
|
||||||
|
<Profile>
|
||||||
|
<SecondaryType>ApplicationProfile</SecondaryType>
|
||||||
|
<Name>GRSF Fishery</Name>
|
||||||
|
<Description>GRSF mapping between fields and namespaces for Fishery
|
||||||
|
records</Description>
|
||||||
|
<Body>
|
||||||
|
<fields>
|
||||||
|
<field>
|
||||||
|
<originalKey>Data Owner</originalKey>
|
||||||
|
<modifiedKey>fishery_data:Data Owner</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Database Source</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Database Source</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Short Name</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Short Name</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Catch</originalKey>
|
||||||
|
<modifiedKey>fishery_data:Catch</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Landing</originalKey>
|
||||||
|
<modifiedKey>fishery_data:Landing</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Species</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Species</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Similar GRSF Record</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Similar GRSF Record</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Management Body/Authority</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Management Body/Authority</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Connected Record</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Connected Record</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Fishery Name</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:GRSF Fishery Name</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Semantic Identifier</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:GRSF Semantic Identifier
|
||||||
|
</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Traceability Flag</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Traceability Flag</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Fishing Area</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Fishing Area</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Jurisdiction Area</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Jurisdiction Area</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Resources Exploited</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Resources Exploited</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Flag State</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Flag State</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Fishing Gear</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:Fishing Gear</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Type</originalKey>
|
||||||
|
<modifiedKey>fishery_identity:GRSF Type</modifiedKey>
|
||||||
|
</field>
|
||||||
|
</fields>
|
||||||
|
</Body>
|
||||||
|
</Profile>
|
||||||
|
</Resource>
|
|
@ -0,0 +1,118 @@
|
||||||
|
<Resource version="0.4.x">
|
||||||
|
<ID>512cca02-e178-420c-a766-b47171e154e2</ID>
|
||||||
|
<Type>GenericResource</Type>
|
||||||
|
<Scopes>
|
||||||
|
<Scope>/d4science.research-infrastructures.eu/FARM/GRSF</Scope>
|
||||||
|
</Scopes>
|
||||||
|
<Profile>
|
||||||
|
<SecondaryType>ApplicationProfile</SecondaryType>
|
||||||
|
<Name>GRSF Stock</Name>
|
||||||
|
<Description>GRSF mapping between fields and namespaces for Stock
|
||||||
|
records
|
||||||
|
</Description>
|
||||||
|
<Body>
|
||||||
|
<fields>
|
||||||
|
<field>
|
||||||
|
<originalKey>Data Owner</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Database Source</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Database Source</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Short Name</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Short Name</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Catch</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Landing</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Species</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Species</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Similar GRSF Record</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Similar GRSF Record</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Management Body/Authority</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Management Body/Authority</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Connected Record</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Connected Record</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Annotation</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Stock Name</originalKey>
|
||||||
|
<modifiedKey>stock_identity:GRSF Stock Name</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Semantic Identifier</originalKey>
|
||||||
|
<modifiedKey>stock_identity:GRSF Semantic Identifier</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Assessment Area</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Assessment Area</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Exploiting Fishery</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Exploiting Fishery</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Assessment Method</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Abundance Level (FIRMS Standard)</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Abundance Level</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Biomass</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Fishing Pressure (FIRMS Standard)</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Fishing Pressure</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>State and Trend</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>FAO Stock Status Category</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Scientific Advice</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Assessor</originalKey>
|
||||||
|
<modifiedKey>none:none</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Type</originalKey>
|
||||||
|
<modifiedKey>stock_identity:GRSF Type</modifiedKey>
|
||||||
|
</field>
|
||||||
|
</fields>
|
||||||
|
</Body>
|
||||||
|
</Profile>
|
||||||
|
</Resource>
|
|
@ -0,0 +1,115 @@
|
||||||
|
<Resource version="0.4.x">
|
||||||
|
<ID>c9cad3f8-5773-4ca7-95a5-4692db5eae2e</ID>
|
||||||
|
<Type>GenericResource</Type>
|
||||||
|
<Scopes>
|
||||||
|
<Scope>/d4science.research-infrastructures.eu/FARM</Scope>
|
||||||
|
<Scope>/d4science.research-infrastructures.eu/FARM/GRSF_Admin</Scope>
|
||||||
|
</Scopes>
|
||||||
|
<Profile>
|
||||||
|
<SecondaryType>ApplicationProfile</SecondaryType>
|
||||||
|
<Name>GRSF Stock</Name>
|
||||||
|
<Description>GRSF mapping between fields and namespaces for Stock
|
||||||
|
records</Description>
|
||||||
|
<Body>
|
||||||
|
<fields>
|
||||||
|
<field>
|
||||||
|
<originalKey>Data Owner</originalKey>
|
||||||
|
<modifiedKey>stock_data:Data Owner</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Database Source</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Database Source</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Short Name</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Short Name</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Catch</originalKey>
|
||||||
|
<modifiedKey>stock_data:Catch</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Landing</originalKey>
|
||||||
|
<modifiedKey>stock_data:Landing</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Species</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Species</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Similar GRSF Record</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Similar GRSF Record</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Management Body/Authority</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Management Body/Authority</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Connected Record</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Connected Record</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Stock Name</originalKey>
|
||||||
|
<modifiedKey>stock_identity:GRSF Stock Name</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Semantic Identifier</originalKey>
|
||||||
|
<modifiedKey>stock_identity:GRSF Semantic Identifier</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Assessment Area</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Assessment Area</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Exploiting Fishery</originalKey>
|
||||||
|
<modifiedKey>stock_identity:Exploiting Fishery</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Assessment Method</originalKey>
|
||||||
|
<modifiedKey>stock_data:Assessment Method</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Abundance Level (FIRMS Standard)</originalKey>
|
||||||
|
<modifiedKey>stock_data:Abundance Level (FIRMS Standard)
|
||||||
|
</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Abundance Level</originalKey>
|
||||||
|
<modifiedKey>stock_data:Abundance Level</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Biomass</originalKey>
|
||||||
|
<modifiedKey>stock_data:Biomass</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Fishing Pressure (FIRMS Standard)</originalKey>
|
||||||
|
<modifiedKey>stock_data:Fishing Pressure (FIRMS Standard)</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Fishing Pressure</originalKey>
|
||||||
|
<modifiedKey>stock_data:Fishing Pressure</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>State and Trend</originalKey>
|
||||||
|
<modifiedKey>stock_data:State and Trend</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>FAO Stock Status Category</originalKey>
|
||||||
|
<modifiedKey>stock_data:FAO Stock Status Category</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Scientific Advice</originalKey>
|
||||||
|
<modifiedKey>stock_data:Scientific Advice</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>Assessor</originalKey>
|
||||||
|
<modifiedKey>stock_data:Assessor</modifiedKey>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<originalKey>GRSF Type</originalKey>
|
||||||
|
<modifiedKey>stock_identity:GRSF Type</modifiedKey>
|
||||||
|
</field>
|
||||||
|
</fields>
|
||||||
|
</Body>
|
||||||
|
</Profile>
|
||||||
|
</Resource>
|
|
@ -0,0 +1,40 @@
|
||||||
|
<Resource version="0.4.x">
|
||||||
|
|
||||||
|
<ID>7ee9c6e9-ff73-4428-88e4-185aeb4b3742</ID>
|
||||||
|
|
||||||
|
<Type>GenericResource</Type>
|
||||||
|
|
||||||
|
<Scopes>
|
||||||
|
|
||||||
|
<Scope>/d4science.research-infrastructures.eu/FARM/GRSF_Pre</Scope>
|
||||||
|
|
||||||
|
<Scope>/d4science.research-infrastructures.eu/FARM/GRSF_Admin</Scope>
|
||||||
|
|
||||||
|
</Scopes>
|
||||||
|
|
||||||
|
<Profile>
|
||||||
|
|
||||||
|
<SecondaryType>ApplicationProfile</SecondaryType>
|
||||||
|
|
||||||
|
<Name>GRSFManageEntries</Name>
|
||||||
|
|
||||||
|
<Description>A list of extras metadata to be looked up and prompted by the GRSF Manage widget. The body reports the key values.</Description>
|
||||||
|
|
||||||
|
<Body>
|
||||||
|
fishery_identity:GRSF Type,
|
||||||
|
fishery_identity:Short Name,
|
||||||
|
fishery_identity:Database Source,
|
||||||
|
fishery_identity:GRSF Semantic Identifier,
|
||||||
|
fishery_data:Catch,
|
||||||
|
fishery_data:Landing,
|
||||||
|
stock_identity:GRSF Type,
|
||||||
|
stock_identity:Short Name,
|
||||||
|
stock_identity:Database Source,
|
||||||
|
stock_identity:GRSF Semantic Identifier,
|
||||||
|
stock_data:Catch,
|
||||||
|
stock_data:Landing
|
||||||
|
</Body>
|
||||||
|
|
||||||
|
</Profile>
|
||||||
|
|
||||||
|
</Resource>
|
|
@ -1,7 +1,7 @@
|
||||||
<application mode='online'>
|
<application mode='online'>
|
||||||
<name>GRSFPublisher</name>
|
<name>GRSFPublisher</name>
|
||||||
<group>Data-Catalogue</group>
|
<group>Data-Catalogue</group>
|
||||||
<version>1.5.0</version>
|
<version>1.13.0</version>
|
||||||
<description>Data Catalogue Service</description>
|
<description>Data Catalogue Service</description>
|
||||||
<local-persistence location='target' />
|
<local-persistence location='target' />
|
||||||
<exclude>/rest/</exclude>
|
<exclude>/rest/</exclude>
|
||||||
|
|
|
@ -13,17 +13,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
||||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
|
||||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.catalogue.WorkspaceCatalogue;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.InsufficientPrivilegesException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
|
||||||
|
@ -238,129 +227,8 @@ public class JTests {
|
||||||
instance.uploadResourceFile(csvFile, datasetName, instance.getApiKeyFromUsername("costantino.perciante"), "random_name.csv", null, null, null);
|
instance.uploadResourceFile(csvFile, datasetName, instance.getApiKeyFromUsername("costantino.perciante"), "random_name.csv", null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
|
||||||
public void sharedVREFolderWriteTest() throws Exception{
|
|
||||||
|
|
||||||
String token = "";
|
|
||||||
String context = "/gcube/devNext/NextNext";
|
|
||||||
|
|
||||||
ScopeProvider.instance.set(context);
|
|
||||||
SecurityTokenProvider.instance.set(token);
|
|
||||||
|
|
||||||
Workspace ws = HomeLibrary.getHomeManagerFactory().getHomeManager().getHome().getWorkspace();
|
|
||||||
|
|
||||||
// Get a VRE folder by scope
|
|
||||||
WorkspaceSharedFolder vreFolder = ws.getVREFolderByScope(context);
|
|
||||||
|
|
||||||
//Get the VRE Folder catalogue
|
|
||||||
WorkspaceCatalogue catalogueFolder = vreFolder.getVRECatalogue();
|
|
||||||
|
|
||||||
logger.debug("Catalogue folder retrieved " + catalogueFolder.getName());
|
|
||||||
|
|
||||||
// WorkspaceItem stockFolder = catalogueFolder.find("stock");
|
|
||||||
|
|
||||||
// vreFolder.removeChild(stockFolder);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test is
|
|
||||||
* .catalogue:
|
|
||||||
* -test
|
|
||||||
* - a
|
|
||||||
* -aproductwiththisname
|
|
||||||
* - csv
|
|
||||||
* - testfile.csv
|
|
||||||
*/
|
|
||||||
|
|
||||||
String allSubPath = "/test/a/aproductwiththisname/";
|
|
||||||
//WorkspaceFolder lastFolder = createGetSubFoldersByPath(catalogueFolder, allSubPath);
|
|
||||||
// WorkspaceFolder recordFolder = (WorkspaceFolder)getFolderOrCreate(catalogueFolder, "test", "");
|
|
||||||
// String firstLetter = "a";
|
|
||||||
// WorkspaceFolder firstLetterFolder = (WorkspaceFolder)getFolderOrCreate(recordFolder, firstLetter, "");
|
|
||||||
// String folderPath = "aproductwiththisname";
|
|
||||||
// WorkspaceFolder productFolder = (WorkspaceFolder)getFolderOrCreate(firstLetterFolder, folderPath, "");
|
|
||||||
//logger.debug("Test folder created/get..its path is " + lastFolder.getPath());
|
|
||||||
// String ccsvUnderProductFolderName = productFolderName + "/" + "csv";
|
|
||||||
// WorkspaceFolder csvUnderProductFolder = (WorkspaceFolder)getFolderOrCreate(catalogueFolder, ccsvUnderProductFolderName, "");
|
|
||||||
//
|
|
||||||
// logger.debug("FOLDERS created " + csvUnderProductFolder.getPath());
|
|
||||||
// treeCheck(catalogueFolder);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void treeCheck(WorkspaceFolder rootFolder) throws InternalErrorException{
|
|
||||||
List<WorkspaceItem> children = rootFolder.getChildren();
|
|
||||||
for (WorkspaceItem workspaceItem : children) {
|
|
||||||
if(workspaceItem.isFolder()){
|
|
||||||
logger.debug("children folder is " + workspaceItem.getName());
|
|
||||||
treeCheck((WorkspaceFolder)workspaceItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create subfolders in cascade, returning the last created ones
|
|
||||||
* It could be also used for getting them if they already exists
|
|
||||||
* @param folder
|
|
||||||
* @param subPath
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static WorkspaceFolder createGetSubFoldersByPath(WorkspaceFolder folder, String subPath){
|
|
||||||
|
|
||||||
String pathSeparator = "/";
|
|
||||||
WorkspaceFolder parentFolder = folder;
|
|
||||||
if(folder == null)
|
|
||||||
throw new IllegalArgumentException("Root folder is null!");
|
|
||||||
|
|
||||||
if(subPath == null || subPath.isEmpty())
|
|
||||||
throw new IllegalArgumentException("subPath is null/empty!");
|
|
||||||
|
|
||||||
try{
|
|
||||||
if(subPath.startsWith(pathSeparator))
|
|
||||||
subPath = subPath.replaceFirst(pathSeparator, "");
|
|
||||||
|
|
||||||
if(subPath.endsWith(subPath))
|
|
||||||
subPath = subPath.substring(0, subPath.length() - 1);
|
|
||||||
|
|
||||||
logger.debug("Splitting path " + subPath);
|
|
||||||
|
|
||||||
String[] splittedPaths = subPath.split(pathSeparator);
|
|
||||||
|
|
||||||
for (String path : splittedPaths) {
|
|
||||||
WorkspaceFolder createdFolder = getFolderOrCreate(parentFolder, path, "");
|
|
||||||
logger.debug("Created subfolder with path " + createdFolder.getPath());
|
|
||||||
parentFolder = createdFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch(Exception e){
|
|
||||||
logger.error("Failed to create the subfolders by path " + subPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return parentFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a folder within the catalogue folder or create it if it doesn't exist.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static WorkspaceFolder getFolderOrCreate(WorkspaceFolder folder, String relativePath, String descriptionFolder){
|
|
||||||
WorkspaceFolder result = null;
|
|
||||||
try {
|
|
||||||
if(folder.exists(relativePath) && folder.find(relativePath).isFolder())
|
|
||||||
result = (WorkspaceFolder) folder.find(relativePath);
|
|
||||||
if(result != null)
|
|
||||||
logger.debug("Folder found with name " + result.getName() + ", it has id " + result.getId());
|
|
||||||
else
|
|
||||||
throw new Exception("There is no folder with name " + relativePath + " under foler " + folder.getName());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.debug("Probably the folder doesn't exist", e);
|
|
||||||
try{
|
|
||||||
result = folder.createFolder(relativePath, descriptionFolder);
|
|
||||||
} catch (InsufficientPrivilegesException | InternalErrorException | ItemAlreadyExistException e2) {
|
|
||||||
logger.error("Failed to get or generate this folder", e2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
public void GRSFServiceUrl() throws Exception{
|
public void GRSFServiceUrl() throws Exception{
|
||||||
|
@ -402,7 +270,7 @@ public class JTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
public void testCaches(){
|
public void testCaches() throws Exception{
|
||||||
|
|
||||||
String context = "/gcube/devNext/NextNext";
|
String context = "/gcube/devNext/NextNext";
|
||||||
String token = "";
|
String token = "";
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.gcube.data_catalogue.grsf_publish_ws;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.StockRecord;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
*/
|
||||||
|
public class TestJson {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(Test.class);
|
||||||
|
|
||||||
|
public File getResourcesDirectory() throws Exception {
|
||||||
|
URL logbackFileURL = TestJson.class.getClassLoader().getResource("logback-test.xml");
|
||||||
|
File logbackFile = new File(logbackFileURL.toURI());
|
||||||
|
File resourcesDirectory = logbackFile.getParentFile();
|
||||||
|
return resourcesDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testJsonDeserialization() throws Exception {
|
||||||
|
File jsonQueryFile = new File(getResourcesDirectory(), "70ae6895-7d3d-4f4a-86f9-bcb17d41bff6.json");
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
JsonNode jsonNode = objectMapper.readTree(jsonQueryFile);
|
||||||
|
logger.debug("{}", jsonNode);
|
||||||
|
StockRecord sr = objectMapper.readValue(jsonQueryFile, StockRecord.class);
|
||||||
|
logger.debug("{}", sr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"stock_name" : "European hake - Southern Adriatic",
|
||||||
|
"license_id" : "CC-BY-SA-4.0",
|
||||||
|
"version" : 1.0,
|
||||||
|
"database_sources" : [ {
|
||||||
|
"name" : "FAO SDG 14.4.1 questionnaire",
|
||||||
|
"description" : "FAO SDG 14.4.1 questionnaire",
|
||||||
|
"url" : "https://www.fao.org/sustainable-development-goals/indicators/14.4.1/en/"
|
||||||
|
} ],
|
||||||
|
"stock_uri" : "https://github.com/grsf/resource/sdg_14_4_1/stock/70ae6895-7d3d-4f4a-86f9-bcb17d41bff6",
|
||||||
|
"grsf_uuid" : "70ae6895-7d3d-4f4a-86f9-bcb17d41bff6",
|
||||||
|
"short_name" : "European hake - Southern Adriatic",
|
||||||
|
"description" : "European hake - Southern Adriatic",
|
||||||
|
"grsf_type" : "assessment unit",
|
||||||
|
"species" : [ "Code: HKE, Classification System: ASFIS, Scientific Name: Merluccius merluccius" ],
|
||||||
|
"assessment_area" : [ "Code: 18, System: gfcm, Name: Southern Adriatic " ],
|
||||||
|
"source_of_information" : [ {
|
||||||
|
"name" : "https://www.fao.org/sustainable-development-goals/indicators/14.4.1/en/sdg-alb-1",
|
||||||
|
"description" : "",
|
||||||
|
"url" : "https://www.fao.org/sustainable-development-goals/indicators/14.4.1/en/sdg-alb-1"
|
||||||
|
} ],
|
||||||
|
"data_owner" : [ "Albania" ],
|
||||||
|
"assessment_methods" : [ "The official stock assessment concludes 'Overfished' with respect to abundance reference points. [Rep. Year or Assessment ID: 2019, Ref. Year: 2018]" ],
|
||||||
|
"connections_indicator" : "not connected",
|
||||||
|
"similarities_indicator" : "without similar records",
|
||||||
|
"landings" : [ {
|
||||||
|
"value" : "872",
|
||||||
|
"unit" : "Tonnes",
|
||||||
|
"reference_year" : 2018,
|
||||||
|
"reporting_year_or_assessment_id" : "2020",
|
||||||
|
"data_owner" : "Albania"
|
||||||
|
} ],
|
||||||
|
"citation" : "citation TBD"
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE xml>
|
||||||
|
<configuration>
|
||||||
|
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
|
||||||
|
<logger name="org.gcube" level="INFO" />
|
||||||
|
<logger name="org.gcube.data_catalogue.grsf_publish_ws" level="TRACE" />
|
||||||
|
|
||||||
|
<root level="WARN">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
Loading…
Reference in New Issue