core/src/main/java/com/orientechnologies/orient/core/sql/executor/UpdateEdgePointersStep.java
private void changeVertexEdgePointer(ODocument edge, OIdentifiable prevVertex, OIdentifiable currentVertex, String direction) {
    if (prevVertex != null && !prevVertex.equals(currentVertex)) {
      String edgeClassName = edge.getClassName();
      if (edgeClassName.equalsIgnoreCase("E")) {
        edgeClassName = "";
      }
      String vertexFieldName = direction + "_" + edgeClassName;
      ODocument prevOutDoc = ((OIdentifiable) prevVertex).getRecord();
      ORidBag prevBag = prevOutDoc.field(vertexFieldName);
      if (prevBag != null) {
        prevBag.remove(edge);
        prevOutDoc.save();
      }

      ODocument currentVertexDoc = ((OIdentifiable) currentVertex).getRecord();
      ORidBag currentBag = currentVertexDoc.field(vertexFieldName);
      if (currentBag == null) {
        currentBag = new ORidBag();
        currentVertexDoc.field(vertexFieldName, currentBag);
      }
      currentBag.add(edge);
    }
  }
private void changeVertexEdgePointer(ODocument edge, OIdentifiable prevVertex, OIdentifiable currentVertex, String direction) {
    if (prevVertex != null && !prevVertex.equals(currentVertex)) {
      String edgeClassName = edge.getClassName();
      if (edgeClassName.equalsIgnoreCase("E")) {
        edgeClassName = "";
      }
      String vertexFieldName = direction + "_" + edgeClassName;
      ODocument prevOutDoc = ((OIdentifiable) prevVertex).getRecord();
      ORidBag prevBag = prevOutDoc.field(vertexFieldName);
      if (prevBag != null) {
        prevBag.remove(edge);
        prevOutDoc.save();
      }

      ODocument currentVertexDoc = ((OIdentifiable) currentVertex).getRecord();
      ORidBag currentBag = currentVertexDoc.field(vertexFieldName);
      if (currentBag == null) {
        currentBag = new ORidBag();
        currentVertexDoc.field(vertexFieldName, currentBag);
      }
      currentBag.add(edge);
    }
  }
private void changeVertexEdgePointer ( ODocument edge , OIdentifiable prevVertex , OIdentifiable currentVertex , String direction ) { if ( prevVertex != null && ! prevVertex . equals ( currentVertex ) ) { String edgeClassName = edge . getClassName ( ) ; if ( edgeClassName . equalsIgnoreCase ( "E" ) ) { edgeClassName = "" ; } String vertexFieldName = direction + "_" + edgeClassName ; ODocument prevOutDoc = ( ( OIdentifiable ) prevVertex ) . getRecord ( ) ; ORidBag prevBag = prevOutDoc . field ( vertexFieldName ) ; if ( prevBag != null ) { prevBag . remove ( edge ) ; prevOutDoc . save ( ) ; } ODocument currentVertexDoc = ( ( OIdentifiable ) currentVertex ) . getRecord ( ) ; ORidBag currentBag = currentVertexDoc . field ( vertexFieldName ) ; if ( currentBag == null ) { currentBag = new ORidBag ( ) ; currentVertexDoc . field ( vertexFieldName , currentBag ) ; } currentBag . add ( edge ) ; } }
updates old and new vertices connected to an edge after out/in update on the edge itself

@param edge          the edge
@param prevVertex    the previously connected vertex
@param currentVertex the currently connected vertex
@param direction     the direction ("out" or "in")
updates old and new vertices connected to an edge after out / in update on the edge itself