{
public void visitMap( MapEntityStore.MapChanger changer )
throws IOException
{
DefaultEntityStoreUnitOfWork uow = (DefaultEntityStoreUnitOfWork) unitOfWork;
CacheOptions options = uow.usecase().metaInfo( CacheOptions.class );
if( options == null )
{
options = CacheOptions.ALWAYS;
}
for( EntityState entityState : state )
{
JSONEntityState state = (JSONEntityState) entityState;
if( state.status().equals( EntityStatus.NEW ) )
{
Writer writer = changer.newEntity( state.identity(),
state.entityDescriptor() );
writeEntityState( state, writer, unitOfWork.identity(), unitOfWork.currentTime() );
writer.close();
if( options.cacheOnNew() )
{
cache.put( state.identity().identity(), new CacheState(state.state()) );
}
} else if( state.status().equals( EntityStatus.UPDATED ) )
{
Writer writer = changer.updateEntity( state.identity(),
state.entityDescriptor() );
writeEntityState( state, writer, unitOfWork.identity(), unitOfWork.currentTime() );
writer.close();
if( options.cacheOnWrite() )
{
cache.put( state.identity().identity(), new CacheState(state.state()) );
}
} else if( state.status().equals( EntityStatus.REMOVED ) )
{