private List buildRecords ( InternalAggregations internalAgg , SearchHits topHits , KunderaQuery query , MetamodelImpl metaModel , Class clazz , EntityMetadata entityMetadata ) { List temp = new ArrayList <> ( ) ; Iterator < Expression > orderIterator = getSelectExpressionOrder ( query ) . iterator ( ) ; while ( orderIterator . hasNext ( ) ) { Expression exp = orderIterator . next ( ) ; String text = exp . toActualText ( ) ; String field = KunderaQueryUtils . isAggregatedExpression ( exp ) ? text . substring ( text . indexOf ( ESConstants . DOT ) + 1 , text . indexOf ( ESConstants . RIGHT_BRACKET ) ) : text . substring ( text . indexOf ( ESConstants . DOT ) + 1 , text . length ( ) ) ; temp . add ( KunderaQueryUtils . isAggregatedExpression ( exp ) ? getAggregatedResult ( internalAgg , ( ( AggregateFunction ) exp ) . getIdentifier ( ) , exp ) : getFirstResult ( query , field , topHits , clazz , metaModel , entityMetadata ) ) ; } return temp ; }
Parses the records .