Compare commits

...

55 Commits

Author SHA1 Message Date
Lampros Smyrnaios 17d0ac6c33 Merge pull request 'Resolve tickets 9114 and 9031' (#12) from develop into master
Reviewed-on: #12
2024-04-04 15:33:10 +02:00
Lampros Smyrnaios e4009b7903 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	README.md
2024-04-04 16:16:31 +03:00
Lampros Smyrnaios 4f1e3a14d4 Fix conflicts in README. 2024-04-04 16:15:17 +03:00
Lampros Smyrnaios cb458553f0 - Update the "RepositoryServiceImpl.getCompatibilityClasses()" method to recognise additional "CRIS" modes.
- Catch exceptions thrown in "RepositoryServiceImpl.searchApi()".
- Code optimization.
- Update dependencies.
2024-04-03 14:59:43 +03:00
Lampros Smyrnaios c836de5761 Use the new DSM-2.0 API to obtain the "aggregation history" of a repository. 2024-03-22 11:51:22 +02:00
Lampros Smyrnaios 6dfe11484e - Add the Maven Central repository.
- Add/update/fix/cleanup dependencies.
- Add the "show-actuator"-config for springdoc.
- Remove obsolete configuration.
2024-03-15 13:58:38 +02:00
Lampros Smyrnaios 0deeb00ee5 - Replaced DSM's "AggregationInfo" with "CollectionInfoV2" in "eu.dnetlib.repo.manager.domain.AggregationInfo".
- Cleanup related dependencies.

Co-authored-by: Konstantinos Spyrou <spyroukon@gmail.com>
2024-03-13 18:20:45 +02:00
Lampros Smyrnaios b047caee26 Merge pull request 'Documentation cleanup.' (#11) from lsmyrnaios-patch-2 into master
Reviewed-on: #11
2024-03-11 12:27:21 +01:00
Lampros Smyrnaios 958e6b304e Documentation cleanup. 2024-03-11 12:26:30 +01:00
Antonis Lempesis 44610c172d Merge pull request 'Add/update documentation.' (#10) from lsmyrnaios-patch-1 into master
Reviewed-on: #10
2024-03-11 11:41:32 +01:00
Lampros Smyrnaios 547b3107a3 Add/update documentation. 2024-03-11 11:39:24 +01:00
Antonis Lempesis 4e7ba9d5cb Update 'README.md' 2024-03-11 10:51:15 +01:00
Antonis Lempesis 62aa87bd86 updated documentation 2024-03-11 10:50:21 +01:00
Lampros Smyrnaios 7853494a5b Remove obsolete paragraph. 2023-11-15 13:01:56 +02:00
Lampros Smyrnaios d1c336f4e7 Merge branch 'master' into develop 2023-11-14 18:50:30 +02:00
Lampros Smyrnaios 1c9ff0669a - Add information in the README, about the "Building", "Deployment", "Installation" and "Configuration" of the project.
- Eliminate a warning in the POM file, about a missing tag.
2023-11-14 18:45:45 +02:00
Antonis Lempesis cb8c68e8f9 Update 'README.md' 2023-11-14 15:25:37 +01:00
Antonis Lempesis 6f964e3d16 Update 'README.md' 2023-11-14 15:25:16 +01:00
Antonis Lempesis a673450f9c Update 'README.md' 2023-11-14 15:21:08 +01:00
Lampros Smyrnaios 224d058d89 Merge pull request 'merge master to develop' (#9) from master into develop
Reviewed-on: #9
2023-11-02 14:16:54 +01:00
Lampros Smyrnaios 91e0b66b28 Merge pull request 'Merge develop into master' (#6) from develop into master
Reviewed-on: #6
2023-11-02 14:05:14 +01:00
Lampros Smyrnaios c838f71227 merge from disable_compliance_failure_emails 2023-11-02 15:04:19 +02:00
Lampros Smyrnaios 0b8e4c4729 Update the Sushilite-R5 dependency from Nexus. 2023-11-02 14:39:10 +02:00
Lampros Smyrnaios a72c5b2fb8 - Update dependencies.
- Fix a file-extension in README.
2023-10-31 13:56:59 +02:00
Konstantinos Spyrou bd315848e0 fixed typo 2023-10-11 14:53:44 +03:00
Konstantinos Spyrou 4b5132358a created repository metrics calls and excluded them from authentication 2023-10-11 14:45:53 +03:00
Konstantinos Spyrou 39596cfcc1 added method to get if piwik is validated 2023-10-11 13:03:00 +03:00
Konstantinos Spyrou 5138605163 added method to get if piwik is validated 2023-10-11 13:00:48 +03:00
Lampros Smyrnaios 75e97ece26 Add info about the Swagger-UI-url in the README.md 2023-10-04 12:29:52 +03:00
TheQuaker 9da5fa5c1e Fix typo for DataType param 2023-09-29 15:36:55 +03:00
Lampros Smyrnaios 842468a175 Improve performance and error-handling in "InterfaceComplianceService.cleanUp()". 2023-09-27 12:24:22 +03:00
Lampros Smyrnaios 64fdff095d - Resolve a dependency-conflict.
- Update dependencies.
2023-09-25 15:01:31 +03:00
Lampros Smyrnaios 11460764a2 Merge pull request 'Disable sending emails about compliance failure.' (#5) from disable_compliance_failure_emails into master
Reviewed-on: #5
2023-07-24 12:47:31 +02:00
Lampros Smyrnaios 3cb8e7a5f6 - Update dependencies.
- Code polishing.
2023-07-05 13:16:48 +03:00
Lampros Smyrnaios eb42185991 - Update dependencies.
- Add notes for swagger-UI in README.
2023-06-06 19:27:02 +03:00
Lampros Smyrnaios a2a387be90 - Fix a security config for Swagger.
- Add the "displayRequestDuration" for "Try it out" requests in Swagger.
- Code polishing.
2023-06-02 14:23:54 +03:00
Lampros Smyrnaios dc469df9d6 Add JPA configuration. This fixes a missing Bean error. 2023-06-02 13:00:25 +03:00
Lampros Smyrnaios 8f6426eaf6 - Upgrade Spring and other dependencies.
- Migrate to SpringDoc, since SpringFox is dead.
2023-06-01 20:48:01 +03:00
Konstantinos Spyrou ab854a6624 changed application type and replaced counters with gauges 2023-04-04 18:43:48 +03:00
Lampros Smyrnaios 311442854a Add missing "sushiliteR5Endpoint" property. 2023-03-29 15:15:53 +03:00
Lampros Smyrnaios dfc4a4690e Update Json and Gson dependencies. 2023-03-29 12:11:19 +03:00
Lampros Smyrnaios 0ce67b6355 Avoid assigning an empty list, in case the "reportItems" is null, inside "SushiliteServiceImpl.getReportResults()". 2023-03-29 12:08:43 +03:00
Lampros Smyrnaios 54ebb35161 Detect the "504 Gateway Time-out" error from Sushilite-R5 and provide a mention to it, in the response-body. 2023-03-29 12:04:34 +03:00
Lampros Smyrnaios 97e85c2a75 Add suchilite-R5 support. 2023-03-28 15:08:20 +03:00
Lampros Smyrnaios 7cab17c133 Move Sushilite Service in its own package. Later, additional Sushilite Services will be added. 2023-03-22 13:35:20 +02:00
Lampros Smyrnaios d2973871a8 Inform the developer about the possibility of a "RestClientException" being thrown by various methods of "HttpUtils" and "RegistryCalls" classes. 2023-03-08 15:26:26 +02:00
Lampros Smyrnaios a0fd5f67a7 Fix the "NoSuchBeanDefinitionException: No bean named 'transactionManager' available", when trying to run the scheduled task -during initialization- for assigning pending user roles. 2023-03-08 13:57:29 +02:00
Lampros Smyrnaios 59fc344730 - Use the production AAI url, as the "beta" one has issues.
- Polish the application.yml
2023-03-02 16:15:54 +02:00
Konstantinos Spyrou e9fedc90d4 experimental: temp save role if assign fails 2023-02-17 20:40:51 +02:00
Konstantinos Spyrou 0ad86025b3 throw error when assigning role to a user who is not found in the aai registry 2023-02-17 17:35:18 +02:00
Konstantinos Spyrou bae9a132cb Merge branch 'develop' of code-repo.d4science.org:MaDgIK/uoa-repository-manager-service into develop 2023-02-17 16:17:56 +02:00
Konstantinos Spyrou b67e98976d Improved role functionality 2023-02-17 16:17:37 +02:00
Lampros Smyrnaios c006c7baa0 - Show error-messages for Broker's errors.
- Code polishing.
2023-02-15 18:31:13 +02:00
Lampros Smyrnaios 8f5aed3aab Update application.yml 2023-02-15 18:03:20 +02:00
Lampros Smyrnaios 0f0163dc2d Update the "getRepositoriesByCountry"-endpoint to return up to 10_000 repositories. 2023-02-15 17:14:02 +02:00
42 changed files with 992 additions and 420 deletions

221
README.md
View File

@ -1,9 +1,218 @@
# Provide
# OpenAIRE Provide - backend service
## Introduction
OpenAIRE PROVIDE is the content gateway service of OpenAIRE, where data providers are invited to connect scholarly content with OpenAIRE.<br>
OpenAIRE PROVIDE allows repositories, data archives, journals, aggregators, CRIS systems, to enter the OpenAIRE and European Open Science (EOSC) ecosystem and be accessible by millions of researchers, research institutes and networks, research funders, policy makers and citizens.<br>
OpenAIRE PROVIDE lowers any technological barriers, by supporting a series of integrations, therefore, enabling its users to visually access OpenAIRE's services that are responsible for the data harvesting process.
<br><br>
There are four distinctive steps from the initial express of interest for OpenAIRE PROVIDE to the actual content availability on OpenAIRE and EOSC.
<br>
The steps indicate the important subservices of OpenAIRE that perform the following functionalities:
- Validation of data sources with the OpenAIRE guidelines (via the OpenAIRE Validator)
- Registration of data sources to OpenAIRE and global interlinked networks provides links to content for text and data mining, view history of validations, status of harvesting Enrichment of metadata information that describes the data sources to be available through OpenAIRE.
- Subscribe and view/receive notifications to enrich the metadata or the content of the data source (via the OpenAIRE Broker)
- View usage statistics of Open research impact by subscribing to the OpenAIRE UsageCounts service; view aggregated, cleaned usage stats for repository access and broaden your mechanisms for impact assessment.
<br>
## Architecture
[...]
## Install and run:
- Run **git clone** and then **cd uoa-repository-manager-service**.
- Provide all not-set or redacted configurations, inside the **src/main/resources/application.properties** file.
- Build the app with: `mvn clean install`
- Run the app with: `java -jar ./target/uoa-repository-manager-service.jar`
<br>
## Building
The backend is a [Maven](https://maven.apache.org/index.html) project. It has been tested using Java 8.
<br>
#### Manual Build Instructions
###### Requirements:
- Java 8
- Apache Maven 3+
###### Build Instructions:
1. Clone the repository and move inside the directory
<br> `git clone https://code-repo.d4science.org/MaDgIK/uoa-repository-manager-service.git && cd uoa-repository-manager-service`
2. Provide all not-set or redacted configurations, inside the **src/main/resources/application.yml** file.
3. Build Maven project
<br> `mvn clean package`
<br> Produces the file "./target/**uoa-repository-manager-service.jar**" which can be run with: - Run the app with: `java -jar ./target/uoa-repository-manager-service.jar`
#### Build using Docker
The repository contains a **Dockerfile** which can be used to build an image containing the compiled project.
###### Requirements:
- Docker
###### Build Instructions:
1. Clone the repository and move inside the directory
<br> `git clone https://code-repo.d4science.org/MaDgIK/uoa-repository-manager-service.git && cd uoa-repository-manager-service`
2. Provide all not-set or redacted configurations, inside the **src/main/resources/application.yml** file.
3. Build Docker image
<br> `docker build . -t <docker-image-name>`
<br>
## Configuration
The configuration can be set inside the **src/main/resources/application.yml** file.
### Server-related configuration.
```
server:
port: 8480
servlet:
context-path: /uoa-repository-manager-service
```
### Swagger UI - related configuration
```
springdoc:
swagger-ui:
disable-swagger-default-url: true
path: /swagger-ui.html
displayRequestDuration: true
api-docs:
path: /api-docs
```
### Datasource -related configuration
```
spring:
jpa:
hibernate:
ddl-auto: update
datasource:
url: ${services.provide.db.url}
username: ${services.provide.db.username}
password: ${services.provide.db.password}
driverClassName: ${services.provide.db.driverClassName}
```
### Configurations about the provide service.
```
services:
openaireServicesBaseUrl: https://beta.services.openaire.eu
provide:
dev-machine: 88.197.53.71 # VM-71
```
### Configuration about Authentication and authorization infrastructure (AAI).
```
aai:
baseURL: https://aai.openaire.eu
oidc:
domain: .openaire.eu # use empty value for local, otherwise: ".openaire.eu"
id: XX
issuer: ${services.provide.aai.baseURL}/oidc/
redirectURL: http://localhost:${server.port}${server.servlet.context-path}/openid_connect_login
secret: XX
webURL: http://localhost:4200/join
registry:
coid: XX
username: XX
password: XX
production: false
url: ${services.provide.aai.baseURL}/registry/
```
### Broker's configuration
```
broker:
api: api/
openaire: openaireBroker
port: 443
url: https://beta.broker.openaire.eu
```
### Client's configuration
```
clients:
dsm: ${services.provide.baseUrl}
search: ${services.openaireServicesBaseUrl}/search/v2/api
usageEvents: http://beta.lbs.openaire.eu:8080/ajax/summary
usagestats: ${services.openaireServicesBaseUrl}/usagestats
```
### Database configuration for Provide.
```
db:
driverClassName: org.postgresql.Driver
password: dnetPwd
url: jdbc:postgresql://${services.provide.dev-machine}:5432/repomanager
username: dnet
```
### Configuration for the IS LookUp service.
```
iSLookUpService:
url: https://dev-openaire.d4science.org:443/is/services/isLookUp
```
### Mail-server configuration.
```
mail:
authenticate: true
debug: false
from: XX
host: smtp.gmail.com
mode: ssl
password: XX
port: 465
replyTo: XX
username: XX
```
### Redis's configuration
```
redis:
host: vereniki.athenarc.gr
password: XX
port: 6379
```
### Usage statistics
```
usageStatisticsDiagramsBaseURL: https://beta.openaire.eu/stats3/
usageStatisticsNumbersBaseURL: ${services.openaireServicesBaseUrl}/usagestats/datasources/
usagestats:
adminEmail: XX
sushiliteEndpoint: ${services.openaireServicesBaseUrl}/usagestats/sushilite/
sushiliteR5Endpoint: ${services.openaireServicesBaseUrl}/usagestats_r5/sushilite/r5/
```
### Validator - related configuration.
```
validator:
results:
url: https://beta.provide.openaire.eu/compatibility/browseHistory/
validatorService:
url: http://${services.provide.dev-machine}:8080/uoa-validator-service/services/validatorWebService
```
### Miscellaneous
```
topic_types:
url: ${services.openaireServicesBaseUrl}/provision/mvc/vocabularies/dnet:topic_types.json
adminEmail: XX
analyticsURL: https://analytics.openaire.eu/addsite.php?
baseUrl: ${services.openaireServicesBaseUrl}/openaire
```
<br>
## Deployment
### Prerequisites
* install [PostgreSQL 9.5+](https://www.postgresql.org/)
* Run the app with: `java -jar ./target/uoa-repository-manager-service.jar --spring.config.location=application.yml`
<br>
## misc
### Notes for Swagger-UI:
- Access it through this url: http://localhost:8480/uoa-repository-manager-service/swagger-ui/index.html
- In order to request data from most endpoints, you have to be a "REGISTERED_USER", otherwise you will get a 403 error code.
- In order to be a registered user, you have to run the [UI-service](https://code-repo.d4science.org/MaDgIK/uoa-repository-manager-ui) , in the same machine, at the same time and login through a browser, using the following url: http://localhost:8480/uoa-repository-manager-service/openid_connect_login

152
pom.xml
View File

@ -6,7 +6,8 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<version>2.7.18</version>
<relativePath></relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -16,13 +17,14 @@
<packaging>jar</packaging>
<properties>
<spring.boot.version>2.5.4</spring.boot.version>
<spring.boot.version>2.7.18</spring.boot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.boot.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
@ -33,47 +35,81 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${spring.boot.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>${spring.boot.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>9.1.1</version>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.224</version>
</dependency>
<dependency>
<groupId>eu.dnetlib.dhp</groupId>
<artifactId>dnet-exporter-api</artifactId>
<version>[3.3.3-SNAPSHOT, )</version>
<artifactId>dnet-exporter-model</artifactId>
<version>[3.5.1, )</version>
<exclusions>
<exclusion>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-common</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/io.micrometer/micrometer-registry-prometheus -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.12.4</version>
</dependency>
<dependency>
@ -85,7 +121,6 @@
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
@ -123,6 +158,11 @@
<artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>dnet-openaire-usage-stats-sushilite-r5</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>eu.dnetlib.dhp</groupId>
<artifactId>dnet-openaire-broker-common</artifactId>
@ -134,16 +174,17 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2</version>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.16.0</version>
</dependency>
<dependency>
@ -151,63 +192,58 @@
<artifactId>oai4j</artifactId>
<version>[0.6b1,)</version>
</dependency>
<!-- TODO - Do we need this? -->
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.2</version>
<version>2.7.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client -->
<dependency>
<groupId>com.sun.jersey</groupId>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19.3</version>
<version>2.42</version>
</dependency>
<!-- TODO - Do we need this? We already have: "com.google.code.gson:gson" -->
<dependency>
<groupId>org.aksw.gson</groupId>
<artifactId>gson-utils-core</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20080701</version>
<version>20240303</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.0</version>
<version>1.6.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/postgresql/postgresql -->
<dependency>
<groupId>postgresql</groupId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc3</version>
<version>42.7.3</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.mitre</groupId>
<artifactId>openid-connect-client</artifactId>
<version>1.3.0</version>
<version>1.3.4</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
@ -218,36 +254,40 @@
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
<version>2.7.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>${jedis.version}</version>
<version>${jedis.version}</version> <!-- This property comes from the parent-pom. -->
<!--<version>3.7.0</version>-->
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId>
<version>2.5</version>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.jws/javax.jws-api -->
<dependency>
@ -258,23 +298,23 @@
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
<version>2.3.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-core -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1-rev-1</version>
<version>1.1.1</version>
</dependency>
<dependency>
@ -297,7 +337,7 @@
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-bom</artifactId>
<version>2021.0.2</version>
<version>2021.2.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -311,7 +351,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@ -321,22 +361,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<version>3.4.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
-->
</plugin>
-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
</plugin>
<plugin>
<groupId>cz.habarta.typescript-generator</groupId>
<artifactId>typescript-generator-maven-plugin</artifactId>
<version>2.16.538</version>
<version>2.37.1128</version>
<executions>
<execution>
<id>java to typeScript</id>
@ -367,6 +408,15 @@
</build>
<repositories>
<repository>
<id>central</id>
<name>Maven Central</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>dnet45-bootstrap-snapshot</id>
<name>D-Net 45 Bootstrap Snapshot</name>
@ -421,6 +471,12 @@
<enabled>false</enabled>
</releases>
</repository>
<!-- Use this when testing local JARs. -->
<!--<repository>
<id>libs</id>
<url>file:///${project.basedir}/libs</url>
</repository>-->
</repositories>
</project>

View File

@ -1,12 +1,16 @@
package eu.dnetlib.repo.manager;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
package eu.dnetlib.repo.manager;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableJpaRepositories
@EnableScheduling
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

View File

@ -0,0 +1,20 @@
package eu.dnetlib.repo.manager.components;
import eu.dnetlib.repo.manager.service.PendingUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class ScheduledTasks {
@Autowired
PendingUserRoleService pendingUserRoleService;
@Scheduled(fixedRate = 3_600_000)
public void assignPendingRoles() {
pendingUserRoleService.assignRoles();
}
}

View File

@ -63,12 +63,15 @@ public class AaiSecurityConfiguration extends WebSecurityConfigurerAdapter {
.csrf().disable()
.authorizeRequests()
.regexMatchers("/actuator/.*").permitAll()
.regexMatchers("/repositories/.*/metrics/?.*").permitAll()
.regexMatchers("/metrics").permitAll()
.antMatchers("/api-docs/**","/swagger-ui/**").permitAll()
.anyRequest().authenticated()
.and()
.logout().logoutUrl("/openid_logout")
.clearAuthentication(true)
.invalidateHttpSession(true)
.deleteCookies("openAIRESession")
.deleteCookies()
.logoutSuccessUrl(logoutSuccessUrl)
.and()
.addFilterBefore(openIdConnectAuthenticationFilter(), AbstractPreAuthenticatedProcessingFilter.class)

View File

@ -0,0 +1,17 @@
package eu.dnetlib.repo.manager.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
@Configuration
public class JPAConfig {
@Bean
public PlatformTransactionManager transactionManager() {
return new JpaTransactionManager();
}
}

View File

@ -0,0 +1,23 @@
package eu.dnetlib.repo.manager.config;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.info.License;
@OpenAPIDefinition(
info = @Info(
title = "Repository Manager Dashboard API Documentation",
description = "Repository Manager Dashboard API Documentation",
version = "1.0",
termsOfService = "urn:tos",
license = @License(
name = "Apache 2.0",
url = "https://www.apache.org/licenses/LICENSE-2.0.html"
),
contact = @Contact(name = "", url = "", email = "")
)
)
public class OpenAPIConfiguration {
}

View File

@ -1,47 +0,0 @@
package eu.dnetlib.repo.manager.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
/**
* Created by panagiotis on 16/11/2017.
*/
@Configuration
@EnableSwagger2
@EnableWebMvc
public class SwaggerConfig {
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.pathMapping("/")
.apiInfo(getApiInfo());
}
private ApiInfo getApiInfo() {
return new ApiInfo("Repository Manager Dashboard API Documentation",
"Repository Manager Dashboard API Documentation",
"1.0",
"urn:tos",
new Contact("", "", ""),
"Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0",
new ArrayList<VendorExtension>());
}
}

View File

@ -4,8 +4,8 @@ import eu.dnetlib.repo.manager.domain.Term;
import eu.dnetlib.repo.manager.domain.broker.*;
import eu.dnetlib.repo.manager.exception.BrokerException;
import eu.dnetlib.repo.manager.service.BrokerServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.json.JSONException;
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
import org.springframework.beans.factory.annotation.Autowired;
@ -21,7 +21,7 @@ import java.util.Map;
@RestController
@RequestMapping(value = "/broker")
@Api(description = "Broker API", tags = {"broker"})
@Tag(name="broker", description="Broker API")
public class BrokerController{
@Autowired
@ -33,9 +33,9 @@ public class BrokerController{
@PreAuthorize("hasAuthority('REGISTERED_USER')")
public DatasourcesBroker getDatasourcesOfUser(
@RequestParam("includeShared")
@ApiParam(value = "Include shared datasources", required = true , defaultValue = "false") String includeShared,
@Parameter(description = "Include shared datasources (default = false)", required = true) String includeShared,
@RequestParam("includeByOthers")
@ApiParam(value = "Include datasources of other", required = true,defaultValue = "false") String includeByOthers) throws JSONException {
@Parameter(description = "Include datasources of other (default = false)", required = true) String includeByOthers) throws JSONException {
return brokerService.getDatasourcesOfUser(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(), includeShared, includeByOthers);
}

View File

@ -1,6 +1,6 @@
package eu.dnetlib.repo.manager.controllers;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
import eu.dnetlib.repo.manager.domain.BrokerSummary;
import eu.dnetlib.repo.manager.domain.CollectionMonitorSummary;
import eu.dnetlib.repo.manager.domain.RepositorySummaryInfo;
@ -8,7 +8,7 @@ import eu.dnetlib.repo.manager.domain.UsageSummary;
import eu.dnetlib.repo.manager.exception.BrokerException;
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
import eu.dnetlib.repo.manager.service.*;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.json.JSONException;
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
import org.springframework.beans.factory.annotation.Autowired;
@ -21,7 +21,7 @@ import java.util.List;
@RestController
@RequestMapping(value = "/dashboard")
@Api(description = "Dashboard API", tags = {"dashboard"})
@Tag(name="dashboard", description = "Dashboard API")
public class DashboardController {
@Autowired

View File

@ -4,8 +4,8 @@ import eu.dnetlib.api.functionality.ValidatorServiceException;
import eu.dnetlib.domain.functionality.validator.StoredJob;
import eu.dnetlib.repo.manager.domain.JobsOfUser;
import eu.dnetlib.repo.manager.service.MonitorServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.json.JSONException;
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
import org.slf4j.Logger;
@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = "/monitor")
@Api(description = "Monitor API", tags = {"monitor"})
@Tag(name="monitor", description="Monitor API")
public class MonitorController {
private static final Logger logger = LoggerFactory.getLogger(MonitorController.class);
@ -31,13 +31,13 @@ public class MonitorController {
@ResponseBody
@PreAuthorize("hasAuthority('REGISTERED_USER')")
public JobsOfUser getJobsOfUser(@RequestParam(value = "jobType", required = false)
@ApiParam(value = "Equals to filter job type on validation history page") String jobType,
@RequestParam("offset") @ApiParam(value = "Page number", required = true) String offset,
@RequestParam(value = "limit", required = false,defaultValue = "10") @ApiParam(value = "Null value") String limit,
@RequestParam(value = "dateFrom", required = false) @ApiParam(value = "Null value") String dateFrom,
@RequestParam(value = "dateTo", required = false) @ApiParam(value = "Null value") String dateTo,
@RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = false) String validationStatus,
@RequestParam("includeJobsTotal") @ApiParam(value = "Always true", required = true) String includeJobsTotal) throws JSONException, ValidatorServiceException {
@Parameter(description = "Equals to filter job type on validation history page") String jobType,
@RequestParam("offset") @Parameter(name = "Page number", required = true) String offset,
@RequestParam(value = "limit", required = false,defaultValue = "10") @Parameter(description = "Null value") String limit,
@RequestParam(value = "dateFrom", required = false) @Parameter(description = "Null value") String dateFrom,
@RequestParam(value = "dateTo", required = false) @Parameter(description = "Null value") String dateTo,
@RequestParam("validationStatus") @Parameter(description = "Equals to filter validation jobs", required = false) String validationStatus,
@RequestParam("includeJobsTotal") @Parameter(description = "Always true", required = true) String includeJobsTotal) throws JSONException, ValidatorServiceException {
return monitorService.getJobsOfUser(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(), jobType, offset, limit, dateFrom, dateTo, validationStatus, includeJobsTotal);
}

View File

@ -6,9 +6,9 @@ import eu.dnetlib.repo.manager.domain.OrderByType;
import eu.dnetlib.repo.manager.domain.Paging;
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
import eu.dnetlib.repo.manager.service.PiWikServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -31,7 +31,7 @@ import java.util.List;
@RestController
@RequestMapping(value = "/piwik")
@Api(description = "Piwik API", tags = {"piwik"})
@Tag(name="piwik", description = "Piwik API")
public class PiWikController {
private static final Logger logger = LoggerFactory.getLogger(PiWikController.class);
@ -39,6 +39,16 @@ public class PiWikController {
@Autowired
private PiWikServiceImpl piWikService;
@RequestMapping(value = "/validated", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Boolean isPiwikValidated(@RequestParam("repositoryId") String repositoryId) {
PiwikInfo info = piWikService.getPiwikSiteForRepo(repositoryId);
if (info != null) {
return info.isValidated();
}
return false;
}
@RequestMapping(value = "/getPiwikSiteForRepo/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasAnyAuthority('SUPER_ADMINISTRATOR', 'CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or @authorizationService.isMemberOf(#repositoryId) or (@repositoryService.getRepositoryById(#repositoryId).registeredby==null and hasAuthority('REGISTERED_USER'))")
@ -53,17 +63,17 @@ public class PiWikController {
}
@RequestMapping(value = "/getPiwikSitesForRepos" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ApiImplicitParams({
@ApiImplicitParam(name = "from", dataType = "number", paramType = "query"),
@ApiImplicitParam(name = "quantity", dataType = "number", paramType = "query"),
@ApiImplicitParam(name = "order", dataType = "eu.dnetlib.repo.manager.domain.OrderByType", paramType = "query"),
@ApiImplicitParam(name = "orderField", dataType = "eu.dnetlib.repo.manager.domain.OrderByField", paramType = "query"),
@ApiImplicitParam(name = "searchField", dataType = "string", paramType = "query"),
@Parameters({
@Parameter(name = "from", description = "number"),
@Parameter(name = "quantity", description = "number"),
@Parameter(name = "order", description = "eu.dnetlib.repo.manager.domain.OrderByType"),
@Parameter(name = "orderField", description = "eu.dnetlib.repo.manager.domain.OrderByField"),
@Parameter(name = "searchField", description = "string")
})
public Paging<PiwikInfo> getPiwikSitesForRepos(
@RequestParam(value = "from",required=false,defaultValue = "0") int from,
@RequestParam(value = "quantity",required=false,defaultValue = "100") int quantity,
@RequestParam(value = "order",required=false,defaultValue = "DSC") OrderByType orderType,
@RequestParam(value = "from", required=false, defaultValue = "0") int from,
@RequestParam(value = "quantity", required=false, defaultValue = "100") int quantity,
@RequestParam(value = "order", required=false, defaultValue = "DSC") OrderByType orderType,
@RequestParam(value = "orderField", required = false, defaultValue = "REPOSITORY_NAME") OrderByField orderField,
@RequestParam(value = "searchField", required = false, defaultValue = "") String searchField
@ -77,12 +87,12 @@ public class PiWikController {
return results;
}
@ApiImplicitParams({
@ApiImplicitParam(name = "from", dataType = "number", paramType = "query"),
@ApiImplicitParam(name = "quantity", dataType = "number", paramType = "query"),
@ApiImplicitParam(name = "order", dataType = "eu.dnetlib.repo.manager.domain.OrderByType", paramType = "query"),
@ApiImplicitParam(name = "searchField", dataType = "eu.dnetlib.repo.manager.domain.OrderByField", paramType = "query"),
@ApiImplicitParam(name = "orderField", dataType = "string", paramType = "query"),
@Parameters({
@Parameter(name = "from", description = "number"),
@Parameter(name = "quantity", description = "number"),
@Parameter(name = "order", description = "eu.dnetlib.repo.manager.domain.OrderByType"),
@Parameter(name = "searchField", description = "eu.dnetlib.repo.manager.domain.OrderByField"),
@Parameter(name = "orderField", description = "string")
})
@RequestMapping(value = "/getPiwikSitesForRepos/csv" , method = RequestMethod.GET,produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@ResponseBody

View File

@ -1,16 +1,18 @@
package eu.dnetlib.repo.manager.controllers;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.domain.data.PiwikInfo;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
import eu.dnetlib.repo.manager.domain.*;
import eu.dnetlib.repo.manager.domain.dto.RepositoryTerms;
import eu.dnetlib.repo.manager.domain.dto.User;
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
import eu.dnetlib.repo.manager.service.AggregationService;
import eu.dnetlib.repo.manager.service.PiWikService;
import eu.dnetlib.repo.manager.service.RepositoryService;
import eu.dnetlib.repo.manager.service.security.AuthorizationService;
import eu.dnetlib.repo.manager.utils.JsonUtils;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.json.JSONException;
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
import org.slf4j.Logger;
@ -32,7 +34,7 @@ import java.util.Map;
@RestController
@RequestMapping(value = "/repositories")
@Api(description = "Repository API", tags = {"repositories"})
@Tag(name="repositories", description="Repository API")
public class RepositoryController {
private static final Logger logger = LoggerFactory.getLogger(RepositoryController.class);
@ -43,12 +45,17 @@ public class RepositoryController {
private final AuthorizationService authorizationService;
private final PiWikService piWikService;
@Autowired
RepositoryController(RepositoryService repositoryService,
AggregationService aggregationService, AuthorizationService authorizationService) {
AggregationService aggregationService,
AuthorizationService authorizationService,
PiWikService piWikService) {
this.repositoryService = repositoryService;
this.aggregationService = aggregationService;
this.authorizationService = authorizationService;
this.piWikService = piWikService;
}
@RequestMapping(value = "/countries", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ -295,4 +302,26 @@ public class RepositoryController {
authorizationService.removeAdmin(id, email);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Returns whether the Piwik Site of a repository is enabled and validated.
*/
@RequestMapping(value = "{repositoryId}/metrics/valid", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public boolean getMetricsEnabledAndValidated(@PathVariable("repositoryId") String repositoryId) {
PiwikInfo info = piWikService.getPiwikSiteForRepo(repositoryId);
return info != null && info.isValidated();
}
/**
* Returns repository Metrics.
*/
@RequestMapping(value = "{repositoryId}/metrics", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public MetricsInfo getMetricsInfo(@PathVariable("repositoryId") String id) throws RepositoryServiceException {
return repositoryService.getMetricsInfoForRepository(id);
}
}

View File

@ -1,7 +1,7 @@
package eu.dnetlib.repo.manager.controllers;
import eu.dnetlib.repo.manager.service.StatsServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
@ -13,7 +13,7 @@ import java.util.Map;
@RestController
@RequestMapping(value = "/stats")
@Api(description = "Stats API", tags = {"statistics"})
@Tag(name="statistics", description = "Stats API")
public class StatsController {
@Autowired

View File

@ -1,8 +1,8 @@
package eu.dnetlib.repo.manager.controllers;
import eu.dnetlib.repo.manager.service.SushiliteServiceImpl;
import eu.dnetlib.repo.manager.service.sushilite.SushiliteServiceImpl;
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
@ -10,10 +10,9 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = "/sushilite")
@Api(description = "Sushi-Lite API", tags = {"sushilite"})
@Tag(name="sushilite", description = "Sushi-Lite API")
public class SushiliteController {
@Autowired
private SushiliteServiceImpl sushiliteService;

View File

@ -0,0 +1,52 @@
package eu.dnetlib.repo.manager.controllers;
import eu.dnetlib.repo.manager.service.sushilite.SushiliteR5ServiceImpl;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/sushiliteR5")
@Tag(name="sushiliteR5", description = "Sushi-Lite R5 API")
public class SushiliteR5Controller {
private static final Logger logger = LoggerFactory.getLogger(SushiliteR5Controller.class);
@Autowired
private SushiliteR5ServiceImpl sushiliteR5Service;
@RequestMapping(value = "/getReportResults", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasAuthority('REGISTERED_USER')")
public ResponseEntity<?> getReportResults(@RequestParam(value = "Report") String report,
@RequestParam(value = "Release", required=false, defaultValue="5") String release,
@RequestParam(value = "RequestorID",required=false, defaultValue="anonymous") String requestorID,
@RequestParam(value = "BeginDate",required=false, defaultValue="") String beginDate,
@RequestParam(value = "EndDate",required=false, defaultValue="") String endDate,
@RequestParam(value = "RepositoryIdentifier", required=false, defaultValue="") String repositoryIdentifier,
@RequestParam(value = "DatasetIdentifier", required=false, defaultValue="") String datasetIdentifier,
@RequestParam(value = "ItemIdentifier",required=false, defaultValue="") String itemIdentifier,
@RequestParam(value = "MetricType",required=false) List<String> metricTypes,
@RequestParam(value = "DataType",required=false, defaultValue="") String dataType,
@RequestParam(value = "Granularity", required = false, defaultValue ="Monthly") String granularity,
@RequestParam(value = "Pretty",required=false, defaultValue="") String pretty) {
try {
return sushiliteR5Service.getReportResults(report, release, requestorID, beginDate, endDate, repositoryIdentifier, datasetIdentifier, itemIdentifier, metricTypes, dataType, granularity, pretty);
} catch (JSONException je) {
logger.error("", je);
return ResponseEntity.internalServerError().build();
}
}
}

View File

@ -1,7 +1,7 @@
package eu.dnetlib.repo.manager.controllers;
import eu.dnetlib.repo.manager.service.UserServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/user")
@Api(description = "User API", tags = {"user"})
@Tag(name="user", description = "User API")
public class UserController {
@Autowired

View File

@ -9,8 +9,8 @@ import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
import eu.dnetlib.repo.manager.exception.ValidationServiceException;
import eu.dnetlib.repo.manager.service.EmailUtils;
import eu.dnetlib.repo.manager.service.ValidatorServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.json.JSONException;
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,7 +25,7 @@ import java.util.List;
@RestController
@RequestMapping(value = "/validator")
@Api(description = "Validator API", tags = {"validator"})
@Tag(name="validator", description = "Validator API")
public class ValidatorController {
@Autowired
@ -80,12 +80,12 @@ public class ValidatorController {
@ResponseBody
@PreAuthorize("hasAuthority('REGISTERED_USER')")
public List<StoredJob> getStoredJobsNew(@RequestParam(value = "jobType", required = false)
@ApiParam(value = "Equals to filter job type on validation history page") String jobType,
@RequestParam("offset") @ApiParam(value = "Page number", required = true) String offset,
@RequestParam(value = "limit", required = false,defaultValue = "10") @ApiParam(value = "Null value") String limit,
@RequestParam(value = "dateFrom", required = false) @ApiParam(value = "Null value") String dateFrom,
@RequestParam(value = "dateTo", required = false) @ApiParam(value = "Null value") String dateTo,
@RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus
@Parameter(description = "Equals to filter job type on validation history page") String jobType,
@RequestParam("offset") @Parameter(description = "Page number", required = true) String offset,
@RequestParam(value = "limit", required = false,defaultValue = "10") @Parameter(description = "Null value") String limit,
@RequestParam(value = "dateFrom", required = false) @Parameter(description = "Null value") String dateFrom,
@RequestParam(value = "dateTo", required = false) @Parameter(description = "Null value") String dateTo,
@RequestParam("validationStatus") @Parameter(description = "Equals to filter validation jobs", required = true) String validationStatus
) throws ValidatorServiceException {
return validatorService.getStoredJobsNew(((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail(), jobType, offset, limit, dateFrom, dateTo, validationStatus);
}

View File

@ -1,29 +0,0 @@
package eu.dnetlib.repo.manager.domain;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import java.util.List;
@JsonAutoDetect
public class AggregationHistoryResponse extends Response {
private List<AggregationInfo> aggregationInfo;
public AggregationHistoryResponse() {
// no-arg constructor
}
public AggregationHistoryResponse(final List<AggregationInfo> aggregationInfo) {
super();
this.aggregationInfo = aggregationInfo;
}
public List<AggregationInfo> getAggregationInfo() {
return aggregationInfo;
}
public void setAggregationInfo(final List<AggregationInfo> aggregationInfo) {
this.aggregationInfo = aggregationInfo;
}
}

View File

@ -1,8 +0,0 @@
package eu.dnetlib.repo.manager.domain;
// TODO: this class must be replaced by common dnet class (CollectionInfo / TransformationInfo / AggregationInfo)
public class AggregationInfo extends eu.dnetlib.enabling.datasources.common.AggregationInfo {
public AggregationInfo() {
}
}

View File

@ -1,6 +1,6 @@
package eu.dnetlib.repo.manager.domain;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
import java.util.List;

View File

@ -0,0 +1,53 @@
package eu.dnetlib.repo.manager.domain;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class PendingUserRole {
@Id
long id;
int coPersonId;
int couId;
public PendingUserRole() {
// no-arg constructor
}
public PendingUserRole(int coPersonId, int couId) {
this.coPersonId = coPersonId;
this.couId = couId;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getCoPersonId() {
return coPersonId;
}
public void setCoPersonId(int coPersonId) {
this.coPersonId = coPersonId;
}
public int getCouId() {
return couId;
}
public void setCouId(int couId) {
this.couId = couId;
}
@Override
public String toString() {
return "PendingUserRole{" +
"coPersonId=" + coPersonId +
", couId=" + couId +
'}';
}
}

View File

@ -0,0 +1,9 @@
package eu.dnetlib.repo.manager.repository;
import eu.dnetlib.repo.manager.domain.PendingUserRole;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface PendingUserRoleRepository extends CrudRepository<PendingUserRole, Long> {
}

View File

@ -1,6 +1,6 @@
package eu.dnetlib.repo.manager.service;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
import org.json.JSONException;
import java.util.List;

View File

@ -1,7 +1,7 @@
package eu.dnetlib.repo.manager.service;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.repo.manager.domain.AggregationHistoryResponse;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationHistoryResponseV2;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@ -41,7 +41,7 @@ public class AggregationServiceImpl implements AggregationService {
logger.debug("Retrieving aggregations for repository with id : " + id);
UriComponents uriComponents = getAggregationHistory(id);
AggregationHistoryResponse rs = restTemplate.getForObject(uriComponents.toUri(), AggregationHistoryResponse.class);
AggregationHistoryResponseV2 rs = restTemplate.getForObject(uriComponents.toUri(), AggregationHistoryResponseV2.class);
return rs != null ? (List<T>) rs.getAggregationInfo() : null;
}
@ -73,7 +73,7 @@ public class AggregationServiceImpl implements AggregationService {
private UriComponents getAggregationHistory(String repoId) {
return UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/aggregationhistory/")
.fromHttpUrl(baseAddress + "/dsm/2.0/aggregationhistory/")
.path(repoId)
.build().expand(repoId).encode();
}

View File

@ -1,6 +1,6 @@
package eu.dnetlib.repo.manager.service;
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
import eu.dnetlib.openaire.exporter.model.dsm.AggregationInfo;
import eu.dnetlib.repo.manager.domain.MetricsNumbers;
import eu.dnetlib.repo.manager.domain.RepositorySnippet;
import eu.dnetlib.repo.manager.domain.RepositorySummaryInfo;
@ -49,7 +49,7 @@ public class DashboardServiceImpl implements DashboardService {
repositorySummaryInfo.setRepositoryName(repoOfficialName);
repositorySummaryInfo.setLogoURL(repository.getLogoUrl());
//TODO getRepositoryAggregations returns only the 20 more recent items. Is it positive that we will find an indexed version there?
//TODO getRepositoryAggregations returns only the 20 more recent items. Is it possible that we will find an indexed version there?
boolean isIndexedVersionFound = false;
long start = System.currentTimeMillis();
List<AggregationInfo> aggregationInfoList = aggregationService.getRepositoryAggregations(repoId, 0, 20);

View File

@ -41,19 +41,26 @@ public class InterfaceComplianceService {
Set<InterfaceComplianceRequest> requests = getOutdated();
// TODO - In case we want to send the emails, uncomment the following code.
/*for (InterfaceComplianceRequest request : requests) {
/*for ( InterfaceComplianceRequest request : requests )
{
String repoId = request.getRepositoryId();
String interfaceId = request.getInterfaceId();
try {
Map<String, RepositoryInterface> repositoryInterfaceMap = repositoryService.getRepositoryInterface(request.getRepositoryId())
Map<String, RepositoryInterface> repositoryInterfaceMap = repositoryService.getRepositoryInterface(repoId)
.stream()
.collect(Collectors.toMap(ApiDetails::getId, i -> i));
Repository repo = repositoryService.getRepositoryById(request.getRepositoryId());
RepositoryInterface iFace = repositoryInterfaceMap.get(request.getInterfaceId());
List<User> repositoryAdmins = authorizationService.getAdminsOfRepo(request.getRepositoryId());
RepositoryInterface iFace = repositoryInterfaceMap.get(interfaceId);
if ( iFace == null ) {
logger.error("The repository-interface \"" + interfaceId + "\" does not exist! | the request had the \"repoId\": \"" + repoId + "\"");
continue;
}
Repository repo = repositoryService.getRepositoryById(repoId);
List<User> repositoryAdmins = authorizationService.getAdminsOfRepo(repoId);
emailUtils.sendUserUpdateInterfaceComplianceFailure(repositoryAdmins.stream().map(User::getEmail).collect(Collectors.toList()), repo, iFace, request);
emailUtils.sendAdminUpdateInterfaceComplianceFailure(repo, iFace, request);
} catch (ResourceNotFoundException e) {
logger.error("Error", e);
}
logger.error("Error for request with \"repoId\": \"" + repoId + "\" and \"interfaceId\": \"" + interfaceId + "\"", e);
} // Continue to the next request.
}*/
repository.deleteAll(requests);

View File

@ -0,0 +1,36 @@
package eu.dnetlib.repo.manager.service;
import eu.dnetlib.repo.manager.domain.PendingUserRole;
import eu.dnetlib.repo.manager.repository.PendingUserRoleRepository;
import eu.dnetlib.repo.manager.service.aai.registry.AaiRegistryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@Service
public class PendingUserRoleService {
private static final Logger logger = LoggerFactory.getLogger(PendingUserRoleService.class);
private final PendingUserRoleRepository pendingUserRoleRepository;
private final AaiRegistryService aaiRegistryService;
public PendingUserRoleService(PendingUserRoleRepository pendingUserRoleRepository,
AaiRegistryService aaiRegistryService) {
this.pendingUserRoleRepository = pendingUserRoleRepository;
this.aaiRegistryService = aaiRegistryService;
}
public void assignRoles() {
Iterable<PendingUserRole> roles = pendingUserRoleRepository.findAll();
for (PendingUserRole role : roles) {
logger.debug("Attempt to assign role: {}", role);
try {
aaiRegistryService.assignMemberRole(role.getCoPersonId(), role.getCouId());
pendingUserRoleRepository.deleteById(role.getId());
} catch (Exception e) {
logger.warn("Could not assign role to user. Pending Role: {}\n", role, e);
}
}
}
}

View File

@ -4,7 +4,6 @@ import eu.dnetlib.api.functionality.ValidatorServiceException;
import eu.dnetlib.repo.manager.domain.*;
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
import org.json.JSONException;
import org.springframework.security.core.Authentication;
import java.util.List;

View File

@ -28,6 +28,7 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@ -38,6 +39,7 @@ import javax.annotation.PostConstruct;
import java.sql.Timestamp;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Service("repositoryService")
public class RepositoryServiceImpl implements RepositoryService {
@ -284,14 +286,14 @@ public class RepositoryServiceImpl implements RepositoryService {
public List<Repository> getRepositoriesOfUser(String page, String size) {
logger.debug("Retrieving repositories of authenticated user : {}",
((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail());
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles());
Collection<String> repoIds = roleMappingService.getRepositoryIds(authorizationService.getUserRoles());
return getRepositories(new ArrayList<>(repoIds));
}
@Override
public List<Repository> getRepositoriesOfUser(String userEmail, String page, String size) {
logger.debug("Retrieving repositories of authenticated user : {}", userEmail);
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRolesByEmail(userEmail));
Collection<String> repoIds = roleMappingService.getRepositoryIds(authorizationService.getUserRolesByEmail(userEmail));
return getRepositories(new ArrayList<>(repoIds));
}
@ -304,12 +306,7 @@ public class RepositoryServiceImpl implements RepositoryService {
public List<RepositorySnippet> getRepositoriesSnippetsOfUser(String userEmail, String page, String size) {
int from = Integer.parseInt(page) * Integer.parseInt(size);
int to = from + Integer.parseInt(size);
List<String> repoIds = new ArrayList<>();
if (userEmail != null && !"".equals(userEmail)) {
repoIds.addAll(roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRolesByEmail(userEmail)));
} else {
repoIds.addAll(roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles()));
}
List<String> repoIds = getRepoIdsOfUser(userEmail);
if (repoIds.size() < from) {
return Collections.emptyList();
@ -534,8 +531,8 @@ public class RepositoryServiceImpl implements RepositoryService {
emailUtils.sendUserRegisterInterfaceEmail(repo, comment, repositoryInterface, desiredCompatibilityLevel, authentication);
String prevCompatibilityLevel = repositoryInterface.getCompatibility();
if ( (desiredCompatibilityLevel != null)
&& ((prevCompatibilityLevel == null) || ! prevCompatibilityLevel.equals(desiredCompatibilityLevel))) {
if ((desiredCompatibilityLevel != null)
&& ((prevCompatibilityLevel == null) || !prevCompatibilityLevel.equals(desiredCompatibilityLevel))) {
InterfaceComplianceRequest request = new InterfaceComplianceRequest(repoId, repositoryInterface.getId(), desiredCompatibilityLevel);
interfaceComplianceService.create(request);
}
@ -689,19 +686,20 @@ public class RepositoryServiceImpl implements RepositoryService {
public Map<String, String> getCompatibilityClasses(String mode) {
logger.debug("Getting compatibility classes for mode: {}", mode);
String lowercaseMode = mode.toLowerCase();
Map<String, String> retMap = new HashMap<>();
Map<String, String> compatibilityClasses = this.getVocabulary("dnet:compatibilityLevel").getAsMap();
boolean foundData = false;
for (Map.Entry<String, String> entry : compatibilityClasses.entrySet()) {
if (mode.equalsIgnoreCase(Constants.REPOSITORY_MODE_ALL))
if (lowercaseMode.equals(Constants.REPOSITORY_MODE_ALL))
return compatibilityClasses;
else if (mode.equalsIgnoreCase(Constants.REPOSITORY_MODE_RE3DATA)) {
else if (lowercaseMode.equals(Constants.REPOSITORY_MODE_RE3DATA)) {
if (ValidatorServiceImpl.OPENAIRE_DATA_REGEX.matcher(entry.getKey()).matches()) {
retMap.put(entry.getKey(), entry.getValue());
foundData = true;
}
} else if (mode.equalsIgnoreCase("cris")) {
} else if (lowercaseMode.startsWith("cris")) { // Future proofing for inconsistent CRIS modes.
if (entry.getKey().contains("openaire-cris")) {
retMap.put(entry.getKey(), entry.getValue());
foundData = true;
@ -713,7 +711,7 @@ public class RepositoryServiceImpl implements RepositoryService {
}
//TODO TO BE REMOVED WHEN VOCABULARIES ARE UPDATED
if ((mode.equalsIgnoreCase("repository") || mode.equalsIgnoreCase(Constants.REPOSITORY_MODE_RE3DATA)) && !foundData)
if ((lowercaseMode.equals("repository") || lowercaseMode.equals(Constants.REPOSITORY_MODE_RE3DATA)) && !foundData)
retMap.put("openaire2.0_data", "OpenAIRE Data (funded, referenced datasets)");
return retMap;
@ -866,6 +864,8 @@ public class RepositoryServiceImpl implements RepositoryService {
new ParameterizedTypeReference<MetricsNumbers>() {
});
// TODO - the project "usagestats" returns "200-OK" even for an invalid datasourceID.. Report this to the person who manages usage-stats.
return resp.getBody();
}
@ -935,7 +935,12 @@ public class RepositoryServiceImpl implements RepositoryService {
private <T> Paging<T> searchApi(UriComponents uriComponents, RequestFilter requestFilter, Class<T> clazz) {
Paging<T> repositories = new Paging<>();
ResponseEntity<Map> rs;
rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, new HttpEntity<>(requestFilter), Map.class);
try {
rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, new HttpEntity<>(requestFilter), Map.class);
} catch (Exception e) {
logger.error("", e);
throw e;
}
if (!rs.getStatusCode().is2xxSuccessful()) {
logger.error("Api call not successful. Code: {} | Body: {}", rs.getStatusCode(), rs.getBody());
}
@ -955,10 +960,27 @@ public class RepositoryServiceImpl implements RepositoryService {
return repositories;
}
private List<String> getRepoIdsOfUser(String userEmail) {
List<String> repoIds;
if (userEmail != null && !"".equals(userEmail)) {
repoIds = new ArrayList<>(roleMappingService.getRepositoryIds(authorizationService.getUserRolesByEmail(userEmail)));
} else {
Collection<?> authorities = SecurityContextHolder.getContext().getAuthentication().getAuthorities();
repoIds = authorities
.stream()
.map(a -> roleMappingService.authorityToRepositoryId((GrantedAuthority) a))
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
return repoIds;
}
@Deprecated
private String getRepositoryType(String typology) {
return invertedDataSourceClass.get(typology);
}
@Deprecated
private List<String> getRoleIdsFromUserRoles(String userEmail) {
List<Integer> coPersonId = registryCalls.getCoPersonIdsByEmail(userEmail);
JsonArray roles;

View File

@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@ -55,7 +56,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public List<String> getUserIdentifiersByCoPersonId(Integer coPersonId) {
public List<String> getUserIdentifiersByCoPersonId(Integer coPersonId) throws RestClientException {
List<String> ids = new ArrayList<>();
Map<String, String> params = new HashMap<>();
params.put("copersonid", coPersonId.toString());
@ -86,7 +87,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public List<Integer> getCoPersonIdsByEmail(String email) {
public List<Integer> getCoPersonIdsByEmail(String email) throws RestClientException {
List<Integer> coPersonIds = new ArrayList<>();
Map<String, String> params = new HashMap<>();
params.put("mail", email);
@ -113,7 +114,7 @@ public class RegistryCalls implements AaiRegistryService {
}
}
public Integer getCoPersonIdByIdentifier(String sub) {
public Integer getCoPersonIdByIdentifier(String sub) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("search.identifier", sub);
params.put("coid", coid);
@ -122,7 +123,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public JsonArray getCous(String name) {
public JsonArray getCous(String name) throws RestClientException {
Map<String, String> params = new HashMap<>();
if (name != null) {
try {
@ -163,8 +164,9 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public JsonArray getRoles(Integer coPersonId) {
public JsonArray getRoles(Integer coPersonId) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("coid", coid);
params.put("copersonid", coPersonId.toString());
JsonElement response = httpUtils.get("co_person_roles.json", params);
return (response != null) ? response.getAsJsonObject().get("CoPersonRoles").getAsJsonArray() : new JsonArray();
@ -203,7 +205,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public JsonArray getUserGroups(Integer coPersonId) {
public JsonArray getUserGroups(Integer coPersonId) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("copersonid", coPersonId.toString());
JsonElement response = httpUtils.get("co_groups.json", params);
@ -211,7 +213,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public JsonObject getUserAdminGroup(Integer coPersonId, Integer couId) {
public JsonObject getUserAdminGroup(Integer coPersonId, Integer couId) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("copersonid", coPersonId.toString());
JsonElement response = httpUtils.get("co_groups.json", params);
@ -228,7 +230,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public JsonArray getCouGroups(Integer couId) {
public JsonArray getCouGroups(Integer couId) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("couid", couId.toString());
JsonElement response = httpUtils.get("co_groups.json", params);
@ -247,7 +249,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public JsonArray getGroupMembers(Integer coGroupId) {
public JsonArray getGroupMembers(Integer coGroupId) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("cogroupid", coGroupId.toString());
JsonElement response = httpUtils.get("co_group_members.json", params);
@ -256,7 +258,7 @@ public class RegistryCalls implements AaiRegistryService {
@Override
public JsonArray getUserEmailByCouId(Integer couId, boolean admin) {
public JsonArray getUserEmailByCouId(Integer couId, boolean admin) throws RestClientException {
Map<String, String> params = new HashMap<>();
if (couId == null) {
throw new IllegalArgumentException("Provided 'couId' is null");
@ -287,7 +289,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public JsonArray getUsersByCouId(Integer couId) {
public JsonArray getUsersByCouId(Integer couId) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("couid", couId.toString());
JsonElement response = httpUtils.get("co_person_roles.json", params);
@ -320,7 +322,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public JsonArray getUserNamesByCouId(Integer couId, boolean admin) {
public JsonArray getUserNamesByCouId(Integer couId, boolean admin) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("couid", couId.toString());
if (admin) {
@ -340,7 +342,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public JsonArray getUserIdByCouId(Integer couId, boolean admin) {
public JsonArray getUserIdByCouId(Integer couId, boolean admin) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("couid", couId.toString());
if (admin) {
@ -360,26 +362,26 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public void assignMemberRole(Integer coPersonId, Integer couId) {
public void assignMemberRole(Integer coPersonId, Integer couId) throws RestClientException {
httpUtils.post("co_person_roles.json", jsonUtils.coPersonRoles(coPersonId, couId, "Active"));
}
@Override
public void removeMemberRole(Integer coPersonId, Integer couId, Integer id) {
public void removeMemberRole(Integer coPersonId, Integer couId, Integer id) throws RestClientException {
if (id != null) {
httpUtils.put("co_person_roles/" + id + ".json", jsonUtils.coPersonRoles(coPersonId, couId, "Deleted"));
}
}
@Override
public Integer createRole(Role role) {
public Integer createRole(Role role) throws RestClientException {
JsonElement element = httpUtils.post("cous.json", jsonUtils.createNewCou(role));
return element.getAsJsonObject().get("Id").getAsInt();
}
@Override
public String getUserEmail(Integer coPersonId) {
public String getUserEmail(Integer coPersonId) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("copersonid", coPersonId.toString());
JsonElement response = httpUtils.get("email_addresses.json", params);
@ -388,7 +390,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public String getUserNames(Integer coPersonId) {
public String getUserNames(Integer coPersonId) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("copersonid", coPersonId.toString());
JsonElement response = httpUtils.get("names.json", params);
@ -401,7 +403,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public String getUserId(Integer coPersonId) {
public String getUserId(Integer coPersonId) throws RestClientException {
Map<String, String> params = new HashMap<>();
params.put("copersonid", coPersonId.toString());
JsonElement response = httpUtils.get("identifiers.json", params);
@ -410,7 +412,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public void assignAdminRole(Integer coPersonId, Integer couId) {
public void assignAdminRole(Integer coPersonId, Integer couId) throws RestClientException {
JsonObject group = getCouAdminGroup(couId);
if (group != null) {
httpUtils.post("co_group_members.json", jsonUtils.coGroupMembers(group.get("Id").getAsInt(), coPersonId, true));
@ -418,7 +420,7 @@ public class RegistryCalls implements AaiRegistryService {
}
@Override
public void removeAdminRole(Integer coPersonId, Integer couId) {
public void removeAdminRole(Integer coPersonId, Integer couId) throws RestClientException {
JsonObject adminGroup = this.getCouAdminGroup(couId);
JsonArray admins = this.getGroupMembers(adminGroup.get("Id").getAsInt());
Integer id = null;

View File

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
@ -32,7 +33,7 @@ public class HttpUtils {
@Value("${services.provide.aai.registry.password}")
private String password;
public JsonElement post(String path, JsonObject body) {
public JsonElement post(String path, JsonObject body) throws RestClientException {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = createHeaders(user, password);
headers.setContentType(MediaType.APPLICATION_JSON);
@ -41,7 +42,7 @@ public class HttpUtils {
return getResponseEntityAsJsonElement(responseEntity);
}
public JsonElement put(String path, JsonObject body) {
public JsonElement put(String path, JsonObject body) throws RestClientException {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = createHeaders(user, password);
headers.setContentType(MediaType.APPLICATION_JSON);
@ -50,7 +51,7 @@ public class HttpUtils {
return getResponseEntityAsJsonElement(responseEntity);
}
public JsonElement get(String path, Map<String, String> params) {
public JsonElement get(String path, Map<String, String> params) throws RestClientException {
RestTemplate restTemplate = new RestTemplate();
String url = createUrl(registryUrl + path, params);
ResponseEntity<String> responseEntity = restTemplate.exchange
@ -58,7 +59,7 @@ public class HttpUtils {
return getResponseEntityAsJsonElement(responseEntity);
}
public JsonElement delete(String path) {
public JsonElement delete(String path) throws RestClientException {
RestTemplate restTemplate = new RestTemplate();
String url = registryUrl + path;
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.DELETE, new HttpEntity<>(createHeaders(user, password)), String.class);

View File

@ -7,6 +7,8 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Collection;
import java.util.Objects;
@ -20,21 +22,8 @@ public class AaiRoleMappingService implements RoleMappingService {
@Value("${services.provide.aai.registry.production:true}")
private boolean production;
private String createRepoRoleName(String prefix, String repoId) {
return prefix + "." + repoId.replace(":", "$");
}
@Override
public String getRepoNameWithoutType(String fullName, String prefix) {
if (fullName != null && prefix != null && fullName.startsWith(prefix)) {
return fullName.substring(prefix.length());
}
return null;
}
@Override
public String getRepoIdByRoleId(String roleId) {
public String getRepositoryId(String roleId) {
if (!roleActive(roleId)) {
return null;
}
@ -42,43 +31,46 @@ public class AaiRoleMappingService implements RoleMappingService {
}
@Override
public Collection<String> getRepoIdsByRoleIds(Collection<String> roleIds) {
public Collection<String> getRepositoryIds(Collection<String> roleIds) {
return roleIds
.stream()
//.filter(this::roleActive) // implicitly executed in the next statement
.map(this::getRepoIdByRoleId)
.map(this::getRepositoryId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
@Override
public String getRoleIdByRepoId(String repoId) {
String roleId = "";
public String getRole(String repoId) {
String role = null;
String prefix = (production ? "" : "beta.") + "datasource";
if (repoId != null) {
roleId = createRepoRoleName(prefix, repoId);
return roleId;
} else {
return null;
role = createRole(prefix, repoId);
}
return role;
}
@Override
public Collection<String> getRoleIdsByRepoIds(Collection<String> repoIds) {
public Collection<String> getRoles(Collection<String> repoIds) {
return repoIds
.stream()
.map(this::getRoleIdByRepoId)
.map(this::getRole)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
@Override
public String convertAuthorityIdToRepoId(String authorityId) {
String repo = "";
if (authorityId != null && roleActive(authorityId)) {
repo = authorityId
.replaceFirst(".*datasource\\.", "")
public String authorityToRepositoryId(GrantedAuthority authority) {
String repo = null;
String auth = null;
try {
auth = URLDecoder.decode(authority.getAuthority(), "UTF-8").toLowerCase();
} catch (UnsupportedEncodingException e) {
logger.error("", e);
}
if (auth != null && roleActive(auth)) {
repo = auth
.replaceFirst(".*datasource\\_", "")
.replace("$", ":")
.toLowerCase();
}
@ -86,12 +78,26 @@ public class AaiRoleMappingService implements RoleMappingService {
}
@Override
public String convertAuthorityToRepoId(GrantedAuthority authority) {
return convertAuthorityIdToRepoId(authority.toString());
public GrantedAuthority repositoryIdToAuthority(String repoId) {
String role = null;
try {
role = URLEncoder.encode(convertRepoIdToAuthorityId(repoId), "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.error("", e);
}
return new SimpleGrantedAuthority(role);
}
@Override
public String convertRepoIdToAuthorityId(String repoId) {
private String createRole(String prefix, String repoId) {
return prefix + "." + repoId.replace(":", "$");
}
private boolean roleActive(String roleId) {
return (production && !roleId.toLowerCase().startsWith("beta"))
|| (!production && roleId.toLowerCase().startsWith("beta"));
}
private String convertRepoIdToAuthorityId(String repoId) {
StringBuilder roleBuilder = new StringBuilder();
String role = "";
if (repoId != null) {
@ -102,20 +108,4 @@ public class AaiRoleMappingService implements RoleMappingService {
}
return role;
}
@Override
public String convertRepoIdToEncodedAuthorityId(String repoId) {
return URLEncoder.encode(convertRepoIdToAuthorityId(repoId));
}
@Override
public SimpleGrantedAuthority convertRepoIdToAuthority(String repoId) {
String role = convertRepoIdToEncodedAuthorityId(repoId);
return new SimpleGrantedAuthority(role);
}
private boolean roleActive(String roleId) {
return (production && !roleId.toLowerCase().startsWith("beta."))
|| (!production && roleId.toLowerCase().startsWith("beta."));
}
}

View File

@ -1,9 +1,11 @@
package eu.dnetlib.repo.manager.service.security;
import com.google.gson.JsonElement;
import eu.dnetlib.repo.manager.domain.PendingUserRole;
import eu.dnetlib.repo.manager.domain.dto.Role;
import eu.dnetlib.repo.manager.domain.dto.User;
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
import eu.dnetlib.repo.manager.repository.PendingUserRoleRepository;
import eu.dnetlib.repo.manager.service.aai.registry.AaiRegistryService;
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
import org.mitre.openid.connect.model.UserInfo;
@ -30,13 +32,16 @@ public class AuthorizationServiceImpl implements AuthorizationService {
private final RoleMappingService roleMappingService;
private final AaiRegistryService aaiRegistryService;
private final AuthoritiesUpdater authoritiesUpdater;
private final PendingUserRoleRepository pendingUserRoleRepository;
@Autowired
AuthorizationServiceImpl(RoleMappingService roleMappingService, AaiRegistryService aaiRegistryService,
AuthoritiesUpdater authoritiesUpdater) {
AuthoritiesUpdater authoritiesUpdater,
PendingUserRoleRepository pendingUserRoleRepository) {
this.roleMappingService = roleMappingService;
this.aaiRegistryService = aaiRegistryService;
this.authoritiesUpdater = authoritiesUpdater;
this.pendingUserRoleRepository = pendingUserRoleRepository;
}
private String mapType(String type) {
@ -56,9 +61,9 @@ public class AuthorizationServiceImpl implements AuthorizationService {
@Override
public boolean isMemberOf(String repoId) {
String repoRole = roleMappingService.convertRepoIdToEncodedAuthorityId(repoId);
String repoAuthority = roleMappingService.repositoryIdToAuthority(repoId).getAuthority();
return SecurityContextHolder.getContext().getAuthentication().getAuthorities()
.stream().anyMatch(authority -> authority.toString().equals(repoRole));
.stream().anyMatch(authority -> authority.toString().equals(repoAuthority));
}
@Override
@ -74,7 +79,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
public List<User> getAdminsOfRepo(String repoId) {
// find couId by role name
String role = roleMappingService.getRoleIdByRepoId(repoId);
String role = roleMappingService.getRole(repoId);
Integer couId = aaiRegistryService.getCouId(role);
return aaiRegistryService.getUsers(couId);
}
@ -82,26 +87,29 @@ public class AuthorizationServiceImpl implements AuthorizationService {
@Override
public void addAdmin(String resourceId, String email) throws ResourceNotFoundException {
String role = roleMappingService.getRoleIdByRepoId(resourceId);
String role = roleMappingService.getRole(resourceId);
Integer couId = aaiRegistryService.getCouId(role);
if (couId == null) {
throw new ResourceNotFoundException("Cannot find CouId for role: " + role);
}
List<Integer> coPersonIds = aaiRegistryService.getCoPersonIdsByEmail(email);
if (coPersonIds.isEmpty()) {
throw new ResourceNotFoundException("User with email '%s' could not be found..");
}
for (Integer coPersonId : coPersonIds) {
assert coPersonId != null;
aaiRegistryService.assignMemberRole(coPersonId, couId);
// Add role to user current authorities
for (String userId : aaiRegistryService.getUserIdentifiersByEmail(email)) {
authoritiesUpdater.addRole(userId, roleMappingService.convertRepoIdToAuthority(resourceId));
authoritiesUpdater.addRole(userId, roleMappingService.repositoryIdToAuthority(resourceId));
}
}
}
@Override
public void removeAdmin(String resourceId, String email) throws ResourceNotFoundException {
String role = roleMappingService.getRoleIdByRepoId(resourceId);
String role = roleMappingService.getRole(resourceId);
Integer couId = aaiRegistryService.getCouId(role);
if (couId == null) {
throw new ResourceNotFoundException("Cannot find CouId for role: " + role);
@ -115,7 +123,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
// Remove role from user current authorities
for (String userId : aaiRegistryService.getUserIdentifiersByEmail(email)) {
authoritiesUpdater.removeRole(userId, roleMappingService.convertRepoIdToAuthority(resourceId));
authoritiesUpdater.removeRole(userId, roleMappingService.repositoryIdToAuthority(resourceId));
}
} else {
logger.error("Cannot find RoleId for role: {}", role);
@ -126,7 +134,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
@Override
public void createAndAssignRoleToAuthenticatedUser(String resourceId, String roleDescription) {
// Create new role
String newRoleName = roleMappingService.getRoleIdByRepoId(resourceId);
String newRoleName = roleMappingService.getRole(resourceId);
Role newRole = new Role(newRoleName, roleDescription);
Integer couId;
@ -145,10 +153,15 @@ public class AuthorizationServiceImpl implements AuthorizationService {
// Assign new role to the current authenticated user
Integer coPersonId = aaiRegistryService.getCoPersonIdByIdentifier();
if (couId != null) {
aaiRegistryService.assignMemberRole(coPersonId, couId);
try {
aaiRegistryService.assignMemberRole(coPersonId, couId);
} catch (Exception e) {
pendingUserRoleRepository.save(new PendingUserRole(coPersonId, couId));
}
// Add role to current user authorities
authoritiesUpdater.addRole(roleMappingService.convertRepoIdToAuthority(resourceId));
authoritiesUpdater.addRole(roleMappingService.repositoryIdToAuthority(resourceId));
}
}

View File

@ -7,68 +7,41 @@ import java.util.Collection;
public interface RoleMappingService {
/**
* @param fullName
* @param prefix
* @return
*/
String getRepoNameWithoutType(String fullName, String prefix);
/**
* @param roleId Role Id
* @return Converts {@param roleId} to a repo Id.
*/
String getRepoIdByRoleId(String roleId);
String getRepositoryId(String roleId);
/**
*
* @param roleIds Collection of roles
* @return Converts {@param roleIds} to a repo Ids.
*/
Collection<String> getRepoIdsByRoleIds(Collection<String> roleIds);
Collection<String> getRepositoryIds(Collection<String> roleIds);
/**
* @param repoId Repository Id
* @return Converts {@param repoId} to a role Id.
*/
String getRoleIdByRepoId(String repoId);
String getRole(String repoId);
/**
* @param repoIds Collection of Repository Ids
* @return Converts {@param repoIds} to role Ids.
*/
Collection<String> getRoleIdsByRepoIds(Collection<String> repoIds);
Collection<String> getRoles(Collection<String> repoIds);
/**
* @param authorityId Authority Id
* @return Converts {@param authorityId} to repo Id.
* @param authority {@link GrantedAuthority}
* @return Converts {@param authority} to repository Id.
*/
String convertAuthorityIdToRepoId(String authorityId);
/**
* @param authority Granted authority
* @return Converts {@param authority} to repo Id.
*/
String convertAuthorityToRepoId(GrantedAuthority authority);
/**
* @param repoId Repository Id
* @return
*/
String convertRepoIdToAuthorityId(String repoId);
/**
* @param repoId Repository Id
* @return Converts {@param repoId} to {@link String} role id url encoded ($ -> %24)
* // TODO: remove role encoding and perform url decoding when mapping authorities. (Must be performed in all OpenAIRE projects because of Redis)
*/
String convertRepoIdToEncodedAuthorityId(String repoId);
String authorityToRepositoryId(GrantedAuthority authority);
/**
* @param repoId Repository Id
* @return Converts {@param repoId} to {@link SimpleGrantedAuthority} with the role url encoded ($ -> %24)
* // TODO: remove role encoding and perform url decoding when mapping authorities. (Must be performed in all OpenAIRE projects because of Redis)
*/
SimpleGrantedAuthority convertRepoIdToAuthority(String repoId);
GrantedAuthority repositoryIdToAuthority(String repoId);
}

View File

@ -0,0 +1,27 @@
package eu.dnetlib.repo.manager.service.sushilite;
import org.json.JSONException;
import org.springframework.http.ResponseEntity;
import java.util.List;
public interface SushiliteR5Service {
ResponseEntity<?> getReportResults(String Report,
String release,
String requestorID,
String beginDate,
String endDate,
String repositoryIdentifier,
String datasetIdentifier,
String itemIdentifier,
List<String> metricTypes,
String dataType,
String granularity,
String pretty) throws JSONException;
}

View File

@ -0,0 +1,135 @@
package eu.dnetlib.repo.manager.service.sushilite;
//import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Item_Report;
import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI;
import java.util.List;
@Service("sushiliteR5Service")
public class SushiliteR5ServiceImpl implements SushiliteR5Service {
private static final Logger logger = LoggerFactory.getLogger(SushiliteR5ServiceImpl.class);
@Value("${services.provide.usagestats.sushiliteR5Endpoint}")
private String usagestatsSushiliteR5Endpoint;
public ResponseEntity<?> getReportResults(String report,
String release,
String requestorID,
String beginDate,
String endDate,
String repositoryIdentifier,
String datasetIdentifier,
String itemIdentifier,
List<String> metricTypes,
String dataType,
String granularity,
String pretty) throws JSONException
{
//build the uri params
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.usagestatsSushiliteR5Endpoint + "reports/" + report.toLowerCase())
.queryParam("Report", report)
.queryParam("Release", release)
.queryParam("RequestorID", requestorID)
.queryParam("BeginDate", beginDate)
.queryParam("EndDate", endDate)
.queryParam("RepositoryIdentifier", repositoryIdentifier)
.queryParam("DatasetIdentifier", datasetIdentifier)
.queryParam("ItemIdentifier", itemIdentifier);
if ( metricTypes != null ) {
for ( String metricType : metricTypes )
builder.queryParam("MetricType", metricType);
}
builder.queryParam("DataType", dataType)
.queryParam("Granularity", granularity)
.queryParam("Pretty", pretty);
URI uri = builder.build().encode().toUri();
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
ResponseEntity<?> resp;
try {
resp = restTemplate.exchange(
uri,
HttpMethod.GET,
null,
new ParameterizedTypeReference<Object>() {}); // THis "Object" must be a valid json-object.
} catch (RestClientException rce) {
String errorMsg = "Failed to get a response from sushiliteR5!";
String message = rce.getMessage();
if ( (message != null) && message.contains("504 Gateway Time-out") ) // In this case the parsing-exception is thrown before we get to check the response code..
errorMsg += " Reason: 504 Gateway Time-out";
logger.error(errorMsg + " URI was:\n" + uri + "\n" + message);
return ResponseEntity.internalServerError().body(errorMsg);
}
HttpStatus httpStatus = resp.getStatusCode();
if ( httpStatus != HttpStatus.OK ) {
logger.warn("Sushi cannot give us data! Responded status: " + httpStatus);
return ResponseEntity.status(httpStatus).build();
}
Object reportResult = resp.getBody();
if ( reportResult == null ) {
logger.error("The \"reportResponseWrapper\" for sushi was null!");
return ResponseEntity.internalServerError().build();
}
logger.trace(reportResult.toString());
return ResponseEntity.ok(reportResult);
// TODO - Depending on the "report-type", map the "object" to the right Report-type class.
// TODO - This will be useful, in case we add preprocessing steps, like pagination.
/* try {
switch ( report ) {
case "PR":
break;
case "PR_P1":
break;
case "IR":
COUNTER_Item_Report counterItemReport = (COUNTER_Item_Report) resp.getBody();
if ( counterItemReport == null ) {
logger.error("The \"reportResponseWrapper\" for sushi was null!");
return ResponseEntity.internalServerError().build();
} else {
logger.debug(counterItemReport.toString());
return ResponseEntity.ok(counterItemReport);
}
case "DSR":
break;
default:
String errorMsg = "Invalid report type was given: " + report;
logger.error(errorMsg);
return ResponseEntity.badRequest().body(errorMsg);
}
} catch (ClassCastException cce) {
logger.error("The report object could not be mapped to the repo-type-object of \"" + report + "\"!", cce);
return ResponseEntity.internalServerError().build();
}*/
}
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.repo.manager.service;
package eu.dnetlib.repo.manager.service.sushilite;
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
import org.json.JSONException;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.repo.manager.service;
package eu.dnetlib.repo.manager.service.sushilite;
import eu.dnetlib.usagestats.sushilite.domain.Customer;
import eu.dnetlib.usagestats.sushilite.domain.ReportItem;
@ -93,8 +93,8 @@ public class SushiliteServiceImpl implements SushiliteService {
List<ReportItem> requestedItemList = new ArrayList<>();
Customer customer = reportResponseWrapper.getReportResponse().getReportWrapper().getReport().getCustomer();
List<ReportItem> allReportItems = customer.getReportItems();
List<ReportItem> allReportItems = customer.getReportItems();
if ( allReportItems != null ) {
try {
int totalItems = allReportItems.size();
@ -111,9 +111,9 @@ public class SushiliteServiceImpl implements SushiliteService {
logger.error("Exception on getReportResults - trying to cast strings to integers", e);
throw e;
}
}
customer.setReportItems(requestedItemList); // Setting the reportItems to the "customer"-reference, updates the "reportResponseWrapper" object.
customer.setReportItems(requestedItemList); // Setting the reportItems to the "customer"-reference, updates the "reportResponseWrapper" object.
}
return reportResponseWrapper;
}

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config/>
<context:component-scan base-package="eu.dnetlib.repo.manager.service.*"/>
<bean class="eu.dnetlib.repo.manager.config.CascadingPropertyLoader"
id="propertyLoader">
<property name="order" value="2"/>
<property name="properties">
<bean class="eu.dnetlib.conf.WebappContextProperyFactory">
<property name="propertyFetcher">
<bean class="eu.dnetlib.conf.PropertyFetcher"/>
</property>
</bean>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<property name="locations">
<list>
<value>classpath*:/gr/**/springContext-*.properties</value>
<value>classpath*:/eu/**/springContext-*.properties</value>
<value>classpath*:/application.properties</value>
<value>classpath*:email-texts.properties</value>
<!-- <value>classpath*:dnet-site-wizard.properties</value>-->
<!-- <value>classpath*:dnet-site-override.properties</value>-->
<!-- <value>classpath*:dnet-wizard.properties</value>-->
<!-- <value>classpath*:dnet-override.properties</value>-->
<!-- <value>classpath*:dnet-validator-wizard.properties</value>-->
<!-- <value>classpath*:dnet-validator-override.properties</value>-->
<!-- <value>classpath*:dnet-site-force-override.properties</value>-->
<!-- <value>classpath*:dnet-force-override.properties</value>-->
</list>
</property>
</bean>
</beans>

View File

@ -1,6 +1,16 @@
springdoc.swagger-ui:
disable-swagger-default-url: true
version: 3
server:
port: 8480
servlet:
context-path: /uoa-repository-manager-service
springdoc:
swagger-ui:
disable-swagger-default-url: true
path: /swagger-ui.html
displayRequestDuration: true
api-docs:
path: /api-docs
show-actuator: true
spring:
jpa:
@ -14,11 +24,11 @@ spring:
driverClassName: ${services.provide.db.driverClassName}
services:
openaireServicesBaseUrl: https://beta.services.openaire.eu
openaireServicesBaseUrl: https://beta.services.openaire.eu # dev-openaire.d4science.org
provide:
dev-machine: 88.197.53.71 # VM-71
aai:
baseURL: https://beta.aai.openaire.eu
baseURL: https://aai.openaire.eu
oidc:
domain: .openaire.eu # use empty value for local, otherwise: ".openaire.eu"
id: XX
@ -34,14 +44,14 @@ services:
url: ${services.provide.aai.baseURL}/registry/
adminEmail: XX
analyticsURL: https://analytics.openaire.eu/addsite.php?
baseUrl: https://dev-openaire.d4science.org/openaire
baseUrl: ${services.openaireServicesBaseUrl}/openaire
broker:
api: api/
openaire: openaireBroker
port: 443
url: https://beta.broker.openaire.eu
clients:
dsm: https://dev-openaire.d4science.org/openaire
dsm: ${services.provide.baseUrl}
search: ${services.openaireServicesBaseUrl}/search/v2/api
usageEvents: http://beta.lbs.openaire.eu:8080/ajax/summary
usagestats: ${services.openaireServicesBaseUrl}/usagestats
@ -67,12 +77,14 @@ services:
password: XX
port: 6379
topic_types:
url: ${services.openaireServicesBaseUrl}/provision/mvc/vocabularies/dnet:topic_types.json
url: ${services.openaireServicesBaseUrl}/provision/mvc/vocabularies/dnet:topic_types.json # TODO - Check this! The requested json file does not exist in the DEV-url below)
# https://dev-openaire.d4science.org/provision/mvc/vocabularies/
usageStatisticsDiagramsBaseURL: https://beta.openaire.eu/stats3/
usageStatisticsNumbersBaseURL: ${services.openaireServicesBaseUrl}/usagestats/datasources/
usagestats:
adminEmail: XX
sushiliteEndpoint: ${services.openaireServicesBaseUrl}/usagestats/sushilite/
sushiliteR5Endpoint: ${services.openaireServicesBaseUrl}/usagestats_r5/sushilite/r5/
validator:
results:
url: https://beta.provide.openaire.eu/compatibility/browseHistory/

View File

@ -15,8 +15,5 @@
<Logger name="org.springframework.boot" level="warn" additivity="false">
<AppenderRef ref="LogToConsole"/>
</Logger>
<Logger name="springfox.documentation" level="warn" additivity="false">
<AppenderRef ref="LogToConsole"/>
</Logger>
</Loggers>
</Configuration>