add tenant to tables

This commit is contained in:
amentis 2023-12-06 14:21:25 +02:00
parent 85bd0de2d5
commit 908c530922
23 changed files with 46 additions and 24 deletions

View File

@ -8,6 +8,7 @@ import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.old.helpers.EntityBinder;
import eu.eudat.data.old.queryableentity.DataEntity;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -16,7 +17,7 @@ import java.util.*;
@Entity
@Table(name = "\"Description\"")
public class DescriptionEntity implements DataEntity<DescriptionEntity, UUID> {
public class DescriptionEntity extends TenantScopedBaseEntity implements DataEntity<DescriptionEntity, UUID> {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -2,6 +2,7 @@ package eu.eudat.data;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -9,7 +10,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"DescriptionReference\"")
public class DescriptionReferenceEntity {
public class DescriptionReferenceEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")

View File

@ -2,6 +2,7 @@ package eu.eudat.data;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -9,7 +10,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"DescriptionTag\"")
public class DescriptionTagEntity {
public class DescriptionTagEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")

View File

@ -7,6 +7,7 @@ import eu.eudat.data.converters.enums.DescriptionTemplateStatusConverter;
import eu.eudat.data.converters.enums.DescriptionTemplateVersionStatusConverter;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.old.queryableentity.DataEntity;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import eu.eudat.data.types.SQLXMLType;
import jakarta.persistence.*;
import org.hibernate.annotations.Type;
@ -17,7 +18,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"DescriptionTemplate\"")
public class DescriptionTemplateEntity implements DataEntity<DescriptionTemplateEntity,UUID>{
public class DescriptionTemplateEntity extends TenantScopedBaseEntity implements DataEntity<DescriptionTemplateEntity,UUID>{
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
private UUID id;

View File

@ -4,6 +4,7 @@ import eu.eudat.commons.enums.DescriptionTemplateTypeStatus;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.DescriptionTemplateTypeStatusConverter;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -11,7 +12,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"DescriptionTemplateType\"")
public class DescriptionTemplateTypeEntity {
public class DescriptionTemplateTypeEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -4,6 +4,7 @@ import eu.eudat.commons.enums.DmpBlueprintStatus;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.DmpBlueprintStatusConverter;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -11,7 +12,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"DmpBlueprint\"")
public class DmpBlueprintEntity {
public class DmpBlueprintEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
private UUID id;

View File

@ -2,6 +2,7 @@ package eu.eudat.data;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -9,7 +10,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"DmpDescriptionTemplate\"")
public class DmpDescriptionTemplateEntity {
public class DmpDescriptionTemplateEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")

View File

@ -9,6 +9,7 @@ import eu.eudat.data.converters.enums.DmpStatusConverter;
import eu.eudat.data.converters.enums.DmpVersionStatusConverter;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.old.queryableentity.DataEntity;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -17,7 +18,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"Dmp\"")
public class DmpEntity implements DataEntity<DmpEntity, UUID> {
public class DmpEntity extends TenantScopedBaseEntity implements DataEntity<DmpEntity, UUID> {
@Id
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")

View File

@ -2,6 +2,7 @@ package eu.eudat.data;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -9,7 +10,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"DmpReference\"")
public class DmpReferenceEntity {
public class DmpReferenceEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -4,6 +4,7 @@ import eu.eudat.commons.enums.DmpUserRole;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.DmpUserRoleConverter;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -11,7 +12,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"DmpUser\"")
public class DmpUserEntity {
public class DmpUserEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")

View File

@ -4,6 +4,7 @@ import eu.eudat.commons.enums.EntityType;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.EntityTypeConverter;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -11,7 +12,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"EntityDoi\"")
public class EntityDoiEntity {
public class EntityDoiEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")

View File

@ -2,6 +2,7 @@ package eu.eudat.data;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -9,7 +10,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"Language\"")
public class LanguageEntity {
public class LanguageEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -6,6 +6,7 @@ import eu.eudat.commons.enums.ReferenceSourceType;
import eu.eudat.data.converters.enums.ReferenceSourceTypeConverter;
import eu.eudat.data.converters.enums.ReferenceTypeConverter;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -13,7 +14,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"Reference\"")
public class ReferenceEntity {
public class ReferenceEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -2,6 +2,7 @@ package eu.eudat.data;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -9,7 +10,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"ReferenceType\"")
public class ReferenceTypeEntity {
public class ReferenceTypeEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -3,6 +3,7 @@ package eu.eudat.data;
import eu.eudat.commons.enums.StorageType;
import eu.eudat.data.converters.enums.StorageTypeConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -10,7 +11,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"StorageFile\"")
public class StorageFileEntity {
public class StorageFileEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -4,6 +4,7 @@ import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.enums.SupportiveMaterialFieldType;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.converters.enums.SupportiveMaterialFieldTypeConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -11,7 +12,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"SupportiveMaterial\"")
public class SupportiveMaterialEntity {
public class SupportiveMaterialEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -2,6 +2,7 @@ package eu.eudat.data;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -9,7 +10,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"Tag\"")
public class TagEntity {
public class TagEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
private UUID id;

View File

@ -2,6 +2,7 @@ package eu.eudat.data;
import eu.eudat.commons.enums.ContactInfoType;
import eu.eudat.data.converters.enums.ContactInfoTypeConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -9,7 +10,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"UserContactInfo\"")
public class UserContactInfoEntity {
public class UserContactInfoEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -1,5 +1,6 @@
package eu.eudat.data;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
@ -10,7 +11,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"UserCredential\"")
public class UserCredentialEntity {
public class UserCredentialEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -4,6 +4,7 @@ import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.enums.UserDescriptionTemplateRole;
import eu.eudat.data.converters.enums.IsActiveConverter;
import eu.eudat.data.converters.enums.UserDescriptionTemplateRoleConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
@ -11,7 +12,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"UserDescriptionTemplate\"")
public class UserDescriptionTemplateEntity {
public class UserDescriptionTemplateEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
private UUID id;

View File

@ -1,5 +1,6 @@
package eu.eudat.data;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
@ -10,7 +11,7 @@ import java.util.UUID;
@Entity
@Table(name = "\"UserRole\"")
public class UserRoleEntity {
public class UserRoleEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
private UUID id;

View File

@ -2,14 +2,15 @@ package eu.eudat.data;
import eu.eudat.commons.enums.UserSettingsType;
import eu.eudat.data.converters.enums.UserSettingsTypeConverter;
import eu.eudat.data.tenant.TenantScopedBaseEntity;
import jakarta.persistence.*;
import java.time.Instant;
import java.util.UUID;
@Entity
@Table(name = "UserSettings")
public class UserSettingsEntity {
@Table(name = "\"UserSettings\"")
public class UserSettingsEntity extends TenantScopedBaseEntity {
@Id
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)

View File

@ -22,7 +22,7 @@ public abstract class TenantScopedBaseEntity implements TenantScoped, Serializab
public static final String tenantFilter = "tenantFilter";
public static final String tenantFilterTenantParam = "tenantId";
@Column(name = "tenant", columnDefinition = "uuid", nullable = false)
@Column(name = "tenant", columnDefinition = "uuid", nullable = true)
private UUID tenantId;
public static final String _tenantId = "tenantId";
public UUID getTenantId() {