Compare commits

..

47 Commits

Author SHA1 Message Date
Luca Frosini 903cc302d8 Reordered constants to improve readability 2024-05-09 17:09:53 +02:00
luca.frosini ad9d5a3776 Ignored MacOs File 2023-06-21 11:38:09 +02:00
Luca Frosini a0ac2b3b9c Removed -SNAPSHOT to release the component 2023-03-03 12:17:32 +01:00
Luca Frosini 0c6ca18b08 Added AUTHOR_FULLNAME metadata key constant 2023-03-01 13:58:24 +01:00
Luca Frosini 13782f02ac Fixed changelog 2023-02-23 16:00:42 +01:00
Luca Frosini 48ac672b9a Updated gcube-bom version 2023-02-23 12:17:43 +01:00
Luca Frosini b56ef53759 Adding new version to export file 2023-02-17 15:21:47 +01:00
Luca Frosini 3620a5918b Fixed changelog 2023-02-17 15:18:10 +01:00
Luca Frosini b7013ce493 Merge remote-tracking branch 'origin/migrating_to_smartgears_4' 2023-02-17 14:17:34 +01:00
Luca Frosini 40082495bd Adding JSON:API support 2023-02-17 14:14:45 +01:00
Luca Frosini 0c405ad0b1 Fixed README and added FUNDING 2023-01-16 19:16:47 +01:00
Luca Frosini a84521a1ef Fixed changelog and added json to publish/export software 2023-01-16 19:04:10 +01:00
Luca Frosini 5c882338d5 Fixed changelog 2023-01-13 14:00:50 +01:00
Luca Frosini d7a1d3bf20 Removed uneeded constant 2022-12-13 11:16:54 +01:00
Luca Frosini 19f0975ce9 Fixed map initialization 2022-12-13 10:51:00 +01:00
Luca Frosini 0dfd0000d9 Added facilities to simplify new IS adoption 2022-12-01 16:18:56 +01:00
Luca Frosini faf102e5d7 Changed solution to support both Smartgears 3 and 4 2022-11-28 14:29:49 +01:00
Luca Frosini ec25766c3b Migrating to smartgears 4 2022-11-16 12:38:31 +01:00
Luca Frosini e95483a15e Switched to ContextBean 2022-11-16 11:46:51 +01:00
Luca Frosini 7742300b42 Removed -SNAPSHOT to release the component 2022-10-20 16:46:38 +02:00
Luca Frosini ebef365b9c Upgraded version 2022-10-20 11:38:36 +02:00
Luca Frosini f1ab4b1911 Added comments 2022-10-20 11:34:00 +02:00
Luca Frosini f4dbfd21bd Added item_author metadata as system:cm_ fields 2022-10-20 11:30:11 +02:00
Luca Frosini e1ba2c282c added comment 2022-10-19 14:20:45 +02:00
Luca Frosini 591a687dda Added dependency to properly support JDK 11 compiler 2022-10-18 17:34:41 +02:00
Luca Frosini 1d1e260104 Removed -SNAPSHOT to release the component 2022-08-01 15:11:44 +02:00
Luca Frosini e344f54703 Added query parameter constant to get the whole item fields refs #23691 2022-07-26 11:46:33 +02:00
Luca Frosini c1b7512557 Aligned constants names. 2022-07-26 11:44:02 +02:00
Luca Frosini 155709bcf8 Downgraded gcube-bom 2022-05-04 15:05:11 +02:00
Luca Frosini 5ee0613609 Removed -SNAPSHOT to release the component 2022-04-28 17:29:02 +02:00
Luca Frosini 452cf085bf Added method to discriminated between valid and not valid item statuses 2022-04-21 15:37:00 +02:00
Luca Frosini 54c79bc12c Added status ANY 2022-04-21 15:33:57 +02:00
Luca Frosini 5c797820ef constants has been made public 2022-04-01 16:18:41 +02:00
Luca Frosini 4eada706ac Fixed Changelog 2022-03-11 14:55:35 +01:00
Luca Frosini 9662a18176 Fixed Changelog 2022-03-11 14:54:25 +01:00
Luca Frosini 34036e9b32 Upgraded gcube-bom version 2022-02-25 17:30:48 +01:00
Luca Frosini db56213155 moved gcat to new service class 2022-02-24 11:41:44 +01:00
Luca Frosini cf86847997 Restored old service class 2022-02-22 15:43:49 +01:00
Luca Frosini 9515fb1440 Fixed configuration path 2022-02-22 10:46:12 +01:00
Luca Frosini a7ff757499 Fixed service class and name 2022-02-22 09:42:58 +01:00
Luca Frosini 7e38fc8fb4 Fixed changelog 2022-02-21 13:43:32 +01:00
Luca Frosini 66b5f47807 fixed interface 2022-02-21 13:17:02 +01:00
Luca Frosini 0cc5173a1f Upgraded version 2022-02-21 12:00:14 +01:00
Luca Frosini 77cc958ac0 constructor is now protected to enable the subclass to use it 2022-02-17 17:10:42 +01:00
Luca Frosini c3a94d9185 Removed dependency 2022-02-16 22:58:35 +01:00
Luca Frosini 41c5044255 Added CkanDB in configuration 2022-02-16 22:57:09 +01:00
Luca Frosini 7d6de07bac Added support for configuration management 2022-02-15 21:19:29 +01:00
13 changed files with 670 additions and 54 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
target
.classpath
.project
/.DS_Store

