signature:
public class OGraphMLReader { /** * Input the GraphML stream data into the graph . More control over how data is streamed is provided by this method .
 * @ param inputGraph
 * the graph to populate with the GraphML data
 * @ param graphMLInputStream
 * an InputStream of GraphML data
 * @ param bufferSize
 * the amount of elements to hold in memory before committing a transactions ( only valid for TransactionalGraphs )
 * @ param vertexIdKey
 * if the id of a vertex is a & lt ; data / & gt ; property , fetch it from the data property .
 * @ param edgeIdKey
 * if the id of an edge is a & lt ; data / & gt ; property , fetch it from the data property .
 * @ param edgeLabelKey
 * if the label of an edge is a & lt ; data / & gt ; property , fetch it from the data property .
 * @ throws IOException
 * thrown when the GraphML data is not correctly formatted */
public OGraphMLReader inputGraph ( final Graph inputGraph , final InputStream graphMLInputStream , int bufferSize , String vertexIdKey , String edgeIdKey , String edgeLabelKey ) throws IOException { } }

implementation:
XMLInputFactory inputFactory = XMLInputFactory . newInstance ( ) ; try { XMLStreamReader reader = inputFactory . createXMLStreamReader ( graphMLInputStream ) ; final OrientBaseGraph graph = ( OrientBaseGraph ) inputGraph ; if ( storeVertexIds ) graph . setSaveOriginalIds ( storeVertexIds ) ; Map < String , String > keyIdMap = new HashMap < String , String > ( ) ; Map < String , String > keyTypesMaps = new HashMap < String , String > ( ) ; // < Mapped ID String , ID Object >
// < Default ID String , Mapped ID String >
Map < String , ORID > vertexMappedIdMap = new HashMap < String , ORID > ( ) ; // Buffered Vertex Data
String vertexId = null ; Map < String , Object > vertexProps = null ; boolean inVertex = false ; // Buffered Edge Data
String edgeId = null ; String edgeLabel = null ; String vertexLabel = null ; Vertex [ ] edgeEndVertices = null ; // [0 ] = outVertex , [ 1 ] = inVertex
Map < String , Object > edgeProps = null ; boolean inEdge = false ; int bufferCounter = 0 ; long importedVertices = 0 ; long importedEdges = 0 ; while ( reader . hasNext ( ) ) { Integer eventType = reader . next ( ) ; if ( eventType . equals ( XMLEvent . START_ELEMENT ) ) { String elementName = reader . getName ( ) . getLocalPart ( ) ; if ( elementName . equals ( GraphMLTokens . KEY ) ) { String id = reader . getAttributeValue ( null , GraphMLTokens . ID ) ; String attributeName = reader . getAttributeValue ( null , GraphMLTokens . ATTR_NAME ) ; String attributeType = reader . getAttributeValue ( null , GraphMLTokens . ATTR_TYPE ) ; keyIdMap . put ( id , attributeName ) ; keyTypesMaps . put ( id , attributeType ) ; } else if ( elementName . equals ( GraphMLTokens . NODE ) ) { vertexId = reader . getAttributeValue ( null , GraphMLTokens . ID ) ; vertexLabel = reader . getAttributeValue ( null , LABELS ) ; if ( vertexLabel != null ) { if ( vertexLabel . startsWith ( ":" ) ) // REMOVE : AS PREFIX
vertexLabel = vertexLabel . substring ( 1 ) ; final String [ ] vertexLabels = vertexLabel . split ( ":" ) ; // GET ONLY FIRST LABEL AS CLASS
vertexLabel = vertexId + ",class:" + vertexLabels [ vertexLabelIndex ] ; } else vertexLabel = vertexId ; inVertex = true ; vertexProps = new HashMap < String , Object > ( ) ; } else if ( elementName . equals ( GraphMLTokens . EDGE ) ) { edgeId = reader . getAttributeValue ( null , GraphMLTokens . ID ) ; edgeLabel = reader . getAttributeValue ( null , GraphMLTokens . LABEL ) ; edgeLabel = edgeLabel == null ? GraphMLTokens . _DEFAULT : edgeLabel ; String [ ] vertexIds = new String [ 2 ] ; vertexIds [ 0 ] = reader . getAttributeValue ( null , GraphMLTokens . SOURCE ) ; vertexIds [ 1 ] = reader . getAttributeValue ( null , GraphMLTokens . TARGET ) ; edgeEndVertices = new Vertex [ 2 ] ; for ( int i = 0 ; i < 2 ; i ++ ) { // i = 0 = > outVertex , i = 1 = > inVertex
if ( vertexIdKey == null ) { edgeEndVertices [ i ] = null ; } else { final Object vId = vertexMappedIdMap . get ( vertexIds [ i ] ) ; edgeEndVertices [ i ] = vId != null ? graph . getVertex ( vId ) : null ; } if ( null == edgeEndVertices [ i ] ) { edgeEndVertices [ i ] = graph . addVertex ( vertexLabel ) ; if ( vertexIdKey != null ) { mapId ( vertexMappedIdMap , vertexIds [ i ] , ( ORID ) edgeEndVertices [ i ] . getId ( ) ) ; } bufferCounter ++ ; importedVertices ++ ; printStatus ( reader , importedVertices , importedEdges ) ; } } inEdge = true ; vertexLabel = null ; edgeProps = new HashMap < String , Object > ( ) ; } else if ( elementName . equals ( GraphMLTokens . DATA ) ) { String key = reader . getAttributeValue ( null , GraphMLTokens . KEY ) ; String attributeName = keyIdMap . get ( key ) ; if ( attributeName == null ) attributeName = key ; String value = reader . getElementText ( ) ; if ( inVertex ) { if ( ( vertexIdKey != null ) && ( key . equals ( vertexIdKey ) ) ) { // Should occur at most once per Vertex
vertexId = value ; } else if ( attributeName . equalsIgnoreCase ( LABELS ) ) { // IGNORE LABELS
} else { final Object attrValue = typeCastValue ( key , value , keyTypesMaps ) ; final OGraphMLImportStrategy strategy = vertexPropsStrategy . get ( attributeName ) ; if ( strategy != null ) { attributeName = strategy . transformAttribute ( attributeName , attrValue ) ; } if ( attributeName != null ) vertexProps . put ( attributeName , attrValue ) ; } } else if ( inEdge ) { if ( ( edgeLabelKey != null ) && ( key . equals ( edgeLabelKey ) ) ) edgeLabel = value ; else if ( ( edgeIdKey != null ) && ( key . equals ( edgeIdKey ) ) ) edgeId = value ; else { final Object attrValue = typeCastValue ( key , value , keyTypesMaps ) ; final OGraphMLImportStrategy strategy = edgePropsStrategy . get ( attributeName ) ; if ( strategy != null ) { attributeName = strategy . transformAttribute ( attributeName , attrValue ) ; } if ( attributeName != null ) edgeProps . put ( attributeName , attrValue ) ; } } } } else if ( eventType . equals ( XMLEvent . END_ELEMENT ) ) { String elementName = reader . getName ( ) . getLocalPart ( ) ; if ( elementName . equals ( GraphMLTokens . NODE ) ) { ORID currentVertex = null ; if ( vertexIdKey != null ) currentVertex = vertexMappedIdMap . get ( vertexId ) ; if ( currentVertex == null ) { final OrientVertex v = graph . addVertex ( vertexLabel , vertexProps ) ; if ( vertexIdKey != null ) mapId ( vertexMappedIdMap , vertexId , v . getIdentity ( ) ) ; bufferCounter ++ ; importedVertices ++ ; printStatus ( reader , importedVertices , importedEdges ) ; } else { // UPDATE IT
final OrientVertex v = graph . getVertex ( currentVertex ) ; v . setProperties ( vertexProps ) ; } vertexId = null ; vertexLabel = null ; vertexProps = null ; inVertex = false ; } else if ( elementName . equals ( GraphMLTokens . EDGE ) ) { Edge currentEdge = ( ( OrientVertex ) edgeEndVertices [ 0 ] ) . addEdge ( null , ( OrientVertex ) edgeEndVertices [ 1 ] , edgeLabel , null , edgeProps ) ; bufferCounter ++ ; importedEdges ++ ; printStatus ( reader , importedVertices , importedEdges ) ; edgeId = null ; edgeLabel = null ; edgeEndVertices = null ; edgeProps = null ; inEdge = false ; } } if ( bufferCounter > bufferSize ) { graph . commit ( ) ; bufferCounter = 0 ; } } reader . close ( ) ; graph . commit ( ) ; } catch ( Exception xse ) { throw OException . wrapException ( new ODatabaseImportException ( "Error on importing GraphML" ) , xse ) ; } return this ;


signature:
public class OGraphMLReader { /** * Input the GraphML stream data into the graph . In practice , usually the provided graph is empty .
 * @ param graphMLInputStream
 * an InputStream of GraphML data
 * @ throws IOException
 * thrown when the GraphML data is not correctly formatted */
public OGraphMLReader inputGraph ( final InputStream graphMLInputStream ) throws IOException { } }

implementation: return inputGraph ( this . graph , graphMLInputStream , batchSize , this . vertexIdKey , this . edgeIdKey , this . edgeLabelKey ) ;


signature:
public class OGraphMLReader { /** * Input the GraphML stream data into the graph . In practice , usually the provided graph is empty .
 * @ param filename
 * name of a file containing GraphML data
 * @ throws IOException
 * thrown when the GraphML data is not correctly formatted */
public OGraphMLReader inputGraph ( final String filename ) throws IOException { } }

implementation: return inputGraph ( this . graph , filename , batchSize , this . vertexIdKey , this . edgeIdKey , this . edgeLabelKey ) ;


signature:
public class ODateSerializer { /** * { @ inheritDoc } */
@ Override public void serializeInByteBufferObject ( Date object , ByteBuffer buffer , Object ... hints ) { } }

implementation: final Calendar calendar = Calendar . getInstance ( ) ; calendar . setTime ( object ) ; calendar . set ( Calendar . HOUR_OF_DAY , 0 ) ; calendar . set ( Calendar . MINUTE , 0 ) ; calendar . set ( Calendar . SECOND , 0 ) ; calendar . set ( Calendar . MILLISECOND , 0 ) ; final ODateTimeSerializer dateTimeSerializer = ODateTimeSerializer . INSTANCE ; dateTimeSerializer . serializeInByteBufferObject ( calendar . getTime ( ) , buffer ) ;


signature:
public class ODateSerializer { /** * { @ inheritDoc } */
@ Override public Date deserializeFromByteBufferObject ( ByteBuffer buffer ) { } }

implementation: final ODateTimeSerializer dateTimeSerializer = ODateTimeSerializer . INSTANCE ; return dateTimeSerializer . deserializeFromByteBufferObject ( buffer ) ;


signature:
public class ODateSerializer { /** * { @ inheritDoc } */
@ Override public Date deserializeFromByteBufferObject ( ByteBuffer buffer , OWALChanges walChanges , int offset ) { } }

implementation: final ODateTimeSerializer dateTimeSerializer = ODateTimeSerializer . INSTANCE ; return dateTimeSerializer . deserializeFromByteBufferObject ( buffer , walChanges , offset ) ;


signature:
public class OTransactionRealAbstract { /** * Called by class iterator . */
public List < ORecordOperation > getNewRecordEntriesByClass ( final OClass iClass , final boolean iPolymorphic ) { } }

implementation:
final List < ORecordOperation > result = new ArrayList < ORecordOperation > ( ) ; if ( iClass == null ) // RETURN ALL THE RECORDS
for ( ORecordOperation entry : allEntries . values ( ) ) { if ( entry . type == ORecordOperation . CREATED ) result . add ( entry ) ; } else { // FILTER RECORDS BY CLASSNAME
for ( ORecordOperation entry : allEntries . values ( ) ) { if ( entry . type == ORecordOperation . CREATED ) if ( entry . getRecord ( ) != null && entry . getRecord ( ) instanceof ODocument ) { if ( iPolymorphic ) { if ( iClass . isSuperClassOf ( ( ( ODocument ) entry . getRecord ( ) ) . getSchemaClass ( ) ) ) result . add ( entry ) ; } else if ( iClass . getName ( ) . equals ( ( ( ODocument ) entry . getRecord ( ) ) . getClassName ( ) ) ) result . add ( entry ) ; } } } return result ;


signature:
public class OTransactionRealAbstract { /** * Called by cluster iterator . */
public List < ORecordOperation > getNewRecordEntriesByClusterIds ( final int [ ] iIds ) { } }

implementation:
final List < ORecordOperation > result = new ArrayList < ORecordOperation > ( ) ; if ( iIds == null ) // RETURN ALL THE RECORDS
for ( ORecordOperation entry : allEntries . values ( ) ) { if ( entry . type == ORecordOperation . CREATED ) result . add ( entry ) ; } else // FILTER RECORDS BY ID
for ( ORecordOperation entry : allEntries . values ( ) ) { for ( int id : iIds ) { if ( entry . getRecord ( ) != null && entry . getRecord ( ) . getIdentity ( ) . getClusterId ( ) == id && entry . type == ORecordOperation . CREATED ) { result . add ( entry ) ; break ; } } } return result ;


signature:
public class OTransactionRealAbstract { /** * Bufferizes index changes to be flushed at commit time . */
public void addIndexEntry ( final OIndex < ? > delegate , final String iIndexName , final OTransactionIndexChanges . OPERATION iOperation , final Object key , final OIdentifiable iValue , boolean clientTrackOnly ) { } }

implementation: OTransactionIndexChanges indexEntry = indexEntries . get ( iIndexName ) ; if ( indexEntry == null ) { indexEntry = new OTransactionIndexChanges ( ) ; indexEntries . put ( iIndexName , indexEntry ) ; } if ( iOperation == OPERATION . CLEAR ) indexEntry . setCleared ( ) ; else { OTransactionIndexChangesPerKey changes = indexEntry . getChangesPerKey ( key ) ; changes . clientTrackOnly = clientTrackOnly ; changes . add ( iValue , iOperation ) ; if ( iValue == null ) return ; List < OTransactionRecordIndexOperation > transactionIndexOperations = recordIndexOperations . get ( iValue . getIdentity ( ) ) ; if ( transactionIndexOperations == null ) { transactionIndexOperations = new ArrayList < OTransactionRecordIndexOperation > ( ) ; recordIndexOperations . put ( iValue . getIdentity ( ) . copy ( ) , transactionIndexOperations ) ; } transactionIndexOperations . add ( new OTransactionRecordIndexOperation ( iIndexName , key , iOperation ) ) ; }


signature:
public class ODirtyManager { /** * Merge the two set try to use the optimum case
 * @ param target
 * @ param source
 * @ return */
private static Set < ORecord > mergeSet ( Set < ORecord > target , Set < ORecord > source ) { } }

implementation: if ( source != null ) { if ( target == null ) { return source ; } else { if ( target . size ( ) > source . size ( ) ) { target . addAll ( source ) ; return target ; } else { source . addAll ( target ) ; return source ; } } } else { return target ; }


signature:
public class OServerConfigAuthenticator { /** * Returns the actual username if successful , null otherwise . */
public String authenticate ( final String username , final String password ) { } }

implementation:
String principal = null ; try { if ( getServerConfig ( ) != null ) { OServerUserConfiguration userCfg = null ; // This will throw an IllegalArgumentException if username is null or empty .
// However , a null or empty username is possible with some security implementations .
if ( username != null && ! username . isEmpty ( ) ) userCfg = getServerConfig ( ) . getUser ( username ) ; if ( userCfg != null && userCfg . password != null ) { if ( OSecurityManager . instance ( ) . checkPassword ( password , userCfg . password ) ) { principal = userCfg . name ; } } } else { OLogManager . instance ( ) . error ( this , "OServerConfigAuthenticator.authenticate() ServerConfig is null" , null ) ; } } catch ( Exception ex ) { OLogManager . instance ( ) . error ( this , "OServerConfigAuthenticator.authenticate()" , ex ) ; } return principal ;


signature:
public class OServerConfigAuthenticator { /** * OSecurityAuthenticator */
public void config ( final OServer oServer , final OServerConfigurationManager serverCfg , final ODocument jsonConfig ) { } }

implementation: super . config ( oServer , serverCfg , jsonConfig ) ;


signature:
public class OServerConfigAuthenticator { /** * OSecurityAuthenticator */
public OServerUserConfiguration getUser ( final String username ) { } }

implementation: OServerUserConfiguration userCfg = null ; if ( getServerConfig ( ) != null ) { userCfg = getServerConfig ( ) . getUser ( username ) ; } return userCfg ;


signature:
public class OServerConfigAuthenticator { /** * If not supported by the authenticator , return false . */
public boolean isAuthorized ( final String username , final String resource ) { } }

implementation:
if ( username == null || resource == null ) return false ; if ( getServerConfig ( ) != null ) { // getUser ( ) will throw an IllegalArgumentException if username is null or empty .
// However , a null or empty username is possible with some security implementations .
if ( ! username . isEmpty ( ) ) { OServerUserConfiguration userCfg = getServerConfig ( ) . getUser ( username ) ; if ( userCfg != null ) { // Total Access
if ( userCfg . resources . equals ( "*" ) ) return true ; String [ ] resourceParts = userCfg . resources . split ( "," ) ; for ( String r : resourceParts ) { if ( r . equalsIgnoreCase ( resource ) ) return true ; } } } } else { OLogManager . instance ( ) . error ( this , "OServerConfigAuthenticator.isAuthorized() ServerConfig is null" , null ) ; } return false ;


signature:
public class OCommandExecutorSQLUpdate { /** * Update current record . */
@ SuppressWarnings ( "unchecked" ) public boolean result ( final Object iRecord ) { } }

implementation:
final ODocument record = ( ( OIdentifiable ) iRecord ) . getRecord ( ) ; if ( isUpdateEdge ( ) && ! isRecordInstanceOf ( iRecord , "E" ) ) { throw new OCommandExecutionException ( "Using UPDATE EDGE on a record that is not an instance of E" ) ; } if ( compiledFilter != null ) { // ADDITIONAL FILTERING
if ( ! ( Boolean ) compiledFilter . evaluate ( record , null , context ) ) return false ; } parameters . reset ( ) ; returnHandler . beforeUpdate ( record ) ; boolean updated = handleContent ( record ) ; updated |= handleMerge ( record ) ; updated |= handleSetEntries ( record ) ; updated |= handleIncrementEntries ( record ) ; updated |= handleAddEntries ( record ) ; updated |= handlePutEntries ( record ) ; updated |= handleRemoveEntries ( record ) ; if ( updated ) { handleUpdateEdge ( record ) ; record . setDirty ( ) ; record . save ( ) ; returnHandler . afterUpdate ( record ) ; this . updated = true ; } return true ;


signature:
public class OCommandExecutorSQLUpdate { /** * handles vertex consistency after an UPDATE EDGE
 * @ param record the edge record */
private void handleUpdateEdge ( ODocument record ) { } }

implementation: if ( ! updateEdge ) { return ; } Object currentOut = record . field ( "out" ) ; Object currentIn = record . field ( "in" ) ; Object prevOut = record . getOriginalValue ( "out" ) ; Object prevIn = record . getOriginalValue ( "in" ) ; validateOutInForEdge ( record , currentOut , currentIn ) ; changeVertexEdgePointer ( record , ( OIdentifiable ) prevIn , ( OIdentifiable ) currentIn , "in" ) ; changeVertexEdgePointer ( record , ( OIdentifiable ) prevOut , ( OIdentifiable ) currentOut , "out" ) ;


signature:
public class OCommandExecutorSQLUpdate { /** * Parses the returning keyword if found . */
protected void parseReturn ( ) throws OCommandSQLParsingException { } }

implementation: parserNextWord ( false , " " ) ; String mode = parserGetLastWord ( ) . trim ( ) ; if ( mode . equalsIgnoreCase ( "COUNT" ) ) { returnHandler = new ORecordCountHandler ( ) ; } else if ( mode . equalsIgnoreCase ( "BEFORE" ) || mode . equalsIgnoreCase ( "AFTER" ) ) { parserNextWord ( false , " " ) ; String returning = parserGetLastWord ( ) . trim ( ) ; Object returnExpression = null ; if ( returning . equalsIgnoreCase ( KEYWORD_WHERE ) || returning . equalsIgnoreCase ( KEYWORD_TIMEOUT ) || returning . equalsIgnoreCase ( KEYWORD_LIMIT ) || returning . equalsIgnoreCase ( KEYWORD_UPSERT ) || returning . equalsIgnoreCase ( KEYWORD_LOCK ) || returning . length ( ) == 0 ) { parserGoBack ( ) ; } else { if ( returning . startsWith ( "$" ) || returning . startsWith ( "@" ) ) returnExpression = ( returning . length ( ) > 0 ) ? OSQLHelper . parseValue ( this , returning , this . getContext ( ) ) : null ; else throwSyntaxErrorException ( "record attribute (@attributes) or functions with $current variable expected" ) ; } if ( mode . equalsIgnoreCase ( "BEFORE" ) ) returnHandler = new OOriginalRecordsReturnHandler ( returnExpression , getContext ( ) ) ; else returnHandler = new OUpdatedRecordsReturnHandler ( returnExpression , getContext ( ) ) ; } else throwSyntaxErrorException ( " COUNT | BEFORE | AFTER keywords expected" ) ;


signature:
public class OFunctionCall { /** * see OIndexableSQLFunction . searchFromTarget ( )
 * @ param target
 * @ param ctx
 * @ param operator
 * @ param rightValue
 * @ return */
public Iterable < OIdentifiable > executeIndexedFunction ( OFromClause target , OCommandContext ctx , OBinaryCompareOperator operator , Object rightValue ) { } }

implementation: OSQLFunction function = OSQLEngine . getInstance ( ) . getFunction ( name . getStringValue ( ) ) ; if ( function instanceof OIndexableSQLFunction ) { return ( ( OIndexableSQLFunction ) function ) . searchFromTarget ( target , operator , rightValue , ctx , this . getParams ( ) . toArray ( new OExpression [ ] { } ) ) ; } return null ;


signature:
public class OFunctionCall { /** * @ param target query target
 * @ param ctx execution context
 * @ param operator operator at the right of the function
 * @ param rightValue value to compare to funciton result
 * @ return the approximate number of items returned by the condition execution , - 1 if the extimation cannot be executed */
public long estimateIndexedFunction ( OFromClause target , OCommandContext ctx , OBinaryCompareOperator operator , Object rightValue ) { } }

implementation: OSQLFunction function = OSQLEngine . getInstance ( ) . getFunction ( name . getStringValue ( ) ) ; if ( function instanceof OIndexableSQLFunction ) { return ( ( OIndexableSQLFunction ) function ) . estimate ( target , operator , rightValue , ctx , this . getParams ( ) . toArray ( new OExpression [ ] { } ) ) ; } return - 1 ;


signature:
public class OFunctionCall { /** * tests if current function is an indexed function AND that function can also be executed without using the index
 * @ param target the query target
 * @ param context the execution context
 * @ param operator
 * @ param right
 * @ return true if current function is an indexed funciton AND that function can also be executed without using the index , false
 * otherwise */
public boolean canExecuteIndexedFunctionWithoutIndex ( OFromClause target , OCommandContext context , OBinaryCompareOperator operator , Object right ) { } }

implementation: OSQLFunction function = OSQLEngine . getInstance ( ) . getFunction ( name . getStringValue ( ) ) ; if ( function instanceof OIndexableSQLFunction ) { return ( ( OIndexableSQLFunction ) function ) . canExecuteInline ( target , operator , right , context , this . getParams ( ) . toArray ( new OExpression [ ] { } ) ) ; } return false ;


signature:
public class OStreamSerializerSBTreeIndexRIDContainer { /** * { @ inheritDoc } */
@ Override public void serializeInByteBufferObject ( OIndexRIDContainer object , ByteBuffer buffer , Object ... hints ) { } }

implementation: buffer . putLong ( object . getFileId ( ) ) ; final boolean embedded = object . isEmbedded ( ) ; final boolean durable = object . isDurableNonTxMode ( ) ; buffer . put ( ( byte ) ( embedded ? 1 : 0 ) ) ; buffer . put ( ( byte ) ( durable ? 1 : 0 ) ) ; if ( embedded ) { buffer . putInt ( object . size ( ) ) ; for ( OIdentifiable ids : object ) { LINK_SERIALIZER . serializeInByteBufferObject ( ids , buffer ) ; } } else { final OIndexRIDContainerSBTree underlying = ( OIndexRIDContainerSBTree ) object . getUnderlying ( ) ; final OBonsaiBucketPointer rootPointer = underlying . getRootPointer ( ) ; buffer . putLong ( rootPointer . getPageIndex ( ) ) ; buffer . putInt ( rootPointer . getPageOffset ( ) ) ; }


signature:
public class OStreamSerializerSBTreeIndexRIDContainer { /** * { @ inheritDoc } */
@ Override public OIndexRIDContainer deserializeFromByteBufferObject ( ByteBuffer buffer ) { } }

implementation: final long fileId = buffer . getLong ( ) ; final boolean embedded = buffer . get ( ) > 0 ; final boolean durable = buffer . get ( ) > 0 ; if ( embedded ) { final int size = buffer . getInt ( ) ; final Set < OIdentifiable > underlying = new HashSet < OIdentifiable > ( Math . max ( ( int ) ( size / .75f ) + 1 , 16 ) ) ; for ( int i = 0 ; i < size ; i ++ ) { underlying . add ( LINK_SERIALIZER . deserializeFromByteBufferObject ( buffer ) ) ; } return new OIndexRIDContainer ( fileId , underlying , durable ) ; } else { final long pageIndex = buffer . getLong ( ) ; final int pageOffset = buffer . getInt ( ) ; final OBonsaiBucketPointer rootPointer = new OBonsaiBucketPointer ( pageIndex , pageOffset ) ; final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal . instance ( ) . get ( ) ; final OIndexRIDContainerSBTree underlying = new OIndexRIDContainerSBTree ( fileId , rootPointer , ( OAbstractPaginatedStorage ) db . getStorage ( ) . getUnderlying ( ) ) ; return new OIndexRIDContainer ( fileId , underlying , durable ) ; }


signature:
public class OStreamSerializerSBTreeIndexRIDContainer { /** * { @ inheritDoc } */
@ Override public int getObjectSizeInByteBuffer ( ByteBuffer buffer ) { } }

implementation: final int offset = buffer . position ( ) ; buffer . position ( ) ; if ( buffer . get ( offset + EMBEDDED_OFFSET ) > 0 ) { return embeddedObjectSerializedSize ( buffer . getInt ( offset + EMBEDDED_SIZE_OFFSET ) ) ; } else { return SBTREE_CONTAINER_SIZE ; }


signature:
public class OStreamSerializerSBTreeIndexRIDContainer { /** * { @ inheritDoc } */
@ Override public OIndexRIDContainer deserializeFromByteBufferObject ( ByteBuffer buffer , OWALChanges walChanges , int offset ) { } }

implementation: final long fileId = walChanges . getLongValue ( buffer , offset + FILE_ID_OFFSET ) ; final boolean durable = walChanges . getByteValue ( buffer , offset + DURABLE_OFFSET ) > 0 ; if ( walChanges . getByteValue ( buffer , offset + EMBEDDED_OFFSET ) > 0 ) { final int size = walChanges . getIntValue ( buffer , offset + EMBEDDED_SIZE_OFFSET ) ; final Set < OIdentifiable > underlying = new HashSet < OIdentifiable > ( Math . max ( ( int ) ( size / .75f ) + 1 , 16 ) ) ; int p = offset + EMBEDDED_VALUES_OFFSET ; for ( int i = 0 ; i < size ; i ++ ) { underlying . add ( LINK_SERIALIZER . deserializeFromByteBufferObject ( buffer , walChanges , p ) ) ; p += RID_SIZE ; } return new OIndexRIDContainer ( fileId , underlying , durable ) ; } else { final long pageIndex = walChanges . getLongValue ( buffer , offset + SBTREE_ROOTINDEX_OFFSET ) ; final int pageOffset = walChanges . getIntValue ( buffer , offset + SBTREE_ROOTOFFSET_OFFSET ) ; final OBonsaiBucketPointer rootPointer = new OBonsaiBucketPointer ( pageIndex , pageOffset ) ; final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal . instance ( ) . get ( ) ; final OIndexRIDContainerSBTree underlying = new OIndexRIDContainerSBTree ( fileId , rootPointer , ( OAbstractPaginatedStorage ) db . getStorage ( ) . getUnderlying ( ) ) ; return new OIndexRIDContainer ( fileId , underlying , durable ) ; }


signature:
public class OStreamSerializerSBTreeIndexRIDContainer { /** * { @ inheritDoc } */
@ Override public int getObjectSizeInByteBuffer ( ByteBuffer buffer , OWALChanges walChanges , int offset ) { } }

implementation: if ( walChanges . getByteValue ( buffer , offset + EMBEDDED_OFFSET ) > 0 ) { return embeddedObjectSerializedSize ( walChanges . getIntValue ( buffer , offset + EMBEDDED_SIZE_OFFSET ) ) ; } else { return SBTREE_CONTAINER_SIZE ; }


signature:
public class OrientDB { /** * Open a database
 * @ param database the database to open
 * @ param user username of a database user or a server user allowed to open the database
 * @ param password related to the specified username
 * @ return the opened database */
public ODatabaseSession open ( String database , String user , String password ) { } }

implementation: return open ( database , user , password , OrientDBConfig . defaultConfig ( ) ) ;


signature:
public class OrientDB { /** * Open a database
 * @ param database the database to open
 * @ param user username of a database user or a server user allowed to open the database
 * @ param password related to the specified username
 * @ param config custom configuration for current database
 * @ return the opened database */
public ODatabaseSession open ( String database , String user , String password , OrientDBConfig config ) { } }

implementation: return internal . open ( database , user , password , config ) ;


signature:
public class OrientDB { /** * Create a new database
 * @ param database database name
 * @ param type can be plocal or memory */
public void create ( String database , ODatabaseType type ) { } }

implementation: create ( database , type , OrientDBConfig . defaultConfig ( ) ) ;


signature:
public class OrientDB { /** * Create a new database
 * @ param database database name
 * @ param type can be plocal or memory
 * @ param config custom configuration for current database */
public void create ( String database , ODatabaseType type , OrientDBConfig config ) { } }

implementation: this . internal . create ( database , serverUser , serverPassword , type , config ) ;


signature:
public class OrientDB { /** * Create a new database if not exists
 * @ param database database name
 * @ param type can be plocal or memory
 * @ return true if the database has been created , false if already exists */
public boolean createIfNotExists ( String database , ODatabaseType type ) { } }

implementation: return createIfNotExists ( database , type , OrientDBConfig . defaultConfig ( ) ) ;


signature:
public class OrientDB { /** * Create a new database if not exists
 * @ param database database name
 * @ param type can be plocal or memory
 * @ param config custom configuration for current database
 * @ return true if the database has been created , false if already exists */
public boolean createIfNotExists ( String database , ODatabaseType type , OrientDBConfig config ) { } }

implementation: if ( ! this . internal . exists ( database , serverUser , serverPassword ) ) { this . internal . create ( database , serverUser , serverPassword , type , config ) ; return true ; } return false ;


signature:
public class OChainedIndexProxy { /** * Create proxies that support maximum number of different operations . In case when several different indexes which support
 * different operations ( e . g . indexes of { @ code UNIQUE } and { @ code FULLTEXT } types ) are possible , the creates the only one index
 * of each type .
 * @ param longChain - property chain from the query , which should be evaluated
 * @ return proxies needed to process query . */
public static < T > Collection < OChainedIndexProxy < T > > createProxies ( OClass iSchemaClass , OSQLFilterItemField . FieldChain longChain ) { } }

implementation: List < OChainedIndexProxy < T > > proxies = new ArrayList < OChainedIndexProxy < T > > ( ) ; for ( List < OIndex < ? > > indexChain : getIndexesForChain ( iSchemaClass , longChain ) ) { proxies . add ( new OChainedIndexProxy < T > ( indexChain ) ) ; } return proxies ;


signature:
public class OChainedIndexProxy { /** * Finds the index that fits better as a base index in chain .
 * Requirements to the base index :
 * < ul >
 * < li > Should be unique or not unique . Other types cannot be used to get all documents with required links . < / li >
 * < li > Should not be composite hash index . As soon as hash index does not support partial match search . < / li >
 * < li > Composite index that ignores null values should not be used . < / li >
 * < li > Hash index is better than tree based indexes . < / li >
 * < li > Non composite indexes is better that composite . < / li >
 * < / ul >
 * @ param indexes where search
 * @ return the index that fits better as a base index in chain */
protected static OIndex < ? > findBestIndex ( Iterable < OIndex < ? > > indexes ) { } }

implementation: OIndex < ? > bestIndex = null ; for ( OIndex < ? > index : indexes ) { if ( priorityOfUsage ( index ) > priorityOfUsage ( bestIndex ) ) bestIndex = index ; } return bestIndex ;


signature:
public class OChainedIndexProxy { /** * { @ inheritDoc } */
@ Override public long getRebuildVersion ( ) { } }

implementation: long rebuildVersion = 0 ; for ( OIndex < ? > index : indexChain ) { rebuildVersion += index . getRebuildVersion ( ) ; } return rebuildVersion ;


signature:
public class OChainedIndexProxy { /** * { @ inheritDoc } */
@ Override public T get ( Object iKey ) { } }

implementation: final Object lastIndexResult = lastIndex . get ( iKey ) ; final Set < OIdentifiable > result = new HashSet < OIdentifiable > ( ) ; if ( lastIndexResult != null ) result . addAll ( applyTailIndexes ( lastIndexResult ) ) ; return ( T ) result ;


signature:
public class OChainedIndexProxy { /** * Make type conversion of keys for specific index .
 * @ param index - index for which keys prepared for .
 * @ param keys - which should be prepared .
 * @ return keys converted to necessary type . */
private Set < Comparable > prepareKeys ( OIndex < ? > index , Object keys ) { } }

implementation: final OIndexDefinition indexDefinition = index . getDefinition ( ) ; if ( keys instanceof Collection ) { final Set < Comparable > newKeys = new TreeSet < Comparable > ( ) ; for ( Object o : ( ( Collection ) keys ) ) { newKeys . add ( ( Comparable ) indexDefinition . createValue ( o ) ) ; } return newKeys ; } else { return Collections . singleton ( ( Comparable ) indexDefinition . createValue ( keys ) ) ; }


signature:
public class OChainedIndexProxy { /** * Register statistic information about usage of index in { @ link OProfilerStub } .
 * @ param index which usage is registering . */
private void updateStatistic ( OIndex < ? > index ) { } }

implementation: final OProfiler profiler = Orient . instance ( ) . getProfiler ( ) ; if ( profiler . isRecording ( ) ) { Orient . instance ( ) . getProfiler ( ) . updateCounter ( profiler . getDatabaseMetric ( index . getDatabaseName ( ) , "query.indexUsed" ) , "Used index in query" , + 1 ) ; final int paramCount = index . getDefinition ( ) . getParamCount ( ) ; if ( paramCount > 1 ) { final String profiler_prefix = profiler . getDatabaseMetric ( index . getDatabaseName ( ) , "query.compositeIndexUsed" ) ; profiler . updateCounter ( profiler_prefix , "Used composite index in query" , + 1 ) ; profiler . updateCounter ( profiler_prefix + "." + paramCount , "Used composite index in query with " + paramCount + " params" , + 1 ) ; } }


signature:
public class OWALSegmentCache { /** * Writes page with given page index to the cache and eventually writes it to the file . */
void writePage ( ByteBuffer page , long pageIndex ) throws IOException { } }

implementation: synchronized ( lockObject ) { lastAccessTime = System . nanoTime ( ) ; if ( pageIndex >= firstCachedPage && pageIndex <= firstCachedPage + pageCache . size ( ) ) { if ( pageIndex < firstCachedPage + pageCache . size ( ) ) { pageCache . set ( ( int ) ( pageIndex - firstCachedPage ) , page ) ; } else { pageCache . add ( page ) ; } } else if ( pageCache . isEmpty ( ) ) { pageCache . add ( page ) ; firstCachedPage = pageIndex ; } lastWrittenPage = page ; lastWrittenPageIndex = pageIndex ; if ( pageCache . size ( ) * OWALPage . PAGE_SIZE >= bufferSize + OWALPage . PAGE_SIZE ) { flushAllBufferPagesExceptLastOne ( ) ; } }


signature:
public class OWALSegmentCache { /** * Read page content with given index from cache or file . */
byte [ ] readPage ( long pageIndex ) throws IOException { } }

implementation: synchronized ( lockObject ) { lastAccessTime = System . nanoTime ( ) ; if ( pageIndex == lastWrittenPageIndex ) { return lastWrittenPage . array ( ) ; } if ( pageIndex >= firstCachedPage && pageIndex < firstCachedPage + pageCache . size ( ) ) { final ByteBuffer buffer = pageCache . get ( ( int ) ( pageIndex - firstCachedPage ) ) ; return buffer . array ( ) ; } final ByteBuffer buffer = ByteBuffer . allocate ( OWALPage . PAGE_SIZE ) . order ( ByteOrder . nativeOrder ( ) ) ; initFile ( ) ; segChannel . position ( pageIndex * OWALPage . PAGE_SIZE ) ; readByteBuffer ( buffer , segChannel ) ; return buffer . array ( ) ; }


signature:
public class OWALSegmentCache { /** * Flushes all buffered pages and truncates file till passed in page index */
void truncate ( long pageIndex ) throws IOException { } }

implementation: synchronized ( lockObject ) { lastAccessTime = System . nanoTime ( ) ; flushBuffer ( ) ; lastWrittenPageIndex = - 1 ; lastWrittenPage = null ; segChannel . truncate ( pageIndex * OWALPage . PAGE_SIZE ) ; }


signature:
public class OWALSegmentCache { /** * Reads page content from the cache to the < code > ByteBuffer < / code >
 * < code > ByteBuffer < / code > is not backed by the cache and can be freely changed */
ByteBuffer readPageBuffer ( long pageIndex ) throws IOException { } }

implementation: synchronized ( lockObject ) { lastAccessTime = System . nanoTime ( ) ; if ( pageIndex == lastWrittenPageIndex ) { final ByteBuffer copy = ByteBuffer . allocate ( OWALPage . PAGE_SIZE ) . order ( ByteOrder . nativeOrder ( ) ) ; lastWrittenPage . position ( 0 ) ; copy . put ( lastWrittenPage ) ; return copy ; } if ( pageIndex >= firstCachedPage && pageIndex < firstCachedPage + pageCache . size ( ) ) { final ByteBuffer buffer = pageCache . get ( ( int ) ( pageIndex - firstCachedPage ) ) ; final ByteBuffer copy = ByteBuffer . allocate ( OWALPage . PAGE_SIZE ) . order ( ByteOrder . nativeOrder ( ) ) ; buffer . position ( 0 ) ; copy . put ( buffer ) ; return copy ; } final ByteBuffer buffer = ByteBuffer . allocate ( OWALPage . PAGE_SIZE ) . order ( ByteOrder . nativeOrder ( ) ) ; initFile ( ) ; segChannel . position ( pageIndex * OWALPage . PAGE_SIZE ) ; readByteBuffer ( buffer , segChannel ) ; buffer . position ( 0 ) ; return buffer ; }


signature:
public class OWALSegmentCache { /** * Writes cache content to the file and performs < code > fsync < / code > */
public void sync ( ) throws IOException { } }

implementation: synchronized ( lockObject ) { if ( segChannel != null ) { lastAccessTime = System . nanoTime ( ) ; flushBuffer ( ) ; segChannel . force ( false ) ; } }


signature:
public class OWALSegmentCache { /** * Writes cache content to the file and closes it .
 * Calls < code > fsync < / code > if needed . */
public void close ( boolean flush ) { } }

implementation: closer . shutdown ( ) ; try { if ( ! closer . awaitTermination ( CLOSER_TIMEOUT_MIN , TimeUnit . MINUTES ) ) { OLogManager . instance ( ) . error ( this , "Can not close file " + path . getFileName ( ) , null ) ; } else { synchronized ( lockObject ) { try { if ( segChannel != null ) { closeFile ( flush ) ; } } catch ( IOException ioe ) { OLogManager . instance ( ) . error ( this , "Can not close file " + path . getFileName ( ) , ioe ) ; } } } } catch ( InterruptedException ie ) { OLogManager . instance ( ) . warn ( this , "WAL file " + path . getFileName ( ) + " close was interrupted" , ie ) ; }


signature:
public class OWALSegmentCache { /** * Initializes cache and opens underlying file . */
public void open ( ) throws IOException { } }

implementation: synchronized ( lockObject ) { lastAccessTime = System . nanoTime ( ) ; initFile ( ) ; long pagesCount = segChannel . size ( ) / OWALPage . PAGE_SIZE ; if ( segChannel . size ( ) % OWALPage . PAGE_SIZE > 0 ) { OLogManager . instance ( ) . error ( this , "Last WAL page was written partially, auto fix" , null ) ; segChannel . truncate ( OWALPage . PAGE_SIZE * pagesCount ) ; } firstCachedPage = - 1 ; pageCache . clear ( ) ; lastWrittenPage = null ; lastWrittenPageIndex = - 1 ; }


signature:
public class OWALPageV2 { /** * { @ inheritDoc } */
@ Override public byte [ ] getRecord ( int position ) { } }

implementation: buffer . position ( position + 2 ) ; final int recordSize = buffer . getInt ( ) ; final byte [ ] record = new byte [ recordSize ] ; buffer . get ( record ) ; return record ;


signature:
public class ODistributedConfiguration { /** * Returns true if the replication is active , otherwise false .
 * @ param iClusterName Cluster name , or null for * */
public boolean isReplicationActive ( final String iClusterName , final String iLocalNode ) { } }

implementation: final Collection < String > servers = getClusterConfiguration ( iClusterName ) . field ( SERVERS ) ; if ( servers != null && ! servers . isEmpty ( ) ) { return true ; } return false ;


signature:
public class ODistributedConfiguration { /** * Returns the new node strategy between " dynamic " and " static " . If static , the node is registered under the " server " tag .
 * @ return NEW _ NODE _ STRATEGIES enum */
public NEW_NODE_STRATEGIES getNewNodeStrategy ( ) { } }

implementation: final String value = configuration . field ( NEW_NODE_STRATEGY ) ; if ( value != null ) return NEW_NODE_STRATEGIES . valueOf ( value . toUpperCase ( Locale . ENGLISH ) ) ; return NEW_NODE_STRATEGIES . STATIC ;


signature:
public class ODistributedConfiguration { /** * Returns the execution mode if synchronous .
 * @ param iClusterName Cluster name , or null for *
 * @ return true = synchronous , false = asynchronous , null = undefined */
public Boolean isExecutionModeSynchronous ( final String iClusterName ) { } }

implementation: Object value = getClusterConfiguration ( iClusterName ) . field ( EXECUTION_MODE ) ; if ( value == null ) { value = configuration . field ( EXECUTION_MODE ) ; if ( value == null ) return null ; } if ( value . toString ( ) . equalsIgnoreCase ( "undefined" ) ) return null ; return value . toString ( ) . equalsIgnoreCase ( EXECUTION_MODE_SYNCHRONOUS ) ;


signature:
public class ODistributedConfiguration { /** * Reads your writes .
 * @ param iClusterName Cluster name , or null for * */
public Boolean isReadYourWrites ( final String iClusterName ) { } }

implementation: Object value = getClusterConfiguration ( iClusterName ) . field ( READ_YOUR_WRITES ) ; if ( value == null ) { value = configuration . field ( READ_YOUR_WRITES ) ; if ( value == null ) { OLogManager . instance ( ) . warn ( this , "%s setting not found for cluster=%s in distributed-config.json" , READ_YOUR_WRITES , iClusterName ) ; return true ; } } return ( Boolean ) value ;


signature:
public class ODistributedConfiguration { /** * Returns the list of servers that can manage a list of clusters . The algorithm makes its best to involve the less servers as it
 * can .
 * @ param iClusterNames Set of cluster names to find
 * @ param iLocalNode Local node name */
public Map < String , Collection < String > > getServerClusterMap ( Collection < String > iClusterNames , final String iLocalNode , final boolean optimizeForLocalOnly ) { } }

implementation:
if ( iClusterNames == null || iClusterNames . isEmpty ( ) ) iClusterNames = DEFAULT_CLUSTER_NAME ; final Map < String , Collection < String > > servers = new HashMap < String , Collection < String > > ( iClusterNames . size ( ) ) ; // TRY TO SEE IF IT CAN BE EXECUTED ON LOCAL NODE ONLY
boolean canUseLocalNode = true ; for ( String p : iClusterNames ) { final List < String > serverList = getClusterConfiguration ( p ) . field ( SERVERS ) ; if ( serverList != null && ! serverList . contains ( iLocalNode ) ) { canUseLocalNode = false ; break ; } } if ( optimizeForLocalOnly && canUseLocalNode ) { // USE LOCAL NODE ONLY ( MUCH FASTER )
servers . put ( iLocalNode , iClusterNames ) ; return servers ; } // GROUP BY SERVER WITH THE NUMBER OF CLUSTERS
final Map < String , Collection < String > > serverMap = new HashMap < String , Collection < String > > ( ) ; for ( String p : iClusterNames ) { final List < String > serverList = getClusterConfiguration ( p ) . field ( SERVERS ) ; for ( String s : serverList ) { if ( NEW_NODE_TAG . equalsIgnoreCase ( s ) ) continue ; Collection < String > clustersInServer = serverMap . get ( s ) ; if ( clustersInServer == null ) { clustersInServer = new HashSet < String > ( ) ; serverMap . put ( s , clustersInServer ) ; } clustersInServer . add ( p ) ; } } if ( serverMap . size ( ) == 1 ) // RETURN THE ONLY SERVER INVOLVED
return serverMap ; if ( ! optimizeForLocalOnly ) return serverMap ; // ORDER BY NUMBER OF CLUSTERS
final List < String > orderedServers = new ArrayList < String > ( serverMap . keySet ( ) ) ; Collections . sort ( orderedServers , new Comparator < String > ( ) { @ Override public int compare ( final String o1 , final String o2 ) { return ( ( Integer ) serverMap . get ( o2 ) . size ( ) ) . compareTo ( ( Integer ) serverMap . get ( o1 ) . size ( ) ) ; } } ) ; // BROWSER ORDERED SERVER MAP PUTTING THE MINIMUM SERVER TO COVER ALL THE CLUSTERS
final Set < String > remainingClusters = new HashSet < String > ( iClusterNames ) ; // KEEPS THE REMAINING CLUSTER TO ADD IN FINAL
// RESULT
final Set < String > includedClusters = new HashSet < String > ( iClusterNames . size ( ) ) ; // KEEPS THE COLLECTION OF ALREADY INCLUDED
// CLUSTERS
for ( String s : orderedServers ) { final Collection < String > clusters = serverMap . get ( s ) ; if ( ! servers . isEmpty ( ) ) { // FILTER CLUSTER LIST AVOIDING TO REPEAT CLUSTERS ALREADY INCLUDED ON PREVIOUS NODES
clusters . removeAll ( includedClusters ) ; } servers . put ( s , clusters ) ; remainingClusters . removeAll ( clusters ) ; includedClusters . addAll ( clusters ) ; if ( remainingClusters . isEmpty ( ) ) // FOUND ALL CLUSTERS
break ; } return servers ;


signature:
public class ODistributedConfiguration { /** * Returns the clusters where a server is owner . This is used when a cluster must be selected : locality is always the best choice .
 * @ param iClusterNames Set of cluster names
 * @ param iNode Node */
public List < String > getOwnedClustersByServer ( Collection < String > iClusterNames , final String iNode ) { } }

implementation:
if ( iClusterNames == null || iClusterNames . isEmpty ( ) ) iClusterNames = DEFAULT_CLUSTER_NAME ; final List < String > notDefinedClusters = new ArrayList < String > ( 5 ) ; final List < String > candidates = new ArrayList < String > ( 5 ) ; for ( String p : iClusterNames ) { if ( p == null ) continue ; final String ownerServer = getClusterOwner ( p ) ; if ( ownerServer == null ) notDefinedClusters . add ( p ) ; else if ( iNode . equals ( ownerServer ) ) { // COLLECT AS CANDIDATE
candidates . add ( p ) ; } } if ( ! candidates . isEmpty ( ) ) // RETURN THE FIRST ONE
return candidates ; final String owner = getClusterOwner ( ALL_WILDCARD ) ; if ( iNode . equals ( owner ) ) // CURRENT SERVER IS MASTER OF DEFAULT : RETURN ALL THE NON CONFIGURED CLUSTERS
return notDefinedClusters ; // NO MASTER FOUND , RETURN EMPTY LIST
return candidates ;


signature:
public class ODistributedConfiguration { /** * Returns the set of server names involved on the passed cluster collection .
 * @ param iClusterNames Collection of cluster names to find */
public Set < String > getServers ( Collection < String > iClusterNames ) { } }

implementation: if ( iClusterNames == null || iClusterNames . isEmpty ( ) ) return getAllConfiguredServers ( ) ; final Set < String > partitions = new HashSet < String > ( iClusterNames . size ( ) ) ; for ( String p : iClusterNames ) { final List < String > serverList = getClusterConfiguration ( p ) . field ( SERVERS ) ; if ( serverList != null ) { for ( String s : serverList ) if ( ! s . equals ( NEW_NODE_TAG ) ) partitions . add ( s ) ; } } return partitions ;


