private void addTypeCriteria ( final QueryPrint _print ) { final MultiValuedMap < TableIdx , TypeCriteria > typeCriterias = MultiMapUtils . newListValuedHashMap ( ) ; final List < Type > types = _print . getTypes ( ) . stream ( ) . sorted ( ( type1 , type2 ) -> Long . compare ( type1 . getId ( ) , type2 . getId ( ) ) ) . collect ( Collectors . toList ( ) ) ; for ( final Type type : types ) { final String tableName = type . getMainTable ( ) . getSqlTable ( ) ; final TableIdx tableIdx = sqlSelect . getIndexer ( ) . getTableIdx ( tableName ) ; if ( tableIdx . isCreated ( ) ) { sqlSelect . from ( tableIdx . getTable ( ) , tableIdx . getIdx ( ) ) ; } if ( type . getMainTable ( ) . getSqlColType ( ) != null ) { typeCriterias . put ( tableIdx , new TypeCriteria ( type . getMainTable ( ) . getSqlColType ( ) , type . getId ( ) ) ) ; } } if ( ! typeCriterias . isEmpty ( ) ) { final SQLWhere where = sqlSelect . getWhere ( ) ; for ( final TableIdx tableIdx : typeCriterias . keySet ( ) ) { final Collection < TypeCriteria > criterias = typeCriterias . get ( tableIdx ) ; final Iterator < TypeCriteria > iter = criterias . iterator ( ) ; final TypeCriteria typeCriteria = iter . next ( ) ; final Criteria criteria = where . addCriteria ( tableIdx . getIdx ( ) , typeCriteria . sqlColType , iter . hasNext ( ) ? Comparison . IN : Comparison . EQUAL , String . valueOf ( typeCriteria . id ) , Connection . AND ) ; while ( iter . hasNext ( ) ) { criteria . value ( String . valueOf ( iter . next ( ) . id ) ) ; } } } }
Adds the type criteria .