public OrientVertex getVertex ( final Object id ) { makeActive ( ) ; if ( null == id ) throw ExceptionFactory . vertexIdCanNotBeNull ( ) ; if ( id instanceof OrientVertex ) return ( OrientVertex ) id ; else if ( id instanceof ODocument ) return getVertexInstance ( ( OIdentifiable ) id ) ; setCurrentGraphInThreadLocal ( ) ; ORID rid ; if ( id instanceof OIdentifiable ) rid = ( ( OIdentifiable ) id ) . getIdentity ( ) ; else { try { rid = new ORecordId ( id . toString ( ) ) ; } 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 ; } } if ( ! rid . isValid ( ) ) return null ; final ORecord rec = rid . getRecord ( ) ; if ( rec == null || ! ( rec instanceof ODocument ) ) return null ; final OClass cls = ( ( ODocument ) rec ) . getSchemaClass ( ) ; if ( cls != null && cls . isEdgeType ( ) ) throw new IllegalArgumentException ( "Cannot retrieve a vertex with the RID " + rid + " because it is an edge" ) ; return getVertexInstance ( rec ) ; }
Returns a vertex by an ID .