Fixed categorical filtering on enums

This commit is contained in:
Francesco 2023-10-25 10:11:25 +02:00
parent b6cfe37c84
commit 3183c810b7

View File

@ -245,10 +245,17 @@ public class DbField {
} }
public Set<DbFieldValue> getAllValues() { public Set<DbFieldValue> getAllValues() {
List<?> findAll = schema.getJpaRepository().findAll(); if (type instanceof EnumFieldType) {
return findAll.stream() List<?> values = type.getValues();
.map(o -> new DbObject(o, schema).get(this)) return values.stream().map(v -> {
.collect(Collectors.toSet()); return new DbFieldValue(v, this);
}).collect(Collectors.toSet());
} else {
List<?> findAll = schema.getJpaRepository().findAll();
return findAll.stream()
.map(o -> new DbObject(o, schema).get(this))
.collect(Collectors.toSet());
}
} }
@Override @Override