description refactor

This commit is contained in:
Efstratios Giannopoulos 2023-11-07 13:11:21 +02:00
parent ac8d36d1d5
commit df5ae4a278
15 changed files with 1 additions and 567 deletions

View File

@ -185,7 +185,7 @@ public class DMP implements DataEntity<DMP, UUID> {
@Convert(converter = DateToUTCConverter.class) @Convert(converter = DateToUTCConverter.class)
private Date publishedAt; private Date publishedAt;
@OneToMany(mappedBy = "entityId", fetch = FetchType.LAZY) @Transient
private Set<EntityDoiEntity> dois; private Set<EntityDoiEntity> dois;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)

View File

@ -36,9 +36,6 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
@Column(name = "\"Definition\"", columnDefinition = "xml") @Column(name = "\"Definition\"", columnDefinition = "xml")
private String definition; private String definition;
@OneToMany(mappedBy = "dataRepository", cascade = CascadeType.ALL, orphanRemoval = true)
private Set<DatasetDataRepository> datasetDataRepositories;
@Column(name = "\"Status\"", nullable = false) @Column(name = "\"Status\"", nullable = false)
private Short status; private Short status;
@ -116,13 +113,6 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,
this.definition = definition; this.definition = definition;
} }
public Set<DatasetDataRepository> getDatasetDataRepositories() {
return datasetDataRepositories;
}
public void setDatasetDataRepositories(Set<DatasetDataRepository> datasetDataRepositories) {
this.datasetDataRepositories = datasetDataRepositories;
}
public UserInfo getCreationUser() { public UserInfo getCreationUser() {
return creationUser; return creationUser;
} }

View File

@ -1,98 +0,0 @@
package eu.eudat.data.old;
import eu.eudat.data.DescriptionEntity;
import eu.eudat.data.old.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
/**
* Created by ikalyvas on 5/22/2018.
*/
@Entity
@Table(name = "\"DatasetDataRepository\"")
public class DatasetDataRepository implements DataEntity<DatasetDataRepository, UUID> {
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@ManyToOne
@JoinColumn(name = "\"Dataset\"", nullable = false)
private DescriptionEntity descriptionEntity;
@ManyToOne
@JoinColumn(name = "\"DataRepository\"", nullable = false)
private DataRepository dataRepository;
@Column(name = "\"Role\"")
private Integer role;
@Column(name = "\"Data\"")
private String data;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public DescriptionEntity getDataset() {
return descriptionEntity;
}
public void setDataset(DescriptionEntity descriptionEntity) {
this.descriptionEntity = descriptionEntity;
}
public DataRepository getDataRepository() {
return dataRepository;
}
public void setDataRepository(DataRepository dataRepository) {
this.dataRepository = dataRepository;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Override
public void update(DatasetDataRepository entity) {
this.descriptionEntity = entity.getDataset();
this.dataRepository = entity.getDataRepository();
this.role = entity.getRole();
}
@Override
public UUID getKeys() {
return this.id;
}
@Override
public DatasetDataRepository buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
String currentBase = base.isEmpty() ? "" : base + ".";
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
return this;
}
}

View File

@ -1,96 +0,0 @@
package eu.eudat.data.old;
import eu.eudat.data.DescriptionEntity;
import eu.eudat.data.old.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
@Entity
@Table(name = "\"DatasetExternalDataset\"")
public class DatasetExternalDataset implements DataEntity<DatasetExternalDataset, UUID> {
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@ManyToOne
@JoinColumn(name = "\"Dataset\"", nullable = false)
private DescriptionEntity descriptionEntity;
@ManyToOne
@JoinColumn(name = "\"ExternalDataset\"", nullable = false)
private ExternalDataset externalDataset;
@Column(name = "\"Role\"")
private Integer role;
@Column(name = "\"Data\"")
private String data;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public DescriptionEntity getDataset() {
return descriptionEntity;
}
public void setDataset(DescriptionEntity descriptionEntity) {
this.descriptionEntity = descriptionEntity;
}
public ExternalDataset getExternalDataset() {
return externalDataset;
}
public void setExternalDataset(ExternalDataset externalDataset) {
this.externalDataset = externalDataset;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Override
public void update(DatasetExternalDataset entity) {
this.descriptionEntity = entity.getDataset();
this.externalDataset = entity.getExternalDataset();
this.role = entity.getRole();
}
@Override
public UUID getKeys() {
return this.id;
}
@Override
public DatasetExternalDataset buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
String currentBase = base.isEmpty() ? "" : base + ".";
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
return this;
}
}

View File

