Skip to content
Snippets Groups Projects
Unverified Commit 01bb47e8 authored by Martin Weise's avatar Martin Weise
Browse files

WIP

- frontend still missing unique column constraints form
parent d6b21042
No related branches found
No related tags found
2 merge requests!163Relase 1.3.0,!155Added readme to authentication service and added eureka service
Showing
with 119 additions and 33 deletions
...@@ -46,6 +46,25 @@ build-docker: ...@@ -46,6 +46,25 @@ build-docker:
docker compose build dbrepo-metadata-db docker compose build dbrepo-metadata-db
docker compose build --parallel docker compose build --parallel
build-docker-slow:
docker compose build dbrepo-analyse-service
docker compose build dbrepo-authentication-service
docker compose build dbrepo-broker-service
docker compose build dbrepo-metadata-db
docker compose build dbrepo-container-service
docker compose build dbrepo-database-service
docker compose build dbrepo-discovery-service
docker compose build dbrepo-gateway-service
docker compose build dbrepo-identifier-service
docker compose build dbrepo-metadata-service
docker compose build dbrepo-proxy
docker compose build dbrepo-query-service
docker compose build dbrepo-search-service
docker compose build dbrepo-semantics-service
docker compose build dbrepo-table-service
docker compose build dbrepo-ui
docker compose build dbrepo-user-service
build-frontend: build-frontend:
yarn --cwd ./dbrepo-ui install --legacy-peer-deps yarn --cwd ./dbrepo-ui install --legacy-peer-deps
yarn --cwd ./dbrepo-ui run build yarn --cwd ./dbrepo-ui run build
......
...@@ -245,7 +245,7 @@ public class ContainerEndpoint { ...@@ -245,7 +245,7 @@ public class ContainerEndpoint {
}) })
public ResponseEntity<?> delete(@NotNull @PathVariable("id") Long containerId, public ResponseEntity<?> delete(@NotNull @PathVariable("id") Long containerId,
@NotNull Principal principal) throws ContainerNotFoundException, @NotNull Principal principal) throws ContainerNotFoundException,
ContainerStillRunningException, ContainerAlreadyRemovedException, DockerClientException { ContainerStillRunningException, ContainerAlreadyRemovedException {
log.debug("endpoint delete container, containerId={}, principal={}", containerId, principal); log.debug("endpoint delete container, containerId={}, principal={}", containerId, principal);
containerService.remove(containerId); containerService.remove(containerId);
return ResponseEntity.accepted() return ResponseEntity.accepted()
......
...@@ -99,8 +99,8 @@ public class ContainerServiceImpl implements ContainerService { ...@@ -99,8 +99,8 @@ public class ContainerServiceImpl implements ContainerService {
response.getName() + ":/var/lib/mysql", availableTcpPort + ":" + image.get().getDefaultPort()); response.getName() + ":/var/lib/mysql", availableTcpPort + ":" + image.get().getDefaultPort());
log.trace("host config {}", hostConfig); log.trace("host config {}", hostConfig);
final User user = userService.findByUsername(principal.getName()); final User user = userService.findByUsername(principal.getName());
container.setCreator(user); container.setCreatedBy(user.getId());
container.setOwner(user); container.setOwnedBy(user.getId());
/* create the container */ /* create the container */
final CreateContainerResponse response1; final CreateContainerResponse response1;
try { try {
......
...@@ -148,7 +148,7 @@ public class DatabaseEndpoint { ...@@ -148,7 +148,7 @@ public class DatabaseEndpoint {
principal); principal);
final Container container = containerService.find(containerId); final Container container = containerService.find(containerId);
final User user = userService.findByUsername(principal.getName()); final User user = userService.findByUsername(principal.getName());
if (!container.getOwner().getId().equals(user.getId())) { if (!container.getOwner().equals(user)) {
log.error("Failed to create database: not owner"); log.error("Failed to create database: not owner");
throw new NotAllowedException(("Failed to create database: not owner")); throw new NotAllowedException(("Failed to create database: not owner"));
} }
...@@ -195,7 +195,7 @@ public class DatabaseEndpoint { ...@@ -195,7 +195,7 @@ public class DatabaseEndpoint {
databaseId, data, principal); databaseId, data, principal);
final Database database = databaseService.findById(containerId, databaseId); final Database database = databaseService.findById(containerId, databaseId);
final User user = userService.findByUsername(principal.getName()); final User user = userService.findByUsername(principal.getName());
if (!database.getOwner().getId().equals(user.getId())) { if (!database.getOwner().equals(user)) {
log.error("Failed to create database: not owner"); log.error("Failed to create database: not owner");
throw new NotAllowedException(("Failed to create database: not owner")); throw new NotAllowedException(("Failed to create database: not owner"));
} }
...@@ -236,7 +236,7 @@ public class DatabaseEndpoint { ...@@ -236,7 +236,7 @@ public class DatabaseEndpoint {
databaseId, transferDto, principal); databaseId, transferDto, principal);
final Database database = databaseService.findById(containerId, databaseId); final Database database = databaseService.findById(containerId, databaseId);
final User user = userService.findByUsername(principal.getName()); final User user = userService.findByUsername(principal.getName());
if (!database.getOwner().getId().equals(user.getId())) { if (!database.getOwner().equals(user)) {
log.error("Failed to create database: not owner"); log.error("Failed to create database: not owner");
throw new NotAllowedException(("Failed to create database: not owner")); throw new NotAllowedException(("Failed to create database: not owner"));
} }
...@@ -274,7 +274,7 @@ public class DatabaseEndpoint { ...@@ -274,7 +274,7 @@ public class DatabaseEndpoint {
log.debug("endpoint find database, containerId={}, databaseId={}", containerId, databaseId); log.debug("endpoint find database, containerId={}, databaseId={}", containerId, databaseId);
final Database database = databaseService.findById(containerId, databaseId); final Database database = databaseService.findById(containerId, databaseId);
final DatabaseDto dto = databaseMapper.databaseToDatabaseDto(database); final DatabaseDto dto = databaseMapper.databaseToDatabaseDto(database);
if (principal != null && database.getOwner().getUsername().equals(principal.getName())) { if (principal != null && database.getOwner().equals(principal)) {
/* only owner sees the access rights */ // TODO improve this by proper mapping /* only owner sees the access rights */ // TODO improve this by proper mapping
final List<DatabaseAccess> accesses = accessService.list(databaseId); final List<DatabaseAccess> accesses = accessService.list(databaseId);
dto.setAccesses(accesses.stream() dto.setAccesses(accesses.stream()
......
...@@ -5,7 +5,6 @@ import at.tuwien.api.identifier.IdentifierDto; ...@@ -5,7 +5,6 @@ import at.tuwien.api.identifier.IdentifierDto;
import at.tuwien.entities.identifier.Identifier; import at.tuwien.entities.identifier.Identifier;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(componentModel = "spring")
public interface IdentifierMapper { public interface IdentifierMapper {
......
...@@ -133,8 +133,9 @@ public class MariaDbServiceImpl extends HibernateConnector implements DatabaseSe ...@@ -133,8 +133,9 @@ public class MariaDbServiceImpl extends HibernateConnector implements DatabaseSe
database.setId(containerId); database.setId(containerId);
database.setContainer(container); database.setContainer(container);
final User owner = userService.findByUsername(principal.getName()); final User owner = userService.findByUsername(principal.getName());
database.setCreator(owner); database.setOwnedBy(owner.getId());
database.setOwner(owner); database.setCreatedBy(owner.getId());
database.setContactPerson(owner.getId());
database.setExchangeName("dbrepo." + database.getInternalName()); database.setExchangeName("dbrepo." + database.getInternalName());
final ComboPooledDataSource dataSource = getDataSource(container.getImage(), container, root); final ComboPooledDataSource dataSource = getDataSource(container.getImage(), container, root);
try { try {
...@@ -185,7 +186,7 @@ public class MariaDbServiceImpl extends HibernateConnector implements DatabaseSe ...@@ -185,7 +186,7 @@ public class MariaDbServiceImpl extends HibernateConnector implements DatabaseSe
final Database entity = findById(containerId, databaseId); final Database entity = findById(containerId, databaseId);
final User user = userService.findByUsername(transferDto.getUsername()); final User user = userService.findByUsername(transferDto.getUsername());
/* update in metadata database */ /* update in metadata database */
entity.setOwner(user); entity.setOwnedBy(user.getId());
databaseIdxRepository.save(databaseMapper.databaseToDatabaseDto(entity)); databaseIdxRepository.save(databaseMapper.databaseToDatabaseDto(entity));
log.info("Updated database in elastic search with id {}", entity.getId()); log.info("Updated database in elastic search with id {}", entity.getId());
return entity; return entity;
......
...@@ -174,7 +174,7 @@ public class IdentifierEndpoint { ...@@ -174,7 +174,7 @@ public class IdentifierEndpoint {
}) })
public ResponseEntity<IdentifierDto> update(@NotNull @PathVariable("id") Long id, public ResponseEntity<IdentifierDto> update(@NotNull @PathVariable("id") Long id,
@NotNull @Valid @RequestBody IdentifierDto data) @NotNull @Valid @RequestBody IdentifierDto data)
throws IdentifierPublishingNotAllowedException, IdentifierNotFoundException, IdentifierRequestException { throws IdentifierNotFoundException, IdentifierRequestException {
log.debug("endpoint update identifier, id={}, data={}", id, data); log.debug("endpoint update identifier, id={}, data={}", id, data);
final Identifier identifier = identifierService.update(id, data); final Identifier identifier = identifierService.update(id, data);
return ResponseEntity.accepted() return ResponseEntity.accepted()
......
...@@ -116,7 +116,7 @@ public class IdentifierServiceImpl implements IdentifierService { ...@@ -116,7 +116,7 @@ public class IdentifierServiceImpl implements IdentifierService {
tmp.setContainerId(data.getCid()); tmp.setContainerId(data.getCid());
tmp.setDatabaseId(data.getDbid()); tmp.setDatabaseId(data.getDbid());
final User creator = userService.findByUsername(principal.getName()); final User creator = userService.findByUsername(principal.getName());
tmp.setCreator(creator); tmp.setCreatedBy(creator.getId());
tmp.setCreators(List.of()); tmp.setCreators(List.of());
if (data.getType().equals(IdentifierTypeDto.SUBSET)) { if (data.getType().equals(IdentifierTypeDto.SUBSET)) {
log.debug("identifier describes a subset"); log.debug("identifier describes a subset");
...@@ -136,7 +136,7 @@ public class IdentifierServiceImpl implements IdentifierService { ...@@ -136,7 +136,7 @@ public class IdentifierServiceImpl implements IdentifierService {
.map(c -> { .map(c -> {
final Creator creatorDto = identifierMapper.creatorCreateDtoToCreator(c); final Creator creatorDto = identifierMapper.creatorCreateDtoToCreator(c);
creatorDto.setPid(entity.getId()); creatorDto.setPid(entity.getId());
creatorDto.setCreator(creator); creatorDto.setCreatedBy(creator.getId());
return creatorDto; return creatorDto;
}) })
.collect(Collectors.toList())); .collect(Collectors.toList()));
...@@ -146,7 +146,7 @@ public class IdentifierServiceImpl implements IdentifierService { ...@@ -146,7 +146,7 @@ public class IdentifierServiceImpl implements IdentifierService {
.forEach(r -> { .forEach(r -> {
final RelatedIdentifier id = identifierMapper.relatedIdentifierCreateDtoToRelatedIdentifier(r); final RelatedIdentifier id = identifierMapper.relatedIdentifierCreateDtoToRelatedIdentifier(r);
id.setIid(entity.getId()); id.setIid(entity.getId());
id.setCreator(creator); id.setCreatedBy(creator.getId());
final RelatedIdentifier relatedIdentifier = relatedIdentifierRepository.save(id); final RelatedIdentifier relatedIdentifier = relatedIdentifierRepository.save(id);
log.debug("identifier add related with id {}", relatedIdentifier.getId()); log.debug("identifier add related with id {}", relatedIdentifier.getId());
entity.getRelated().add(relatedIdentifier); entity.getRelated().add(relatedIdentifier);
......
...@@ -10,6 +10,7 @@ import lombok.*; ...@@ -10,6 +10,7 @@ import lombok.*;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.time.Instant; import java.time.Instant;
import java.util.UUID;
@Getter @Getter
@Setter @Setter
...@@ -52,7 +53,7 @@ public class ViewBriefDto { ...@@ -52,7 +53,7 @@ public class ViewBriefDto {
private Instant created; private Instant created;
@JsonIgnore @JsonIgnore
private String createdBy; private UUID createdBy;
@NotNull @NotNull
private UserDto creator; private UserDto creator;
......
...@@ -11,6 +11,7 @@ import org.springframework.data.elasticsearch.annotations.Document; ...@@ -11,6 +11,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.time.Instant; import java.time.Instant;
import java.util.UUID;
@Getter @Getter
@Setter @Setter
...@@ -57,7 +58,7 @@ public class ViewDto { ...@@ -57,7 +58,7 @@ public class ViewDto {
private Instant created; private Instant created;
@JsonIgnore @JsonIgnore
private String createdBy; private UUID createdBy;
@NotNull @NotNull
private UserDto creator; private UserDto creator;
......
...@@ -13,6 +13,7 @@ import lombok.*; ...@@ -13,6 +13,7 @@ import lombok.*;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.time.Instant; import java.time.Instant;
import java.util.UUID;
@Getter @Getter
...@@ -35,7 +36,7 @@ public class QueryBriefDto { ...@@ -35,7 +36,7 @@ public class QueryBriefDto {
@JsonIgnore @JsonIgnore
@NotNull(message = "created by is required") @NotNull(message = "created by is required")
private String createdBy; private UUID createdBy;
@NotNull(message = "creator is required") @NotNull(message = "creator is required")
private UserDto creator; private UserDto creator;
......
...@@ -5,15 +5,13 @@ import at.tuwien.api.user.UserDto; ...@@ -5,15 +5,13 @@ import at.tuwien.api.user.UserDto;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.time.Instant; import java.time.Instant;
import java.util.UUID;
@Getter @Getter
...@@ -37,7 +35,7 @@ public class QueryDto { ...@@ -37,7 +35,7 @@ public class QueryDto {
@JsonIgnore @JsonIgnore
@EqualsAndHashCode.Exclude @EqualsAndHashCode.Exclude
@NotNull(message = "created by is required") @NotNull(message = "created by is required")
private String createdBy; private UUID createdBy;
@NotNull(message = "creator is required") @NotNull(message = "creator is required")
private UserDto creator; private UserDto creator;
......
...@@ -6,12 +6,14 @@ import at.tuwien.entities.user.User; ...@@ -6,12 +6,14 @@ import at.tuwien.entities.user.User;
import com.github.dockerjava.api.model.HealthCheck; import com.github.dockerjava.api.model.HealthCheck;
import lombok.*; import lombok.*;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.time.Instant; import java.time.Instant;
import java.util.UUID;
@Data @Data
@Entity @Entity
...@@ -31,15 +33,25 @@ public class Container { ...@@ -31,15 +33,25 @@ public class Container {
@Column(updatable = false, nullable = false) @Column(updatable = false, nullable = false)
private Long id; private Long id;
@ToString.Exclude
@Column(name = "createdBy", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID createdBy;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "createdBy", referencedColumnName = "ID") @JoinColumn(name = "createdBy", referencedColumnName = "ID", insertable = false, updatable = false)
}) })
private User creator; private User creator;
@ToString.Exclude
@Column(name = "ownedBy", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID ownedBy;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "ownedBy", referencedColumnName = "ID") @JoinColumn(name = "ownedBy", referencedColumnName = "ID", insertable = false, updatable = false)
}) })
private User owner; private User owner;
......
...@@ -16,6 +16,7 @@ import javax.persistence.Entity; ...@@ -16,6 +16,7 @@ import javax.persistence.Entity;
import java.io.Serializable; import java.io.Serializable;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.UUID;
@Data @Data
@Entity @Entity
...@@ -34,15 +35,26 @@ public class Database implements Serializable { ...@@ -34,15 +35,26 @@ public class Database implements Serializable {
@Column(updatable = false, nullable = false) @Column(updatable = false, nullable = false)
private Long id; private Long id;
@ToString.Exclude
@Column(name = "created_by", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID createdBy;
@Type(type = "uuid-char")
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "created_by", referencedColumnName = "ID") @JoinColumn(name = "created_by", referencedColumnName = "ID", insertable = false, updatable = false)
}) })
private User creator; private User creator;
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @ToString.Exclude
@Column(name = "owned_by", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID ownedBy;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "owned_by", referencedColumnName = "ID") @JoinColumn(name = "owned_by", referencedColumnName = "ID", insertable = false, updatable = false)
}) })
private User owner; private User owner;
...@@ -66,9 +78,15 @@ public class Database implements Serializable { ...@@ -66,9 +78,15 @@ public class Database implements Serializable {
@Column(columnDefinition = "TEXT") @Column(columnDefinition = "TEXT")
private String description; private String description;
@ToString.Exclude
@Column(name = "contact_person", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID contactPerson;
@Type(type = "uuid-char")
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "contact_person", referencedColumnName = "ID") @JoinColumn(name = "contact_person", referencedColumnName = "ID", updatable = false, insertable = false)
}) })
private User contact; private User contact;
......
...@@ -2,6 +2,7 @@ package at.tuwien.entities.database; ...@@ -2,6 +2,7 @@ package at.tuwien.entities.database;
import at.tuwien.entities.user.User; import at.tuwien.entities.user.User;
import lombok.*; import lombok.*;
import org.hibernate.annotations.Type;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
...@@ -21,6 +22,7 @@ import java.util.UUID; ...@@ -21,6 +22,7 @@ import java.util.UUID;
public class DatabaseAccess { public class DatabaseAccess {
@Id @Id
@Type(type = "uuid-char")
@EqualsAndHashCode.Include @EqualsAndHashCode.Include
@Column(name = "user_id", updatable = false, columnDefinition = "VARCHAR(36)") @Column(name = "user_id", updatable = false, columnDefinition = "VARCHAR(36)")
private UUID huserid; private UUID huserid;
......
...@@ -5,6 +5,7 @@ import at.tuwien.entities.user.User; ...@@ -5,6 +5,7 @@ import at.tuwien.entities.user.User;
import lombok.*; import lombok.*;
import net.sf.jsqlparser.statement.select.FromItem; import net.sf.jsqlparser.statement.select.FromItem;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
...@@ -13,6 +14,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; ...@@ -13,6 +14,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.UUID;
@Data @Data
@Entity @Entity
...@@ -40,9 +42,14 @@ public class View { ...@@ -40,9 +42,14 @@ public class View {
@EqualsAndHashCode.Include @EqualsAndHashCode.Include
private Long vdbid; private Long vdbid;
@ToString.Exclude
@Column(name = "createdBy", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID createdBy;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "createdBy", referencedColumnName = "ID") @JoinColumn(name = "createdBy", referencedColumnName = "ID", insertable = false, updatable = false)
}) })
private User creator; private User creator;
......
...@@ -7,6 +7,7 @@ import at.tuwien.entities.user.User; ...@@ -7,6 +7,7 @@ import at.tuwien.entities.user.User;
import lombok.*; import lombok.*;
import net.sf.jsqlparser.statement.select.FromItem; import net.sf.jsqlparser.statement.select.FromItem;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
...@@ -41,9 +42,14 @@ public class Table { ...@@ -41,9 +42,14 @@ public class Table {
@EqualsAndHashCode.Include @EqualsAndHashCode.Include
private Long tdbid; private Long tdbid;
@ToString.Exclude
@Column(name = "createdBy", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID createdBy;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "createdBy", referencedColumnName = "ID", columnDefinition = "VARCHAR(36)") @JoinColumn(name = "createdBy", referencedColumnName = "ID", updatable = false, insertable = false)
}) })
private User creator; private User creator;
......
...@@ -6,6 +6,7 @@ import at.tuwien.entities.user.User; ...@@ -6,6 +6,7 @@ import at.tuwien.entities.user.User;
import lombok.*; import lombok.*;
import net.sf.jsqlparser.statement.select.SelectItem; import net.sf.jsqlparser.statement.select.SelectItem;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
...@@ -13,6 +14,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; ...@@ -13,6 +14,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.UUID;
@Data @Data
@Entity @Entity
...@@ -58,9 +60,14 @@ public class TableColumn implements Comparable<TableColumn> { ...@@ -58,9 +60,14 @@ public class TableColumn implements Comparable<TableColumn> {
}) })
private Table table; private Table table;
@ToString.Exclude
@Column(name = "createdBy", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID createdBy;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "createdBy", referencedColumnName = "ID") @JoinColumn(name = "createdBy", referencedColumnName = "ID", insertable = false, updatable = false)
}) })
private User creator; private User creator;
......
...@@ -3,12 +3,14 @@ package at.tuwien.entities.identifier; ...@@ -3,12 +3,14 @@ package at.tuwien.entities.identifier;
import at.tuwien.entities.user.User; import at.tuwien.entities.user.User;
import lombok.*; import lombok.*;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.time.Instant; import java.time.Instant;
import java.util.UUID;
@Data @Data
@Entity @Entity
...@@ -54,9 +56,14 @@ public class Creator { ...@@ -54,9 +56,14 @@ public class Creator {
@CreatedDate @CreatedDate
private Instant created; private Instant created;
@ToString.Exclude
@Column(name = "createdBy", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID createdBy;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "createdBy", referencedColumnName = "ID") @JoinColumn(name = "createdBy", referencedColumnName = "ID", insertable = false, updatable = false)
}) })
private User creator; private User creator;
......
...@@ -6,6 +6,7 @@ import at.tuwien.entities.database.License; ...@@ -6,6 +6,7 @@ import at.tuwien.entities.database.License;
import at.tuwien.entities.user.User; import at.tuwien.entities.user.User;
import lombok.*; import lombok.*;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
...@@ -15,6 +16,7 @@ import javax.validation.constraints.NotBlank; ...@@ -15,6 +16,7 @@ import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.UUID;
@Data @Data
@Entity @Entity
...@@ -44,9 +46,14 @@ public class Identifier implements Serializable { ...@@ -44,9 +46,14 @@ public class Identifier implements Serializable {
@Column(name = "qid") @Column(name = "qid")
private Long queryId; private Long queryId;
@ToString.Exclude
@Column(name = "createdBy", nullable = false, columnDefinition = "VARCHAR(36)")
@Type(type = "uuid-char")
private UUID createdBy;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE) @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
@JoinColumns({ @JoinColumns({
@JoinColumn(name = "createdBy", referencedColumnName = "ID") @JoinColumn(name = "createdBy", referencedColumnName = "ID", insertable = false, updatable = false)
}) })
private User creator; private User creator;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment