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