public List < ThriftRow > toIndexThriftRow ( Object e , EntityMetadata m , String columnFamily ) { List < ThriftRow > indexThriftRows = new ArrayList < ThriftRow > ( ) ; byte [ ] rowKey = getThriftColumnValue ( e , m . getIdAttribute ( ) ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; // Add thrift rows for embeddables Map < String , EmbeddableType > embeddables = metaModel . getEmbeddables ( m . getEntityClazz ( ) ) ; EntityType entityType = metaModel . entity ( m . getEntityClazz ( ) ) ; for ( String embeddedFieldName : embeddables . keySet ( ) ) { EmbeddableType embeddedColumn = embeddables . get ( embeddedFieldName ) ; // Index embeddable only when specified by user Field embeddedField = ( Field ) entityType . getAttribute ( embeddedFieldName ) . getJavaMember ( ) ; if ( ! MetadataUtils . isEmbeddedAtributeIndexable ( embeddedField ) ) { continue ; } Object embeddedObject = PropertyAccessorHelper . getObject ( e , ( Field ) entityType . getAttribute ( embeddedFieldName ) . getJavaMember ( ) ) ; if ( embeddedObject == null ) { continue ; } if ( embeddedObject instanceof Collection ) { ElementCollectionCacheManager ecCacheHandler = ElementCollectionCacheManager . getInstance ( ) ; for ( Object obj : ( Collection ) embeddedObject ) { for ( Object column : embeddedColumn . getAttributes ( ) ) { Attribute columnAttribute = ( Attribute ) column ; String columnName = columnAttribute . getName ( ) ; if ( ! MetadataUtils . isColumnInEmbeddableIndexable ( embeddedField , columnName ) ) { continue ; } // Column Value String id = ( String ) CassandraDataTranslator . decompose ( ( ( AbstractAttribute ) m . getIdAttribute ( ) ) . getBindableJavaType ( ) , rowKey , false ) ; String superColumnName = ecCacheHandler . getElementCollectionObjectName ( id , obj ) ; ThriftRow tr = constructIndexTableThriftRow ( columnFamily , embeddedFieldName , obj , columnAttribute , rowKey , superColumnName ) ; if ( tr != null ) { indexThriftRows . add ( tr ) ; } } } } else { for ( Object column : embeddedColumn . getAttributes ( ) ) { Attribute columnAttribute = ( Attribute ) column ; String columnName = columnAttribute . getName ( ) ; Class < ? > columnClass = ( ( AbstractAttribute ) columnAttribute ) . getBindableJavaType ( ) ; if ( ! MetadataUtils . isColumnInEmbeddableIndexable ( embeddedField , columnName ) || columnClass . equals ( byte [ ] . class ) ) { continue ; } // No EC Name ThriftRow tr = constructIndexTableThriftRow ( columnFamily , embeddedFieldName , embeddedObject , ( Attribute ) column , rowKey , "" ) ; if ( tr != null ) { indexThriftRows . add ( tr ) ; } } } } return indexThriftRows ; }
To index thrift row .