Commit 0e8f4daddb72a0c84965dfbc0eae9b2a3ef7f895

Authored by zbeacon
1 parent fc597f2c

Fix for entityType selection

@@ -162,13 +162,17 @@ public class EntityKeyMapping { @@ -162,13 +162,17 @@ public class EntityKeyMapping {
162 162
163 public String toSelection(EntityFilterType filterType, EntityType entityType) { 163 public String toSelection(EntityFilterType filterType, EntityType entityType) {
164 if (entityKey.getType().equals(EntityKeyType.ENTITY_FIELD)) { 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 } else { 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 } else if (entityKey.getType().equals(EntityKeyType.TIME_SERIES)) { 177 } else if (entityKey.getType().equals(EntityKeyType.TIME_SERIES)) {
174 return buildTimeSeriesSelection(); 178 return buildTimeSeriesSelection();