public OrientElement getElement ( final Object id ) { makeActive ( ) ; if ( null == id ) throw new IllegalArgumentException ( "id cannot be null" ) ; if ( id instanceof OrientElement ) return ( OrientElement ) id ; OIdentifiable rec ; if ( id instanceof OIdentifiable ) rec = ( OIdentifiable ) id ; else try { rec = 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 ; } final ODocument doc = rec . getRecord ( ) ; if ( doc != null ) { final OImmutableClass schemaClass = ODocumentInternal . getImmutableSchemaClass ( doc ) ; if ( schemaClass != null && schemaClass . isEdgeType ( ) ) return getEdge ( doc ) ; else return getVertexInstance ( doc ) ; } return null ; }
Returns a graph element vertex or edge starting from an ID .