signature:
public class ODistributedConfiguration { /** * Returns true if the local server has all the requested clusters .
 * @ param server Server name
 * @ param clusters Collection of cluster names to find */
public boolean isServerContainingAllClusters ( final String server , Collection < String > clusters ) { } }

implementation: if ( clusters == null || clusters . isEmpty ( ) ) clusters = DEFAULT_CLUSTER_NAME ; for ( String cluster : clusters ) { final List < String > serverList = getClusterConfiguration ( cluster ) . field ( SERVERS ) ; if ( serverList != null ) { if ( ! serverList . contains ( server ) ) return false ; } } return true ;


signature:
public class ODistributedConfiguration { /** * Returns true if the local server has the requested cluster .
 * @ param server Server name
 * @ param cluster cluster names to find */
public boolean isServerContainingCluster ( final String server , String cluster ) { } }

implementation: if ( cluster == null ) cluster = ALL_WILDCARD ; final List < String > serverList = getClusterConfiguration ( cluster ) . field ( SERVERS ) ; if ( serverList != null ) { return serverList . contains ( server ) ; } return true ;


signature:
public class ODistributedConfiguration { /** * Returns the server list for the requested cluster cluster excluding any tags like < NEW _ NODES > and iExclude if any .
 * @ param iClusterName Cluster name , or null for *
 * @ param iExclude Node to exclude */
public List < String > getServers ( final String iClusterName , final String iExclude ) { } }

implementation:
final List < String > serverList = getClusterConfiguration ( iClusterName ) . field ( SERVERS ) ; if ( serverList != null ) { // COPY AND REMOVE ANY NEW _ NODE _ TAG
List < String > filteredServerList = new ArrayList < String > ( serverList . size ( ) ) ; for ( String s : serverList ) { if ( ! s . equals ( NEW_NODE_TAG ) && ( iExclude == null || ! iExclude . equals ( s ) ) ) filteredServerList . add ( s ) ; } return filteredServerList ; } return Collections . EMPTY_LIST ;


signature:
public class ODistributedConfiguration { /** * Returns an ordered list of master server . The first in the list is the first found in configuration . This is used to determine
 * the cluster leader . */
public List < String > getMasterServers ( ) { } }

implementation:
final List < String > serverList = getClusterConfiguration ( null ) . field ( SERVERS ) ; if ( serverList != null ) { // COPY AND REMOVE ANY NEW _ NODE _ TAG
List < String > masters = new ArrayList < String > ( serverList . size ( ) ) ; for ( String s : serverList ) { if ( ! s . equals ( NEW_NODE_TAG ) ) masters . add ( s ) ; } final ROLES defRole = getDefaultServerRole ( ) ; final ODocument servers = configuration . field ( SERVERS ) ; if ( servers != null ) { for ( Iterator < String > it = masters . iterator ( ) ; it . hasNext ( ) ; ) { final String server = it . next ( ) ; final String roleAsString = servers . field ( server ) ; final ROLES role = roleAsString != null ? ROLES . valueOf ( roleAsString . toUpperCase ( Locale . ENGLISH ) ) : defRole ; if ( role != ROLES . MASTER ) it . remove ( ) ; } } return masters ; } return Collections . EMPTY_LIST ;


signature:
public class ODistributedConfiguration { /** * Returns the complete list of servers found in configuration . */
public Set < String > getAllConfiguredServers ( ) { } }

implementation: final Set < String > servers = new HashSet < String > ( ) ; for ( String p : getClusterNames ( ) ) { final List < String > serverList = getClusterConfiguration ( p ) . field ( SERVERS ) ; if ( serverList != null ) { for ( String s : serverList ) if ( ! s . equals ( NEW_NODE_TAG ) ) servers . add ( s ) ; } } return servers ;


signature:
public class ODistributedConfiguration { /** * Returns the set of clusters managed by a server .
 * @ param iNodeName Server name */
public Set < String > getClustersOnServer ( final String iNodeName ) { } }

implementation: final Set < String > clusters = new HashSet < String > ( ) ; for ( String cl : getClusterNames ( ) ) { final List < String > servers = getServers ( cl , null ) ; if ( servers . contains ( iNodeName ) ) clusters . add ( cl ) ; } return clusters ;


signature:
public class ODistributedConfiguration { /** * Returns the set of clusters where server is the owner .
 * @ param iNodeName Server name */
public Set < String > getClustersOwnedByServer ( final String iNodeName ) { } }

implementation: final Set < String > clusters = new HashSet < String > ( ) ; for ( String cl : getClusterNames ( ) ) { if ( iNodeName . equals ( getClusterOwner ( cl ) ) ) clusters . add ( cl ) ; } return clusters ;


signature:
public class ODistributedConfiguration { /** * Returns the owner server for the given cluster excluding the passed node . The Owner server is the first in server list .
 * @ param iClusterName Cluster name , or null for * */
public String getClusterOwner ( final String iClusterName ) { } }

implementation:
String owner ; final ODocument clusters = getConfiguredClusters ( ) ; // GET THE CLUSTER CFG
final ODocument cfg = iClusterName != null ? ( ODocument ) clusters . field ( iClusterName ) : null ; if ( cfg != null ) { owner = cfg . field ( OWNER ) ; if ( owner != null ) return owner ; final List < String > serverList = cfg . field ( SERVERS ) ; if ( serverList != null && ! serverList . isEmpty ( ) ) { // RETURN THE FIRST ONE
owner = serverList . get ( 0 ) ; if ( NEW_NODE_TAG . equals ( owner ) && serverList . size ( ) > 1 ) // DON ' T RETURN < NEW _ NODE >
owner = serverList . get ( 1 ) ; } } else // RETURN THE OWNER OF *
return getClusterOwner ( ALL_WILDCARD ) ; return owner ;


signature:
public class ODistributedConfiguration { /** * Returns the static owner server for the given cluster .
 * @ param iClusterName Cluster name , or null for * */
public String getConfiguredClusterOwner ( final String iClusterName ) { } }

implementation:
String owner = null ; final ODocument clusters = getConfiguredClusters ( ) ; // GET THE CLUSTER CFG
final ODocument cfg = clusters . field ( iClusterName ) ; if ( cfg != null ) owner = cfg . field ( OWNER ) ; return owner ;


signature:
public class ODistributedConfiguration { /** * Returns the configured server list for the requested cluster .
 * @ param iClusterName Cluster name , or null for * */
public List < String > getConfiguredServers ( final String iClusterName ) { } }

implementation: final Collection < ? extends String > list = ( Collection < ? extends String > ) getClusterConfiguration ( iClusterName ) . field ( SERVERS ) ; return list != null ? new ArrayList < String > ( list ) : null ;


signature:
public class ODistributedConfiguration { /** * Returns the server role between MASTER ( default ) and REPLICA . */
public ROLES getServerRole ( final String iServerName ) { } }

implementation:
final ODocument servers = configuration . field ( SERVERS ) ; if ( servers == null ) // DEFAULT : MASTER
return ROLES . MASTER ; String role = servers . field ( iServerName ) ; if ( role == null ) { // DEFAULT : MASTER
role = servers . field ( ALL_WILDCARD ) ; if ( role == null ) // DEFAULT : MASTER
return ROLES . MASTER ; } return ROLES . valueOf ( role . toUpperCase ( Locale . ENGLISH ) ) ;


signature:
public class ODistributedConfiguration { /** * Returns the registered servers . */
public Set < String > getRegisteredServers ( ) { } }

implementation: final ODocument servers = configuration . field ( SERVERS ) ; final Set < String > result = new HashSet < String > ( ) ; if ( servers != null ) for ( String s : servers . fieldNames ( ) ) result . add ( s ) ; return result ;


signature:
public class ODistributedConfiguration { /** * Returns all the configured data centers ' names , if any . */
public Set < String > getDataCenters ( ) { } }

implementation: final ODocument dcs = configuration . field ( DCS ) ; if ( dcs == null ) return Collections . EMPTY_SET ; final Set < String > result = new HashSet < String > ( ) ; for ( String dc : dcs . fieldNames ( ) ) { result . add ( dc ) ; } return result ;


signature:
public class ODistributedConfiguration { /** * Returns the data center write quorum .
 * @ param dataCenter Data center name */
public int getDataCenterWriteQuorum ( final String dataCenter ) { } }

implementation: final ODocument dc = getDataCenterConfiguration ( dataCenter ) ; Object wq = dc . field ( WRITE_QUORUM ) ; if ( wq instanceof String ) { if ( wq . toString ( ) . equalsIgnoreCase ( ODistributedConfiguration . QUORUM_MAJORITY ) ) { final List < String > servers = dc . field ( SERVERS ) ; wq = servers . size ( ) / 2 + 1 ; } else if ( wq . toString ( ) . equalsIgnoreCase ( ODistributedConfiguration . QUORUM_ALL ) ) { final List < String > servers = dc . field ( SERVERS ) ; wq = servers . size ( ) ; } } return ( Integer ) wq ;


signature:
public class ODistributedConfiguration { /** * Returns true if the database is sharded across servers . False if it ' s completely replicated . */
public boolean isSharded ( ) { } }

implementation: final ODocument allCluster = getClusterConfiguration ( ALL_WILDCARD ) ; if ( allCluster != null ) { final List < String > allServers = allCluster . field ( SERVERS ) ; if ( allServers != null && ! allServers . isEmpty ( ) ) { for ( String cl : getClusterNames ( ) ) { final List < String > servers = getServers ( cl , null ) ; if ( servers != null && ! servers . isEmpty ( ) && ! allServers . containsAll ( servers ) ) return false ; } } } return false ;


signature:
public class ODistributedConfiguration { /** * Returns the list of servers in a data center .
 * @ param dataCenter Data center name
 * @ throws OConfigurationException if the list of servers is not found in data center configuration */
public List < String > getDataCenterServers ( final String dataCenter ) { } }

implementation: final ODocument dc = getDataCenterConfiguration ( dataCenter ) ; final List < String > servers = dc . field ( SERVERS ) ; if ( servers == null || servers . isEmpty ( ) ) throw new OConfigurationException ( "Data center '" + dataCenter + "' does not contain any server in distributed database configuration" ) ; return new ArrayList < String > ( servers ) ;


signature:
public class ODistributedConfiguration { /** * Returns the data center where the server belongs .
 * @ param server Server name */
public String getDataCenterOfServer ( final String server ) { } }

implementation:
final ODocument dcs = configuration . field ( DCS ) ; if ( dcs != null ) { for ( String dc : dcs . fieldNames ( ) ) { final ODocument dcConfig = dcs . field ( dc ) ; if ( dcConfig != null ) { final List < String > dcServers = dcConfig . field ( "servers" ) ; if ( dcServers != null && ! dcServers . isEmpty ( ) ) { if ( dcServers . contains ( server ) ) // FOUND
return dc ; } } } } // NOT FOUND
return null ;


signature:
public class ODistributedConfiguration { /** * Returns the global read quorum .
 * @ param iClusterName Cluster name , or null for * */
public Object getGlobalReadQuorum ( final String iClusterName ) { } }

implementation: Object value = getClusterConfiguration ( iClusterName ) . field ( READ_QUORUM ) ; if ( value == null ) value = configuration . field ( READ_QUORUM ) ; return value ;


signature:
public class ODistributedConfiguration { /** * Returns the read quorum .
 * @ param clusterName Cluster name , or null for *
 * @ param totalConfiguredServers Total node available */
public int getReadQuorum ( final String clusterName , final int totalConfiguredServers , final String server ) { } }

implementation: return getQuorum ( "readQuorum" , clusterName , totalConfiguredServers , DEFAULT_READ_QUORUM , server ) ;


signature:
public class ODistributedConfiguration { /** * Returns the write quorum .
 * @ param clusterName Cluster name , or null for *
 * @ param totalConfiguredMasterServers Total node available */
public int getWriteQuorum ( final String clusterName , final int totalConfiguredMasterServers , final String server ) { } }

implementation: Integer overWrite = overwriteWriteQuorum . get ( ) ; if ( overWrite != null ) return overWrite . intValue ( ) ; else return getQuorum ( "writeQuorum" , clusterName , totalConfiguredMasterServers , DEFAULT_WRITE_QUORUM , server ) ;


