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)