public OMVRBTreeEntryPersistent < K , V > save ( ) throws OSerializationException { if ( ! dataProvider . isEntryDirty ( ) ) return this ; final boolean isNew = dataProvider . getIdentity ( ) . isNew ( ) ; // FOR EACH NEW LINK, SAVE BEFORE if ( left != null && left . dataProvider . getIdentity ( ) . isNew ( ) ) { if ( isNew ) { // TEMPORARY INCORRECT SAVE FOR GETTING AN ID. WILL BE SET DIRTY AGAIN JUST AFTER left . dataProvider . save ( ) ; } else left . save ( ) ; } if ( right != null && right . dataProvider . getIdentity ( ) . isNew ( ) ) { if ( isNew ) { // TEMPORARY INCORRECT SAVE FOR GETTING AN ID. WILL BE SET DIRTY AGAIN JUST AFTER right . dataProvider . save ( ) ; } else right . save ( ) ; } if ( parent != null && parent . dataProvider . getIdentity ( ) . isNew ( ) ) { if ( isNew ) { // TEMPORARY INCORRECT SAVE FOR GETTING AN ID. WILL BE SET DIRTY AGAIN JUST AFTER parent . dataProvider . save ( ) ; } else parent . save ( ) ; } dataProvider . save ( ) ; // if (parent != null) // if (!parent.record.getIdentity().equals(parentRid)) // OLogManager.instance().error(this, // "[save]: Tree node %s has parentRid '%s' different by the rid of the assigned parent node: %s", record.getIdentity(), // parentRid, parent.record.getIdentity()); checkEntryStructure ( ) ; if ( pTree . searchNodeInCache ( dataProvider . getIdentity ( ) ) != this ) { // UPDATE THE CACHE pTree . addNodeInMemory ( this ) ; } return this ; }
Assures that all the links versus parent left and right are consistent .