private void deleteLinks ( @ NotNull final PersistentStoreTransaction txn , @ NotNull final PersistentEntity entity ) { final PersistentEntityId id = entity . getId ( ) ; final int entityTypeId = id . getTypeId ( ) ; final long entityLocalId = id . getLocalId ( ) ; final Transaction envTxn = txn . getEnvironmentTransaction ( ) ; final LinksTable links = getLinksTable ( txn , entityTypeId ) ; final IntHashSet deletedLinks = new IntHashSet ( ) ; try ( Cursor cursor = links . getFirstIndexCursor ( envTxn ) ) { for ( boolean success = cursor . getSearchKeyRange ( PropertyKey . propertyKeyToEntry ( new PropertyKey ( entityLocalId , 0 ) ) ) != null ; success ; success = cursor . getNext ( ) ) { final ByteIterable keyEntry = cursor . getKey ( ) ; final PropertyKey key = PropertyKey . entryToPropertyKey ( keyEntry ) ; if ( key . getEntityLocalId ( ) != entityLocalId ) { break ; } final ByteIterable valueEntry = cursor . getValue ( ) ; if ( links . delete ( envTxn , keyEntry , valueEntry ) ) { int linkId = key . getPropertyId ( ) ; if ( getLinkName ( txn , linkId ) != null ) { deletedLinks . add ( linkId ) ; final LinkValue linkValue = LinkValue . entryToLinkValue ( valueEntry ) ; txn . linkDeleted ( entity . getId ( ) , ( PersistentEntityId ) linkValue . getEntityId ( ) , linkValue . getLinkId ( ) ) ; } } } } for ( Integer linkId : deletedLinks ) { links . deleteAllIndex ( envTxn , linkId , entityLocalId ) ; } }
Deletes all outgoing links of specified entity .