@ -1,75 +0,0 @@
package eu.eudat.data.old;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import jakarta.persistence.*;
import java.io.Serializable;
import java.util.UUID;
@Entity
@Table(name = "\"DatasetRegistry\"")
public class DatasetRegistry {
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
//DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Dataset\"", nullable = false)
private UUID dataset;
//DEPWARN dependency to Hibernate and PostgreSQL
@Column(name = "\"Registry\"", nullable = false)
private UUID registry;
@Column(name = "\"Role\"")
private Integer role;
@Column(name = "\"Data\"")
private String data;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public UUID getDataset() {
return dataset;
}
public void setDataset(UUID dataset) {
this.dataset = dataset;
}
public UUID getRegistry() {
return registry;
}
public void setRegistry(UUID registry) {
this.registry = registry;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}

View File

@ -1,97 +0,0 @@
package eu.eudat.data.old;
import eu.eudat.data.DescriptionEntity;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import jakarta.persistence.*;
import java.util.List;
import java.util.UUID;
@Entity
@Table(name = "\"DatasetService\"")
public class DatasetService implements DataEntity<DatasetService, UUID> {
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@ManyToOne
@JoinColumn(name = "\"Dataset\"", nullable = false)
private DescriptionEntity descriptionEntity;
@ManyToOne
@JoinColumn(name = "\"Service\"", nullable = false)
private Service service;
@Column(name = "\"Role\"")
private Integer role;
@Column(name = "\"Data\"")
private String data;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public DescriptionEntity getDataset() {
return descriptionEntity;
}
public void setDataset(DescriptionEntity descriptionEntity) {
this.descriptionEntity = descriptionEntity;
}
public Service getService() {
return service;
}
public void setService(Service service) {
this.service = service;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Override
public void update(DatasetService entity) {
this.descriptionEntity = entity.getDataset();
this.service = entity.getService();
this.role = entity.getRole();
}
@Override
public UUID getKeys() {
return this.id;
}
@Override
public DatasetService buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
String currentBase = base.isEmpty() ? "" : base + ".";
if(fields.contains(currentBase + "id")) this.id = UUID.fromString((String) tuple.get(0).get(currentBase + "id"));
return this;
}
}

View File

@ -36,9 +36,6 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
@Convert(converter = DateToUTCConverter.class) @Convert(converter = DateToUTCConverter.class)
private Date modified; private Date modified;
@OneToMany(mappedBy = "externalDataset", cascade = CascadeType.ALL, orphanRemoval = true)
private Set<DatasetExternalDataset> datasets;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "\"CreationUser\"", nullable = true) @JoinColumn(name = "\"CreationUser\"", nullable = true)
private UserInfo creationUser; private UserInfo creationUser;
@ -86,13 +83,6 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
this.modified = modified; this.modified = modified;
} }
public Set<DatasetExternalDataset> getDatasets() {
return datasets;
}
public void setDatasets(Set<DatasetExternalDataset> datasets) {
this.datasets = datasets;
}
public UserInfo getCreationUser() { public UserInfo getCreationUser() {
return creationUser; return creationUser;
} }

View File

@ -36,9 +36,6 @@ public class Service implements DataEntity<Service, UUID> {
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false) @Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
private String definition; private String definition;
@OneToMany(mappedBy = "service", cascade = CascadeType.ALL, orphanRemoval = true)
private Set<DatasetService> services;
@Column(name = "\"Status\"", nullable = false) @Column(name = "\"Status\"", nullable = false)
private Short status; private Short status;
@ -118,13 +115,6 @@ public class Service implements DataEntity<Service, UUID> {
this.definition = definition; this.definition = definition;
} }
public Set<DatasetService> getServices() {
return services;
}
public void setServices(Set<DatasetService> services) {
this.services = services;
}
public UserInfo getCreationUser() { public UserInfo getCreationUser() {
return creationUser; return creationUser;
} }

View File

@ -1,13 +0,0 @@
package eu.eudat.data.dao.entities;
import eu.eudat.data.dao.DatabaseAccessLayer;
import eu.eudat.data.old.DatasetExternalDataset;
import java.util.UUID;
/**
* Created by ikalyvas on 5/22/2018.
*/
public interface DatasetExternalDatasetDao extends DatabaseAccessLayer<DatasetExternalDataset, UUID> {
}

View File

