}
}, Iterables.map( SQLCompatEntityStateWrapper.WRAP, changedStates ) );
for( EntityState eState : relatedStates )
{
EntityStatus status = eState.status();
Long pk = null;
boolean needToInsert = status.equals( EntityStatus.NEW );
if( !needToInsert )
{
if( status.equals( EntityStatus.UPDATED ) )
{
pk = this.findEntityPK( eState, queryEntityPKPS );
if( pk == null )
{
// Happens when reindexing
needToInsert = true;
}
else
{
// TODO if multiple applications with different application model use
// indexing, need to sync type-table.
this.updateEntityInfoAndProperties( connection, qNameInsertPSs,
insertToPropertyQNamesPS,
clearEntityDataPS,
updateEntityTablePS,
eState,
pk, qNamePKs );
}
}
else if( status.equals( EntityStatus.REMOVED ) )
{
this.removeEntity( eState, removeEntityPS );
}
else
{