public OrientEdge getEdge ( final Object id ) { makeActive ( ) ; if ( null == id ) throw ExceptionFactory . edgeIdCanNotBeNull ( ) ; if ( id instanceof OrientEdge ) return ( OrientEdge ) id ; else if ( id instanceof ODocument ) return new OrientEdge ( this , ( OIdentifiable ) id ) ; final OIdentifiable rec ; if ( id instanceof OIdentifiable ) rec = ( OIdentifiable ) id ; else { final String str = id . toString ( ) ; int pos = str . indexOf ( "->" ) ; if ( pos > - 1 ) { // DUMMY EDGE: CREATE IT IN MEMORY final String from = str . substring ( 0 , pos ) ; final String to = str . substring ( pos + 2 ) ; return getEdgeInstance ( new ORecordId ( from ) , new ORecordId ( to ) , null ) ; } try { rec = new ORecordId ( str ) ; } catch ( IllegalArgumentException iae ) { // orientdb throws IllegalArgumentException: Argument 'xxxx' is // not a RecordId in form of string. Format must be: // [#]<cluster-id>:<cluster-position> return null ; } } final ODocument doc = rec . getRecord ( ) ; if ( doc == null ) return null ; final OClass cls = doc . getSchemaClass ( ) ; if ( cls != null ) { if ( cls . isVertexType ( ) ) throw new IllegalArgumentException ( "Cannot retrieve an edge with the RID " + id + " because it is a vertex" ) ; if ( ! cls . isEdgeType ( ) ) throw new IllegalArgumentException ( "Class '" + doc . getClassName ( ) + "' is not an edge class" ) ; } return new OrientEdge ( this , rec ) ; }
Returns a edge by an ID .