diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/MappingNotFoundException.java b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/MappingNotFoundException.java deleted file mode 100644 index e73a89f5..00000000 --- a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/MappingNotFoundException.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.numcodex.feasibility_gui_backend.terminology; - - -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.ResponseStatus; - -@ResponseStatus(value = HttpStatus.NOT_FOUND) -public class MappingNotFoundException extends RuntimeException { - - public MappingNotFoundException() { - } -} diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCode.java b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCode.java index 66b2a1a1..c5b9a420 100644 --- a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCode.java +++ b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCode.java @@ -20,9 +20,6 @@ public class ContextualizedTermCode { @Column(name = "termcode_id", nullable = false) private int termCodeId; @Basic - @Column(name = "mapping_id", nullable = true) - private Integer mappingId; - @Basic @Column(name = "ui_profile_id", nullable = true) private Integer uiProfileId; } diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCodeRepository.java b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCodeRepository.java index 54331f33..df7a92b7 100644 --- a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCodeRepository.java +++ b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCodeRepository.java @@ -1,14 +1,6 @@ package de.numcodex.feasibility_gui_backend.terminology.persistence; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - -import java.util.List; public interface ContextualizedTermCodeRepository extends JpaRepository { - - @Query("select ct.contextTermcodeHash from CriteriaSet cs inner join ContextualizedTermCodeToCriteriaSet ctctcs on ctctcs.criteriaSetId = cs.id inner join ContextualizedTermCode ct on ctctcs.contextTermcodeHash = ct.contextTermcodeHash where ct.contextTermcodeHash in :contextTermCodeHashList and cs.url = :criteriaSetUrl") - List filterByCriteriaSetUrl(@Param("criteriaSetUrl") String criteriaSetUrl, - @Param("contextTermCodeHashList") List contextTermCodeHashList); } diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCodeToCriteriaSet.java b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCodeToCriteriaSet.java deleted file mode 100644 index ce2edc81..00000000 --- a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/ContextualizedTermCodeToCriteriaSet.java +++ /dev/null @@ -1,20 +0,0 @@ -package de.numcodex.feasibility_gui_backend.terminology.persistence; - -import jakarta.persistence.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Entity -@Table(name = "contextualized_termcode_to_criteria_set", schema = "public") -@Data -@EqualsAndHashCode -public class ContextualizedTermCodeToCriteriaSet { - @Id - @Basic - @Column(name = "context_termcode_hash", nullable = false, length = -1) - private String contextTermcodeHash; - @Id - @Basic - @Column(name = "criteria_set_id", nullable = false) - private int criteriaSetId; -} diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/CriteriaSet.java b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/CriteriaSet.java deleted file mode 100644 index eb9beeb6..00000000 --- a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/CriteriaSet.java +++ /dev/null @@ -1,19 +0,0 @@ -package de.numcodex.feasibility_gui_backend.terminology.persistence; - -import jakarta.persistence.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Entity -@Table(name = "criteria_set", schema = "public") -@Data -@EqualsAndHashCode -public class CriteriaSet { - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id - @Column(name = "id", nullable = false) - private int id; - @Basic - @Column(name = "url", nullable = false, length = -1) - private String url; -} diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/Mapping.java b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/Mapping.java deleted file mode 100644 index ca9c6b12..00000000 --- a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/Mapping.java +++ /dev/null @@ -1,24 +0,0 @@ -package de.numcodex.feasibility_gui_backend.terminology.persistence; - -import jakarta.persistence.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Entity -@Data -@EqualsAndHashCode -public class Mapping { - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id - @Column(name = "id", nullable = false) - private int id; - @Basic - @Column(name = "name", nullable = false, length = -1) - private String name; - @Basic - @Column(name = "type", nullable = false, length = -1) - private String type; - @Basic - @Column(name = "content", columnDefinition = "json", nullable = false) - private String content; -} diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/MappingRepository.java b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/MappingRepository.java deleted file mode 100644 index f73df9ee..00000000 --- a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/persistence/MappingRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package de.numcodex.feasibility_gui_backend.terminology.persistence; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - -import java.util.Optional; - -public interface MappingRepository extends JpaRepository { - - @Query("select m from ContextualizedTermCode ct left join Mapping m on ct.uiProfileId = m.id where ct.contextTermcodeHash = :contextualizedTermcodeHash") - Optional findByContextualizedTermcodeHash(@Param("contextualizedTermcodeHash") String contextualizedTermcodeHash); -} diff --git a/src/main/resources/db/migration/V10__drop_unused_tables.sql b/src/main/resources/db/migration/V10__drop_unused_tables.sql new file mode 100644 index 00000000..d44f921e --- /dev/null +++ b/src/main/resources/db/migration/V10__drop_unused_tables.sql @@ -0,0 +1,7 @@ +DROP INDEX idx_mapping_name_mapping; +ALTER TABLE contextualized_termcode DROP CONSTRAINT mapping_id_fk; +ALTER TABLE contextualized_termcode DROP COLUMN mapping_id; + +DROP TABLE mapping; +DROP TABLE contextualized_termcode_to_criteria_set; +DROP TABLE criteria_set; \ No newline at end of file