signature:
public class ODistributedConfiguration { /** * Gets the document representing the cluster configuration .
 * @ param iClusterName Cluster name , or null for *
 * @ return Always a ODocument
 * @ throws OConfigurationException in case " clusters " field is not found in configuration */
protected ODocument getClusterConfiguration ( String iClusterName ) { } }

implementation:
final ODocument clusters = getConfiguredClusters ( ) ; if ( iClusterName == null ) iClusterName = ALL_WILDCARD ; final ODocument cfg ; if ( ! clusters . containsField ( iClusterName ) ) // NO CLUSTER IN CFG : GET THE DEFAULT ONE
cfg = clusters . field ( ALL_WILDCARD ) ; else // GET THE CLUSTER CFG
cfg = clusters . field ( iClusterName ) ; if ( cfg == null ) return new ODocument ( ) ; return cfg ;


signature:
public class ODistributedConfiguration { /** * Gets the document representing the dc configuration .
 * @ param dataCenter Data center name
 * @ return Always a ODocument
 * @ throws OConfigurationException if the data center configuration is not found */
private ODocument getDataCenterConfiguration ( final String dataCenter ) { } }

implementation: final ODocument dcs = configuration . field ( DCS ) ; if ( dcs != null ) return dcs . field ( dataCenter ) ; throw new OConfigurationException ( "Cannot find the data center '" + dataCenter + "' in distributed database configuration" ) ;


signature:
public class ODistributedConfiguration { /** * Returns the read quorum .
 * @ param iClusterName Cluster name , or null for *
 * @ param totalServers Total nodes available */
private int getQuorum ( final String quorumSetting , final String iClusterName , final int totalServers , final Object defaultValue , final String server ) { } }

implementation: Object value = getClusterConfiguration ( iClusterName ) . field ( quorumSetting ) ; if ( value == null ) { value = configuration . field ( quorumSetting ) ; if ( value == null ) { OLogManager . instance ( ) . warn ( this , "%s setting not found for cluster=%s in distributed-config.json" , quorumSetting , iClusterName ) ; value = defaultValue ; } } if ( value instanceof String ) { if ( value . toString ( ) . equalsIgnoreCase ( QUORUM_MAJORITY ) ) value = totalServers / 2 + 1 ; else if ( value . toString ( ) . equalsIgnoreCase ( QUORUM_ALL ) ) value = totalServers ; else if ( value . toString ( ) . equalsIgnoreCase ( QUORUM_LOCAL_DC ) ) { final String dc = getDataCenterOfServer ( server ) ; if ( dc == null ) throw new OConfigurationException ( "Data center not specified for server '" + server + "' in distributed configuration" ) ; value = getDataCenterWriteQuorum ( dc ) ; } else throw new OConfigurationException ( "The value '" + value + "' is not supported for " + quorumSetting + " in distributed configuration" ) ; } return ( Integer ) value ;


signature:
public class OrientBaseGraph { /** * Internal use only . */
public static void clearInitStack ( ) { } }

implementation: final ThreadLocal < Deque < OrientBaseGraph > > is = initializationStack ; if ( is != null ) is . get ( ) . clear ( ) ; final ThreadLocal < OrientBaseGraph > ag = activeGraph ; if ( ag != null ) ag . remove ( ) ;


signature:
public class OrientBaseGraph { /** * ( Internal ) */
public static void encodeClassNames ( final String ... iLabels ) { } }

implementation:
if ( iLabels != null ) // ENCODE LABELS
for ( int i = 0 ; i < iLabels . length ; ++ i ) iLabels [ i ] = encodeClassName ( iLabels [ i ] ) ;


signature:
public class OrientBaseGraph { /** * ( Internal ) Returns the case sensitive edge class names . */
public static void getEdgeClassNames ( final OrientBaseGraph graph , final String ... iLabels ) { } }

implementation:
if ( iLabels != null && graph != null && graph . isUseClassForEdgeLabel ( ) ) { for ( int i = 0 ; i < iLabels . length ; ++ i ) { final OrientEdgeType edgeType = graph . getEdgeType ( iLabels [ i ] ) ; if ( edgeType != null ) // OVERWRITE CLASS NAME BECAUSE ATTRIBUTES ARE CASE SENSITIVE
iLabels [ i ] = edgeType . getName ( ) ; } }


signature:
public class OrientBaseGraph { /** * ( Internal ) */
public static String encodeClassName ( String iClassName ) { } }

implementation:
if ( iClassName == null ) return null ; if ( Character . isDigit ( iClassName . charAt ( 0 ) ) ) iClassName = "-" + iClassName ; try { return URLEncoder . encode ( iClassName , "UTF-8" ) . replaceAll ( "\\." , "%2E" ) ; // encode invalid ' . '
} catch ( UnsupportedEncodingException e ) { OLogManager . instance ( ) . error ( null , "Error on encoding class name using encoding '%s'" , e , "UTF-8" ) ; return iClassName ; }


signature:
public class OrientBaseGraph { /** * ( Internal ) */
public static String decodeClassName ( String iClassName ) { } }