@ -1,57 +0,0 @@
package eu.eudat.data.dao.entities;
import eu.eudat.data.dao.DatabaseAccess;
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.old.DatasetExternalDataset;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.management.InvalidApplicationException;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
/**
* Created by ikalyvas on 5/22/2018.
*/
@Component("datasetExternalDatasetDao")
public class DatasetExternalDatasetDaoImpl extends DatabaseAccess<DatasetExternalDataset> implements DatasetExternalDatasetDao {
@Autowired
public DatasetExternalDatasetDaoImpl(DatabaseService<DatasetExternalDataset> databaseService) {
super(databaseService);
}
@Override
public DatasetExternalDataset createOrUpdate(DatasetExternalDataset item) {
return this.getDatabaseService().createOrUpdate(item,DatasetExternalDataset.class);
}
@Override
public CompletableFuture<DatasetExternalDataset> createOrUpdateAsync(DatasetExternalDataset item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
@Async
public DatasetExternalDataset find(UUID id) throws InvalidApplicationException {
return getDatabaseService().getQueryable(DatasetExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public DatasetExternalDataset find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(DatasetExternalDataset item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<DatasetExternalDataset> asQueryable() {
return this.getDatabaseService().getQueryable(DatasetExternalDataset.class);
}
}

View File

@ -1,12 +0,0 @@
package eu.eudat.data.dao.entities;
import eu.eudat.data.dao.DatabaseAccessLayer;
import eu.eudat.data.old.DatasetService;
import java.util.UUID;
/**
* Created by ikalyvas on 5/22/2018.
*/
public interface DatasetServiceDao extends DatabaseAccessLayer<DatasetService, UUID> {
}

View File

@ -1,56 +0,0 @@
package eu.eudat.data.dao.entities;
import eu.eudat.data.dao.DatabaseAccess;
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.old.DatasetService;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.management.InvalidApplicationException;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
/**
* Created by ikalyvas on 5/22/2018.
*/
@Component("datasetServiceDao")
public class DatasetServiceDaoImpl extends DatabaseAccess<DatasetService> implements DatasetServiceDao {
@Autowired
public DatasetServiceDaoImpl(DatabaseService<DatasetService> databaseService) {
super(databaseService);
}
@Override
public DatasetService createOrUpdate(DatasetService item) {
return this.getDatabaseService().createOrUpdate(item, DatasetService.class);
}
@Async
@Override
public CompletableFuture<DatasetService> createOrUpdateAsync(DatasetService item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}
@Override
public DatasetService find(UUID id) throws InvalidApplicationException {
return getDatabaseService().getQueryable(DatasetService.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}
@Override
public DatasetService find(UUID id, String hint) {
throw new UnsupportedOperationException();
}
@Override
public void delete(DatasetService item) {
this.getDatabaseService().delete(item);
}
@Override
public QueryableList<DatasetService> asQueryable() {
return this.getDatabaseService().getQueryable(DatasetService.class);
}
}

View File

@ -41,10 +41,6 @@ public interface DatabaseRepository {
ContentDao getContentDao(); ContentDao getContentDao();
DatasetExternalDatasetDao getDatasetExternalDatasetDao();
DatasetServiceDao getDatasetServiceDao();
EmailConfirmationDao getLoginConfirmationEmailDao(); EmailConfirmationDao getLoginConfirmationEmailDao();
ProjectDao getProjectDao(); ProjectDao getProjectDao();

View File

@ -45,10 +45,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository {
private ContentDao contentDao; private ContentDao contentDao;
private DatasetExternalDatasetDao datasetExternalDatasetDao;
private DatasetServiceDao datasetServiceDao;
private EmailConfirmationDao loginConfirmationEmailDao; private EmailConfirmationDao loginConfirmationEmailDao;
private ProjectDao projectDao; private ProjectDao projectDao;
@ -238,26 +234,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository {
this.contentDao = contentDao; this.contentDao = contentDao;
} }
@Override
public DatasetExternalDatasetDao getDatasetExternalDatasetDao() {
return datasetExternalDatasetDao;
}
@Autowired
public void setDatasetExternalDatasetDao(DatasetExternalDatasetDao datasetExternalDatasetDao) {
this.datasetExternalDatasetDao = datasetExternalDatasetDao;
}
@Override
public DatasetServiceDao getDatasetServiceDao() {
return datasetServiceDao;
}
@Autowired
public void setDatasetServiceDao(DatasetServiceDao datasetServiceDao) {
this.datasetServiceDao = datasetServiceDao;
}
@Override @Override
public EmailConfirmationDao getLoginConfirmationEmailDao() { public EmailConfirmationDao getLoginConfirmationEmailDao() {
return loginConfirmationEmailDao; return loginConfirmationEmailDao;

View File

@ -1,17 +1,13 @@
package eu.eudat.models.data.dataset; package eu.eudat.models.data.dataset;
import eu.eudat.data.DescriptionEntity; import eu.eudat.data.DescriptionEntity;
import eu.eudat.data.old.DatasetDataRepository;
import eu.eudat.data.old.DatasetService;
import eu.eudat.models.DataModel; import eu.eudat.models.DataModel;
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel; import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
import eu.eudat.models.data.dmp.DataManagementPlan; import eu.eudat.models.data.dmp.DataManagementPlan;
import java.util.Date; import java.util.Date;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
public class Dataset implements DataModel<DescriptionEntity, Dataset> { public class Dataset implements DataModel<DescriptionEntity, Dataset> {
private UUID id; private UUID id;