private void collectGroupValues ( Entity obj , PathEntry entry , GroupSetEntry groupSetEntry , Set < String > [ ] groupKeys ) { if ( entry . query != null ) { timers . start ( "Where" , entry . queryText ) ; boolean result = entry . checkCondition ( obj ) ; timers . stop ( "Where" , entry . queryText , result ? 1 : 0 ) ; if ( ! result ) return ; } for ( PathEntry field : entry . leafBranches ) { String fieldName = field . name ; int groupIndex = field . groupIndex ; if ( fieldName == PathEntry . ANY ) { groupSetEntry . m_groupPaths [ groupIndex ] . addValueKeys ( groupKeys [ groupIndex ] , obj . id ( ) . toString ( ) ) ; } else { String value = obj . get ( fieldName ) ; if ( value == null || value . indexOf ( CommonDefs . MV_SCALAR_SEP_CHAR ) == - 1 ) { groupSetEntry . m_groupPaths [ groupIndex ] . addValueKeys ( groupKeys [ groupIndex ] , value ) ; } else { String [ ] values = value . split ( CommonDefs . MV_SCALAR_SEP_CHAR ) ; for ( String collectionValue : values ) { groupSetEntry . m_groupPaths [ groupIndex ] . addValueKeys ( groupKeys [ groupIndex ] , collectionValue ) ; } } } } for ( PathEntry child : entry . linkBranches ) { boolean hasLinkedEntities = false ; if ( child . nestedLinks == null || child . nestedLinks . size ( ) == 0 ) { for ( Entity linkedObj : obj . getLinkedEntities ( child . name , child . fieldNames ) ) { hasLinkedEntities = true ; collectGroupValues ( linkedObj , child , groupSetEntry , groupKeys ) ; } } else { for ( LinkInfo linkInfo : child . nestedLinks ) { for ( Entity linkedObj : obj . getLinkedEntities ( linkInfo . name , child . fieldNames ) ) { hasLinkedEntities = true ; collectGroupValues ( linkedObj , child , groupSetEntry , groupKeys ) ; } } } if ( ! hasLinkedEntities && ! child . hasUnderlyingQuery ( ) ) nullifyGroupKeys ( child , groupSetEntry , groupKeys ) ; } }
Collect all values from all object found in the path subtree