{
Index index = ( Index ) idxList.next();
NamingEnumeration list = index.listReverseIndices( id );
while ( list.hasMore() )
{
IndexRecord rec = ( IndexRecord ) list.next();
Object val = rec.getIndexKey();
String attrId = index.getAttribute().getName();
Attribute attr = attributes.get( attrId );
if ( attr == null)
{
attr = new LockableAttributeImpl( attrId );
}
attr.add( val );
attributes.put( attr );
}
}
// Get all existance mappings for this id creating a special key
// that looks like so 'existance[attribute]' and the value is set to id
NamingEnumeration list = existanceIdx.listReverseIndices( id );
StringBuffer val = new StringBuffer();
while ( list.hasMore() )
{
IndexRecord rec = ( IndexRecord ) list.next();
val.append( "_existance[" );
val.append( rec.getIndexKey() );
val.append( "]" );
String valStr = val.toString();
Attribute attr = attributes.get( valStr );
if ( attr == null )
{
attr = new LockableAttributeImpl( valStr );
}
attr.add( rec.getEntryId() );
attributes.put( attr );
val.setLength( 0 );
}
// Get all parent child mappings for this entry as the parent using the
// key 'child' with many entries following it.
list = hierarchyIdx.listIndices( id );
Attribute childAttr = new LockableAttributeImpl( "_child" );
attributes.put( childAttr );
while ( list.hasMore() )
{
IndexRecord rec = ( IndexRecord ) list.next();
childAttr.add( rec.getEntryId() );
}
return attributes;
}