private List returnEntityObjectList ( EntityMetadata m , List < HBaseDataWrapper > results , List outputResults ) { Map < Object , Object > entityListMap = new HashMap < Object , Object > ( ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; EntityType entityType = metaModel . entity ( m . getEntityClazz ( ) ) ; List < AbstractManagedType > subManagedTypes = ( ( AbstractManagedType ) entityType ) . getSubManagedType ( ) ; Map < String , Class > discrValueToEntityClazz = new HashMap < String , Class > ( ) ; String discrColumn = null ; if ( subManagedTypes != null && ! subManagedTypes . isEmpty ( ) ) { for ( AbstractManagedType subEntity : subManagedTypes ) { discrColumn = ( ( AbstractManagedType ) subEntity ) . getDiscriminatorColumn ( ) ; discrValueToEntityClazz . put ( subEntity . getDiscriminatorValue ( ) , subEntity . getJavaType ( ) ) ; } } for ( HBaseDataWrapper data : results ) { Class clazz = null ; if ( discrValueToEntityClazz != null && ! discrValueToEntityClazz . isEmpty ( ) ) { String discrColumnKey = HBaseUtils . getColumnDataKey ( m . getTableName ( ) , discrColumn ) ; String discrValue = Bytes . toString ( data . getColumnValue ( discrColumnKey ) ) ; clazz = discrValueToEntityClazz . get ( discrValue ) ; m = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , clazz ) ; } else { clazz = m . getEntityClazz ( ) ; } Object entity = KunderaCoreUtils . createNewInstance ( clazz ) ; // Entity Object rowKeyValue = HBaseUtils . fromBytes ( m , metaModel , data . getRowKey ( ) ) ; if ( ! metaModel . isEmbeddable ( m . getIdAttribute ( ) . getBindableJavaType ( ) ) ) { PropertyAccessorHelper . setId ( entity , m , rowKeyValue ) ; } if ( entityListMap . get ( rowKeyValue ) != null ) { entity = entityListMap . get ( rowKeyValue ) ; } entity = populateEntityFromHBaseData ( entity , data , m , null ) ; if ( entity != null ) { entityListMap . put ( rowKeyValue , entity ) ; } } for ( Object obj : entityListMap . values ( ) ) { outputResults . add ( obj ) ; } return outputResults ; }
Return entity object list .