Commit 80ea2b7de5b3bfcf5871cf349a667df375937fc2
Committed by
GitHub
Merge pull request #3126 from zbeacon/master
Fix for entityType selection
Showing
1 changed file
with
10 additions
and
6 deletions
... | ... | @@ -162,13 +162,17 @@ public class EntityKeyMapping { |
162 | 162 | |
163 | 163 | public String toSelection(EntityFilterType filterType, EntityType entityType) { |
164 | 164 | if (entityKey.getType().equals(EntityKeyType.ENTITY_FIELD)) { |
165 | - Set<String> existingEntityFields = getExistingEntityFields(filterType, entityType); | |
166 | - String alias = getEntityFieldAlias(filterType, entityType); | |
167 | - if (existingEntityFields.contains(alias)) { | |
168 | - String column = entityFieldColumnMap.get(alias); | |
169 | - return String.format("e.%s as %s", column, getValueAlias()); | |
165 | + if (entityKey.getKey().equals("entityType") && !filterType.equals(EntityFilterType.RELATIONS_QUERY)) { | |
166 | + return String.format("'%s' as %s", entityType.name(), getValueAlias()); | |
170 | 167 | } else { |
171 | - return String.format("'' as %s", getValueAlias()); | |
168 | + Set<String> existingEntityFields = getExistingEntityFields(filterType, entityType); | |
169 | + String alias = getEntityFieldAlias(filterType, entityType); | |
170 | + if (existingEntityFields.contains(alias)) { | |
171 | + String column = entityFieldColumnMap.get(alias); | |
172 | + return String.format("e.%s as %s", column, getValueAlias()); | |
173 | + } else { | |
174 | + return String.format("'' as %s", getValueAlias()); | |
175 | + } | |
172 | 176 | } |
173 | 177 | } else if (entityKey.getType().equals(EntityKeyType.TIME_SERIES)) { |
174 | 178 | return buildTimeSeriesSelection(); | ... | ... |