diff --git a/dbrepo-metadata-db/setup-schema.sql b/dbrepo-metadata-db/setup-schema.sql index 320ff3001828c4b9150a98e3675f7790fc93f1b8..d69d524079f6357f05a47913f99c923ff1967255 100644 --- a/dbrepo-metadata-db/setup-schema.sql +++ b/dbrepo-metadata-db/setup-schema.sql @@ -356,11 +356,9 @@ CREATE TABLE IF NOT EXISTS `fda`.`mdb_ontologies` sparql_endpoint TEXT NULL, last_modified timestamp, created timestamp NOT NULL DEFAULT NOW(), - created_by character varying(36) NOT NULL, UNIQUE (prefix), UNIQUE (uri(200)), - PRIMARY KEY (id), - FOREIGN KEY (created_by) REFERENCES mdb_users (id) + PRIMARY KEY (id) ) WITH SYSTEM VERSIONING; CREATE TABLE IF NOT EXISTS `fda`.`mdb_view_columns` diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/semantics/Ontology.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/semantics/Ontology.java index 708dd8f64b8dd48aa21e1255a874929fa9a72fa7..2a683f4ae29b838e50579073d515b97eb5ae24b3 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/semantics/Ontology.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/semantics/Ontology.java @@ -43,10 +43,6 @@ public class Ontology { @Column private String sparqlEndpoint; - @JdbcTypeCode(java.sql.Types.VARCHAR) - @Column(name = "createdBy", nullable = false, columnDefinition = "VARCHAR(36)") - private UUID createdBy; - @CreatedDate @Column(nullable = false, updatable = false, columnDefinition = "TIMESTAMP") private Instant created; diff --git a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/OntologyServiceImpl.java b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/OntologyServiceImpl.java index 424343dfc046117992249c7433ddb44925904a63..fb11a25f24c34348c616d7c1cce3d4eeb289715d 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/OntologyServiceImpl.java +++ b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/OntologyServiceImpl.java @@ -2,9 +2,7 @@ package at.tuwien.service.impl; import at.tuwien.api.semantics.OntologyCreateDto; import at.tuwien.api.semantics.OntologyModifyDto; -import at.tuwien.api.user.UserDto; import at.tuwien.entities.semantics.Ontology; -import at.tuwien.entities.user.User; import at.tuwien.exception.AccessDeniedException; import at.tuwien.exception.KeycloakRemoteException; import at.tuwien.exception.OntologyNotFoundException; @@ -12,7 +10,6 @@ import at.tuwien.exception.UserNotFoundException; import at.tuwien.mapper.OntologyMapper; import at.tuwien.repository.mdb.OntologyRepository; import at.tuwien.service.OntologyService; -import at.tuwien.service.UserService; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -25,14 +22,11 @@ import java.util.Optional; @Service public class OntologyServiceImpl implements OntologyService { - private final UserService userService; private final OntologyMapper ontologyMapper; private final OntologyRepository ontologyRepository; @Autowired - public OntologyServiceImpl(UserService userService, OntologyMapper ontologyMapper, - OntologyRepository ontologyRepository) { - this.userService = userService; + public OntologyServiceImpl(OntologyMapper ontologyMapper, OntologyRepository ontologyRepository) { this.ontologyMapper = ontologyMapper; this.ontologyRepository = ontologyRepository; } @@ -55,9 +49,7 @@ public class OntologyServiceImpl implements OntologyService { @Override public Ontology create(OntologyCreateDto data, Principal principal) throws UserNotFoundException, KeycloakRemoteException, AccessDeniedException { - final User user = userService.findByUsername(principal.getName()); final Ontology entity = ontologyMapper.ontologyCreateDtoToOntology(data); - entity.setCreatedBy(user.getId()); final Ontology ontology = ontologyRepository.save(entity); log.info("Created ontology with id {}", ontology.getId()); return ontology; diff --git a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java index c8ee4c13fdb3fccff1703fc24a7e435b6e1ceb29..8e7fa5ab4bcb31efa6fa973f5ed601bb165b09fc 100644 --- a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java +++ b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java @@ -2038,7 +2038,6 @@ public abstract class BaseTest { .prefix(ONTOLOGY_1_PREFIX) .uri(ONTOLOGY_1_URI) .sparqlEndpoint(ONTOLOGY_1_SPARQL_ENDPOINT) - .createdBy(ONTOLOGY_1_CREATED_BY) .build(); public final static OntologyCreateDto ONTOLOGY_1_CREATE_DTO = OntologyCreateDto.builder() @@ -2064,7 +2063,6 @@ public abstract class BaseTest { .prefix(ONTOLOGY_2_PREFIX) .uri(ONTOLOGY_2_URI) .sparqlEndpoint(ONTOLOGY_2_SPARQL_ENDPOINT) - .createdBy(ONTOLOGY_2_CREATED_BY) .build(); public final static OntologyCreateDto ONTOLOGY_2_CREATE_DTO = OntologyCreateDto.builder() @@ -2084,7 +2082,6 @@ public abstract class BaseTest { .prefix(ONTOLOGY_3_PREFIX) .uri(ONTOLOGY_3_URI) .sparqlEndpoint(ONTOLOGY_3_SPARQL_ENDPOINT) - .createdBy(ONTOLOGY_3_CREATED_BY) .build(); public final static OntologyCreateDto ONTOLOGY_3_CREATE_DTO = OntologyCreateDto.builder() @@ -2104,7 +2101,6 @@ public abstract class BaseTest { .prefix(ONTOLOGY_4_PREFIX) .uri(ONTOLOGY_4_URI) .sparqlEndpoint(ONTOLOGY_4_SPARQL_ENDPOINT) - .createdBy(ONTOLOGY_4_CREATED_BY) .build(); public final static OntologyCreateDto ONTOLOGY_4_CREATE_DTO = OntologyCreateDto.builder() @@ -2124,7 +2120,6 @@ public abstract class BaseTest { .prefix(ONTOLOGY_5_PREFIX) .uri(ONTOLOGY_5_URI) .sparqlEndpoint(ONTOLOGY_5_SPARQL_ENDPOINT) - .createdBy(ONTOLOGY_5_CREATED_BY) .build(); public final static OntologyCreateDto ONTOLOGY_5_CREATE_DTO = OntologyCreateDto.builder()