diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 326a788cf..d844cd063 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,13 +8,29 @@ jobs:
test:
name: Test
strategy:
+ fail-fast: false
matrix:
os:
- - ubuntu-20.04
- # - windows-2022 (MongoDB issues in CI)
- - macos-12
+ - ubuntu-22.04
+ # - windows-2022 (cannot use Docker for postgres)
+ # - macos-12 (cannot use Docker for postgres)
runs-on: ${{ matrix.os }}
+ services:
+ postgres:
+ image: postgres:16
+ env:
+ POSTGRES_DB: fdp_test
+ POSTGRES_USER: fdp
+ POSTGRES_PASSWORD: fdp
+ options: >-
+ --health-cmd pg_isready
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 5
+ ports:
+ - 54321:5432
+
env:
JAVA_DISTRIBUTION: temurin
JAVA_VERSION: 21
@@ -25,15 +41,6 @@ jobs:
with:
fetch-depth: 0
- - name: Set up MongoDB
- uses: ankane/setup-mongodb@v1
- with:
- mongodb-version: '5.0'
-
- - name: Check MongoDB
- run: |
- mongo --eval "db.version()"
-
- name: Setup Java
uses: actions/setup-java@v3
with:
@@ -48,6 +55,12 @@ jobs:
- name: Test
run: |
mvn -q -U -B test
+ env:
+ FDP_POSTGRES_HOST: localhost
+ FDP_POSTGRES_PORT: 54321
+ FDP_POSTGRES_DB: fdp_test
+ FDP_POSTGRES_USERNAME: fdp
+ FDP_POSTGRES_PASSWORD: fdp
- name: Package
run: |
diff --git a/.gitignore b/.gitignore
index a5f3c7517..a31dd09b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@ target/
# Netbeans
nb-configuration\.xml
-/nbproject/
\ No newline at end of file
+/nbproject/
+*.iml
diff --git a/pom.xml b/pom.xml
index 9cb0d1a5e..c49070c7e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.1.5
+ 3.2.3
nl.dtls
@@ -52,16 +52,15 @@
1.2.0.RELEASE
- 5.2.4.RELEASE
2.2.0
- 5.3.5
- 4.1.5
+ 42.7.2
4.3.8
0.12.3
1.18.30
0.1.2-SNAPSHOT
+ 3.7.3
5.2.2
@@ -104,18 +103,6 @@
-
-
-
- io.mongock
- mongock-bom
- ${mongock.version}
- pom
- import
-
-
-
-
@@ -154,7 +141,7 @@
org.springframework.boot
- spring-boot-starter-data-mongodb
+ spring-boot-starter-data-jpa
org.springframework.security
@@ -172,28 +159,6 @@
org.springframework.boot
spring-boot-starter-validation
-
- org.springframework.security
- spring-security-acl-mongodb
- ${spring.security.acl.mongo.version}
-
-
-
-
-
-
- io.mongock
- mongock-springboot
-
-
- io.mongock
- mongodb-springdata-v4-driver
-
-
- org.springframework.data
- spring-data-mongodb
- ${mongodb.spring-data.version}
-
@@ -257,6 +222,22 @@
rdf-resource-resolver-api
${rdf-resolver.version}
+
+ org.flywaydb
+ flyway-core
+
+
+ io.hypersistence
+ hypersistence-utils-hibernate-63
+ ${hypersistence.version}
+
+
+
+ org.postgresql
+ postgresql
+ ${postgresql.version}
+ runtime
+
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/apikey/ApiKeyController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/apikey/ApiKeyController.java
index 7db4eb6f3..c5d6ce8a9 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/apikey/ApiKeyController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/apikey/ApiKeyController.java
@@ -23,26 +23,27 @@
package nl.dtls.fairdatapoint.api.controller.apikey;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.apikey.ApiKeyDTO;
import nl.dtls.fairdatapoint.entity.exception.ResourceNotFoundException;
import nl.dtls.fairdatapoint.service.apikey.ApiKeyService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
+import java.util.UUID;
import static java.lang.String.format;
@Tag(name = "Authentication and Authorization")
@RestController
@RequestMapping("/api-keys")
+@RequiredArgsConstructor
public class ApiKeyController {
- @Autowired
- private ApiKeyService apiKeyService;
+ private final ApiKeyService apiKeyService;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> getApiKeys() {
@@ -59,7 +60,7 @@ public ResponseEntity createApiKey() {
@DeleteMapping("/{uuid}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public ResponseEntity deleteApiKey(
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException {
final boolean result = apiKeyService.delete(uuid);
if (result) {
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/config/ConfigController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/config/ConfigController.java
index c1d28c43a..e4932f5ad 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/config/ConfigController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/config/ConfigController.java
@@ -23,9 +23,9 @@
package nl.dtls.fairdatapoint.api.controller.config;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.config.BootstrapConfigDTO;
import nl.dtls.fairdatapoint.service.config.ConfigService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -36,10 +36,10 @@
@Tag(name = "Client")
@RestController
@RequestMapping("/configs")
+@RequiredArgsConstructor
public class ConfigController {
- @Autowired
- private ConfigService configService;
+ private final ConfigService configService;
@GetMapping(path = "/bootstrap", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getBootstrapConfig() {
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/dashboard/DashboardController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/dashboard/DashboardController.java
index 4ba66cfea..57f9446ed 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/dashboard/DashboardController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/dashboard/DashboardController.java
@@ -24,12 +24,11 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.dashboard.DashboardItemDTO;
import nl.dtls.fairdatapoint.service.dashboard.DashboardService;
import nl.dtls.fairdatapoint.service.metadata.exception.MetadataServiceException;
import org.eclipse.rdf4j.model.IRI;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -46,14 +45,12 @@
@Tag(name = "Client")
@RestController
@RequestMapping("/dashboard")
+@RequiredArgsConstructor
public class DashboardController {
- @Autowired
- @Qualifier("persistentUrl")
- private String persistentUrl;
+ private final String persistentUrl;
- @Autowired
- private DashboardService dashboardService;
+ private final DashboardService dashboardService;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> getDashboard(
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/exception/ExceptionControllerAdvice.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/exception/ExceptionControllerAdvice.java
index e836f148f..5853681b1 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/exception/ExceptionControllerAdvice.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/exception/ExceptionControllerAdvice.java
@@ -78,6 +78,7 @@ public class ExceptionControllerAdvice {
public ErrorDTO handleConstraintViolation(Exception exception) {
log.warn(exception.getMessage());
log.debug("Handling bad request (ConstraintViolation)", exception);
+ exception.printStackTrace();
return new ErrorDTO(HttpStatus.BAD_REQUEST, exception.getMessage());
}
@@ -95,6 +96,7 @@ public ErrorDTO handleConstraintViolation(Exception exception) {
public ErrorDTO handleValidationException(Exception exception) {
log.warn(exception.getMessage());
log.debug("Handling bad request (ValidationException)", exception);
+ exception.printStackTrace();
return new ErrorDTO(HttpStatus.BAD_REQUEST, exception.getMessage());
}
@@ -112,6 +114,7 @@ public ErrorDTO handleValidationException(Exception exception) {
public Model handleRdfValidationException(RdfValidationException exception) {
final Model validationReportModel = exception.getModel();
log.debug("Handling bad request (RdfValidationException)", exception);
+ exception.printStackTrace();
// Log number of errors
final IRI validationResultIri = i("http://www.w3.org/ns/shacl#ValidationResult");
@@ -140,6 +143,7 @@ public Model handleRdfValidationException(RdfValidationException exception) {
)
)
public ErrorDTO handleInvalidQuery(MalformedQueryException exception) {
+ exception.printStackTrace();
return handleInvalidSparqlQuery(exception);
}
@@ -155,6 +159,7 @@ public ErrorDTO handleInvalidQuery(MalformedQueryException exception) {
)
)
public ErrorDTO handleInvalidQuery(QueryEvaluationException exception) {
+ exception.printStackTrace();
return handleInvalidSparqlQuery(exception);
}
@@ -172,6 +177,7 @@ public ErrorDTO handleInvalidQuery(QueryEvaluationException exception) {
public ErrorDTO handleUnauthorized(Exception exception) {
log.error(exception.getMessage());
log.debug("Handling unauthorized", exception);
+ exception.printStackTrace();
return new ErrorDTO(HttpStatus.UNAUTHORIZED, exception.getMessage());
}
@@ -189,6 +195,7 @@ public ErrorDTO handleUnauthorized(Exception exception) {
public ErrorDTO handleForbidden(Exception exception) {
log.error(exception.getMessage());
log.debug("Handling forbidden", exception);
+ exception.printStackTrace();
return new ErrorDTO(HttpStatus.FORBIDDEN, exception.getMessage());
}
@@ -206,6 +213,7 @@ public ErrorDTO handleForbidden(Exception exception) {
public ErrorDTO handleResourceNotFound(ResourceNotFoundException exception) {
log.error(exception.getMessage());
log.debug("Handling resource not found", exception);
+ exception.printStackTrace();
return new ErrorDTO(HttpStatus.NOT_FOUND, exception.getMessage());
}
@@ -223,12 +231,14 @@ public ErrorDTO handleResourceNotFound(ResourceNotFoundException exception) {
public ErrorDTO handleInternalServerError(Exception exception) {
log.error(exception.getMessage());
log.debug("Handling internal server error (MetadataServiceException)", exception);
+ exception.printStackTrace();
return new ErrorDTO(HttpStatus.INTERNAL_SERVER_ERROR, exception.getMessage());
}
@ExceptionHandler(AbstractIndexException.class)
public ResponseEntity handleIndexException(AbstractIndexException exception) {
log.debug("Handling index exception", exception);
+ exception.printStackTrace();
return new ResponseEntity<>(exception.getErrorDTO(), exception.getStatus());
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/form/FormAutocompleteController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/form/FormAutocompleteController.java
index 3d991c2a3..aaa7f50cb 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/form/FormAutocompleteController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/form/FormAutocompleteController.java
@@ -24,10 +24,10 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.form.FormAutocompleteItemDTO;
import nl.dtls.fairdatapoint.api.dto.form.FormAutocompleteRequestDTO;
import nl.dtls.fairdatapoint.service.form.autocomplete.FormsAutocompleteService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -41,10 +41,10 @@
@Tag(name = "Client")
@RestController
@RequestMapping("/forms")
+@RequiredArgsConstructor
public class FormAutocompleteController {
- @Autowired
- private FormsAutocompleteService autocompleteService;
+ private final FormsAutocompleteService autocompleteService;
@PostMapping(
path = "/autocomplete",
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexAdminController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexAdminController.java
index 7f71acca9..c1d1560fc 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexAdminController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexAdminController.java
@@ -26,15 +26,15 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import nl.dtls.fairdatapoint.api.dto.index.ping.PingDTO;
import nl.dtls.fairdatapoint.database.rdf.repository.exception.MetadataRepositoryException;
-import nl.dtls.fairdatapoint.entity.index.event.Event;
+import nl.dtls.fairdatapoint.entity.index.event.IndexEvent;
import nl.dtls.fairdatapoint.service.UtilityService;
import nl.dtls.fairdatapoint.service.index.entry.IndexEntryService;
import nl.dtls.fairdatapoint.service.index.event.EventService;
import nl.dtls.fairdatapoint.service.index.webhook.WebhookService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@@ -45,19 +45,16 @@
@Slf4j
@RestController
@RequestMapping("/index/admin")
+@RequiredArgsConstructor
public class IndexAdminController {
- @Autowired
- private UtilityService utilityService;
+ private final UtilityService utilityService;
- @Autowired
- private EventService eventService;
+ private final EventService eventService;
- @Autowired
- private WebhookService webhookService;
+ private final WebhookService webhookService;
- @Autowired
- private IndexEntryService indexEntryService;
+ private final IndexEntryService indexEntryService;
@Operation(hidden = true)
@PostMapping("/trigger")
@@ -69,7 +66,7 @@ public void triggerMetadataRetrieve(
) throws MetadataRepositoryException {
log.info("Received ping trigger request from {}",
utilityService.getRemoteAddr(request));
- final Event event = eventService.acceptAdminTrigger(request, reqDto);
+ final IndexEvent event = eventService.acceptAdminTrigger(request, reqDto);
webhookService.triggerWebhooks(event);
eventService.triggerMetadataRetrieval(event);
indexEntryService.harvest(reqDto.getClientUrl());
@@ -82,7 +79,7 @@ public void triggerMetadataRetrieve(
public void triggerMetadataRetrieveAll(HttpServletRequest request) {
log.info("Received ping trigger all request from {}",
utilityService.getRemoteAddr(request));
- final Event event = eventService.acceptAdminTriggerAll(request);
+ final IndexEvent event = eventService.acceptAdminTriggerAll(request);
webhookService.triggerWebhooks(event);
eventService.triggerMetadataRetrieval(event);
}
@@ -94,7 +91,7 @@ public void triggerMetadataRetrieveAll(HttpServletRequest request) {
public void webhookPing(@RequestParam UUID webhook, HttpServletRequest request) {
log.info("Received webhook {} ping trigger from {}",
webhook, utilityService.getRemoteAddr(request));
- final Event event = webhookService.handleWebhookPing(request, webhook);
+ final IndexEvent event = webhookService.handleWebhookPing(request, webhook);
webhookService.triggerWebhooks(event);
}
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexEntryController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexEntryController.java
index ff5d8f510..b0a4d11ed 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexEntryController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexEntryController.java
@@ -24,6 +24,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.index.entry.IndexEntryDTO;
import nl.dtls.fairdatapoint.api.dto.index.entry.IndexEntryDetailDTO;
import nl.dtls.fairdatapoint.api.dto.index.entry.IndexEntryInfoDTO;
@@ -31,13 +32,12 @@
import nl.dtls.fairdatapoint.api.dto.index.ping.PingDTO;
import nl.dtls.fairdatapoint.database.rdf.repository.exception.MetadataRepositoryException;
import nl.dtls.fairdatapoint.entity.index.entry.IndexEntryPermit;
-import nl.dtls.fairdatapoint.entity.index.event.Event;
+import nl.dtls.fairdatapoint.entity.index.event.IndexEvent;
import nl.dtls.fairdatapoint.service.index.entry.IndexEntryService;
import nl.dtls.fairdatapoint.service.index.event.EventService;
import nl.dtls.fairdatapoint.service.index.harvester.HarvesterService;
import nl.dtls.fairdatapoint.service.index.webhook.WebhookService;
import org.eclipse.rdf4j.model.Model;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -47,26 +47,23 @@
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
@Tag(name = "Index")
@RestController
@RequestMapping("/index/entries")
+@RequiredArgsConstructor
public class IndexEntryController {
- @Autowired
- private IndexEntryService service;
+ private final IndexEntryService service;
- @Autowired
- private HarvesterService harvesterService;
+ private final HarvesterService harvesterService;
- @Autowired
- private EventService eventService;
+ private final EventService eventService;
- @Autowired
- private WebhookService webhookService;
+ private final WebhookService webhookService;
- @Autowired
- private IndexEntryService indexEntryService;
+ private final IndexEntryService indexEntryService;
@GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
public Page getEntriesPage(
@@ -78,14 +75,14 @@ public Page getEntriesPage(
}
@GetMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
- public Optional getEntry(@PathVariable final String uuid) {
+ public Optional getEntry(@PathVariable final UUID uuid) {
return service.getEntryDetailDTO(uuid);
}
@PutMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole('ADMIN')")
public Optional updateEntry(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@RequestBody IndexEntryUpdateDTO reqDto,
HttpServletRequest request
) throws MetadataRepositoryException {
@@ -93,7 +90,7 @@ public Optional updateEntry(
if (resDto.isPresent()) {
final String clientUrl = resDto.get().getClientUrl();
if (resDto.get().getPermit().equals(IndexEntryPermit.ACCEPTED)) {
- final Event event = eventService.acceptAdminTrigger(request, new PingDTO(clientUrl));
+ final IndexEvent event = eventService.acceptAdminTrigger(request, new PingDTO(clientUrl));
webhookService.triggerWebhooks(event);
eventService.triggerMetadataRetrieval(event);
indexEntryService.harvest(clientUrl);
@@ -106,13 +103,13 @@ public Optional updateEntry(
}
@GetMapping(path = "/{uuid}/data", produces = "!application/json")
- public Model getEntryData(@PathVariable final String uuid) throws MetadataRepositoryException {
+ public Model getEntryData(@PathVariable final UUID uuid) throws MetadataRepositoryException {
return service.getEntryHarvestedData(uuid);
}
@DeleteMapping("/{uuid}")
@ResponseStatus(HttpStatus.NO_CONTENT)
- public void deleteEntry(@PathVariable final String uuid) throws MetadataRepositoryException {
+ public void deleteEntry(@PathVariable final UUID uuid) throws MetadataRepositoryException {
service.deleteEntry(uuid);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexPingController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexPingController.java
index 2030845df..7751e39d1 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexPingController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexPingController.java
@@ -30,15 +30,15 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import nl.dtls.fairdatapoint.api.dto.index.ping.PingDTO;
import nl.dtls.fairdatapoint.database.rdf.repository.exception.MetadataRepositoryException;
-import nl.dtls.fairdatapoint.entity.index.event.Event;
+import nl.dtls.fairdatapoint.entity.index.event.IndexEvent;
import nl.dtls.fairdatapoint.service.UtilityService;
import nl.dtls.fairdatapoint.service.index.entry.IndexEntryService;
import nl.dtls.fairdatapoint.service.index.event.EventService;
import nl.dtls.fairdatapoint.service.index.webhook.WebhookService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -48,19 +48,16 @@
@Slf4j
@RestController
@RequestMapping("/")
+@RequiredArgsConstructor
public class IndexPingController {
- @Autowired
- private EventService eventService;
+ private final EventService eventService;
- @Autowired
- private WebhookService webhookService;
+ private final WebhookService webhookService;
- @Autowired
- private IndexEntryService indexEntryService;
+ private final IndexEntryService indexEntryService;
- @Autowired
- private UtilityService utilityService;
+ private final UtilityService utilityService;
@Operation(
description = "Inform about running FAIR Data Point. It is expected to "
@@ -97,7 +94,7 @@ public ResponseEntity receivePing(
HttpServletRequest request
) throws MetadataRepositoryException {
log.info("Received ping from {}", utilityService.getRemoteAddr(request));
- final Event event = eventService.acceptIncomingPing(reqDto, request);
+ final IndexEvent event = eventService.acceptIncomingPing(reqDto, request);
log.info("Triggering metadata retrieval for {}", event.getRelatedTo().getClientUrl());
eventService.triggerMetadataRetrieval(event);
indexEntryService.harvest(reqDto.getClientUrl());
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexSettingsController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexSettingsController.java
index 397cabb59..61fa1b600 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexSettingsController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/index/IndexSettingsController.java
@@ -24,10 +24,10 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.index.settings.IndexSettingsDTO;
import nl.dtls.fairdatapoint.api.dto.index.settings.IndexSettingsUpdateDTO;
import nl.dtls.fairdatapoint.service.index.settings.IndexSettingsService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@@ -35,10 +35,10 @@
@Tag(name = "Index")
@RestController
@RequestMapping("/index/settings")
+@RequiredArgsConstructor
public class IndexSettingsController {
- @Autowired
- private IndexSettingsService indexSettingsService;
+ private final IndexSettingsService indexSettingsService;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole('ADMIN')")
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/label/LabelController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/label/LabelController.java
index 66edccc47..962f2e83d 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/label/LabelController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/label/LabelController.java
@@ -22,9 +22,9 @@
*/
package nl.dtls.fairdatapoint.api.controller.label;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.label.LabelDTO;
import nl.dtls.fairdatapoint.service.label.LabelService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -37,9 +37,10 @@
@RestController
@RequestMapping("/label")
+@RequiredArgsConstructor
public class LabelController {
- @Autowired
- private LabelService labelService;
+
+ private final LabelService labelService;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getLabel(
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/membership/MembershipController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/membership/MembershipController.java
index 4ecc55aea..43797367b 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/membership/MembershipController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/membership/MembershipController.java
@@ -23,9 +23,9 @@
package nl.dtls.fairdatapoint.api.controller.membership;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.membership.MembershipDTO;
import nl.dtls.fairdatapoint.service.membership.MembershipService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -38,10 +38,10 @@
@Tag(name = "Authentication and Authorization")
@RestController
@RequestMapping("/memberships")
+@RequiredArgsConstructor
public class MembershipController {
- @Autowired
- private MembershipService membershipService;
+ private final MembershipService membershipService;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> getUsers() {
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericController.java
index 71a55ced1..87ac3b514 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericController.java
@@ -24,6 +24,7 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.database.rdf.repository.RepositoryMode;
import nl.dtls.fairdatapoint.database.rdf.repository.exception.MetadataRepositoryException;
import nl.dtls.fairdatapoint.database.rdf.repository.generic.GenericMetadataRepository;
@@ -31,7 +32,7 @@
import nl.dtls.fairdatapoint.entity.exception.ValidationException;
import nl.dtls.fairdatapoint.entity.resource.ResourceDefinition;
import nl.dtls.fairdatapoint.entity.resource.ResourceDefinitionChild;
-import nl.dtls.fairdatapoint.entity.user.User;
+import nl.dtls.fairdatapoint.entity.user.UserAccount;
import nl.dtls.fairdatapoint.service.metadata.common.MetadataService;
import nl.dtls.fairdatapoint.service.metadata.enhance.MetadataEnhancer;
import nl.dtls.fairdatapoint.service.metadata.exception.MetadataServiceException;
@@ -47,8 +48,6 @@
import org.eclipse.rdf4j.model.impl.LinkedHashModel;
import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
import org.eclipse.rdf4j.rio.RDFFormat;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -70,35 +69,26 @@
@Tag(name = "Metadata")
@RestController
@RequestMapping("/")
+@RequiredArgsConstructor
public class GenericController {
- @Autowired
- @Qualifier("persistentUrl")
- private String persistentUrl;
+ private final String persistentUrl;
- @Autowired
- private MetadataServiceFactory metadataServiceFactory;
+ private final MetadataServiceFactory metadataServiceFactory;
- @Autowired
- private ResourceDefinitionService resourceDefinitionService;
+ private final ResourceDefinitionService resourceDefinitionService;
- @Autowired
- private MetadataSchemaService metadataSchemaService;
+ private final MetadataSchemaService metadataSchemaService;
- @Autowired
- private MetadataEnhancer metadataEnhancer;
+ private final MetadataEnhancer metadataEnhancer;
- @Autowired
- private CurrentUserService currentUserService;
+ private final CurrentUserService currentUserService;
- @Autowired
- private GenericMetadataRepository metadataRepository;
+ private final GenericMetadataRepository metadataRepository;
- @Autowired
- private MetadataStateService metadataStateService;
+ private final MetadataStateService metadataStateService;
- @Autowired
- private SearchFilterCache searchFilterCache;
+ private final SearchFilterCache searchFilterCache;
@Operation(hidden = true)
@GetMapping(path = {"/spec", "{oUrlPrefix:[^.]+}/spec"}, produces = "!application/json")
@@ -107,7 +97,7 @@ public Model getFormMetadata(
) {
final String urlPrefix = oUrlPrefix.orElse("");
final ResourceDefinition rd = resourceDefinitionService.getByUrlPrefix(urlPrefix);
- return metadataSchemaService.getShaclFromSchemas(rd.getMetadataSchemaUuids());
+ return metadataSchemaService.getShaclFromSchemaUsages(rd.getMetadataSchemaUsages());
}
@Operation(hidden = true, deprecated = true)
@@ -127,7 +117,7 @@ public Model getMetaDataExpanded(
final ResourceDefinition rd = resourceDefinitionService.getByUrlPrefix(urlPrefix);
// 2. Get entity (from repository based on permissions)
- final Optional oCurrentUser = currentUserService.getCurrentUser();
+ final Optional oCurrentUser = currentUserService.getCurrentUser();
IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
final RepositoryMode mode = oCurrentUser.isEmpty() ? RepositoryMode.MAIN : RepositoryMode.COMBINED;
Model entity = metadataService.retrieve(entityUri, mode);
@@ -171,7 +161,7 @@ public Model getMetaData(
final ResourceDefinition rd = resourceDefinitionService.getByUrlPrefix(urlPrefix);
// 3. Get entity (from repository based on permissions)
- final Optional oCurrentUser = currentUserService.getCurrentUser();
+ final Optional oCurrentUser = currentUserService.getCurrentUser();
final IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
final RepositoryMode mode = oCurrentUser.isEmpty() ? RepositoryMode.MAIN : RepositoryMode.COMBINED;
final Model entity = metadataService.retrieve(entityUri, mode);
@@ -194,7 +184,7 @@ public ResponseEntity storeMetaData(
) throws MetadataServiceException {
// 1. Check if user is authenticated
// - it can't be in SecurityConfig because the authentication is done based on content-type
- final Optional oUser = currentUserService.getCurrentUser();
+ final Optional oUser = currentUserService.getCurrentUser();
if (oUser.isEmpty()) {
throw new ForbiddenException("You have to be login at first");
}
@@ -316,7 +306,7 @@ public ResponseEntity getMetaDataChildren(
final MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
// 2. Get entity (from repository based on permissions)
- final Optional oCurrentUser = currentUserService.getCurrentUser();
+ final Optional oCurrentUser = currentUserService.getCurrentUser();
final IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
final RepositoryMode mode = oCurrentUser.isEmpty() ? RepositoryMode.MAIN : RepositoryMode.COMBINED;
final Model entity = metadataService.retrieve(entityUri, mode);
@@ -327,7 +317,7 @@ public ResponseEntity getMetaDataChildren(
final MetadataService childMetadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(childPrefix);
for (ResourceDefinitionChild rdChild : rd.getChildren()) {
- if (rdChild.getResourceDefinitionUuid().equals(currentChildRd.getUuid())) {
+ if (rdChild.getTarget().getUuid().equals(currentChildRd.getUuid())) {
final IRI relationUri = i(rdChild.getRelationUri());
// 3.1 Get all titles for sort
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMemberController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMemberController.java
index dc11e8fcf..f172a0cb7 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMemberController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMemberController.java
@@ -25,6 +25,7 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.member.MemberCreateDTO;
import nl.dtls.fairdatapoint.api.dto.member.MemberDTO;
import nl.dtls.fairdatapoint.entity.exception.ResourceNotFoundException;
@@ -35,31 +36,27 @@
import nl.dtls.fairdatapoint.service.metadata.factory.MetadataServiceFactory;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Model;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
+import java.util.UUID;
import static nl.dtls.fairdatapoint.entity.metadata.MetadataGetter.getMetadataIdentifier;
import static nl.dtls.fairdatapoint.util.HttpUtil.getMetadataIRI;
@Tag(name = "Authentication and Authorization")
@RestController
+@RequiredArgsConstructor
public class GenericMemberController {
- @Autowired
- @Qualifier("persistentUrl")
- private String persistentUrl;
+ private final String persistentUrl;
- @Autowired
- private MemberService memberService;
+ private final MemberService memberService;
- @Autowired
- private MetadataServiceFactory metadataServiceFactory;
+ private final MetadataServiceFactory metadataServiceFactory;
@Operation(hidden = true)
@GetMapping(path = "{urlPrefix:[^.]+}/{recordId:[^.]+}/members", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -88,7 +85,7 @@ public ResponseEntity> getMembers(
public ResponseEntity putMember(
@PathVariable final String urlPrefix,
@PathVariable final String recordId,
- @PathVariable final String userUuid,
+ @PathVariable final UUID userUuid,
@RequestBody @Valid MemberCreateDTO reqBody
) throws MetadataServiceException {
// 1. Init
@@ -101,7 +98,7 @@ public ResponseEntity putMember(
// 3. Create / Update member
final String entityId = getMetadataIdentifier(metadata).getIdentifier().getLabel();
final MemberDTO dto = memberService.createOrUpdateMember(entityId, Metadata.class, userUuid,
- reqBody.getMembershipUuid());
+ UUID.fromString(reqBody.getMembershipUuid()));
return new ResponseEntity<>(dto, HttpStatus.OK);
}
@@ -111,7 +108,7 @@ public ResponseEntity putMember(
public ResponseEntity deleteMember(
@PathVariable final String urlPrefix,
@PathVariable final String recordId,
- @PathVariable final String userUuid
+ @PathVariable final UUID userUuid
) throws ResourceNotFoundException, MetadataServiceException {
// 1. Init
final MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMetaController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMetaController.java
index f2413c885..269bdb064 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMetaController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMetaController.java
@@ -25,6 +25,7 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.member.MemberDTO;
import nl.dtls.fairdatapoint.api.dto.metadata.MetaDTO;
import nl.dtls.fairdatapoint.api.dto.metadata.MetaPathDTO;
@@ -33,7 +34,7 @@
import nl.dtls.fairdatapoint.database.rdf.repository.RepositoryMode;
import nl.dtls.fairdatapoint.entity.metadata.Metadata;
import nl.dtls.fairdatapoint.entity.resource.ResourceDefinition;
-import nl.dtls.fairdatapoint.entity.user.User;
+import nl.dtls.fairdatapoint.entity.user.UserAccount;
import nl.dtls.fairdatapoint.service.member.MemberService;
import nl.dtls.fairdatapoint.service.metadata.common.MetadataService;
import nl.dtls.fairdatapoint.service.metadata.exception.MetadataServiceException;
@@ -44,8 +45,6 @@
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
@@ -60,28 +59,22 @@
@Tag(name = "Metadata")
@RestController
+@RequiredArgsConstructor
public class GenericMetaController {
private static final int SUPPORTED_URL_FRAGMENTS = 3;
- @Autowired
- @Qualifier("persistentUrl")
- private String persistentUrl;
+ private final String persistentUrl;
- @Autowired
- private MemberService memberService;
+ private final MemberService memberService;
- @Autowired
- private MetadataServiceFactory metadataServiceFactory;
+ private final MetadataServiceFactory metadataServiceFactory;
- @Autowired
- private MetadataStateService metadataStateService;
+ private final MetadataStateService metadataStateService;
- @Autowired
- private ResourceDefinitionService resourceDefinitionService;
+ private final ResourceDefinitionService resourceDefinitionService;
- @Autowired
- private CurrentUserService currentUserService;
+ private final CurrentUserService currentUserService;
@Operation(hidden = true)
@GetMapping(path = {"meta", "{oUrlPrefix:[^.]+}/{oRecordId:[^.]+}/meta"})
@@ -99,7 +92,7 @@ public MetaDTO getMeta(
ResourceDefinition definition = resourceDefinitionService.getByUrlPrefix(urlPrefix);
// 3. Get and check existence entity
- final Optional oCurrentUser = currentUserService.getCurrentUser();
+ final Optional oCurrentUser = currentUserService.getCurrentUser();
final RepositoryMode mode = oCurrentUser.isEmpty() ? RepositoryMode.MAIN : RepositoryMode.COMBINED;
IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
Model entity = metadataService.retrieve(entityUri, mode);
@@ -117,7 +110,7 @@ public MetaDTO getMeta(
final Map pathMap = new HashMap<>();
while (true) {
final MetaPathDTO entry = new MetaPathDTO();
- entry.setResourceDefinitionUuid(definition.getUuid());
+ entry.setResourceDefinitionUuid(definition.getUuid().toString());
entry.setTitle(getTitle(entity).stringValue());
final IRI parentUri = i(getStringObjectBy(entity, entityUri, DCTERMS.IS_PART_OF));
Optional.ofNullable(parentUri).map(IRI::toString).ifPresent(entry::setParent);
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/profile/ProfileController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/profile/ProfileController.java
index d95c3ddd2..e453414be 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/profile/ProfileController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/profile/ProfileController.java
@@ -24,17 +24,17 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.entity.exception.ResourceNotFoundException;
import nl.dtls.fairdatapoint.service.profile.ProfileService;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Model;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Optional;
+import java.util.UUID;
import static java.lang.String.format;
import static nl.dtls.fairdatapoint.util.HttpUtil.getRequestURL;
@@ -43,14 +43,12 @@
@Tag(name = "Client")
@RestController
@RequestMapping("/profile")
+@RequiredArgsConstructor
public class ProfileController {
- @Autowired
- @Qualifier("persistentUrl")
- private String persistentUrl;
+ private final String persistentUrl;
- @Autowired
- private ProfileService profileService;
+ private final ProfileService profileService;
@GetMapping(path = "/{uuid}", produces = {
"text/turtle",
@@ -64,7 +62,7 @@ public class ProfileController {
})
public ResponseEntity getSchemaContent(
HttpServletRequest request,
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException {
final IRI uri = i(getRequestURL(request, persistentUrl));
final Optional oDto = profileService.getProfileByUuid(uuid, uri);
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/reset/ResetController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/reset/ResetController.java
index 9a90afa80..d9de2f2ea 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/reset/ResetController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/reset/ResetController.java
@@ -24,9 +24,9 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.reset.ResetDTO;
import nl.dtls.fairdatapoint.service.reset.ResetService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -37,10 +37,10 @@
@Tag(name = "Client")
@RestController
+@RequiredArgsConstructor
public class ResetController {
- @Autowired
- private ResetService resetService;
+ private final ResetService resetService;
@PostMapping("/reset")
@PreAuthorize("hasRole('ADMIN')")
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/resource/ResourceDefinitionController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/resource/ResourceDefinitionController.java
index a06177e45..2854781db 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/resource/ResourceDefinitionController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/resource/ResourceDefinitionController.java
@@ -24,11 +24,11 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.resource.ResourceDefinitionChangeDTO;
import nl.dtls.fairdatapoint.api.dto.resource.ResourceDefinitionDTO;
import nl.dtls.fairdatapoint.entity.exception.ResourceNotFoundException;
import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -37,18 +37,19 @@
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
import static java.lang.String.format;
@Tag(name = "Metadata Model")
@RestController
@RequestMapping("/resource-definitions")
+@RequiredArgsConstructor
public class ResourceDefinitionController {
private static final String NOT_FOUND_MSG = "Resource Definition '%s' doesn't exist";
- @Autowired
- private ResourceDefinitionService resourceDefinitionService;
+ private final ResourceDefinitionService resourceDefinitionService;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> getResourceDefinitions() {
@@ -66,7 +67,7 @@ public ResponseEntity createResourceDefinitions(
@GetMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getResourceDefinition(
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException {
final Optional oDto = resourceDefinitionService.getDTOByUuid(uuid);
if (oDto.isPresent()) {
@@ -79,7 +80,7 @@ public ResponseEntity getResourceDefinition(
@PutMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity putResourceDefinitions(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@RequestBody @Valid ResourceDefinitionChangeDTO reqDto
) throws ResourceNotFoundException, BindException {
final Optional oDto = resourceDefinitionService.update(uuid, reqDto);
@@ -93,7 +94,7 @@ public ResponseEntity putResourceDefinitions(
@DeleteMapping(path = "/{uuid}")
@ResponseStatus(HttpStatus.NO_CONTENT)
- public ResponseEntity deleteResourceDefinitions(@PathVariable final String uuid)
+ public ResponseEntity deleteResourceDefinitions(@PathVariable final UUID uuid)
throws ResourceNotFoundException {
final boolean result = resourceDefinitionService.deleteByUuid(uuid);
if (result) {
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/schema/MetadataSchemaController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/schema/MetadataSchemaController.java
index b673af403..5ad03b110 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/schema/MetadataSchemaController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/schema/MetadataSchemaController.java
@@ -24,13 +24,13 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.schema.*;
import nl.dtls.fairdatapoint.entity.exception.ResourceNotFoundException;
import nl.dtls.fairdatapoint.entity.exception.UnauthorizedException;
import nl.dtls.fairdatapoint.service.schema.MetadataSchemaService;
import nl.dtls.fairdatapoint.service.user.CurrentUserService;
import org.eclipse.rdf4j.model.Model;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -39,12 +39,14 @@
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
import static java.lang.String.format;
@Tag(name = "Metadata Model")
@RestController
@RequestMapping("/metadata-schemas")
+@RequiredArgsConstructor
public class MetadataSchemaController {
private static final String NOT_FOUND_MSG =
@@ -52,11 +54,9 @@ public class MetadataSchemaController {
private static final String NOT_FOUND_VERSION_MSG =
"Metadata Schema '%s' doesn't exist with version '%s'";
- @Autowired
- private MetadataSchemaService metadataSchemaService;
+ private final MetadataSchemaService metadataSchemaService;
- @Autowired
- private CurrentUserService currentUserService;
+ private final CurrentUserService currentUserService;
@GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> getSchemas(
@@ -81,7 +81,7 @@ else if (includeDrafts) {
}
@GetMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity getSchema(@PathVariable final String uuid)
+ public ResponseEntity getSchema(@PathVariable final UUID uuid)
throws ResourceNotFoundException {
final Optional oDto = metadataSchemaService.getSchemaByUuid(uuid);
if (oDto.isPresent()) {
@@ -102,7 +102,7 @@ public ResponseEntity getSchema(@PathVariable final String uu
"application/xml",
"text/xml"
})
- public ResponseEntity getSchemaContent(@PathVariable final String uuid)
+ public ResponseEntity getSchemaContent(@PathVariable final UUID uuid)
throws ResourceNotFoundException {
final Optional oDto = metadataSchemaService.getSchemaContentByUuid(uuid);
if (oDto.isPresent()) {
@@ -116,7 +116,7 @@ public ResponseEntity getSchemaContent(@PathVariable final String uuid)
@DeleteMapping(path = "/{uuid}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public ResponseEntity deleteSchemaFull(
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException {
final boolean result = metadataSchemaService.deleteSchemaFull(uuid);
if (result) {
@@ -139,7 +139,7 @@ public ResponseEntity createSchemaDraft(
@PreAuthorize("hasRole('ADMIN')")
@GetMapping(path = "/{uuid}/draft", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getSchemaDraft(
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException {
final Optional oDto = metadataSchemaService.getSchemaDraft(uuid);
if (oDto.isPresent()) {
@@ -153,7 +153,7 @@ public ResponseEntity getSchemaDraft(
@PreAuthorize("hasRole('ADMIN')")
@PutMapping(path = "/{uuid}/draft", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity updateSchemaDraft(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@RequestBody @Valid MetadataSchemaChangeDTO reqDto
) throws ResourceNotFoundException {
final Optional oDto =
@@ -169,7 +169,7 @@ public ResponseEntity updateSchemaDraft(
@PreAuthorize("hasRole('ADMIN')")
@DeleteMapping(path = "/{uuid}/draft")
@ResponseStatus(HttpStatus.NO_CONTENT)
- public ResponseEntity deleteSchemaDraft(@PathVariable final String uuid)
+ public ResponseEntity deleteSchemaDraft(@PathVariable final UUID uuid)
throws ResourceNotFoundException {
final boolean result = metadataSchemaService.deleteSchemaDraft(uuid);
if (result) {
@@ -184,7 +184,7 @@ public ResponseEntity deleteSchemaDraft(@PathVariable final String uuid)
@PostMapping(path = "/{uuid}/versions")
@ResponseStatus(HttpStatus.NO_CONTENT)
public ResponseEntity releaseSchemaVersion(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@RequestBody @Valid MetadataSchemaReleaseDTO reqDto
) throws ResourceNotFoundException {
final Optional oDto = metadataSchemaService.releaseDraft(uuid, reqDto);
@@ -199,7 +199,7 @@ public ResponseEntity releaseSchemaVersion(
@PreAuthorize("hasRole('ADMIN')")
@GetMapping(path = "/{uuid}/versions/{version}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getSchemaVersion(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@PathVariable final String version
) throws ResourceNotFoundException {
final Optional oDto =
@@ -215,7 +215,7 @@ public ResponseEntity getSchemaVersion(
@PreAuthorize("hasRole('ADMIN')")
@PutMapping(path = "/{uuid}/versions/{version}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity updateSchemaVersion(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@PathVariable final String version,
@RequestBody @Valid MetadataSchemaUpdateDTO reqDto
) throws ResourceNotFoundException {
@@ -233,7 +233,7 @@ public ResponseEntity updateSchemaVersion(
@DeleteMapping(path = "/{uuid}/versions/{version}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public ResponseEntity deleteSchemaVersion(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@PathVariable final String version
) throws ResourceNotFoundException {
final boolean result = metadataSchemaService.deleteVersion(uuid, version);
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/search/SearchController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/search/SearchController.java
index e0eda44d4..9dab294a8 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/search/SearchController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/search/SearchController.java
@@ -24,11 +24,11 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.search.*;
import nl.dtls.fairdatapoint.database.rdf.repository.exception.MetadataRepositoryException;
import nl.dtls.fairdatapoint.service.search.SearchService;
import org.eclipse.rdf4j.query.MalformedQueryException;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -39,10 +39,10 @@
@Tag(name = "Search")
@RestController
@RequestMapping("/search")
+@RequiredArgsConstructor
public class SearchController {
- @Autowired
- private SearchService searchService;
+ private final SearchService searchService;
@PostMapping(
path = "",
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/search/SearchSavedQueryController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/search/SearchSavedQueryController.java
index f9c3fd837..d27fa8fb5 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/search/SearchSavedQueryController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/search/SearchSavedQueryController.java
@@ -24,6 +24,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.search.SearchResultDTO;
import nl.dtls.fairdatapoint.api.dto.search.SearchSavedQueryChangeDTO;
import nl.dtls.fairdatapoint.api.dto.search.SearchSavedQueryDTO;
@@ -31,7 +32,6 @@
import nl.dtls.fairdatapoint.entity.exception.ResourceNotFoundException;
import nl.dtls.fairdatapoint.service.search.SearchService;
import nl.dtls.fairdatapoint.service.search.query.SearchSavedQueryService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -40,21 +40,21 @@
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
import static java.lang.String.format;
@Tag(name = "Search")
@RestController
@RequestMapping("/search/query/saved")
+@RequiredArgsConstructor
public class SearchSavedQueryController {
private static final String NOT_FOUND_MSG = "Saved query '%s' doesn't exist";
- @Autowired
- private SearchSavedQueryService searchSavedQueryService;
+ private final SearchSavedQueryService searchSavedQueryService;
- @Autowired
- private SearchService searchService;
+ private final SearchService searchService;
@GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> getAll() {
@@ -63,7 +63,7 @@ public ResponseEntity> getAll() {
@GetMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getSingle(
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException {
final Optional oDto = searchSavedQueryService.getSingle(uuid);
if (oDto.isPresent()) {
@@ -76,7 +76,7 @@ public ResponseEntity getSingle(
@PostMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> search(
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException, MetadataRepositoryException {
final Optional oDto = searchSavedQueryService.getSingle(uuid);
if (oDto.isPresent()) {
@@ -99,7 +99,7 @@ public ResponseEntity create(
@PreAuthorize("isAuthenticated()")
@PutMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity update(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@RequestBody @Valid SearchSavedQueryChangeDTO reqDto
) {
final Optional oDto = searchSavedQueryService.update(uuid, reqDto);
@@ -115,7 +115,7 @@ public ResponseEntity update(
@DeleteMapping(path = "/{uuid}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public ResponseEntity delete(
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException {
final boolean result = searchSavedQueryService.delete(uuid);
if (result) {
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/settings/SettingsDefaults.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/settings/SettingsDefaults.java
new file mode 100644
index 000000000..b792c291a
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/settings/SettingsDefaults.java
@@ -0,0 +1,57 @@
+package nl.dtls.fairdatapoint.api.controller.settings;
+
+import lombok.RequiredArgsConstructor;
+import nl.dtls.fairdatapoint.config.properties.PingProperties;
+import nl.dtls.fairdatapoint.entity.settings.Settings;
+import nl.dtls.fairdatapoint.entity.settings.SettingsMetric;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.UUID;
+
+@Component
+@RequiredArgsConstructor
+public class SettingsDefaults {
+
+ private final PingProperties pingProperties;
+
+ public Settings getDefaults() {
+ final Settings settings = defaultSettings();
+ settings.setMetrics(defaultMetrics(settings));
+ return settings;
+ }
+
+ public Settings defaultSettings() {
+ return Settings.builder()
+ .uuid(KnownUUIDs.SETTINGS_UUID)
+ .appTitle(null)
+ .appSubtitle(null)
+ .pingEnabled(pingProperties.isEnabled())
+ .pingEndpoints(List.of())
+ .autocompleteSearchNamespace(true)
+ .autocompleteSources(List.of())
+ .metrics(List.of())
+ .searchFilters(List.of())
+ .build();
+ }
+
+ public List defaultMetrics(Settings settings) {
+ return List.of(
+ SettingsMetric.builder()
+ .uuid(UUID.randomUUID())
+ .metricUri("https://purl.org/fair-metrics/FM_F1A")
+ .resourceUri("https://www.ietf.org/rfc/rfc3986.txt")
+ .settings(settings)
+ .orderPriority(1)
+ .build(),
+ SettingsMetric.builder()
+ .uuid(UUID.randomUUID())
+ .metricUri("https://purl.org/fair-metrics/FM_A1.1")
+ .resourceUri("https://www.wikidata.org/wiki/Q8777")
+ .settings(settings)
+ .orderPriority(2)
+ .build()
+ );
+ }
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/token/TokenController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/token/TokenController.java
index e1cbe6c2c..b4b2e71fc 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/token/TokenController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/token/TokenController.java
@@ -24,10 +24,10 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.auth.AuthDTO;
import nl.dtls.fairdatapoint.api.dto.auth.TokenDTO;
import nl.dtls.fairdatapoint.service.jwt.JwtService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -38,10 +38,10 @@
@Tag(name = "Authentication and Authorization")
@RestController
@RequestMapping("/tokens")
+@RequiredArgsConstructor
public class TokenController {
- @Autowired
- private JwtService jwtService;
+ private final JwtService jwtService;
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity generateToken(@RequestBody @Valid AuthDTO reqDto) {
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/user/UserController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/user/UserController.java
index e61bd9b41..0dae24c62 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/user/UserController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/user/UserController.java
@@ -24,11 +24,11 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.user.*;
import nl.dtls.fairdatapoint.entity.exception.ForbiddenException;
import nl.dtls.fairdatapoint.entity.exception.ResourceNotFoundException;
import nl.dtls.fairdatapoint.service.user.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -36,20 +36,21 @@
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
import static java.lang.String.format;
@Tag(name = "User Management")
@RestController
@RequestMapping("/users")
+@RequiredArgsConstructor
public class UserController {
private static final String LOGIN_FIRST_MSG = "You have to be login at first";
private static final String NOT_FOUND_MSG = "User '%s' doesn't exist";
- @Autowired
- private UserService userService;
+ private final UserService userService;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> getUsers() {
@@ -66,7 +67,7 @@ public ResponseEntity createUser(@RequestBody @Valid UserCreateDTO reqD
@Tag(name = "Authentication and Authorization")
@GetMapping(path = "/current", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getUserCurrent() throws ResourceNotFoundException {
- final Optional oDto = userService.getCurrentUser();
+ final Optional oDto = userService.getCurrentUserDto();
if (oDto.isPresent()) {
return new ResponseEntity<>(oDto.get(), HttpStatus.OK);
}
@@ -77,9 +78,9 @@ public ResponseEntity getUserCurrent() throws ResourceNotFoundException
@GetMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getUser(
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException {
- final Optional oDto = userService.getUserByUuid(uuid);
+ final Optional oDto = userService.getUserDtoByUuid(uuid);
if (oDto.isPresent()) {
return new ResponseEntity<>(oDto.get(), HttpStatus.OK);
}
@@ -103,7 +104,7 @@ public ResponseEntity putUserCurrent(
@PutMapping(path = "/{uuid}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity putUser(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@RequestBody @Valid UserChangeDTO reqDto
) throws ResourceNotFoundException {
final Optional oDto = userService.updateUser(uuid, reqDto);
@@ -130,7 +131,7 @@ public ResponseEntity putUserCurrentPassword(
@PutMapping(path = "/{uuid}/password", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity putUserPassword(
- @PathVariable final String uuid,
+ @PathVariable final UUID uuid,
@RequestBody @Valid UserPasswordDTO reqDto
) throws ResourceNotFoundException {
final Optional oDto = userService.updatePassword(uuid, reqDto);
@@ -145,7 +146,7 @@ public ResponseEntity putUserPassword(
@DeleteMapping("/{uuid}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public ResponseEntity deleteUser(
- @PathVariable final String uuid
+ @PathVariable final UUID uuid
) throws ResourceNotFoundException {
final boolean result = userService.deleteUser(uuid);
if (result) {
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/apikey/ApiKeyDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/apikey/ApiKeyDTO.java
index 171c09f78..e81c1e452 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/apikey/ApiKeyDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/apikey/ApiKeyDTO.java
@@ -24,6 +24,8 @@
import lombok.*;
+import java.util.UUID;
+
@NoArgsConstructor
@AllArgsConstructor
@Getter
@@ -31,8 +33,7 @@
@EqualsAndHashCode
public class ApiKeyDTO {
- private String uuid;
+ private UUID uuid;
private String token;
-
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/index/entry/IndexEntryDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/index/entry/IndexEntryDTO.java
index ba6c9dac7..8f3dc6cf2 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/index/entry/IndexEntryDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/index/entry/IndexEntryDTO.java
@@ -30,6 +30,8 @@
import nl.dtls.fairdatapoint.entity.index.entry.IndexEntryPermit;
import org.hibernate.validator.constraints.URL;
+import java.util.UUID;
+
@NoArgsConstructor
@AllArgsConstructor
@Getter
@@ -37,7 +39,7 @@
public class IndexEntryDTO {
@NotNull
- private String uuid;
+ private UUID uuid;
@NotNull
@URL
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/index/entry/IndexEntryDetailDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/index/entry/IndexEntryDetailDTO.java
index 67bf2865c..2b65e23b1 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/index/entry/IndexEntryDetailDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/index/entry/IndexEntryDetailDTO.java
@@ -33,6 +33,7 @@
import org.hibernate.validator.constraints.URL;
import java.util.List;
+import java.util.UUID;
@NoArgsConstructor
@AllArgsConstructor
@@ -41,7 +42,7 @@
public class IndexEntryDetailDTO {
@NotNull
- private String uuid;
+ private UUID uuid;
@NotNull
@URL
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/index/event/EventDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/index/event/EventDTO.java
index 3b5ab5891..718b44f60 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/index/event/EventDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/index/event/EventDTO.java
@@ -27,7 +27,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
-import nl.dtls.fairdatapoint.entity.index.event.EventType;
+import nl.dtls.fairdatapoint.entity.index.event.IndexEventType;
import java.util.UUID;
@@ -41,7 +41,7 @@ public class EventDTO {
private UUID uuid;
@NotNull
- private EventType type;
+ private IndexEventType type;
@NotNull
private String created;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/index/webhook/WebhookPayloadDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/index/webhook/WebhookPayloadDTO.java
index bd2a68200..531ea5d75 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/index/webhook/WebhookPayloadDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/index/webhook/WebhookPayloadDTO.java
@@ -24,12 +24,12 @@
import lombok.Data;
import lombok.NoArgsConstructor;
-import nl.dtls.fairdatapoint.entity.index.webhook.WebhookEvent;
+import nl.dtls.fairdatapoint.entity.index.webhook.IndexWebhookEvent;
@Data
@NoArgsConstructor
public class WebhookPayloadDTO {
- private WebhookEvent event;
+ private IndexWebhookEvent event;
private String uuid;
private String clientUrl;
private String timestamp;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/membership/MembershipDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/membership/MembershipDTO.java
index 69798d0d5..60dfe160a 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/membership/MembershipDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/membership/MembershipDTO.java
@@ -26,12 +26,13 @@
import lombok.Data;
import java.util.List;
+import java.util.UUID;
@Data
@AllArgsConstructor
public class MembershipDTO {
- private String uuid;
+ private UUID uuid;
private String name;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChangeDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChangeDTO.java
index 0e597bbda..083b16b4c 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChangeDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChangeDTO.java
@@ -25,19 +25,15 @@
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import nl.dtls.fairdatapoint.entity.resource.ResourceDefinitionChild;
-import nl.dtls.fairdatapoint.entity.resource.ResourceDefinitionLink;
+import lombok.*;
import java.util.List;
+import java.util.UUID;
+@Data
@NoArgsConstructor
@AllArgsConstructor
-@Getter
-@Setter
+@Builder
public class ResourceDefinitionChangeDTO {
@NotBlank
@@ -47,13 +43,13 @@ public class ResourceDefinitionChangeDTO {
private String urlPrefix;
@NotNull
- private List metadataSchemaUuids;
+ private List metadataSchemaUuids;
@NotNull
@Valid
- private List children;
+ private List children;
@NotNull
@Valid
- private List externalLinks;
+ private List externalLinks;
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChildDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChildDTO.java
new file mode 100644
index 000000000..fd052204a
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChildDTO.java
@@ -0,0 +1,50 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.api.dto.resource;
+
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import nl.dtls.fairdatapoint.api.validator.ValidIri;
+
+import java.util.UUID;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class ResourceDefinitionChildDTO {
+
+ @NotBlank
+ private UUID resourceDefinitionUuid;
+
+ @NotBlank
+ @ValidIri
+ private String relationUri;
+
+ @Valid
+ private ResourceDefinitionChildListViewDTO listView;
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinitionChildListView.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChildListViewDTO.java
similarity index 82%
rename from src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinitionChildListView.java
rename to src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChildListViewDTO.java
index 0bc74d203..c15ad0d50 100644
--- a/src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinitionChildListView.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChildListViewDTO.java
@@ -20,22 +20,23 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.entity.resource;
+package nl.dtls.fairdatapoint.api.dto.resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
import nl.dtls.fairdatapoint.api.validator.ValidIri;
import java.util.List;
+@Data
@NoArgsConstructor
@AllArgsConstructor
-@Getter
-@Setter
-@EqualsAndHashCode
-@Builder(toBuilder = true)
-public class ResourceDefinitionChildListView {
+@Builder
+public class ResourceDefinitionChildListViewDTO {
@NotBlank
private String title;
@@ -44,6 +45,5 @@ public class ResourceDefinitionChildListView {
private String tagsUri;
@Valid
- private List metadata;
-
+ private List metadata;
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChildListViewMetadataDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChildListViewMetadataDTO.java
new file mode 100644
index 000000000..e3189655c
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionChildListViewMetadataDTO.java
@@ -0,0 +1,44 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.api.dto.resource;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import nl.dtls.fairdatapoint.api.validator.ValidIri;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class ResourceDefinitionChildListViewMetadataDTO {
+
+ @NotBlank
+ private String title;
+
+ @NotBlank
+ @ValidIri
+ private String propertyUri;
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionDTO.java
index f05724cde..2f1480832 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionDTO.java
@@ -25,23 +25,20 @@
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import nl.dtls.fairdatapoint.entity.resource.ResourceDefinitionChild;
-import nl.dtls.fairdatapoint.entity.resource.ResourceDefinitionLink;
+import lombok.*;
import java.util.List;
+import java.util.UUID;
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
+@Builder
public class ResourceDefinitionDTO {
@NotBlank
- private String uuid;
+ private UUID uuid;
@NotBlank
private String name;
@@ -50,16 +47,16 @@ public class ResourceDefinitionDTO {
private String urlPrefix;
@NotNull
- private List metadataSchemaUuids;
+ private List metadataSchemaUuids;
@NotNull
private List targetClassUris;
@NotNull
@Valid
- private List children;
+ private List children;
@NotNull
@Valid
- private List externalLinks;
+ private List externalLinks;
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinitionChildListViewMetadata.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionLinkDTO.java
similarity index 86%
rename from src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinitionChildListViewMetadata.java
rename to src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionLinkDTO.java
index 983eb78c2..e107d529d 100644
--- a/src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinitionChildListViewMetadata.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/resource/ResourceDefinitionLinkDTO.java
@@ -20,18 +20,20 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.entity.resource;
+package nl.dtls.fairdatapoint.api.dto.resource;
import jakarta.validation.constraints.NotBlank;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
import nl.dtls.fairdatapoint.api.validator.ValidIri;
+@Data
@NoArgsConstructor
@AllArgsConstructor
-@Getter
-@Setter
-@EqualsAndHashCode
-public class ResourceDefinitionChildListViewMetadata {
+@Builder
+public class ResourceDefinitionLinkDTO {
@NotBlank
private String title;
@@ -39,5 +41,4 @@ public class ResourceDefinitionChildListViewMetadata {
@NotBlank
@ValidIri
private String propertyUri;
-
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaChangeDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaChangeDTO.java
index 3d7cb4763..fa91645b6 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaChangeDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaChangeDTO.java
@@ -27,6 +27,7 @@
import lombok.*;
import java.util.List;
+import java.util.UUID;
@NoArgsConstructor
@AllArgsConstructor
@@ -48,7 +49,7 @@ public class MetadataSchemaChangeDTO {
private String definition;
@NotNull
- private List extendsSchemaUuids;
+ private List extendsSchemaUuids;
private String suggestedResourceName;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaDTO.java
index c35e8427a..6c99b6767 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaDTO.java
@@ -28,6 +28,7 @@
import lombok.*;
import java.util.List;
+import java.util.UUID;
@NoArgsConstructor
@AllArgsConstructor
@@ -38,7 +39,7 @@ public class MetadataSchemaDTO {
@NotNull
@NotBlank
- private String uuid;
+ private UUID uuid;
@NotNull
@NotBlank
@@ -54,8 +55,8 @@ public class MetadataSchemaDTO {
private List versions;
@NotNull
- private List extendSchemaUuids;
+ private List extendSchemaUuids;
@NotNull
- private List childSchemaUuids;
+ private List childSchemaUuids;
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaDraftDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaDraftDTO.java
index 5a6734ef8..4812e4f85 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaDraftDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaDraftDTO.java
@@ -28,6 +28,7 @@
import lombok.*;
import java.util.List;
+import java.util.UUID;
@NoArgsConstructor
@AllArgsConstructor
@@ -38,7 +39,7 @@ public class MetadataSchemaDraftDTO {
@NotNull
@NotBlank
- private String uuid;
+ private UUID uuid;
@NotNull
@NotBlank
@@ -53,7 +54,7 @@ public class MetadataSchemaDraftDTO {
private String definition;
@NotNull
- private List extendsSchemaUuids;
+ private List extendsSchemaUuids;
@JsonInclude(JsonInclude.Include.ALWAYS)
private String suggestedResourceName;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaPreviewRequestDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaPreviewRequestDTO.java
index a22287a1f..7dfc039d5 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaPreviewRequestDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaPreviewRequestDTO.java
@@ -29,6 +29,7 @@
import lombok.Setter;
import java.util.List;
+import java.util.UUID;
@NoArgsConstructor
@AllArgsConstructor
@@ -37,5 +38,5 @@
public class MetadataSchemaPreviewRequestDTO {
@NotNull
- private List metadataSchemaUuids;
+ private List metadataSchemaUuids;
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaVersionDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaVersionDTO.java
index 99943e32d..6e4b81739 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaVersionDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/schema/MetadataSchemaVersionDTO.java
@@ -29,7 +29,7 @@
import nl.dtls.fairdatapoint.entity.schema.MetadataSchemaType;
import java.util.List;
-import java.util.Set;
+import java.util.UUID;
@NoArgsConstructor
@AllArgsConstructor
@@ -39,17 +39,16 @@
public class MetadataSchemaVersionDTO {
@NotNull
- @NotBlank
- private String uuid;
+ private UUID uuid;
@JsonInclude(JsonInclude.Include.ALWAYS)
private String version;
@JsonInclude(JsonInclude.Include.ALWAYS)
- private String versionUuid;
+ private UUID versionUuid;
@JsonInclude(JsonInclude.Include.ALWAYS)
- private String previousVersionUuid;
+ private UUID previousVersionUuid;
@NotNull
@NotBlank
@@ -77,10 +76,10 @@ public class MetadataSchemaVersionDTO {
private String description;
@NotNull
- private Set targetClasses;
+ private List targetClasses;
@NotNull
- private List extendsSchemaUuids;
+ private List extendsSchemaUuids;
@JsonInclude(JsonInclude.Include.ALWAYS)
private String suggestedResourceName;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/search/SearchSavedQueryDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/search/SearchSavedQueryDTO.java
index 423ee724f..0d4928838 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/search/SearchSavedQueryDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/search/SearchSavedQueryDTO.java
@@ -31,6 +31,7 @@
import nl.dtls.fairdatapoint.entity.search.SearchSavedQueryType;
import java.time.Instant;
+import java.util.UUID;
@NoArgsConstructor
@AllArgsConstructor
@@ -40,7 +41,7 @@
public class SearchSavedQueryDTO {
@NotBlank
- private String uuid;
+ private UUID uuid;
@NotBlank
private String name;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsDTO.java
index cdba5d5d4..e8d10b073 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsDTO.java
@@ -24,7 +24,6 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
-import nl.dtls.fairdatapoint.entity.settings.SettingsMetricsEntry;
import java.util.List;
@@ -49,7 +48,7 @@ public class SettingsDTO {
private String appSubtitleFromConfig;
- private List metadataMetrics;
+ private List metadataMetrics;
private SettingsPingDTO ping;
diff --git a/src/main/java/nl/dtls/fairdatapoint/entity/settings/SettingsMetricsEntry.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsMetricDTO.java
similarity index 85%
rename from src/main/java/nl/dtls/fairdatapoint/entity/settings/SettingsMetricsEntry.java
rename to src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsMetricDTO.java
index 552afaae6..e37c61480 100644
--- a/src/main/java/nl/dtls/fairdatapoint/entity/settings/SettingsMetricsEntry.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsMetricDTO.java
@@ -20,20 +20,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.entity.settings;
+package nl.dtls.fairdatapoint.api.dto.settings;
-import lombok.*;
+import lombok.Builder;
+import lombok.Data;
-@NoArgsConstructor
-@AllArgsConstructor
-@Getter
-@Setter
-@EqualsAndHashCode
-@Builder(toBuilder = true)
-public class SettingsMetricsEntry {
+@Data
+@Builder
+public class SettingsMetricDTO {
private String metricUri;
private String resourceUri;
-
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsUpdateDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsUpdateDTO.java
index 7607b9906..e14675a89 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsUpdateDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/settings/SettingsUpdateDTO.java
@@ -24,7 +24,6 @@
import jakarta.validation.constraints.NotNull;
import lombok.*;
-import nl.dtls.fairdatapoint.entity.settings.SettingsMetricsEntry;
import java.util.List;
@@ -40,7 +39,7 @@ public class SettingsUpdateDTO {
private String appSubtitle;
@NotNull
- private List metadataMetrics;
+ private List metadataMetrics;
@NotNull
private SettingsPingUpdateDTO ping;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserChangeDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserChangeDTO.java
index c8dd11e92..838f878ef 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserChangeDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserChangeDTO.java
@@ -24,16 +24,14 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
+import lombok.*;
import nl.dtls.fairdatapoint.entity.user.UserRole;
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
+@Builder
public class UserChangeDTO {
@NotBlank
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserCreateDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserCreateDTO.java
index 4e2dc15ba..610d7d428 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserCreateDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserCreateDTO.java
@@ -24,16 +24,14 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
+import lombok.*;
import nl.dtls.fairdatapoint.entity.user.UserRole;
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
+@Builder
public class UserCreateDTO {
@NotBlank
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserDTO.java
index 2f05583fe..5fa423b72 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserDTO.java
@@ -28,13 +28,15 @@
import lombok.Setter;
import nl.dtls.fairdatapoint.entity.user.UserRole;
+import java.util.UUID;
+
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class UserDTO {
- private String uuid;
+ private UUID uuid;
private String firstName;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserSimpleDTO.java b/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserSimpleDTO.java
index 9d0259e46..88ae23c31 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserSimpleDTO.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/dto/user/UserSimpleDTO.java
@@ -25,11 +25,13 @@
import lombok.AllArgsConstructor;
import lombok.Data;
+import java.util.UUID;
+
@Data
@AllArgsConstructor
public class UserSimpleDTO {
- private String uuid;
+ private UUID uuid;
private String firstName;
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/filter/FilterConfigurer.java b/src/main/java/nl/dtls/fairdatapoint/api/filter/FilterConfigurer.java
index f2ff2e561..22cb74f82 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/filter/FilterConfigurer.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/filter/FilterConfigurer.java
@@ -22,7 +22,7 @@
*/
package nl.dtls.fairdatapoint.api.filter;
-import org.springframework.beans.factory.annotation.Autowired;
+import lombok.RequiredArgsConstructor;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
@@ -30,17 +30,15 @@
import org.springframework.stereotype.Component;
@Component
+@RequiredArgsConstructor
public class FilterConfigurer extends
SecurityConfigurerAdapter {
- @Autowired
- private JwtTokenFilter jwtTokenFilter;
+ private final JwtTokenFilter jwtTokenFilter;
- @Autowired
- private CORSFilter corsFilter;
+ private final CORSFilter corsFilter;
- @Autowired
- private LoggingFilter loggingFilter;
+ private final LoggingFilter loggingFilter;
@Override
public void configure(HttpSecurity http) {
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/filter/JwtTokenFilter.java b/src/main/java/nl/dtls/fairdatapoint/api/filter/JwtTokenFilter.java
index 9bb8b0981..a36fa7739 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/filter/JwtTokenFilter.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/filter/JwtTokenFilter.java
@@ -27,11 +27,11 @@
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.api.dto.error.ErrorDTO;
import nl.dtls.fairdatapoint.entity.exception.UnauthorizedException;
import nl.dtls.fairdatapoint.service.apikey.ApiKeyService;
import nl.dtls.fairdatapoint.service.jwt.JwtService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
@@ -44,16 +44,14 @@
import static nl.dtls.fairdatapoint.util.HttpUtil.getToken;
@Component
+@RequiredArgsConstructor
public class JwtTokenFilter extends OncePerRequestFilter {
- @Autowired
- private JwtService jwtService;
+ private final JwtService jwtService;
- @Autowired
- private ApiKeyService apiKeyService;
+ private final ApiKeyService apiKeyService;
- @Autowired
- private ObjectMapper objectMapper;
+ private final ObjectMapper objectMapper;
@Override
public void doFilterInternal(
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/filter/LoggingFilter.java b/src/main/java/nl/dtls/fairdatapoint/api/filter/LoggingFilter.java
index dea6a1f1c..3bbbcbbc4 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/filter/LoggingFilter.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/filter/LoggingFilter.java
@@ -31,9 +31,9 @@
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.service.UtilityService;
import org.apache.logging.log4j.ThreadContext;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
@@ -41,10 +41,10 @@
import java.io.IOException;
@Component
+@RequiredArgsConstructor
public class LoggingFilter extends OncePerRequestFilter {
- @Autowired
- private UtilityService utilityService;
+ private final UtilityService utilityService;
@Override
public void doFilterInternal(
diff --git a/src/main/java/nl/dtls/fairdatapoint/config/AclConfig.java b/src/main/java/nl/dtls/fairdatapoint/config/AclConfig.java
index 2638b5472..61f2ed39d 100644
--- a/src/main/java/nl/dtls/fairdatapoint/config/AclConfig.java
+++ b/src/main/java/nl/dtls/fairdatapoint/config/AclConfig.java
@@ -22,39 +22,36 @@
*/
package nl.dtls.fairdatapoint.config;
+import lombok.RequiredArgsConstructor;
import nl.dtls.fairdatapoint.entity.user.UserRole;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;
import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler;
import org.springframework.security.acls.AclPermissionCacheOptimizer;
import org.springframework.security.acls.AclPermissionEvaluator;
-import org.springframework.security.acls.dao.AclRepository;
import org.springframework.security.acls.domain.*;
+import org.springframework.security.acls.jdbc.BasicLookupStrategy;
+import org.springframework.security.acls.jdbc.JdbcMutableAclService;
import org.springframework.security.acls.jdbc.LookupStrategy;
import org.springframework.security.acls.model.AclCache;
-import org.springframework.security.acls.model.AclService;
+import org.springframework.security.acls.model.MutableAclService;
import org.springframework.security.acls.model.PermissionGrantingStrategy;
-import org.springframework.security.acls.mongodb.BasicLookupStrategy;
-import org.springframework.security.acls.mongodb.MongoDBMutableAclService;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import javax.sql.DataSource;
+
import static java.lang.String.format;
@Configuration
+@RequiredArgsConstructor
public class AclConfig {
public static final String ACL_CACHE = "ACL_CACHE";
- @Autowired
- private MongoTemplate mongoTemplate;
-
- @Autowired
- private AclRepository aclRepository;
+ private final DataSource dataSource;
@Bean
public AclCache aclCache(ConcurrentMapCacheManager cacheManager) {
@@ -65,8 +62,38 @@ springCache, permissionGrantingStrategy(), aclAuthorizationStrategy()
}
@Bean
- public AclService aclService(AclCache aclCache) {
- return new MongoDBMutableAclService(aclRepository, lookupStrategy(aclCache), aclCache);
+ public MutableAclService aclService(AclCache aclCache) {
+ final JdbcMutableAclService jdbcMutableAclService =
+ new JdbcMutableAclService(dataSource, lookupStrategy(aclCache), aclCache);
+
+ // from documentation
+ jdbcMutableAclService.setClassIdentityQuery("select currval(pg_get_serial_sequence('acl_class', 'id'))");
+ jdbcMutableAclService.setSidIdentityQuery("select currval(pg_get_serial_sequence('acl_sid', 'id'))");
+
+ // additional adjustments
+ jdbcMutableAclService.setObjectIdentityPrimaryKeyQuery(
+ """
+ SELECT acl_object_identity.id
+ FROM acl_object_identity, acl_class
+ WHERE acl_object_identity.object_id_class = acl_class.id
+ AND acl_class.class = ?
+ AND acl_object_identity.object_id_identity = CAST(? AS varchar);
+ """
+ );
+ jdbcMutableAclService.setFindChildrenQuery(
+ """
+ SELECT obj.object_id_identity AS obj_id, class.class AS class
+ FROM acl_object_identity obj, acl_object_identity parent, acl_class class
+ WHERE obj.parent_object = parent.id
+ AND obj.object_id_class = class.id
+ AND parent.object_id_identity = CAST(? AS varchar)
+ AND parent.object_id_class = (SELECT id FROM acl_class WHERE acl_class.class = ?)
+ """
+ );
+
+ jdbcMutableAclService.setAclClassIdSupported(true);
+
+ return jdbcMutableAclService;
}
@Bean
@@ -98,8 +125,14 @@ public MethodSecurityExpressionHandler defaultMethodSecurityExpressionHandler(
@Bean
public LookupStrategy lookupStrategy(AclCache aclCache) {
- return new BasicLookupStrategy(mongoTemplate, aclCache, aclAuthorizationStrategy(),
- permissionGrantingStrategy());
+ final BasicLookupStrategy basicLookupStrategy = new BasicLookupStrategy(
+ dataSource, aclCache,
+ aclAuthorizationStrategy(), new ConsoleAuditLogger());
+ final String lookupObjectIdentitiesWhereClause =
+ "(acl_object_identity.object_id_identity::varchar = ? and acl_class.class = ?)";
+ basicLookupStrategy.setLookupObjectIdentitiesWhereClause(lookupObjectIdentitiesWhereClause);
+ basicLookupStrategy.setAclClassIdSupported(true);
+ return basicLookupStrategy;
}
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0006_ShapesSharing.java b/src/main/java/nl/dtls/fairdatapoint/config/DatabaseConfig.java
similarity index 51%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0006_ShapesSharing.java
rename to src/main/java/nl/dtls/fairdatapoint/config/DatabaseConfig.java
index 3b3fcb53b..8d7866855 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0006_ShapesSharing.java
+++ b/src/main/java/nl/dtls/fairdatapoint/config/DatabaseConfig.java
@@ -20,34 +20,37 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.migration.production;
+package nl.dtls.fairdatapoint.config;
-import com.github.cloudyrock.mongock.ChangeLog;
-import com.github.cloudyrock.mongock.ChangeSet;
-import com.mongodb.client.MongoCollection;
-import com.mongodb.client.MongoDatabase;
-import com.mongodb.client.model.Filters;
-import com.mongodb.client.model.Updates;
+import lombok.extern.slf4j.Slf4j;
import nl.dtls.fairdatapoint.Profiles;
-import org.bson.Document;
-import org.springframework.context.annotation.Profile;
+import org.flywaydb.core.Flyway;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
-@ChangeLog(order = "0006")
-@Profile(Profiles.PRODUCTION)
-public class Migration_0006_ShapesSharing {
+@Slf4j
+@Configuration
+public class DatabaseConfig {
- private static final String FIELD_PUBLISHED = "published";
+ @Bean
+ public FlywayMigrationStrategy flywayMigrationStrategy(@Value("${spring.profiles.active}") String activeProfile) {
+ return flywayOld -> {
+ final Flyway flyway = Flyway.configure()
+ .configuration(flywayOld.getConfiguration())
+ .load();
- @ChangeSet(order = "0006", id = "Migration_0006_ShapesSharing", author = "migrationBot")
- public void run(MongoDatabase database) {
- addShapeDefinitions(database);
- }
+ if (activeProfile.equals(Profiles.DEVELOPMENT)) {
+ log.info("Development mode - cleaning up database");
+ flyway.clean();
+ }
- private void addShapeDefinitions(MongoDatabase database) {
- final MongoCollection shapeCol = database.getCollection("shape");
- shapeCol.updateMany(
- Filters.exists(FIELD_PUBLISHED, false),
- Updates.set(FIELD_PUBLISHED, false)
- );
+ if (activeProfile.equals(Profiles.TESTING)) {
+ log.info("Testing mode - not migrating database");
+ return;
+ }
+ flyway.migrate();
+ };
}
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/config/MongoConfig.java b/src/main/java/nl/dtls/fairdatapoint/config/MongoConfig.java
deleted file mode 100644
index 07c835de4..000000000
--- a/src/main/java/nl/dtls/fairdatapoint/config/MongoConfig.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * The MIT License
- * Copyright © 2017 DTL
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package nl.dtls.fairdatapoint.config;
-
-import io.mongock.api.config.LegacyMigration;
-import io.mongock.driver.mongodb.springdata.v4.SpringDataMongoV4Driver;
-import io.mongock.runner.springboot.MongockSpringboot;
-import io.mongock.runner.springboot.base.MongockInitializingBeanRunner;
-import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionCache;
-import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionTargetClassesCache;
-import nl.dtls.fairdatapoint.service.settings.SettingsCache;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.data.mongodb.config.EnableMongoAuditing;
-import org.springframework.data.mongodb.core.MongoTemplate;
-import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
-
-@Configuration
-@EnableMongoAuditing
-@EnableMongoRepositories(
- basePackages = {
- "nl.dtls.fairdatapoint",
- "nl.dtls.rdf.migration",
- "org.springframework.security.acls"
- }
-)
-public class MongoConfig {
-
- @Autowired
- private ResourceDefinitionCache resourceDefinitionCache;
-
- @Autowired
- private ResourceDefinitionTargetClassesCache targetClassesCache;
-
- @Autowired
- private SettingsCache settingsCache;
-
- @Bean("mongockRunner")
- public MongockInitializingBeanRunner mongockApplicationRunner(
- ApplicationContext springContext,
- MongoTemplate mongoTemplate
- ) {
- return MongockSpringboot.builder()
- .setDriver(SpringDataMongoV4Driver.withDefaultLock(mongoTemplate))
- .addMigrationScanPackage(
- "nl.dtls.fairdatapoint.database.mongo.migration.production"
- )
- .setSpringContext(springContext)
- .setLegacyMigration(new LegacyMigration("dbchangelog"))
- .addDependency(ResourceDefinitionCache.class, resourceDefinitionCache)
- .addDependency(ResourceDefinitionTargetClassesCache.class, targetClassesCache)
- .addDependency(SettingsCache.class, settingsCache)
- .buildInitializingBeanRunner();
- }
-}
diff --git a/src/main/java/nl/dtls/fairdatapoint/config/RepositoryMigrationConfig.java b/src/main/java/nl/dtls/fairdatapoint/config/RepositoryMigrationConfig.java
index 1710985e0..343280746 100644
--- a/src/main/java/nl/dtls/fairdatapoint/config/RepositoryMigrationConfig.java
+++ b/src/main/java/nl/dtls/fairdatapoint/config/RepositoryMigrationConfig.java
@@ -28,14 +28,12 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Profile;
@Configuration
public class RepositoryMigrationConfig {
@Bean
- @DependsOn("mongockRunner")
@Profile(Profiles.PRODUCTION)
public RdfProductionMigrationRunner rdfProductionMigrationRunner(
RdfMigrationRepository rdfMigrationRepository,
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/metadata/validator/MetadataStateValidator.java b/src/main/java/nl/dtls/fairdatapoint/database/db/migration/DatabaseSeeder.java
similarity index 56%
rename from src/main/java/nl/dtls/fairdatapoint/service/metadata/validator/MetadataStateValidator.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/migration/DatabaseSeeder.java
index ff0c005e8..f6779d50e 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/metadata/validator/MetadataStateValidator.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/migration/DatabaseSeeder.java
@@ -20,25 +20,40 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.service.metadata.validator;
+package nl.dtls.fairdatapoint.database.db.migration;
-import nl.dtls.fairdatapoint.api.dto.metadata.MetaStateChangeDTO;
-import nl.dtls.fairdatapoint.entity.exception.ValidationException;
-import nl.dtls.fairdatapoint.entity.metadata.Metadata;
-import nl.dtls.fairdatapoint.entity.metadata.MetadataState;
-import org.springframework.stereotype.Service;
+import lombok.RequiredArgsConstructor;
+import org.flywaydb.core.api.callback.Callback;
+import org.flywaydb.core.api.callback.Context;
+import org.flywaydb.core.api.callback.Event;
-@Service
-public class MetadataStateValidator {
+@RequiredArgsConstructor
+public class DatabaseSeeder implements Callback {
- public void validate(MetaStateChangeDTO reqDto, Metadata metadata) {
- if (reqDto.getCurrent().equals(MetadataState.DRAFT)) {
- throw new ValidationException("You can not change state to DRAFT");
- }
+ private final String activeProfile;
+
+ @Override
+ public boolean supports(Event event, Context context) {
+ return event.name().equals(Event.AFTER_MIGRATE.name());
+ }
- if (metadata.getState().equals(MetadataState.PUBLISHED)) {
- throw new ValidationException("Metadata is already published");
+ @Override
+ public boolean canHandleInTransaction(Event event, Context context) {
+ return true;
+ }
+
+ @Override
+ public void handle(Event event, Context context) {
+ try {
+ // TODO: seed or checks?
+ }
+ catch (Exception exc) {
+ exc.printStackTrace();
}
}
+ @Override
+ public String getCallbackName() {
+ return DatabaseSeeder.class.getName();
+ }
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/ApiKeyRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ApiKeyRepository.java
similarity index 79%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/ApiKeyRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/ApiKeyRepository.java
index eef8275d6..218c4beb9 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/ApiKeyRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ApiKeyRepository.java
@@ -20,20 +20,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
import nl.dtls.fairdatapoint.entity.apikey.ApiKey;
-import org.springframework.data.mongodb.repository.MongoRepository;
+import org.springframework.stereotype.Repository;
-import java.util.List;
import java.util.Optional;
-public interface ApiKeyRepository extends MongoRepository {
-
- List findByUserUuid(String userUuid);
-
- Optional findByUuid(String uuid);
-
+@Repository
+public interface ApiKeyRepository extends BaseRepository {
Optional findByToken(String token);
-
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/IndexEntryRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexEntryRepository.java
similarity index 57%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/IndexEntryRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexEntryRepository.java
index 905acc1be..b288c5384 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/IndexEntryRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexEntryRepository.java
@@ -20,49 +20,48 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
import nl.dtls.fairdatapoint.entity.index.entry.IndexEntry;
import nl.dtls.fairdatapoint.entity.index.entry.IndexEntryPermit;
import nl.dtls.fairdatapoint.entity.index.entry.IndexEntryState;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
-import org.springframework.data.mongodb.repository.MongoRepository;
+import org.springframework.stereotype.Repository;
import java.time.Instant;
import java.util.List;
import java.util.Optional;
-public interface IndexEntryRepository extends MongoRepository {
-
- Optional findByUuid(String uuid);
+@Repository
+public interface IndexEntryRepository extends BaseRepository {
+ Iterable findAllByPermitIn(List permit);
- Optional findByClientUrl(String clientUrl);
+ Page findAllByPermitIn(Pageable pageable, List permit);
- Page findAllByStateEqualsAndPermitIn(
- Pageable pageable, IndexEntryState state, List permit
- );
+ Page findAllByStateEqualsAndLastRetrievalAtAfterAndPermitIn(
+ Pageable pageable, IndexEntryState indexEntryState, Instant validThreshold,
+ List permit);
- Page findAllByStateEqualsAndLastRetrievalTimeBeforeAndPermitIn(
- Pageable pageable, IndexEntryState state, Instant when, List permit
- );
+ Page findAllByStateEqualsAndLastRetrievalAtBeforeAndPermitIn(
+ Pageable pageable, IndexEntryState indexEntryState, Instant validThreshold,
+ List permit);
- Page findAllByStateEqualsAndLastRetrievalTimeAfterAndPermitIn(
- Pageable pageable, IndexEntryState state, Instant when, List permit
- );
+ Page findAllByStateEqualsAndPermitIn(
+ Pageable pageable, IndexEntryState indexEntryState, List permit);
- Page findAllByPermitIn(Pageable pageable, List permit);
+ Long countAllByPermitIn(List permit);
- Iterable findAllByPermitIn(List permit);
+ Long countAllByStateEqualsAndPermitIn(
+ IndexEntryState indexEntryState, List permit);
- long countAllByPermitIn(List permit);
+ Long countAllByStateEqualsAndLastRetrievalAtAfterAndPermitIn(
+ IndexEntryState indexEntryState, Instant validThreshold, List permit);
- long countAllByStateEqualsAndPermitIn(IndexEntryState state, List permit);
+ Long countAllByStateEqualsAndLastRetrievalAtBeforeAndPermitIn(
+ IndexEntryState indexEntryState, Instant validThreshold, List permit);
- long countAllByStateEqualsAndLastRetrievalTimeAfterAndPermitIn(
- IndexEntryState state, Instant when, List permit);
+ Optional findByClientUrl(String clientUrl);
- long countAllByStateEqualsAndLastRetrievalTimeBeforeAndPermitIn(
- IndexEntryState state, Instant when, List permit
- );
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/EventRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexEventRepository.java
similarity index 62%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/EventRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexEventRepository.java
index 13f954d22..67f006f25 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/EventRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexEventRepository.java
@@ -20,26 +20,25 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
import nl.dtls.fairdatapoint.entity.index.entry.IndexEntry;
-import nl.dtls.fairdatapoint.entity.index.event.Event;
-import nl.dtls.fairdatapoint.entity.index.event.EventType;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.mongodb.repository.MongoRepository;
+import nl.dtls.fairdatapoint.entity.index.event.IndexEvent;
+import nl.dtls.fairdatapoint.entity.index.event.IndexEventType;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.stereotype.Repository;
import java.time.Instant;
import java.util.List;
-public interface EventRepository extends MongoRepository {
+@Repository
+public interface IndexEventRepository extends BaseRepository {
+ Iterable getAllByRelatedTo(IndexEntry indexEntry, PageRequest pageRequest);
- List getAllByType(EventType type);
+ List findAllByRemoteAddrAndCreatedAtAfter(String remoteAddr, Instant rateLimitSince);
- List getAllByFinishedIsNull();
+ List getAllByFinishedAtIsNull();
- Page getAllByRelatedTo(IndexEntry indexEntry, Pageable pageable);
-
- List findAllByIncomingPingExchangeRemoteAddrAndCreatedAfter(
- String remoteAddr, Instant after);
+ List getAllByType(IndexEventType indexEventType);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/IndexSettingsRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexSettingsRepository.java
similarity index 80%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/IndexSettingsRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexSettingsRepository.java
index 2a7075bdc..e746771fe 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/IndexSettingsRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexSettingsRepository.java
@@ -20,13 +20,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
import nl.dtls.fairdatapoint.entity.index.settings.IndexSettings;
-import org.springframework.data.mongodb.repository.MongoRepository;
+import org.springframework.stereotype.Repository;
-import java.util.Optional;
-
-public interface IndexSettingsRepository extends MongoRepository {
- Optional findFirstBy();
+@Repository
+public interface IndexSettingsRepository extends BaseRepository {
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexWebhookRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexWebhookRepository.java
new file mode 100644
index 000000000..bdca026f7
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/IndexWebhookRepository.java
@@ -0,0 +1,31 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.index.webhook.IndexWebhook;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface IndexWebhookRepository extends BaseRepository {
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MembershipPermissionRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MembershipPermissionRepository.java
new file mode 100644
index 000000000..260e187d3
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MembershipPermissionRepository.java
@@ -0,0 +1,31 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.membership.MembershipPermission;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface MembershipPermissionRepository extends BaseRepository {
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/MembershipRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MembershipRepository.java
similarity index 80%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/MembershipRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/MembershipRepository.java
index 1923af66f..d702ab6e4 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/MembershipRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MembershipRepository.java
@@ -20,15 +20,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
import nl.dtls.fairdatapoint.entity.membership.Membership;
-import org.springframework.data.mongodb.repository.MongoRepository;
-
-import java.util.Optional;
-
-public interface MembershipRepository extends MongoRepository {
-
- Optional findByUuid(String uuid);
+import org.springframework.stereotype.Repository;
+@Repository
+public interface MembershipRepository extends BaseRepository {
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaExtensionRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaExtensionRepository.java
new file mode 100644
index 000000000..caceab19d
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaExtensionRepository.java
@@ -0,0 +1,68 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.entity.schema.MetadataSchema;
+import nl.dtls.fairdatapoint.entity.schema.MetadataSchemaExtension;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.UUID;
+
+@Repository
+public interface MetadataSchemaExtensionRepository extends JpaRepository {
+
+ List findByExtendedMetadataSchema(MetadataSchema schema);
+
+ @Query(
+ """
+ SELECT e.extendedMetadataSchema.uuid
+ FROM MetadataSchemaExtension e
+ WHERE e.metadataSchemaVersion.uuid = :uuid
+ """
+ )
+ List getExtendedSchemaUuids(UUID uuid);
+
+ @Query(
+ """
+ SELECT e.uuid as uuid, v.schema.uuid as schemaUuid,
+ e.metadataSchemaVersion.uuid as versionUuid,
+ e.extendedMetadataSchema.uuid as extendedMetadataSchemaUuid
+ FROM MetadataSchemaExtension e JOIN MetadataSchemaVersion v ON e.metadataSchemaVersion.uuid = v.uuid
+ WHERE v.state = 'LATEST'
+ """
+ )
+ Iterable getBasicExtensionsForLatest();
+
+ interface MetadataSchemaExtensionBasic {
+ UUID getUuid();
+
+ UUID getSchemaUuid();
+
+ UUID getVersionUuid();
+
+ UUID getExtendedMetadataSchemaUuid();
+ }
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/MetadataSchemaRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaRepository.java
similarity index 56%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/MetadataSchemaRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaRepository.java
index 4dcb5f646..8b77ed7e2 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/MetadataSchemaRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaRepository.java
@@ -20,31 +20,38 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
import nl.dtls.fairdatapoint.entity.schema.MetadataSchema;
-import org.springframework.data.mongodb.repository.MongoRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
import java.util.List;
-import java.util.Optional;
+import java.util.UUID;
-public interface MetadataSchemaRepository extends MongoRepository {
+@Repository
+public interface MetadataSchemaRepository extends BaseRepository {
- List findByUuid(String uuid);
+ @Query(
+ """
+ SELECT ms.uuid as uuid, msv.uuid as versionUuid, msv.name as name,
+ msv.version as version, msv.targetClasses as targetClasses
+ FROM MetadataSchema ms JOIN MetadataSchemaVersion msv ON ms.uuid = msv.schema.uuid
+ WHERE msv.state = 'LATEST'
+ """
+ )
+ Iterable getBasicLatestMetadataSchemas();
- Optional findByVersionUuid(String uuid);
+ interface MetadataSchemaBasic {
+ UUID getUuid();
- Optional findByUuidAndVersionString(String uuid, String versionString);
+ UUID getVersionUuid();
- Optional findByUuidAndLatestIsTrue(String uuid);
+ String getName();
- List findAllByPublishedIsTrue();
+ String getVersion();
- List findAllByLatestIsTrue();
-
- List findAllByExtendSchemasContains(String uuid);
-
- Optional findByPreviousVersionUuid(String uuid);
-
- List findAllByImportedFromIsNotNull();
+ List getTargetClasses();
+ }
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaUsageRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaUsageRepository.java
new file mode 100644
index 000000000..4d2cc9a36
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaUsageRepository.java
@@ -0,0 +1,59 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.entity.resource.MetadataSchemaUsage;
+import nl.dtls.fairdatapoint.entity.resource.ResourceDefinition;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.UUID;
+
+@Repository
+public interface MetadataSchemaUsageRepository extends JpaRepository {
+
+ List findAllByResourceDefinition(ResourceDefinition resourceDefinition);
+
+ @Query(
+ """
+ SELECT e.uuid as uuid, rd.uuid as resourceDefinitionUuid,
+ e.usedMetadataSchema.uuid as schemaUuid,
+ rd.name as resourceDefinitionName
+ FROM MetadataSchemaUsage e JOIN ResourceDefinition rd ON e.resourceDefinition.uuid = rd.uuid
+ """
+ )
+ Iterable getBasicUsages();
+
+ interface MetadataSchemaUsageBasic {
+ UUID getUuid();
+
+ UUID getResourceDefinitionUuid();
+
+ UUID getSchemaUuid();
+
+ UUID getResourceDefinitionName();
+ }
+
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaVersionRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaVersionRepository.java
new file mode 100644
index 000000000..53da389f5
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/MetadataSchemaVersionRepository.java
@@ -0,0 +1,106 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.schema.MetadataSchemaState;
+import nl.dtls.fairdatapoint.entity.schema.MetadataSchemaVersion;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
+
+@Repository
+public interface MetadataSchemaVersionRepository extends BaseRepository {
+
+ @Query(
+ """
+ SELECT msv
+ FROM MetadataSchemaVersion msv JOIN MetadataSchema ms ON msv.schema = ms
+ WHERE ms.uuid = :uuid AND msv.state = 'DRAFT'
+ """
+ )
+ Optional getDraftBySchemaUuid(UUID uuid);
+
+ @Query(
+ """
+ SELECT msv
+ FROM MetadataSchemaVersion msv
+ WHERE msv.uuid = :uuid AND msv.state = 'DRAFT'
+ """
+ )
+ Optional getDraftBySchemaVersionUuid(UUID uuid);
+
+ @Query(
+ """
+ SELECT msv
+ FROM MetadataSchemaVersion msv JOIN MetadataSchema ms ON msv.schema = ms
+ WHERE msv.state = 'LATEST'
+ """
+ )
+ List getAllLatest();
+
+ @Query(
+ """
+ SELECT msv
+ FROM MetadataSchemaVersion msv JOIN MetadataSchema ms ON msv.schema = ms
+ WHERE ms.uuid = :uuid AND msv.state = 'LATEST'
+ """
+ )
+ Optional getLatestBySchemaUuid(UUID uuid);
+
+ @Query(
+ """
+ SELECT msv
+ FROM MetadataSchemaVersion msv
+ WHERE msv.uuid = :uuid AND msv.state = 'LATEST'
+ """
+ )
+ Optional getLatestBySchemaVersionUuid(UUID uuid);
+
+ @Query(
+ """
+ SELECT msv
+ FROM MetadataSchemaVersion msv JOIN MetadataSchema ms ON msv.schema = ms
+ WHERE ms.uuid = :uuid AND msv.version = :version
+ """
+ )
+ Optional getBySchemaUuidAndVersion(UUID uuid, String version);
+
+ @Query(
+ """
+ SELECT msv
+ FROM MetadataSchemaVersion msv JOIN MetadataSchema ms ON msv.schema = ms
+ WHERE ms.uuid = :uuid
+ """
+ )
+ List getBySchemaUuid(UUID uuid);
+
+ List findAllByImportedFromIsNotNull();
+
+ List findAllByState(MetadataSchemaState state);
+
+ List findAllByPublishedIsTrue();
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/entity/settings/SettingsFormsAutocomplete.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionChildMetadataRepository.java
similarity index 77%
rename from src/main/java/nl/dtls/fairdatapoint/entity/settings/SettingsFormsAutocomplete.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionChildMetadataRepository.java
index ffd9df06a..af470ed6f 100644
--- a/src/main/java/nl/dtls/fairdatapoint/entity/settings/SettingsFormsAutocomplete.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionChildMetadataRepository.java
@@ -20,21 +20,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.entity.settings;
+package nl.dtls.fairdatapoint.database.db.repository;
-import lombok.*;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.resource.ResourceDefinitionChildMetadata;
-import java.util.List;
-
-@NoArgsConstructor
-@AllArgsConstructor
-@Getter
-@Setter
-@EqualsAndHashCode
-@Builder(toBuilder = true)
-public class SettingsFormsAutocomplete {
-
- private Boolean searchNamespace;
-
- private List sources;
+public interface ResourceDefinitionChildMetadataRepository extends BaseRepository {
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionChildRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionChildRepository.java
new file mode 100644
index 000000000..96bcd7fe9
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionChildRepository.java
@@ -0,0 +1,49 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.resource.ResourceDefinitionChild;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.UUID;
+
+@Repository
+public interface ResourceDefinitionChildRepository extends BaseRepository {
+
+ @Query(
+ """
+ SELECT rdc.source.uuid as sourceUuid, rdc.target.uuid as targetUuid
+ FROM ResourceDefinitionChild rdc
+ """
+ )
+ List getAllMappings();
+
+ interface ResourceDefinitionChildMapping {
+ UUID getSourceUuid();
+
+ UUID getTargetUuid();
+ }
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionLinkRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionLinkRepository.java
new file mode 100644
index 000000000..009d31620
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionLinkRepository.java
@@ -0,0 +1,31 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.resource.ResourceDefinitionLink;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ResourceDefinitionLinkRepository extends BaseRepository {
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/ResourceDefinitionRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionRepository.java
similarity index 76%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/ResourceDefinitionRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionRepository.java
index 6655a9409..fbf385abb 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/ResourceDefinitionRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/ResourceDefinitionRepository.java
@@ -20,22 +20,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
import nl.dtls.fairdatapoint.entity.resource.ResourceDefinition;
-import org.springframework.data.mongodb.repository.MongoRepository;
+import org.springframework.stereotype.Repository;
-import java.util.List;
import java.util.Optional;
-public interface ResourceDefinitionRepository extends MongoRepository {
-
- Optional findByUuid(String uuid);
-
- Optional findByName(String name);
-
+@Repository
+public interface ResourceDefinitionRepository extends BaseRepository {
Optional findByUrlPrefix(String urlPrefix);
- List findByMetadataSchemaUuidsIsContaining(String metadataSchemaUuid);
-
+ Optional findByName(String name);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/SearchSavedQueryRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SearchSavedQueryRepository.java
similarity index 79%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/SearchSavedQueryRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/SearchSavedQueryRepository.java
index cdd716e56..19ff9efc1 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/SearchSavedQueryRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SearchSavedQueryRepository.java
@@ -20,15 +20,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
import nl.dtls.fairdatapoint.entity.search.SearchSavedQuery;
-import org.springframework.data.mongodb.repository.MongoRepository;
-
-import java.util.Optional;
-
-public interface SearchSavedQueryRepository extends MongoRepository {
-
- Optional findByUuid(String uuid);
+import org.springframework.stereotype.Repository;
+@Repository
+public interface SearchSavedQueryRepository extends BaseRepository {
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsAutocompleteSourceRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsAutocompleteSourceRepository.java
new file mode 100644
index 000000000..a8ee08130
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsAutocompleteSourceRepository.java
@@ -0,0 +1,31 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.settings.SettingsAutocompleteSource;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface SettingsAutocompleteSourceRepository extends BaseRepository {
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsMetricRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsMetricRepository.java
new file mode 100644
index 000000000..c3e022ff1
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsMetricRepository.java
@@ -0,0 +1,31 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.settings.SettingsMetric;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface SettingsMetricRepository extends BaseRepository {
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/SettingsRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsRepository.java
similarity index 81%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/SettingsRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsRepository.java
index b0bbb6576..8575dbf35 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/SettingsRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsRepository.java
@@ -20,13 +20,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
import nl.dtls.fairdatapoint.entity.settings.Settings;
-import org.springframework.data.mongodb.repository.MongoRepository;
+import org.springframework.stereotype.Repository;
-import java.util.Optional;
-
-public interface SettingsRepository extends MongoRepository {
- Optional findFirstBy();
+@Repository
+public interface SettingsRepository extends BaseRepository {
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsSearchFilterItemRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsSearchFilterItemRepository.java
new file mode 100644
index 000000000..b22b6bb3b
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsSearchFilterItemRepository.java
@@ -0,0 +1,31 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.db.repository;
+
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.settings.SettingsSearchFilterItem;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface SettingsSearchFilterItemRepository extends BaseRepository {
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/entity/settings/SettingsPing.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsSearchFilterRepository.java
similarity index 76%
rename from src/main/java/nl/dtls/fairdatapoint/entity/settings/SettingsPing.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsSearchFilterRepository.java
index a3d4f68ad..f9dac2373 100644
--- a/src/main/java/nl/dtls/fairdatapoint/entity/settings/SettingsPing.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/SettingsSearchFilterRepository.java
@@ -20,23 +20,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.entity.settings;
+package nl.dtls.fairdatapoint.database.db.repository;
-import jakarta.validation.constraints.NotNull;
-import lombok.*;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.settings.SettingsSearchFilter;
+import org.springframework.stereotype.Repository;
-import java.util.List;
-
-@NoArgsConstructor
-@AllArgsConstructor
-@Getter
-@Setter
-@EqualsAndHashCode
-@Builder(toBuilder = true)
-public class SettingsPing {
-
- private boolean enabled;
-
- @NotNull
- private List endpoints;
+@Repository
+public interface SettingsSearchFilterRepository extends BaseRepository {
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/UserRepository.java b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/UserAccountRepository.java
similarity index 75%
rename from src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/UserRepository.java
rename to src/main/java/nl/dtls/fairdatapoint/database/db/repository/UserAccountRepository.java
index b5deda1dd..98fc2e7d5 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/repository/UserRepository.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/db/repository/UserAccountRepository.java
@@ -20,17 +20,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-package nl.dtls.fairdatapoint.database.mongo.repository;
+package nl.dtls.fairdatapoint.database.db.repository;
-import nl.dtls.fairdatapoint.entity.user.User;
-import org.springframework.data.mongodb.repository.MongoRepository;
+import nl.dtls.fairdatapoint.database.db.repository.base.BaseRepository;
+import nl.dtls.fairdatapoint.entity.user.UserAccount;
+import org.springframework.stereotype.Repository;
import java.util.Optional;
-public interface UserRepository extends MongoRepository