From 2d7e501bd4f0f79d51803cec0a844123ef8499e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Skaar=2C=20Bj=C3=B8rn-Andre?= Date: Fri, 15 Dec 2023 13:42:12 +0100 Subject: [PATCH] Removed solr-dataimporthandler as it conflicted with ANTLR version (and is hopefully not used) --- .../core/model/ClassificationFamily.java | 3 ++ .../ClassificationSeriesRepository.java | 44 +++++++++---------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/klass-shared/src/main/java/no/ssb/klass/core/model/ClassificationFamily.java b/klass-shared/src/main/java/no/ssb/klass/core/model/ClassificationFamily.java index e8595a80..7030dcdd 100644 --- a/klass-shared/src/main/java/no/ssb/klass/core/model/ClassificationFamily.java +++ b/klass-shared/src/main/java/no/ssb/klass/core/model/ClassificationFamily.java @@ -7,11 +7,13 @@ import java.util.List; import jakarta.persistence.Column; +import jakarta.persistence.Convert; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.Index; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; +import no.ssb.klass.core.util.TranslatablePersistenceConverter; import org.hibernate.Hibernate; import no.ssb.klass.core.util.Translatable; @@ -23,6 +25,7 @@ public class ClassificationFamily extends BaseEntity { public static final String BASE_ICON_PATH = "/icons/"; @Column(nullable = false) + @Convert(converter = TranslatablePersistenceConverter.class) private final Translatable name; @Column(nullable = false) private final String iconName; diff --git a/klass-shared/src/main/java/no/ssb/klass/core/repository/ClassificationSeriesRepository.java b/klass-shared/src/main/java/no/ssb/klass/core/repository/ClassificationSeriesRepository.java index 3d0649ca..ea7a4c36 100644 --- a/klass-shared/src/main/java/no/ssb/klass/core/repository/ClassificationSeriesRepository.java +++ b/klass-shared/src/main/java/no/ssb/klass/core/repository/ClassificationSeriesRepository.java @@ -41,42 +41,42 @@ public interface ClassificationSeriesRepository extends JpaRepository findResponsibleSectionsWithPublishedVersions(); @Query(value = "select count(*) from ClassificationSeries classification join classification.contactPerson user where " - + "classification.deleted is false" + CHECKPARAMETERS) + + "classification.deleted = false" + CHECKPARAMETERS) int finNumberOfClassifications(@Param("classificationType") ClassificationType classificationType, @Param("section") String section); @Query(value = "select count(distinct classification.id) from ClassificationVersion version join version.classification classification join " - + "classification.contactPerson user where classification.deleted is false and version.deleted is false " - + "and (version.published.published_no is true or " - + "version.published.published_nn is true or version.published.published_en is true)" + CHECKPARAMETERS) + + "classification.contactPerson user where classification.deleted = false and version.deleted = false " + + "and (version.published.published_no = true or " + + "version.published.published_nn = true or version.published.published_en = true)" + CHECKPARAMETERS) int findNumberOfPublishedClassifications(@Param("classificationType") ClassificationType classificationType, @Param("section") String section); @Query(value = "select count(version.id) from ClassificationVersion version join version.classification classification join " - + "classification.contactPerson user where classification.deleted is false and version.deleted is false " - + "and (version.published.published_no is true " - + "or version.published.published_nn is true or version.published.published_en is true)" + CHECKPARAMETERS) + + "classification.contactPerson user where classification.deleted = false and version.deleted = false " + + "and (version.published.published_no = true " + + "or version.published.published_nn = true or version.published.published_en = true)" + CHECKPARAMETERS) int findNumberOfPublishedVersionsAnyLanguages(@Param("classificationType") ClassificationType classificationType, @Param("section") String section); @Query(value = "select count(version.id) from ClassificationVersion version join version.classification classification join " - + "classification.contactPerson user where classification.deleted is false and version.deleted is false " - + "and version.published.published_no is true " - + "and version.published.published_nn is true and version.published.published_en is true" + CHECKPARAMETERS) + + "classification.contactPerson user where classification.deleted = false and version.deleted = false " + + "and version.published.published_no = true " + + "and version.published.published_nn = true and version.published.published_en = true" + CHECKPARAMETERS) int findNumberOfPublishedVersionsAllLanguages(@Param("classificationType") ClassificationType classificationType, @Param("section") String section); @Query(value = "select new no.ssb.klass.core.service.dto.ClassificationReportDto(classification, user) " + "from ClassificationSeries classification join classification.contactPerson user where " - + "classification.deleted is false" + CHECKPARAMETERS + " order by classification.id") + + "classification.deleted = false" + CHECKPARAMETERS + " order by classification.id") List getClassificationReport( @Param("classificationType") ClassificationType classificationType, @Param("section") String section); @Query(value = "select new no.ssb.klass.core.service.dto.ClassificationReportDto(classification, user) " + "from ClassificationVersion version join version.classification classification join " - + "classification.contactPerson user where classification.deleted is false and (version.published.published_no is true or " - + "version.published.published_nn is true or version.published.published_en is true)" + CHECKPARAMETERS + + "classification.contactPerson user where classification.deleted = false and (version.published.published_no = true or " + + "version.published.published_nn = true or version.published.published_en = true)" + CHECKPARAMETERS + " order by classification.id") List getPublishedClassificationReport( @Param("classificationType") ClassificationType classificationType, @@ -84,9 +84,9 @@ List getPublishedClassificationReport( @Query(value = "select new no.ssb.klass.core.service.dto.ClassificationVersionReportDto(version, classification, user) " + "from ClassificationVersion version join version.classification classification join " - + "classification.contactPerson user where classification.deleted is false and version.deleted is false " - + "and (version.published.published_no is true " - + "or version.published.published_nn is true or version.published.published_en is true)" + CHECKPARAMETERS + + "classification.contactPerson user where classification.deleted = false and version.deleted = false " + + "and (version.published.published_no = true " + + "or version.published.published_nn = true or version.published.published_en = true)" + CHECKPARAMETERS + " order by version.id") List getPublishedVersionsAnyLanguages( @Param("classificationType") ClassificationType classificationType, @@ -96,20 +96,20 @@ List getPublishedVersionsAnyLanguages( + "from ClassificationVersion version " + " join version.classification classification " + " join classification.contactPerson user " - + "where classification.deleted is false and version.deleted is false " - + " and version.published.published_no is true " - + " and version.published.published_nn is true and version.published.published_en is true " + + "where classification.deleted = false and version.deleted = false " + + " and version.published.published_no = true " + + " and version.published.published_nn = true and version.published.published_en = true " + CHECKPARAMETERS + " order by version.id") List getPublishedVersionsAllLanguages( @Param("classificationType") ClassificationType classificationType, @Param("section") String section); - @Query(value = "select count(id) from ClassificationSeries where deleted is false and :user = contactPerson") + @Query(value = "select count(id) from ClassificationSeries where deleted = false and :user = contactPerson") int getNumberOfClassificationForUser(@Param("user") User user); @Modifying - @Query("update ClassificationSeries set contactPerson = :newUser where contactPerson = :oldUser and deleted is false") + @Query("update ClassificationSeries set contactPerson = :newUser where contactPerson = :oldUser and deleted = false") void updateUser(@Param("oldUser") User oldUser, @Param("newUser") User newUser); ClassificationSeries findByNameNoIgnoreCase(@Param("name") String name); @@ -130,6 +130,6 @@ List getPublishedVersionsAllLanguages( void updateClassificationLastModified(@Param("classificationId") Long classificationId, @Param("timeStamp") Date timeStamp); - @Query("select distinct statisticalUnits from ClassificationSeries where deleted is false") + @Query("select distinct statisticalUnits from ClassificationSeries where deleted = false") List findAllClassificationStatisticalUnits(); }