Skip to content

Commit

Permalink
- App: Show all Facet Items and override Facet Type on Field
Browse files Browse the repository at this point in the history
  • Loading branch information
alegauss committed Nov 4, 2024
1 parent bfe43f6 commit d0a5588
Show file tree
Hide file tree
Showing 11 changed files with 327 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ private TurSNSiteFieldExt saveSNSiteFieldExt(TurSNSite turSNSite, TurSNSiteField
.facetType(TurSNSiteFacetFieldEnum.DEFAULT)
.facetItemType(TurSNSiteFacetFieldEnum.DEFAULT)
.facetSort(TurSNSiteFacetFieldSortEnum.COUNT)
.showAllFacetItems(false)
.secondaryFacet(false)
.hl(0)
.multiValued(turSNSiteField.getMultiValued())
Expand All @@ -222,6 +223,7 @@ private void addTurSNSiteFieldExt(TurSNFieldType turSNFieldType, TurSNSite turSN
.facetItemType(TurSNSiteFacetFieldEnum.DEFAULT)
.facetSort(TurSNSiteFacetFieldSortEnum.COUNT)
.secondaryFacet(false)
.showAllFacetItems(false)
.hl(0)
.multiValued(1)
.facetPosition(0)
Expand Down Expand Up @@ -258,6 +260,7 @@ public TurSNSiteFieldExt turSNSiteFieldExtUpdate(@PathVariable String ignoredSnS
turSNSiteFieldExtEdit.setFacetType(turSNSiteFieldExt.getFacetType());
turSNSiteFieldExtEdit.setFacetItemType(turSNSiteFieldExt.getFacetItemType());
turSNSiteFieldExtEdit.setSecondaryFacet(turSNSiteFieldExt.getSecondaryFacet());
turSNSiteFieldExtEdit.setShowAllFacetItems(turSNSiteFieldExt.getShowAllFacetItems());
turSNSiteFieldExtEdit.setHl(turSNSiteFieldExt.getHl());
turSNSiteFieldExtEdit.setEnabled(turSNSiteFieldExt.getEnabled());
turSNSiteFieldExtEdit.setMlt(turSNSiteFieldExt.getMlt());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@

import com.viglet.turing.commons.se.field.TurSEFieldType;
import com.viglet.turing.persistence.model.sn.TurSNSite;
import com.viglet.turing.persistence.model.sn.TurSNSiteFacetRangeEnum;
import com.viglet.turing.persistence.model.sn.field.TurSNSiteFacetFieldEnum;
import com.viglet.turing.persistence.model.sn.field.TurSNSiteFieldExt;
import com.viglet.turing.persistence.model.sn.field.TurSNSiteFieldExtFacet;
import com.viglet.turing.sn.TurSNFieldType;
import jakarta.persistence.Column;
import lombok.*;
import lombok.experimental.Tolerate;

Expand Down Expand Up @@ -53,7 +56,11 @@ public class TurSNSiteFieldExtDto {
private TurSEFieldType type;
private int multiValued;
private int facet;
private TurSNSiteFacetRangeEnum facetRange;
private TurSNSiteFacetFieldEnum facetType;
private TurSNSiteFacetFieldEnum facetItemType;
private Boolean secondaryFacet;
private Boolean showAllFacetItems;
private int hl;
private int mlt;
private int enabled;
Expand All @@ -73,12 +80,16 @@ public TurSNSiteFieldExtDto(TurSNSiteFieldExt turSNSiteFieldExt) {
this.externalId = turSNSiteFieldExt.getExternalId();
this.name = turSNSiteFieldExt.getName();
this.description = turSNSiteFieldExt.getDescription();
this.facet = turSNSiteFieldExt.getFacet();
this.facetRange = turSNSiteFieldExt.getFacetRange();
this.facetName = turSNSiteFieldExt.getFacetName();
this.facetType = turSNSiteFieldExt.getFacetType();
this.facetItemType = turSNSiteFieldExt.getFacetItemType();
this.secondaryFacet = turSNSiteFieldExt.getSecondaryFacet();
this.showAllFacetItems = turSNSiteFieldExt.getShowAllFacetItems();
this.snType = turSNSiteFieldExt.getSnType();
this.type = turSNSiteFieldExt.getType();
this.multiValued = turSNSiteFieldExt.getMultiValued();
this.facet = turSNSiteFieldExt.getFacet();
this.secondaryFacet = turSNSiteFieldExt.getSecondaryFacet();
this.hl = turSNSiteFieldExt.getHl();
this.mlt = turSNSiteFieldExt.getMlt();
this.enabled = turSNSiteFieldExt.getEnabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public class TurSNSiteFieldExt implements Serializable {
private Integer facetPosition;
@Column
private Boolean secondaryFacet;
@Column
private Boolean showAllFacetItems;
@Column(nullable = false)
private TurSNFieldType snType;
@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,73 +37,87 @@

public interface TurSNSiteFieldExtRepository extends JpaRepository<TurSNSiteFieldExt, String> {

@Cacheable("turSNSiteFieldExtFindByTurSNSite")
String FIND_BY_TUR_SN_SITE = "turSNSiteFieldExtFindByTurSNSite";
String FIND_BY_TUR_SN_SITE_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndEnabled";
String FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndFacetAndEnabled";
String FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndSecondaryFacetAndEnabled";
String FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION = "findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition";
String FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE = "findByTurSNSiteAndFacetAndEnabledAndType";
String FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndHlAndEnabled";
String FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndMltAndEnabled";
String FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndRequiredAndEnabled";
String FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndNlpAndEnabled";

@Cacheable(FIND_BY_TUR_SN_SITE)
List<TurSNSiteFieldExt> findByTurSNSite(Sort sort, TurSNSite turSNSite);

@Cacheable("turSNSiteFieldExtFindByTurSNSiteAndEnabled")
@Cacheable(FIND_BY_TUR_SN_SITE_AND_ENABLED)
List<TurSNSiteFieldExt> findByTurSNSiteAndEnabled(TurSNSite turSNSite, int enabled);

@Cacheable("turSNSiteFieldExtFindByTurSNSiteAndFacetAndEnabled")
@Cacheable(FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED)
List<TurSNSiteFieldExt> findByTurSNSiteAndFacetAndEnabled(TurSNSite turSNSite, int facet, int enabled);

@Cacheable("turSNSiteFieldExtFindByTurSNSiteAndSecondaryFacetAndEnabled(")
@Cacheable(FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED)
List<TurSNSiteFieldExt> findByTurSNSiteAndSecondaryFacetAndEnabled(TurSNSite turSNSite, Boolean secondaryFacet, int enabled);

@Cacheable("findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition")
@Cacheable(FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION)
List<TurSNSiteFieldExt> findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition(TurSNSite turSNSite, int facet, int enabled);

@Cacheable("findByTurSNSiteAndFacetAndEnabledAndType")
@Cacheable(FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE)
List<TurSNSiteFieldExt> findByTurSNSiteAndFacetAndEnabledAndType(TurSNSite turSNSite, int facet, int enabled,
TurSEFieldType type);

@Cacheable("turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled")
@Cacheable(FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED)
List<TurSNSiteFieldExt> findByTurSNSiteAndHlAndEnabled(TurSNSite turSNSite, int hl, int enabled);

@Cacheable("turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled")
@Cacheable(FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED)
List<TurSNSiteFieldExt> findByTurSNSiteAndMltAndEnabled(TurSNSite turSNSite, int mlt, int enabled);

@Cacheable("turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled")
@Cacheable(FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED)
List<TurSNSiteFieldExt> findByTurSNSiteAndRequiredAndEnabled(TurSNSite turSNSite, int required, int enabled);

@Cacheable("turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled")
@Cacheable(FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED)
List<TurSNSiteFieldExt> findByTurSNSiteAndNlpAndEnabled(TurSNSite turSNSite, int nlp, int enabled);

List<TurSNSiteFieldExt> findByTurSNSiteAndName(TurSNSite turSNSite, String name);

boolean existsByTurSNSiteAndName(TurSNSite turSNSite, String name);

@Query("SELECT MAX(t.facetPosition) FROM TurSNSiteFieldExt t")
Optional<Integer> findMaxFacetPosition();

@CacheEvict(value = { "turSNSiteFieldExtfindByTurSNSite", "turSNSiteFieldExtfindByTurSNSiteAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndFacetAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled", "findByTurSNSiteAndFacetAndEnabledAndType",
"findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition" }, allEntries = true)
@CacheEvict(value = {FIND_BY_TUR_SN_SITE, FIND_BY_TUR_SN_SITE_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE,
FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION,
FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED}, allEntries = true)
@NotNull
TurSNSiteFieldExt save(@NotNull TurSNSiteFieldExt turSNSiteFieldExt);

@CacheEvict(value = { "turSNSiteFieldExtfindByTurSNSite", "turSNSiteFieldExtfindByTurSNSiteAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndFacetAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled", "findByTurSNSiteAndFacetAndEnabledAndType",
"findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition"}, allEntries = true)
@CacheEvict(value = {FIND_BY_TUR_SN_SITE, FIND_BY_TUR_SN_SITE_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE,
FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION,
FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED}, allEntries = true)
void delete(@NotNull TurSNSiteFieldExt turSNSiteFieldExt);

@Modifying
@Query("delete from TurSNSiteFieldExt ssfe where ssfe.id = ?1")
@CacheEvict(value = { "turSNSiteFieldExtfindByTurSNSite", "turSNSiteFieldExtfindByTurSNSiteAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndFacetAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled" }, allEntries = true)
@CacheEvict(value = {FIND_BY_TUR_SN_SITE, FIND_BY_TUR_SN_SITE_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE,
FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION,
FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED}, allEntries = true)
void delete(String turSnSiteFieldId);

@Modifying
@Query("delete from TurSNSiteFieldExt ssfe where ssfe.turSNSite= ?1 and ssfe.snType = ?2")
@CacheEvict(value = { "turSNSiteFieldExtfindByTurSNSite", "turSNSiteFieldExtfindByTurSNSiteAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndFacetAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled",
"turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled", "findByTurSNSiteAndFacetAndEnabledAndType",
"findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition"}, allEntries = true)
@CacheEvict(value = {FIND_BY_TUR_SN_SITE, FIND_BY_TUR_SN_SITE_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED,
FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE,
FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION,
FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED}, allEntries = true)
void deleteByTurSNSiteAndSnType(TurSNSite turSNSite, TurSNFieldType turSNFieldType);
}
Loading

0 comments on commit d0a5588

Please sign in to comment.