From a53396e38a5b87e718e59479619956d8327b8ee9 Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Thu, 4 Jan 2024 13:19:00 +0200 Subject: [PATCH] remove content --- .../main/java/eu/eudat/data/old/Content.java | 153 ------------------ .../eudat/data/dao/entities/ContentDao.java | 12 -- .../data/dao/entities/ContentDaoImpl.java | 56 ------- .../logic/builders/entity/ContentBuilder.java | 90 ----------- .../operations/DatabaseRepository.java | 1 - .../operations/DatabaseRepositoryImpl.java | 11 -- 6 files changed, 323 deletions(-) delete mode 100644 dmp-backend/core/src/main/java/eu/eudat/data/old/Content.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ContentDao.java delete mode 100644 dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ContentDaoImpl.java delete mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/ContentBuilder.java diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/old/Content.java b/dmp-backend/core/src/main/java/eu/eudat/data/old/Content.java deleted file mode 100644 index 2528a14df..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/data/old/Content.java +++ /dev/null @@ -1,153 +0,0 @@ -package eu.eudat.data.old; - -import eu.eudat.data.old.helpers.EntityBinder; -import eu.eudat.data.old.queryableentity.DataEntity; - -import jakarta.persistence.*; -import java.util.List; -import java.util.UUID; - -/** - * Created by ikalyvas on 3/15/2018. - */ -@Entity -@Table(name = "\"Content\"") -public class Content implements DataEntity { //IGNORE ME - - public enum ParentType { - GRANT(0); - - private int value; - - private ParentType(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - - public static ParentType fromInteger(int value) { - switch (value) { - case 0: - return GRANT; - default: - throw new RuntimeException("Unsupported Content Parent Type Status"); - } - } - } - - public enum LocationType { - EXTERNAL(0), INTERNAL(1); - - private Integer value; - - private LocationType(Integer value) { - this.value = value; - } - - public Integer getValue() { - return value; - } - - public static LocationType fromInteger(int value) { - switch (value) { - case 0: - return EXTERNAL; - case 1: - return INTERNAL; - default: - throw new RuntimeException("Unsupported Content Location Type"); - } - } - } - - @Id - @GeneratedValue - @Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)") - private UUID id; - - @Column(name = "\"Filename\"", nullable = false) - private String label; - - @Column(name = "\"Extension\"", nullable = false) - private String extension; - - @Column(name = "\"ParentType\"", nullable = false) - private Integer parentType; - - @Column(name = "\"Uri\"", nullable = false) - private String uri; - - @Column(name = "\"LocationType\"", nullable = false) - private Integer locationType; - - public UUID getId() { - return id; - } - - public void setId(UUID id) { - this.id = id; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public String getExtension() { - return extension; - } - - public void setExtension(String extension) { - this.extension = extension; - } - - public Integer getParentType() { - return parentType; - } - - public void setParentType(Integer parentType) { - this.parentType = parentType; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public Integer getLocationType() { - return locationType; - } - - public void setLocationType(Integer locationType) { - this.locationType = locationType; - } - - @Override - public void update(Content entity) { - this.extension = entity.getExtension(); - this.label = entity.getLabel(); - this.locationType = entity.getLocationType(); - this.parentType = entity.getParentType(); - this.uri = entity.getUri(); - } - - @Override - public UUID getKeys() { - return this.id; - } - - @Override - public Content buildFromTuple(List tuple, List fields, String base) { - String currentBase = base.isEmpty() ? "" : base + "."; - if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id"); - return this; - } -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ContentDao.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ContentDao.java deleted file mode 100644 index abebdbfa2..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ContentDao.java +++ /dev/null @@ -1,12 +0,0 @@ -package eu.eudat.data.dao.entities; - -import eu.eudat.data.dao.DatabaseAccessLayer; -import eu.eudat.data.old.Content; - -import java.util.UUID; - -/** - * Created by ikalyvas on 3/16/2018. - */ -public interface ContentDao extends DatabaseAccessLayer { -} diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ContentDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ContentDaoImpl.java deleted file mode 100644 index da2a892dc..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ContentDaoImpl.java +++ /dev/null @@ -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.Content; -import eu.eudat.queryable.QueryableList; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; - -import javax.management.InvalidApplicationException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -/** - * Created by ikalyvas on 3/16/2018. - */ -@Service("contentDao") -public class ContentDaoImpl extends DatabaseAccess implements ContentDao { - - @Autowired - public ContentDaoImpl(DatabaseService databaseService) { - super(databaseService); - } - - @Override - public Content createOrUpdate(Content item) { - return this.getDatabaseService().createOrUpdate(item, Content.class); - } - - @Override - @Async - public CompletableFuture createOrUpdateAsync(Content item) { - return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item)); - } - - @Override - public Content find(UUID id) throws InvalidApplicationException { - return this.getDatabaseService().getQueryable(Content.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle(); - } - - @Override - public Content find(UUID id, String hint) { - throw new UnsupportedOperationException(); - } - - @Override - public void delete(Content item) { - this.getDatabaseService().delete(item); - } - - @Override - public QueryableList asQueryable() { - return this.getDatabaseService().getQueryable(Content.class); - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/ContentBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/ContentBuilder.java deleted file mode 100644 index 6e180e6dd..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/builders/entity/ContentBuilder.java +++ /dev/null @@ -1,90 +0,0 @@ -package eu.eudat.logic.builders.entity; - -import eu.eudat.logic.builders.Builder; -import eu.eudat.data.old.Content; - -import java.util.UUID; - -/** - * Created by ikalyvas on 3/16/2018. - */ -public class ContentBuilder extends Builder { - - private UUID id; - - private String label; - - private String extension; - - private Integer parentType; - - private String uri; - - private Integer locationType; - - public UUID getId() { - return id; - } - - public ContentBuilder id(UUID id) { - this.id = id; - return this; - } - - public String getLabel() { - return label; - } - - public ContentBuilder label(String label) { - this.label = label; - return this; - } - - public String getExtension() { - return extension; - } - - public ContentBuilder extension(String extension) { - this.extension = extension; - return this; - } - - public Integer getParentType() { - return parentType; - } - - public ContentBuilder parentType(Integer parentType) { - this.parentType = parentType; - return this; - } - - public String getUri() { - return uri; - } - - public ContentBuilder uri(String uri) { - this.uri = uri; - return this; - } - - public Integer getLocationType() { - return locationType; - } - - public ContentBuilder locationType(Integer locationType) { - this.locationType = locationType; - return this; - } - - @Override - public Content build() { - Content content = new Content(); - content.setExtension(extension); - content.setId(id); - content.setLabel(label); - content.setParentType(parentType); - content.setLocationType(locationType); - content.setUri(uri); - return content; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepository.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepository.java index fbd6008d8..dc64509a5 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepository.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepository.java @@ -14,7 +14,6 @@ public interface DatabaseRepository { InvitationDao getInvitationDao(); - ContentDao getContentDao(); EmailConfirmationDao getLoginConfirmationEmailDao(); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepositoryImpl.java b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepositoryImpl.java index ac8f32eff..491d70de5 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepositoryImpl.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/services/operations/DatabaseRepositoryImpl.java @@ -17,7 +17,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository { private InvitationDao invitationDao; - private ContentDao contentDao; private EmailConfirmationDao loginConfirmationEmailDao; @@ -75,16 +74,6 @@ public class DatabaseRepositoryImpl implements DatabaseRepository { this.entityManager = entityManager; } - @Override - public ContentDao getContentDao() { - return this.contentDao; - } - - @Autowired - public void setContentDao(ContentDao contentDao) { - this.contentDao = contentDao; - } - @Override public EmailConfirmationDao getLoginConfirmationEmailDao() { return loginConfirmationEmailDao;