ArrayMap<Integer,PropertyData> addMap =
nodeManager.getCowPropertyAddMap( this, true );
ArrayMap<Integer,PropertyData> skipMap =
nodeManager.getCowPropertyRemoveMap( this );
PropertyIndex index = null;
PropertyData property = null;
boolean foundInSkipMap = false;
for ( PropertyIndex cachedIndex : nodeManager.index( key ) )
{
if ( skipMap != null )
{
if ( skipMap.remove( cachedIndex.getKeyId() ) != null )
{
foundInSkipMap = true;
}
}
index = cachedIndex;
property = addMap.get( cachedIndex.getKeyId() );
if ( property != null )
{
break;
}
property = propertyMap.get( cachedIndex.getKeyId() );
if ( property != null )
{
break;
}
}
if ( property == null && !nodeManager.hasAllPropertyIndexes() )
{
for ( int keyId : addMap.keySet() )
{
if ( !nodeManager.hasIndexFor( keyId ) )
{
PropertyIndex indexToCheck = nodeManager
.getIndexFor( keyId );
if ( indexToCheck.getKey().equals( key ) )
{
if ( skipMap != null )
{
skipMap.remove( indexToCheck.getKeyId() );
}
index = indexToCheck;
property = addMap.get( indexToCheck.getKeyId() );
if ( property != null )
{
break;
}
}
}
}
if ( property == null )
{
for ( int keyId : propertyMap.keySet() )
{
if ( !nodeManager.hasIndexFor( keyId ) )
{
PropertyIndex indexToCheck = nodeManager
.getIndexFor( keyId );
if ( indexToCheck.getKey().equals( key ) )
{
if ( skipMap != null )
{
skipMap.remove( indexToCheck.getKeyId() );
}
index = indexToCheck;
property = propertyMap.get( indexToCheck
.getKeyId() );
if ( property != null )
{
break;
}
}
}
}
}
}
if ( index == null )
{
index = nodeManager.createPropertyIndex( key );
}
if ( property != null && !foundInSkipMap )
{
long propertyId = property.getId();
changeProperty( nodeManager, propertyId, value );
property = new PropertyData( propertyId, value );
}
else
{
long propertyId = addProperty( nodeManager, index, value );
property = new PropertyData( propertyId, value );
}
addMap.put( index.getKeyId(), property );
success = true;
}
finally