View File

@ -2,7 +2,37 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for gCube Catalogue (gCat) API
## [v2.1.0]
## [v2.3.3-SNAPSHOT]
- Reordered constants to improve readability
## [v2.3.2]
- Library modified to be compliant with both Smartgears 3 and 4
- Added support for JSON:API on listing method of 'items' collection [#24601]
- Added support for JSON:API on listing method of 'licenses' collection [#24601]
## [v2.3.1] [r5.14.0] - 2022-12-07
- Added Item Author as system:cm_ metadata to keep track of item author
## [v2.3.0] [r5.13.1] - 2022-09-19
- Aligned constants name used as query parameters
- Added query parameter constant used in item listing to get the whole item instead of just the name [#23691]
## [v2.2.0] [r5.11.0] - 2022-05-12
- Added support to manage configurations [#22658]
- Migrated to ServiceClass corresponding to Maven groupId
## [v2.1.0] [r5.7.0] - 2022-01-27
- Added query parameter social_post_notification to override default VRE behaviour [#21345]
- Added support for moderation [#21342]
@ -10,28 +40,28 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Added empty trash API [#13322]
## [v2.0.0]
## [v2.0.0] [r5.2.0] - 2021-05-04
- Changed service class
## [v1.2.2]
## [v1.2.2] [r5.0.0] - 2021-02-24
- Added count method for Item collection [#20627]
- Added count method for Organization, Group and Profile collection [#20629]
- Switched JSON management to gcube-jackson [#19735]
## [v1.2.1] [r4.18.0] - 2019-12-10
## [v1.2.1] [r4.18.0] - 2019-12-20
- Fixed distro files and pom according to new release procedure
## [v1.2.0] [r4.15.0] - 2019-11-06
## [v1.2.0] [r4.15.0] - 2019-11-19
- Added org parameter to support to list item at VO level in gCat Service [#17635]
## [v1.1.0] [r4.14.0] - 2019-05-27
## [v1.1.0] [r4.14.0] - 2019-05-16
- Added Social Post parameter [#13335]

26
FUNDING.md Normal file
View File

@ -0,0 +1,26 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

View File

@ -25,16 +25,14 @@ Tell people how to cite this software.
* Cite an associated paper?
* Use a specific BibTeX entry for the software?
@Manual{,
title = {gCube Catalogue (gCat) API},
author = {{Frosini, Luca}},
organization = {ISTI - CNR},
address = {Pisa, Italy},
year = 2019,
url = {http://www.gcube-system.org/}
}
@software{gcat-api,
author = {{Luca Frosini}},
title = {gCube Catalogue (gCat) API},
abstract = {gCube Catalogue (gCat) API is a library containing classes shared across gcat* components.},
url = {https://doi.org/10.5281/zenodo.7446431},
keywords = {Catalogue, D4Science, gCube}
}
## License
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
@ -46,26 +44,6 @@ open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488);
- D4Science-II (grant no.239019);
- ENVRI (grant no. 283465);
- iMarine(grant no. 283644);
- EUBrazilOpenBio (grant no. 288754).
- the H2020 research and innovation programme
- SoBigData (grant no. 654024);
- PARTHENOS (grant no. 654119);
- EGIEngage (grant no. 654142);
- ENVRIplus (grant no. 654182);
- BlueBRIDGE (grant no. 675680);
- PerformFish (grant no. 727610);
- AGINFRAplus (grant no. 731001);
- DESIRA (grant no. 818194);
- ARIADNEplus (grant no. 823914);
- RISIS2 (grant no. 824091);
The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md)

248
gcube/gcat-api-export.json Normal file
View File

@ -0,0 +1,248 @@
{
"global": {
"name": "gcat-api",
"group": "data-catalogue",
"title": "gCube Catalogue (gCat) API {{version}}",
"license": {
"id": "EUPL-1.1",
"url": "https://opensource.org/licenses/EUPL-1.1"
},
"keywords": ["gCube", "Catalogue", "D4Science"],
"description": "gCube Catalogue (gCat) API is a library containing classes shared across gcat* components.",
"authors": [
{
"affiliation": "Istituto di Scienza e Tecnologie dell'Informazione \"A. Faedo\" - CNR, Italy",
"name": "Frosini, Luca",
"orcid": "0000-0003-3183-2291"
}
],
"files": [
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.zip",
"desired_name": "{{name}}-v{{version}}.zip"
},
{
"url": "https://code-repo.d4science.org/gCubeSystem/{{name}}/archive/v{{version}}.tar.gz",
"desired_name": "{{name}}-v{{version}}.tar.gz"
},
{
"url": "https://nexus.d4science.org/nexus/service/local/repo_groups/gcube-releases-all/content/org/gcube/{{group}}/{{name}}/{{version}}/{{name}}-{{version}}.jar",
"desired_name": "{{name}}-v{{version}}.jar"
}
],
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}",
"doi_url": null,
"grants": [
{
"id": "004260",
"name": "DILIGENT",
"url": "https://cordis.europa.eu/project/id/004260"
},
{
"id": "212488",
"name": "D4Science",
"url": "https://cordis.europa.eu/project/id/212488"
},
{
"id": "239019",
"name": "D4Science-II",
"url": "https://cordis.europa.eu/project/id/239019"
},
{
"id": "283465",
"name": "ENVRI",
"url": "https://cordis.europa.eu/project/id/283465"
},
{
"id": "283644",
"name": "iMarine",
"url": "https://cordis.europa.eu/project/id/283644"
},
{
"id": "288754",
"name": "EUBrazilOpenBio",
"url": "https://cordis.europa.eu/project/id/288754"
},
{
"id": "654024",
"name": "SoBigData",
"url": "https://cordis.europa.eu/project/id/654024"
},
{
"id": "654119",
"name": "PARTHENOS",
"url": "https://cordis.europa.eu/project/id/654119"
},
{
"id": "654142",
"name": "EGI-Engage",
"url": "https://cordis.europa.eu/project/id/654142"
},
{
"id": "654182",
"name": "ENVRI PLUS",
"url": "https://cordis.europa.eu/project/id/654182"
},
{
"id": "675680",
"name": "BlueBRIDGE",
"url": "https://cordis.europa.eu/project/id/675680"
},
{
"id": "727610",
"name": "PerformFISH",
"url": "https://cordis.europa.eu/project/id/727610"
},
{
"id": "731001",
"name": "AGINFRA PLUS",
"url": "https://cordis.europa.eu/project/id/731001"
},
{
"id": "818194",
"name": "DESIRA",
"url": "https://cordis.europa.eu/project/id/818194"
},
{
"id": "823914",
"name": "ARIADNEplus",
"url": "https://cordis.europa.eu/project/id/823914"
},
{
"id": "824091",
"name": "RISIS 2",
"url": "https://cordis.europa.eu/project/id/824091"
},
{
"id": "857650",
"name": "EOSC-Pillar",
"url": "https://cordis.europa.eu/project/id/857650"
},
{
"id": "862409",
"name": "Blue Cloud",
"url": "https://cordis.europa.eu/project/id/862409"
},
{
"id": "871042",
"name": "SoBigData-PlusPlus",
"url": "https://cordis.europa.eu/project/id/871042"
}
],
"publishers": {
"ZenodoSoftwareVersionPublisher": {
"elaboration": "NONE",
"html_description": "<p><a href=\"https://www.gcube-system.org/\">gCube</a> Catalogue (gCat) API is a library containing classes shared across gcat* components.</p>\n\n<p><a href=\"https://www.gcube-system.org/\">gCube</a> is an open-source software toolkit used for building and operating Hybrid Data Infrastructures enabling the dynamic deployment of Virtual Research Environments, such as the <a href=\"https://www.d4science.org/\">D4Science Infrastructure</a>, by favouring the realisation of reuse-oriented policies.</p>\n\n<p><a href=\"https://www.gcube-system.org/\">gCube</a> has been used to successfully build and operate infrastructures and virtual research environments for application domains ranging from biodiversity to environmental data management and cultural heritage.</p>\n\n<p><a href=\"https://www.gcube-system.org/\">gCube</a> offers components supporting typical data management workflows including data access, curation, processing, and visualisation on a large set of data typologies ranging from primary biodiversity data to geospatial and tabular data.</p>\n\n<p><a href=\"https://www.d4science.org/\">D4Science</a> is a Hybrid Data Infrastructure combining over 500 software components and integrating data from more than 50 different data providers into a coherent and managed system of hardware, software, and data resources. The D4Science infrastructure drastically reduces the cost of ownership, maintenance, and operation thanks to the exploitation of gCube.</p>\n\n<p>&nbsp;</p>",
"html_code_location": "\n\n<p>The official source code location of this software version is available at:</p>\n\n<p><a href=\"{{code_location}}\">{{code_location}}</a></p>",
"skip_grants": ["004260"]
}
},
"exporters": {
"BibLaTeXSoftwareVersionExporter": {
"elaboration": "ALL"
}
},
"export_filename": "{{name}}"
},
"versions": [
{
"version": "1.0.0",
"date": "2019-02-26",
"group": "data-publishing",
"gcube_release_version": "4.13.1",
"gcube_release_ticket": "https://support.d4science.org/issues/13241",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "1.1.0",
"date": "2019-05-27",
"group": "data-publishing",
"gcube_release_version": "4.14.0",
"gcube_release_ticket": "https://support.d4science.org/issues/16491",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "1.2.0",
"date": "2019-11-06",
"group": "data-publishing",
"gcube_release_version": "4.15.0",
"gcube_release_ticket": "https://support.d4science.org/issues/17295",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "1.2.1",
"date": "2019-12-10",
"group": "data-publishing",
"gcube_release_version": "4.18.0",
"gcube_release_ticket": "https://support.d4science.org/issues/18336",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "1.2.2",
"date": "2021-02-24",
"group": "data-publishing",
"gcube_release_version": "5.0.0",
"gcube_release_ticket": "https://support.d4science.org/issues/20647",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "2.0.0",
"date": "2021-05-04",
"gcube_release_version": "5.2.0",
"gcube_release_ticket": "https://support.d4science.org/issues/19739",
"doi_url": "https://doi.org/10.5281/zenodo.7446431",
"version_doi_url": "https://doi.org/10.5281/zenodo.7446432",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "2.1.0",
"date": "2022-01-27",
"gcube_release_version": "5.7.0",
"gcube_release_ticket": "https://support.d4science.org/issues/21687",
"doi_url": "https://doi.org/10.5281/zenodo.7446431",
"version_doi_url": "https://doi.org/10.5281/zenodo.7446592",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "2.2.0",
"date": "2022-05-12",
"gcube_release_version": "5.11.0",
"gcube_release_ticket": "https://support.d4science.org/issues/22944",
"doi_url": "https://doi.org/10.5281/zenodo.7446431",
"version_doi_url": "https://doi.org/10.5281/zenodo.7446606",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "2.3.0",
"date": "2022-09-19",
"gcube_release_version": "5.13.1",
"gcube_release_ticket": "https://support.d4science.org/issues/23697",
"doi_url": "https://doi.org/10.5281/zenodo.7446431",
"version_doi_url": "https://doi.org/10.5281/zenodo.7448620",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "2.3.1",
"date": "2022-12-07",
"gcube_release_version": "5.14.0",
"gcube_release_ticket": "https://support.d4science.org/issues/23990",
"doi_url": "https://doi.org/10.5281/zenodo.7446431",
"version_doi_url": "https://doi.org/10.5281/zenodo.7467223",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
{
"version": "2.3.2",
"date": null,
"gcube_release_version": null,
"gcube_release_ticket": "https://support.d4science.org/issues/24286",
"doi_url": "https://doi.org/10.5281/zenodo.7446431",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
}
]
}

13
pom.xml
View File

@ -9,7 +9,7 @@
</parent>
<groupId>org.gcube.data-catalogue</groupId>
<artifactId>gcat-api</artifactId>
<version>2.1.0</version>
<version>2.3.3-SNAPSHOT</version>
<name>gCube Catalogue (gCat) API</name>
<description>gCube Catalogue (gCat) API is a library containing classes shared across gcat* components</description>
<properties>
@ -25,7 +25,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>2.0.1</version>
<version>2.2.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -48,5 +48,14 @@
<groupId>org.gcube.common</groupId>
<artifactId>gcube-jackson-databind</artifactId>
</dependency>
<!-- Added to support Java 11 JDK -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- END Added to support Java 11 JDK -->
</dependencies>
</project>

View File

@ -5,16 +5,21 @@ package org.gcube.gcat.api;
*/
public class GCatConstants {
public static final String SERVICE_CLASS = "data-catalogue";
public static final String SERVICE_CLASS = "org.gcube.data-catalogue";
public static final String SERVICE_NAME = "gcat";
public final static String CONFIGURATION_CATEGORY = GCatConstants.SERVICE_CLASS;
public final static String CONFIGURATION_NAME = GCatConstants.SERVICE_NAME + "-configuration";
public static final String SERVICE_ENTRY_NAME = "org.gcube.gcat.ResourceInitializer";
public static final String PURGE_QUERY_PARAMETER = "purge";
public static final String APPLICATION_JSON_CHARSET_UTF_8 = "application/json;charset=UTF-8";
public static final String LIMIT_PARAMETER = "limit";
public static final String OFFSET_PARAMETER = "offset";
public static final String COUNT_PARAMETER = "count";
public static final String APPLICATION_JSON_API = "application/vnd.api+json";
public static final String LIMIT_QUERY_PARAMETER = "limit";
public static final String OFFSET_QUERY_PARAMETER = "offset";
public static final String COUNT_QUERY_PARAMETER = "count";
public static final String OWN_ONLY_QUERY_PARAMETER = "own_only";
public static final String ALL_FIELDS_QUERY_PARAMETER = "all_fields";
public static final String COUNT_KEY = "count";
@ -26,7 +31,9 @@ public class GCatConstants {
public static final String REFER_ONLY_RESOURCE_QUERY_PARAMETER = "refers_only";
public static final String ORGANIZATION_FILTER_TEMPLATE = ORGANIZATION_PARAMETER + ":%s";
public static final String JSON_API_DATA_FIELD_NAME = "data";
}

View File

@ -0,0 +1,36 @@
package org.gcube.gcat.api.configuration;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class CKANDB {
protected String url;
protected String username;
protected String password;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}

View File

@ -0,0 +1,227 @@
package org.gcube.gcat.api.configuration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.gcube.com.fasterxml.jackson.annotation.JsonAnyGetter;
import org.gcube.com.fasterxml.jackson.annotation.JsonAnySetter;
import org.gcube.com.fasterxml.jackson.annotation.JsonProperty;
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class CatalogueConfiguration {
public static final String ID_KEY = "id";
public static final String CONTEXT_KEY = "context";
public static final String DEFAULT_ORGANIZATION_KEY = "defaultOrganization";
public static final String SUPPORTED_ORGANIZATIONS_KEY = "supportedOrganizations";
public static final String SYS_ADMIN_TOKEN_KEY = "sysAdminToken";
public static final String SOCIAL_POST_ENABLED_KEY = "socialPostEnabled";
public static final String NOTIFICATION_TO_USER_ENABLED_KEY = "notificationToUsersEnabled";
public static final String MODERATION_ENABLED_KEY = "moderationEnabled";
public static final String CKAN_URL_KEY = "ckanURL";
public static final String SOLR_URL_KEY = "solrURL";
public static final String CKAN_DB_KEY = "ckanDB";
public static final Set<String> KNOWN_PROPERTIES;
static {
KNOWN_PROPERTIES = new HashSet<>();
KNOWN_PROPERTIES.add(ID_KEY);
KNOWN_PROPERTIES.add(CONTEXT_KEY);
KNOWN_PROPERTIES.add(DEFAULT_ORGANIZATION_KEY);
KNOWN_PROPERTIES.add(SUPPORTED_ORGANIZATIONS_KEY);
KNOWN_PROPERTIES.add(SYS_ADMIN_TOKEN_KEY);
KNOWN_PROPERTIES.add(SOCIAL_POST_ENABLED_KEY);
KNOWN_PROPERTIES.add(NOTIFICATION_TO_USER_ENABLED_KEY);
KNOWN_PROPERTIES.add(MODERATION_ENABLED_KEY);
KNOWN_PROPERTIES.add(CKAN_URL_KEY);
KNOWN_PROPERTIES.add(SOLR_URL_KEY);
KNOWN_PROPERTIES.add(CKAN_DB_KEY);
}
protected String id;
protected String context;
protected String defaultOrganization;
protected Set<String> supportedOrganizations;
protected String sysAdminToken;
protected String ckanURL;
protected String solrURL;
protected boolean socialPostEnabled;
protected boolean notificationToUsersEnabled;
protected boolean moderationEnabled;
protected Map<String,Object> additionalProperties;
protected CKANDB ckanDB;
/*
* Return the CKAN organization name using the current context name
*/
public static String getOrganizationName(String context) {
String[] components = context.split("/");
String name = components[components.length-1];
return name.toLowerCase().replace(" ", "_");
}
protected CatalogueConfiguration() {
this.supportedOrganizations = new HashSet<>();
/* CKAN URL and sysAdminToken can only be retrieved from the IS */
this.ckanURL = null;
this.sysAdminToken = null;
this.socialPostEnabled = true; // default is true
this.notificationToUsersEnabled = false; // default is false
this.moderationEnabled = false; // default is false
additionalProperties = new HashMap<>();
}
public CatalogueConfiguration(String context) {
this();
setContext(context);
this.defaultOrganization = CatalogueConfiguration.getOrganizationName(context);
this.supportedOrganizations.add(defaultOrganization);
}
@JsonProperty(value = ID_KEY)
public String getID() {
return id;
}
public void setID(String id) {
this.id = id;
}
@JsonProperty(value = CONTEXT_KEY)
public String getContext() {
return context;
}
@JsonSetter
private void setContext(String context) {
this.context = context;
}
@JsonProperty(value = DEFAULT_ORGANIZATION_KEY)
public String getDefaultOrganization() {
if(defaultOrganization == null) {
defaultOrganization = CatalogueConfiguration.getOrganizationName(context);
}
return defaultOrganization;
}
public void setDefaultOrganization(String defaultOrganization) {
this.defaultOrganization = defaultOrganization;
}
@JsonProperty(value = SUPPORTED_ORGANIZATIONS_KEY)
public Set<String> getSupportedOrganizations() {
if(supportedOrganizations.isEmpty()) {
supportedOrganizations.add(getDefaultOrganization());
}
return supportedOrganizations;
}
public void setSupportedOrganizations(Set<String> supportedOrganizations) {
this.supportedOrganizations = supportedOrganizations;
}
@JsonProperty(value = SYS_ADMIN_TOKEN_KEY)
public String getSysAdminToken() {
return sysAdminToken;
}
public void setSysAdminToken(String sysAdminToken) {
this.sysAdminToken = sysAdminToken;
}
@JsonProperty(value = CKAN_URL_KEY)
public String getCkanURL() {
return ckanURL;
}
public void setCkanURL(String ckanURL) {
this.ckanURL = ckanURL;
}
@JsonProperty(value = SOLR_URL_KEY)
public String getSolrURL() {
return solrURL;
}
public void setSolrURL(String solrURL) {
this.solrURL = solrURL;
}
@JsonProperty(value = SOCIAL_POST_ENABLED_KEY)
public boolean isSocialPostEnabled() {
return socialPostEnabled;
}
public void setSocialPostEnabled(boolean socialPostEnabled) {
this.socialPostEnabled = socialPostEnabled;
}
@JsonProperty(value = NOTIFICATION_TO_USER_ENABLED_KEY)
public boolean isNotificationToUsersEnabled() {
return notificationToUsersEnabled;
}
public void setNotificationToUsersEnabled(boolean notificationToUsersEnabled) {
this.notificationToUsersEnabled = notificationToUsersEnabled;
}
@JsonProperty(value = MODERATION_ENABLED_KEY)
public boolean isModerationEnabled() {
return moderationEnabled;
}
public void setModerationEnabled(boolean moderationEnabled) {
this.moderationEnabled = moderationEnabled;
}
@JsonProperty(value = CKAN_DB_KEY)
public CKANDB getCkanDB() {
return ckanDB;
}
public void setCkanDB(CKANDB ckanDB) {
this.ckanDB = ckanDB;
}
@JsonAnyGetter
public Map<String,Object> getAdditionalProperties() {
return additionalProperties;
}
public void setAdditionalProperties(Map<String,Object> additionalProperties) {
this.additionalProperties = additionalProperties;
}
public Object getAdditionalProperty(String key) {
return this.additionalProperties.get(key);
}
@JsonAnySetter
public void setAdditionalProperty(String key, Object value) {
this.additionalProperties.put(key, value);
}
}

View File

@ -0,0 +1,26 @@
package org.gcube.gcat.api.interfaces;
import javax.xml.ws.WebServiceException;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public interface Configuration<C,D> {
public static final String CONFIGURATIONS = "configurations";
public static final String CURRENT_CONTEXT_PATH_PARAMETER = "CURRENT_CONTEXT";
public C create(String json) throws WebServiceException;
public C read() throws WebServiceException ;
public C update(String json) throws WebServiceException;
public C patch(String json) throws WebServiceException;
public D delete() throws WebServiceException;
public D purge() throws WebServiceException;
}

View File

@ -8,9 +8,10 @@ import java.util.Map;
*/
public enum CMItemStatus {
PENDING("pending"),
APPROVED("approved"),
REJECTED("rejected");
PENDING("pending", true),
APPROVED("approved", true),
REJECTED("rejected", true),
ANY("*", false);
protected static final Map<String,CMItemStatus> CM_ITEM_STATUS_FROM_VALUE;
@ -24,10 +25,16 @@ public enum CMItemStatus {
protected final String value;
protected final String fancyValue;
protected final boolean validStatus;
private CMItemStatus(String value) {
private CMItemStatus(String value, boolean validStatus) {
this.value = value;
this.fancyValue = Character.toUpperCase(value.charAt(0)) + value.substring(1);
if(this.value.length()>1) {
this.fancyValue = Character.toUpperCase(value.charAt(0)) + value.substring(1);
}else {
this.fancyValue = this.value;
}
this.validStatus = validStatus;
}
public String getValue() {
@ -38,9 +45,12 @@ public enum CMItemStatus {
return fancyValue;
}
public boolean isValidStatus() {
return validStatus;
}
public static CMItemStatus getCMItemStatusFromValue(String value) {
return CM_ITEM_STATUS_FROM_VALUE.get(value);
}
}

View File

@ -10,9 +10,25 @@ public interface Moderated {
/* Content Moderation fields */
public static final String CM_ITEM_STATUS_QUERY_PARAMETER = "status";
public static final String SYSTEM_CM_PREFIX = "system:cm_";
/**
* Used to keep tack of item status
*/
public static final String SYSTEM_CM_ITEM_STATUS = SYSTEM_CM_PREFIX + "item_status";
/**
* Used to keep tack of item visibility
*/
public static final String SYSTEM_CM_ITEM_VISIBILITY = SYSTEM_CM_PREFIX + "item_visibility";
/**
* Used to keep tack of item author
*/
public static final String SYSTEM_CM_ITEM_AUTHOR = SYSTEM_CM_PREFIX + "item_author";
/**
* Used to keep tack of item author fullname
*/
public static final String SYSTEM_CM_ITEM_AUTHOR_FULLNAME = SYSTEM_CM_PREFIX + "item_author_fullname";
public String approve(String moderatorMessage);
public String reject(String moderatorMessage);

View File

@ -10,11 +10,13 @@ public enum Role {
MEMBER(Role.CATALOGUE_MEMBER, "member"),
EDITOR(Role.CATALOGUE_EDITOR, "editor"),
ADMIN(Role.CATALOGUE_ADMIN, "admin");
ADMIN(Role.CATALOGUE_ADMIN, "admin"),
MANAGER(Role.CATALOGUE_MANAGER, "admin");
private static final String CATALOGUE_ADMIN = "Catalogue-Admin";
private static final String CATALOGUE_EDITOR = "Catalogue-Editor";
private static final String CATALOGUE_MEMBER = "Catalogue-Member";
public static final String CATALOGUE_EDITOR = "Catalogue-Editor";
public static final String CATALOGUE_MEMBER = "Catalogue-Member";
public static final String CATALOGUE_ADMIN = "Catalogue-Admin";
public static final String CATALOGUE_MANAGER = "Catalogue-Manager";
private final String portalRole;
private final String ckanRole;