implementation: if ( iClassName == null ) return null ; if ( iClassName . charAt ( 0 ) == '-' ) iClassName = iClassName . substring ( 1 ) ; try { return URLDecoder . decode ( iClassName , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { OLogManager . instance ( ) . error ( null , "Error on decoding class name using encoding '%s'" , e , "UTF-8" ) ; return iClassName ; }


signature:
public class OrientBaseGraph { /** * ( Blueprints Extension ) Configure the Graph instance .
 * @ param iSetting Settings object containing all the settings */
public OrientBaseGraph configure ( final Settings iSetting ) { } }

implementation: makeActive ( ) ; if ( iSetting != null ) { if ( settings == null ) { settings = iSetting ; } else { settings . copyFrom ( iSetting ) ; } } return this ;


signature:
public class OrientBaseGraph { /** * Returns an index by name and class
 * @ param indexName Index name
 * @ param indexClass Class as one or subclass of Vertex . class and Edge . class
 * @ return Index instance */
@ SuppressWarnings ( "unchecked" ) @ Override public < T extends Element > Index < T > getIndex ( final String indexName , final Class < T > indexClass ) { } }

implementation: makeActive ( ) ; final OIndexManager indexManager = getDatabase ( ) . getMetadata ( ) . getIndexManager ( ) ; final OIndex idx = indexManager . getIndex ( indexName ) ; if ( idx == null || ! hasIndexClass ( idx ) ) return null ; final Index < ? extends Element > index = new OrientIndex ( this , idx ) ; if ( indexClass . isAssignableFrom ( index . getIndexClass ( ) ) ) return ( Index < T > ) index ; else throw ExceptionFactory . indexDoesNotSupportClass ( indexName , indexClass ) ;


signature:
public class OrientBaseGraph { /** * Drops an index by name .
 * @ param indexName Index name */
public void dropIndex ( final String indexName ) { } }

implementation: makeActive ( ) ; executeOutsideTx ( new OCallable < Object , OrientBaseGraph > ( ) { @ Override public Object call ( OrientBaseGraph g ) { try { final OIndexManager indexManager = getRawGraph ( ) . getMetadata ( ) . getIndexManager ( ) ; final OIndex index = indexManager . getIndex ( indexName ) ; ODocument metadata = index . getConfiguration ( ) . field ( "metadata" ) ; String recordMapIndexName = null ; if ( metadata != null ) { recordMapIndexName = metadata . field ( OrientIndex . CONFIG_RECORD_MAP_NAME ) ; } indexManager . dropIndex ( indexName ) ; if ( recordMapIndexName != null ) getRawGraph ( ) . getMetadata ( ) . getIndexManager ( ) . dropIndex ( recordMapIndexName ) ; saveIndexConfiguration ( ) ; return null ; } catch ( Exception e ) { g . rollback ( ) ; throw new RuntimeException ( e . getMessage ( ) , e ) ; } } } , "drop index '" , indexName , "'" ) ;


signature:
public class OrientBaseGraph { /** * Creates a new unconnected vertex with no fields in the Graph .
 * @ param id Optional , can contains the Vertex ' s class name by prefixing with " class : "
 * @ return The new OrientVertex created */
@ Override public OrientVertex addVertex ( final Object id ) { } }

implementation: makeActive ( ) ; return addVertex ( id , ( Object [ ] ) null ) ;


signature:
public class OrientBaseGraph { /** * ( Blueprints Extension ) Creates a new unconnected vertex in the Graph setting the initial field values .
 * @ param id Optional , can contains the Vertex ' s class name by prefixing with " class : "
 * @ param prop Fields must be a odd pairs of key / value or a single object as Map containing entries as key / value pairs
 * @ return The new OrientVertex created */
public OrientVertex addVertex ( Object id , final Object ... prop ) { } }

implementation:
makeActive ( ) ; String className = null ; String clusterName = null ; Object [ ] fields = null ; if ( id != null ) { if ( id instanceof String ) { // PARSE ARGUMENTS
final String [ ] args = ( ( String ) id ) . split ( "," ) ; for ( String s : args ) { if ( s . startsWith ( CLASS_PREFIX ) ) // GET THE CLASS NAME
className = s . substring ( CLASS_PREFIX . length ( ) ) ; else if ( s . startsWith ( CLUSTER_PREFIX ) ) // GET THE CLASS NAME
clusterName = s . substring ( CLUSTER_PREFIX . length ( ) ) ; else id = s ; } } if ( isSaveOriginalIds ( ) ) // SAVE THE ID TOO
fields = new Object [ ] { OrientElement . DEF_ORIGINAL_ID_FIELDNAME , id } ; } setCurrentGraphInThreadLocal ( ) ; autoStartTransaction ( ) ; final OrientVertex vertex = getVertexInstance ( className , fields ) ; vertex . setPropertiesInternal ( prop ) ; // SAVE IT
if ( clusterName != null ) vertex . save ( clusterName ) ; else vertex . save ( ) ; return vertex ;


signature:
public class OrientBaseGraph { /** * ( Blueprints Extension ) Creates a new unconnected vertex with no fields of specific class in a cluster in the Graph .
 * @ param iClassName Vertex class name
 * @ param iClusterName Vertex cluster name
 * @ return New vertex created */
public OrientVertex addVertex ( final String iClassName , final String iClusterName ) { } }

implementation:
makeActive ( ) ; setCurrentGraphInThreadLocal ( ) ; autoStartTransaction ( ) ; final OrientVertex vertex = getVertexInstance ( iClassName ) ; // SAVE IT
if ( iClusterName != null ) vertex . save ( iClusterName ) ; else vertex . save ( ) ; return vertex ;


signature:
public class OrientBaseGraph { /** * ( Blueprints Extension ) Creates a temporary vertex setting the initial field values . The vertex is not saved and the transaction
 * is not started .
 * @ param iClassName Vertex ' s class name
 * @ param prop Fields must be a odd pairs of key / value or a single object as Map containing entries as key / value pairs
 * @ return added vertex */
public OrientVertex addTemporaryVertex ( final String iClassName , final Object ... prop ) { } }

implementation: makeActive ( ) ; setCurrentGraphInThreadLocal ( ) ; autoStartTransaction ( ) ; final OrientVertex vertex = getVertexInstance ( iClassName ) ; vertex . setPropertiesInternal ( prop ) ; return vertex ;


signature:
public class OrientBaseGraph { /** * Creates an edge between a source Vertex and a destination Vertex setting label as Edge ' s label .
 * @ param id Optional , can contains the Edge ' s class name by prefixing with " class : "
 * @ param outVertex Source vertex
 * @ param inVertex Destination vertex
 * @ param label Edge ' s label */
@ Override public OrientEdge addEdge ( final Object id , Vertex outVertex , Vertex inVertex , final String label ) { } }

implementation:
makeActive ( ) ; String className = null ; String clusterName = null ; if ( id != null ) { if ( id instanceof String ) { // PARSE ARGUMENTS
final String [ ] args = ( ( String ) id ) . split ( "," ) ; for ( String s : args ) { if ( s . startsWith ( CLASS_PREFIX ) ) // GET THE CLASS NAME
className = s . substring ( CLASS_PREFIX . length ( ) ) ; else if ( s . startsWith ( CLUSTER_PREFIX ) ) // GET THE CLASS NAME
clusterName = s . substring ( CLUSTER_PREFIX . length ( ) ) ; } } } // SAVE THE ID TOO ?
final Object [ ] fields = isSaveOriginalIds ( ) && id != null ? new Object [ ] { OrientElement . DEF_ORIGINAL_ID_FIELDNAME , id } : null ; if ( outVertex instanceof PartitionVertex ) // WRAPPED : GET THE BASE VERTEX
outVertex = ( ( PartitionVertex ) outVertex ) . getBaseVertex ( ) ; if ( inVertex instanceof PartitionVertex ) // WRAPPED : GET THE BASE VERTEX
inVertex = ( ( PartitionVertex ) inVertex ) . getBaseVertex ( ) ; return ( ( OrientVertex ) outVertex ) . addEdge ( label , ( OrientVertex ) inVertex , className , clusterName , fields ) ;


signature:
public class OrientBaseGraph { /** * Returns a vertex by an ID .
 * @ param id Can by a String , ODocument or an OIdentifiable object . */
public OrientVertex getVertex ( final Object id ) { } }

implementation:
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 ) ;


signature:
public class OrientBaseGraph { /** * Get all the Vertices in Graph of a specific vertex class and all sub - classes only if iPolymorphic is true .
 * @ param iClassName Vertex class name to filter
 * @ param iPolymorphic If true consider also Vertex iClassName sub - classes
 * @ return Vertices as Iterable */
public Iterable < Vertex > getVerticesOfClass ( final String iClassName , final boolean iPolymorphic ) { } }

implementation: makeActive ( ) ; final OClass cls = getRawGraph ( ) . getMetadata ( ) . getSchema ( ) . getClass ( iClassName ) ; if ( cls == null ) throw new IllegalArgumentException ( "Cannot find class '" + iClassName + "' in database schema" ) ; if ( ! cls . isSubClassOf ( OrientVertexType . CLASS_NAME ) ) throw new IllegalArgumentException ( "Class '" + iClassName + "' is not a vertex class" ) ; return new OrientElementScanIterable < Vertex > ( this , iClassName , iPolymorphic ) ;


signature:
public class OrientBaseGraph { /** * Get all the Vertices in Graph filtering by field name and value . Example : < code >
 * Iterable < Vertex > resultset = getVertices ( " name " , " Jay " ) ;
 * < / code >
 * @ param iKey Field name
 * @ param iValue Field value
 * @ return Vertices as Iterable */
public Iterable < Vertex > getVertices ( final String iKey , Object iValue ) { } }

implementation:
makeActive ( ) ; if ( iKey . equals ( "@class" ) ) return getVerticesOfClass ( iValue . toString ( ) ) ; int pos = iKey . indexOf ( '.' ) ; final String className = pos > - 1 ? iKey . substring ( 0 , pos ) : OrientVertexType . CLASS_NAME ; final String key = pos > - 1 ? iKey . substring ( pos + 1 ) : iKey ; OClass clazz = getDatabase ( ) . getMetadata ( ) . getImmutableSchemaSnapshot ( ) . getClass ( className ) ; if ( clazz == null ) { throw new IllegalArgumentException ( "OClass not found in the schema: " + className ) ; } OIndex < ? > idx = null ; final Collection < ? extends OIndex < ? > > indexes = clazz . getIndexes ( ) ; for ( OIndex < ? > index : indexes ) { OIndexDefinition indexDef = index . getDefinition ( ) ; if ( "lucene" . equalsIgnoreCase ( index . getAlgorithm ( ) ) ) { continue ; } List < String > indexedFields = indexDef . getFields ( ) ; if ( indexedFields != null && indexedFields . size ( ) > 0 && indexedFields . get ( 0 ) . equals ( key ) ) { idx = index ; break ; } } if ( idx == null ) { idx = getDatabase ( ) . getMetadata ( ) . getIndexManager ( ) . getIndex ( iKey ) ; } if ( idx != null ) { iValue = convertKey ( idx , iValue ) ; Object indexValue = idx . get ( iValue ) ; if ( indexValue != null && ! ( indexValue instanceof Iterable < ? > ) ) indexValue = Arrays . asList ( indexValue ) ; return new OrientElementIterable < Vertex > ( this , ( Iterable < ? > ) indexValue ) ; } else { // NO INDEX : EXECUTE A QUERY
OrientGraphQuery query = ( OrientGraphQuery ) query ( ) ; query . labels ( clazz . getName ( ) ) ; return query . has ( key , iValue ) . vertices ( ) ; }


signature:
public class OrientBaseGraph { /** * Lookup for a vertex by id using an index . < br >
 * This API relies on Unique index ( SBTREE / HASH ) but is deprecated . < br >
 * Example : < code >
 * Vertex v = getVertexByKey ( " V . name " , " name " , " Jay " ) ;
 * < / code >
 * @ param iKey Name of the indexed property
 * @ param iValue Field value
 * @ return Vertex instance if found , otherwise null
 * @ see # getVertices ( String , Object ) */
@ Deprecated public Vertex getVertexByKey ( final String iKey , Object iValue ) { } }

implementation: makeActive ( ) ; String indexName ; if ( iKey . indexOf ( '.' ) > - 1 ) indexName = iKey ; else indexName = OrientVertexType . CLASS_NAME + "." + iKey ; final OIndex < ? > idx = getDatabase ( ) . getMetadata ( ) . getIndexManager ( ) . getIndex ( indexName ) ; if ( idx != null ) { iValue = convertKey ( idx , iValue ) ; Object v = idx . get ( iValue ) ; if ( v != null ) return getVertex ( v ) ; return null ; } else throw new IllegalArgumentException ( "Index '" + indexName + "' not found" ) ;


signature:
public class OrientBaseGraph { /** * Get all the Vertices in Graph filtering by field name and value . Example : < code >
 * Iterable < Vertex > resultset = getVertices ( " Person " , new String [ ] { " name " , " surname " } , new Object [ ] { " Sherlock " , " Holmes " } ) ;
 * < / code >
 * @ param iKey Fields name
 * @ param iValue Fields value
 * @ return Vertices as Iterable */
public Iterable < Vertex > getVertices ( final String label , final String [ ] iKey , Object [ ] iValue ) { } }

implementation:
if ( iKey . length != iValue . length ) { throw new IllegalArgumentException ( "key names and values must be arrays of the same size" ) ; } makeActive ( ) ; final OClass clazz = getDatabase ( ) . getMetadata ( ) . getImmutableSchemaSnapshot ( ) . getClass ( label ) ; if ( clazz != null ) { Set < OIndex < ? > > indexes = clazz . getInvolvedIndexes ( Arrays . asList ( iKey ) ) ; Iterator < OIndex < ? > > iterator = indexes . iterator ( ) ; while ( iterator . hasNext ( ) ) { final OIndex < ? > idx = iterator . next ( ) ; if ( idx != null ) { if ( "lucene" . equalsIgnoreCase ( idx . getAlgorithm ( ) ) ) { continue ; } Object [ ] sortedParams = new Object [ iValue . length ] ; List < String > indexFields = idx . getDefinition ( ) . getFields ( ) ; for ( int i = 0 ; i < iKey . length ; i ++ ) { sortedParams [ indexFields . indexOf ( iKey [ i ] ) ] = iValue [ i ] ; } List < Object > keys = Arrays . asList ( convertKeys ( idx , sortedParams ) ) ; Object key ; if ( indexFields . size ( ) == 1 ) { key = keys . get ( 0 ) ; } else { key = new OCompositeKey ( keys ) ; } Object indexValue = idx . get ( key ) ; if ( indexValue != null && ! ( indexValue instanceof Iterable < ? > ) ) indexValue = Arrays . asList ( indexValue ) ; return new OrientClassVertexIterable ( this , ( Iterable < ? > ) indexValue , label ) ; } } } // NO INDEX : EXECUTE A QUERY
OrientGraphQuery query = ( OrientGraphQuery ) query ( ) ; query . labels ( label ) ; for ( int i = 0 ; i < iKey . length ; i ++ ) { query . has ( iKey [ i ] , iValue [ i ] ) ; } return query . vertices ( ) ;


signature:
public class OrientBaseGraph { /** * Get all the Edges in Graph of a specific edges class and all sub - classes only if iPolymorphic is true .
 * @ param iClassName Edge class name to filter
 * @ param iPolymorphic If true consider also iClassName Edge sub - classes
 * @ return Edges as Iterable */
public Iterable < Edge > getEdgesOfClass ( final String iClassName , final boolean iPolymorphic ) { } }

implementation: makeActive ( ) ; final OClass cls = getRawGraph ( ) . getMetadata ( ) . getSchema ( ) . getClass ( iClassName ) ; if ( cls == null ) throw new IllegalArgumentException ( "Cannot find class '" + iClassName + "' in database schema" ) ; if ( ! cls . isSubClassOf ( OrientEdgeType . CLASS_NAME ) ) throw new IllegalArgumentException ( "Class '" + iClassName + "' is not an edge class" ) ; return new OrientElementScanIterable < Edge > ( this , iClassName , iPolymorphic ) ;


signature:
public class OrientBaseGraph { /** * Get all the Edges in Graph filtering by field name and value . Example : < code >
 * Iterable < Edges > resultset = getEdges ( " name " , " Jay " ) ;
 * < / code >
 * @ param iKey Field name
 * @ param iValue Field value
 * @ return Edges as Iterable */
public Iterable < Edge > getEdges ( final String iKey , Object iValue ) { } }

implementation:
makeActive ( ) ; if ( iKey . equals ( "@class" ) ) return getEdgesOfClass ( iValue . toString ( ) ) ; final String indexName ; final String key ; int pos = iKey . indexOf ( '.' ) ; if ( pos > - 1 ) { indexName = iKey ; key = iKey . substring ( iKey . indexOf ( '.' ) + 1 ) ; } else { indexName = OrientEdgeType . CLASS_NAME + "." + iKey ; key = iKey ; } final OIndex < ? > idx = getDatabase ( ) . getMetadata ( ) . getIndexManager ( ) . getIndex ( indexName ) ; if ( idx != null ) { iValue = convertKey ( idx , iValue ) ; Object indexValue = idx . get ( iValue ) ; if ( indexValue != null && ! ( indexValue instanceof Iterable < ? > ) ) indexValue = Arrays . asList ( indexValue ) ; return new OrientElementIterable < Edge > ( this , ( Iterable < ? > ) indexValue ) ; } // NO INDEX : EXECUTE A QUERY
return query ( ) . has ( key , iValue ) . edges ( ) ;


signature:
public class OrientBaseGraph { /** * Returns a edge by an ID .
 * @ param id Can by a String , ODocument or an OIdentifiable object . */
public OrientEdge getEdge ( final Object id ) { } }

implementation:
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 ) ;


signature:
public class OrientBaseGraph { /** * Reuses the underlying database avoiding to create and open it every time .
 * @ param iDatabase Underlying database object */
public OrientBaseGraph reuse ( final ODatabaseDocumentInternal iDatabase ) { } }

implementation: ODatabaseRecordThreadLocal . instance ( ) . set ( iDatabase ) ; this . url = iDatabase . getURL ( ) ; database = iDatabase ; makeActive ( ) ; return this ;


signature:
public class OrientBaseGraph { /** * Closes the Graph . After closing the Graph cannot be used . */
public void shutdown ( boolean closeDb , boolean commitTx ) { } }

implementation: makeActive ( ) ; try { if ( ! isClosed ( ) ) { if ( commitTx ) { final OStorage storage = getDatabase ( ) . getStorage ( ) . getUnderlying ( ) ; if ( storage instanceof OAbstractPaginatedStorage ) { if ( ( ( OAbstractPaginatedStorage ) storage ) . getWALInstance ( ) != null ) getDatabase ( ) . commit ( ) ; } else { getDatabase ( ) . commit ( ) ; } } else if ( closeDb ) { getDatabase ( ) . rollback ( ) ; } } } catch ( ONeedRetryException e ) { throw e ; } catch ( RuntimeException e ) { OLogManager . instance ( ) . error ( this , "Error during context close for db " + url , e ) ; throw e ; } catch ( Exception e ) { OLogManager . instance ( ) . error ( this , "Error during context close for db " + url , e ) ; throw OException . wrapException ( new ODatabaseException ( "Error during context close for db " + url ) , e ) ; } finally { try { if ( closeDb ) { getDatabase ( ) . close ( ) ; if ( getDatabase ( ) . isPooled ( ) ) { database = null ; } } pollGraphFromStack ( closeDb ) ; } catch ( Exception e ) { OLogManager . instance ( ) . error ( this , "Error during context close for db " + url , e ) ; } } url = null ; username = null ; password = null ; if ( ! closeDb ) getDatabase ( ) . activateOnCurrentThread ( ) ;


signature:
public class OrientBaseGraph { /** * Returns the V persistent class as OrientVertexType instance . */
public OrientVertexType getVertexBaseType ( ) { } }

