protected void renameItem ( final ItemState state , final ItemState lastDelete ) { ItemData data = state . getData ( ) ; ItemData prevData = getFromBufferedCacheById . run ( data . getIdentifier ( ) ) ; if ( data . isNode ( ) ) { if ( state . isPersisted ( ) ) { // it is state where name can be changed by rename operation, so re-add node removeItem ( lastDelete . getData ( ) ) ; putItem ( state . getData ( ) ) ; } else { // update item data with new name only cache . put ( new CacheId ( getOwnerId ( ) , data . getIdentifier ( ) ) , data , false ) ; } } else { PropertyData prop = ( PropertyData ) data ; if ( prevData != null && ! ( prevData instanceof NullItemData ) ) { PropertyData newProp = new PersistedPropertyData ( prop . getIdentifier ( ) , prop . getQPath ( ) , prop . getParentIdentifier ( ) , prop . getPersistedVersion ( ) , prop . getType ( ) , prop . isMultiValued ( ) , ( ( PropertyData ) prevData ) . getValues ( ) , new SimplePersistedSize ( ( ( PersistedPropertyData ) prevData ) . getPersistedSize ( ) ) ) ; // update item data with new name and old values only cache . put ( new CacheId ( getOwnerId ( ) , newProp . getIdentifier ( ) ) , newProp , false ) ; } else { // remove item to avoid inconsistency in cluster mode since we have not old values cache . remove ( new CacheId ( getOwnerId ( ) , data . getIdentifier ( ) ) ) ; } } }
Apply rename operation on cache . Parent node will be re - added into the cache since parent or name might changing . For other children only item data will be replaced .