use of org.apache.atlas.query.Expressions.AliasExpression in project incubator-atlas by apache.
the class EntityDiscoveryService method toAttributesResult.
private AttributeSearchResult toAttributesResult(List list, GremlinQuery query) {
AttributeSearchResult ret = new AttributeSearchResult();
List<String> names = new ArrayList<>();
List<List<Object>> values = new ArrayList<>();
// extract select attributes from gremlin query
Option<SelectExpression> selectExpr = SelectExpressionHelper.extractSelectExpression(query.expr());
if (selectExpr.isDefined()) {
List<AliasExpression> aliases = selectExpr.get().toJavaList();
if (CollectionUtils.isNotEmpty(aliases)) {
for (AliasExpression alias : aliases) {
names.add(alias.alias());
}
ret.setName(names);
}
}
for (Object mapObj : list) {
Map map = (mapObj instanceof Map ? (Map) mapObj : null);
if (MapUtils.isNotEmpty(map)) {
for (Object key : map.keySet()) {
Object vals = map.get(key);
values.add((List<Object>) vals);
}
ret.setValues(values);
}
}
return ret;
}
Aggregations