Fix for entityType selection

This commit is contained in:
zbeacon 2020-07-21 10:51:14 +03:00
parent fc597f2c0b
commit 0e8f4daddb

View File

@ -162,6 +162,9 @@ public class EntityKeyMapping {
public String toSelection(EntityFilterType filterType, EntityType entityType) { public String toSelection(EntityFilterType filterType, EntityType entityType) {
if (entityKey.getType().equals(EntityKeyType.ENTITY_FIELD)) { if (entityKey.getType().equals(EntityKeyType.ENTITY_FIELD)) {
if (entityKey.getKey().equals("entityType") && !filterType.equals(EntityFilterType.RELATIONS_QUERY)) {
return String.format("'%s' as %s", entityType.name(), getValueAlias());
} else {
Set<String> existingEntityFields = getExistingEntityFields(filterType, entityType); Set<String> existingEntityFields = getExistingEntityFields(filterType, entityType);
String alias = getEntityFieldAlias(filterType, entityType); String alias = getEntityFieldAlias(filterType, entityType);
if (existingEntityFields.contains(alias)) { if (existingEntityFields.contains(alias)) {
@ -170,6 +173,7 @@ public class EntityKeyMapping {
} else { } else {
return String.format("'' as %s", getValueAlias()); return String.format("'' as %s", getValueAlias());
} }
}
} else if (entityKey.getType().equals(EntityKeyType.TIME_SERIES)) { } else if (entityKey.getType().equals(EntityKeyType.TIME_SERIES)) {
return buildTimeSeriesSelection(); return buildTimeSeriesSelection();
} else { } else {