implementation: makeActive ( ) ; return new OrientVertexType ( this , getRawGraph ( ) . getMetadata ( ) . getSchema ( ) . getClass ( OrientVertexType . CLASS_NAME ) ) ;


signature:
public class OrientBaseGraph { /** * Returns the persistent class for type iTypeName as OrientVertexType instance .
 * @ param iTypeName Vertex class name */
public OrientVertexType getVertexType ( final String iTypeName ) { } }

implementation: makeActive ( ) ; final OClass cls = getRawGraph ( ) . getMetadata ( ) . getSchema ( ) . getClass ( iTypeName ) ; if ( cls == null ) return null ; OrientVertexType . checkType ( cls ) ; return new OrientVertexType ( this , cls ) ;


signature:
public class OrientBaseGraph { /** * Creates a new Vertex persistent class .
 * @ param iClassName Vertex class name
 * @ param clusters The number of clusters to create for the new class . By default the MINIMUMCLUSTERS database setting is used .
 * In v2.2 and later , the number of clusters are proportioned to the amount of cores found on the machine
 * @ return OrientVertexType instance representing the persistent class */
public OrientVertexType createVertexType ( final String iClassName , final int clusters ) { } }

implementation: makeActive ( ) ; return createVertexType ( iClassName , ( String ) null , clusters ) ;


signature:
public class OrientBaseGraph { /** * Creates a new Vertex persistent class specifying the super class .
 * @ param iClassName Vertex class name
 * @ param iSuperClassName Vertex class name to extend
 * @ return OrientVertexType instance representing the persistent class */
public OrientVertexType createVertexType ( final String iClassName , final String iSuperClassName ) { } }

implementation: makeActive ( ) ; return createVertexType ( iClassName , iSuperClassName == null ? getVertexBaseType ( ) : getVertexType ( iSuperClassName ) ) ;


signature:
public class OrientBaseGraph { /** * Creates a new Vertex persistent class specifying the super class .
 * @ param iClassName Vertex class name
 * @ param iSuperClass OClass Vertex to extend
 * @ return OrientVertexType instance representing the persistent class */
public OrientVertexType createVertexType ( final String iClassName , final OClass iSuperClass , final int clusters ) { } }

implementation: makeActive ( ) ; OrientVertexType . checkType ( iSuperClass ) ; return executeOutsideTx ( new OCallable < OrientVertexType , OrientBaseGraph > ( ) { @ Override public OrientVertexType call ( final OrientBaseGraph g ) { return new OrientVertexType ( g , getRawGraph ( ) . getMetadata ( ) . getSchema ( ) . createClass ( iClassName , clusters , iSuperClass ) ) ; } } , "create vertex type '" , iClassName , "' as subclass of '" , iSuperClass . getName ( ) , "' (clusters=" + clusters + ")" ) ;


signature:
public class OrientBaseGraph { /** * Drop a vertex class .
 * @ param iTypeName Vertex class name */
public void dropVertexType ( final String iTypeName ) { } }

implementation: makeActive ( ) ; if ( getDatabase ( ) . countClass ( iTypeName ) > 0 ) throw new OCommandExecutionException ( "cannot drop vertex type '" + iTypeName + "' because it contains Vertices. Use 'DELETE VERTEX' command first to remove data" ) ; executeOutsideTx ( new OCallable < OClass , OrientBaseGraph > ( ) { @ Override public OClass call ( final OrientBaseGraph g ) { ODatabaseDocument rawGraph = getRawGraph ( ) ; rawGraph . getMetadata ( ) . getSchema ( ) . dropClass ( iTypeName ) ; return null ; } } , "drop vertex type '" , iTypeName , "'" ) ;


signature:
public class OrientBaseGraph { /** * Returns the persistent class for type iTypeName as OrientEdgeType instance .
 * @ param iTypeName Edge class name */
public OrientEdgeType getEdgeType ( final String iTypeName ) { } }

implementation: makeActive ( ) ; final OClass cls = getRawGraph ( ) . getMetadata ( ) . getSchema ( ) . getClass ( iTypeName ) ; if ( cls == null ) return null ; OrientEdgeType . checkType ( cls ) ; return new OrientEdgeType ( this , cls ) ;


signature:
public class OrientBaseGraph { /** * Creates a new Edge persistent class .
 * @ param iClassName Edge class name
 * @ param clusters The number of clusters to create for the new class . By default the MINIMUMCLUSTERS database setting is used .
 * In v2.2 and later , the number of clusters are proportioned to the amount of cores found on the machine
 * @ return OrientEdgeType instance representing the persistent class */
public OrientEdgeType createEdgeType ( final String iClassName , final int clusters ) { } }

implementation: makeActive ( ) ; return createEdgeType ( iClassName , ( String ) null , clusters ) ;


signature:
public class OrientBaseGraph { /** * Creates a new Edge persistent class specifying the super class .
 * @ param iClassName Edge class name
 * @ param iSuperClassName Edge class name to extend
 * @ return OrientEdgeType instance representing the persistent class */
public OrientEdgeType createEdgeType ( final String iClassName , final String iSuperClassName ) { } }

implementation: makeActive ( ) ; return createEdgeType ( iClassName , iSuperClassName == null ? getEdgeBaseType ( ) : getEdgeType ( iSuperClassName ) ) ;


signature:
public class OrientBaseGraph { /** * Creates a new Edge persistent class specifying the super class .
 * @ param iClassName Edge class name
 * @ param iSuperClass OClass Edge to extend
 * @ param clusters The number of clusters to create for the new class . By default the MINIMUMCLUSTERS database setting is used .
 * In v2.2 and later , the number of clusters are proportioned to the amount of cores found on the machine
 * @ return OrientEdgeType instance representing the persistent class */
public OrientEdgeType createEdgeType ( final String iClassName , final OClass iSuperClass , final int clusters ) { } }

implementation: makeActive ( ) ; OrientEdgeType . checkType ( iSuperClass ) ; return executeOutsideTx ( new OCallable < OrientEdgeType , OrientBaseGraph > ( ) { @ Override public OrientEdgeType call ( final OrientBaseGraph g ) { return new OrientEdgeType ( g , getRawGraph ( ) . getMetadata ( ) . getSchema ( ) . createClass ( iClassName , clusters , iSuperClass ) ) ; } } , "create edge type '" , iClassName , "' as subclass of '" , iSuperClass . getName ( ) , "' (clusters=" + clusters + ")" ) ;


signature:
public class OrientBaseGraph { /** * Returns a graph element , vertex or edge , starting from an ID .
 * @ param id Can by a String , ODocument or an OIdentifiable object .
 * @ return OrientElement subclass such as OrientVertex or OrientEdge */
public OrientElement getElement ( final Object id ) { } }

implementation:
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 ;


signature:
public class OrientBaseGraph { /** * Drops the index against a field name .
 * @ param key Field name
 * @ param elementClass Element class as instances of Vertex and Edge */
public < T extends Element > void dropKeyIndex ( final String key , final Class < T > elementClass ) { } }

implementation: makeActive ( ) ; if ( elementClass == null ) throw ExceptionFactory . classForElementCannotBeNull ( ) ; executeOutsideTx ( new OCallable < OClass , OrientBaseGraph > ( ) { @ Override public OClass call ( final OrientBaseGraph g ) { final String className = getClassName ( elementClass ) ; getRawGraph ( ) . getMetadata ( ) . getIndexManager ( ) . dropIndex ( className + "." + key ) ; return null ; } } , "drop key index '" , elementClass . getSimpleName ( ) , "." , key , "'" ) ;


signature:
public class OrientBaseGraph { /** * Creates an automatic indexing structure for indexing provided key for element class .
 * @ param key the key to create the index for
 * @ param elementClass the element class that the index is for
 * @ param indexParameters a collection of parameters for the underlying index implementation : < ul > < li > " type " is the index type
 * between the supported types ( UNIQUE , NOTUNIQUE , FULLTEXT ) . The default type is NOT _ UNIQUE < li > " class " is
 * the class to index when it ' s a custom type derived by Vertex ( V ) or Edge ( E ) < li > " keytype " to use a key
 * type different by OType . STRING , < / li > < / li > < / ul >
 * @ param < T > the element class specification */
@ SuppressWarnings ( { } }

implementation:
"rawtypes" } ) @ Override public < T extends Element > void createKeyIndex ( final String key , final Class < T > elementClass , final Parameter ... indexParameters ) { makeActive ( ) ; if ( elementClass == null ) throw ExceptionFactory . classForElementCannotBeNull ( ) ; executeOutsideTx ( new OCallable < OClass , OrientBaseGraph > ( ) { @ Override public OClass call ( final OrientBaseGraph g ) { String indexType = OClass . INDEX_TYPE . NOTUNIQUE . name ( ) ; OType keyType = OType . STRING ; String className = null ; String collate = null ; ODocument metadata = null ; final String ancestorClassName = getClassName ( elementClass ) ; // READ PARAMETERS
for ( Parameter < ? , ? > p : indexParameters ) { if ( p . getKey ( ) . equals ( "type" ) ) indexType = p . getValue ( ) . toString ( ) . toUpperCase ( Locale . ENGLISH ) ; else if ( p . getKey ( ) . equals ( "keytype" ) ) keyType = OType . valueOf ( p . getValue ( ) . toString ( ) . toUpperCase ( Locale . ENGLISH ) ) ; else if ( p . getKey ( ) . equals ( "class" ) ) className = p . getValue ( ) . toString ( ) ; else if ( p . getKey ( ) . equals ( "collate" ) ) collate = p . getValue ( ) . toString ( ) ; else if ( p . getKey ( ) . toString ( ) . startsWith ( "metadata." ) ) { if ( metadata == null ) metadata = new ODocument ( ) ; metadata . field ( p . getKey ( ) . toString ( ) . substring ( "metadata." . length ( ) ) , p . getValue ( ) ) ; } } if ( className == null ) className = ancestorClassName ; final ODatabaseDocument db = getRawGraph ( ) ; final OSchema schema = db . getMetadata ( ) . getSchema ( ) ; final OClass cls = schema . getOrCreateClass ( className , schema . getClass ( ancestorClassName ) ) ; final OProperty property = cls . getProperty ( key ) ; if ( property != null ) keyType = property . getType ( ) ; OPropertyIndexDefinition indexDefinition = new OPropertyIndexDefinition ( className , key , keyType ) ; if ( collate != null ) indexDefinition . setCollate ( collate ) ; db . getMetadata ( ) . getIndexManager ( ) . createIndex ( className + "." + key , indexType , indexDefinition , cls . getPolymorphicClusterIds ( ) , null , metadata ) ; return null ; } } , "create key index on '" , elementClass . getSimpleName ( ) , "." , key , "'" ) ;


signature:
public class OrientBaseGraph { /** * Returns the indexed properties .
 * @ param elementClass the element class that the index is for
 * @ return Set of String containing the indexed properties */
@ Override public < T extends Element > Set < String > getIndexedKeys ( final Class < T > elementClass ) { } }

implementation: makeActive ( ) ; return getIndexedKeys ( elementClass , false ) ;


signature:
public class OrientBaseGraph { /** * Returns the indexed properties .
 * @ param elementClass the element class that the index is for
 * @ param includeClassNames If true includes also the class name as prefix of fields
 * @ return Set of String containing the indexed properties */
public < T extends Element > Set < String > getIndexedKeys ( final Class < T > elementClass , final boolean includeClassNames ) { } }

implementation: makeActive ( ) ; if ( elementClass == null ) throw ExceptionFactory . classForElementCannotBeNull ( ) ; final OSchema schema = getRawGraph ( ) . getMetadata ( ) . getImmutableSchemaSnapshot ( ) ; final String elementOClassName = getClassName ( elementClass ) ; Set < String > result = new HashSet < String > ( ) ; final Collection < ? extends OIndex < ? > > indexes = getRawGraph ( ) . getMetadata ( ) . getIndexManager ( ) . getIndexes ( ) ; for ( OIndex < ? > index : indexes ) { String indexName = index . getName ( ) ; int point = indexName . indexOf ( "." ) ; if ( point > 0 ) { String oClassName = indexName . substring ( 0 , point ) ; OClass oClass = schema . getClass ( oClassName ) ; if ( oClass != null ) { if ( oClass . isSubClassOf ( elementOClassName ) ) { if ( includeClassNames ) result . add ( index . getName ( ) ) ; else result . add ( index . getDefinition ( ) . getFields ( ) . get ( 0 ) ) ; } } } } return result ;