protected OPair < Direction , String > getConnection ( final Direction iDirection , final String iFieldName , String ... iClassNames ) { if ( iClassNames != null && iClassNames . length == 1 && iClassNames [ 0 ] . equalsIgnoreCase ( "E" ) ) // DEFAULT CLASS, TREAT IT AS NO CLASS/LABEL iClassNames = null ; final OrientBaseGraph graph = getGraph ( ) ; if ( iDirection == Direction . OUT || iDirection == Direction . BOTH ) { if ( settings . isUseVertexFieldsForEdgeLabels ( ) ) { // FIELDS THAT STARTS WITH "out_" if ( iFieldName . startsWith ( CONNECTION_OUT_PREFIX ) ) { String connClass = getConnectionClass ( Direction . OUT , iFieldName ) ; if ( iClassNames == null || iClassNames . length == 0 ) return new OPair < Direction , String > ( Direction . OUT , connClass ) ; // CHECK AGAINST ALL THE CLASS NAMES OrientEdgeType edgeType = graph . getEdgeType ( connClass ) ; if ( edgeType != null ) { for ( String clsName : iClassNames ) { if ( edgeType . isSubClassOf ( clsName ) ) return new OPair < Direction , String > ( Direction . OUT , connClass ) ; } } } } else if ( iFieldName . equals ( OrientBaseGraph . CONNECTION_OUT ) ) // CHECK FOR "out" return new OPair < Direction , String > ( Direction . OUT , null ) ; } if ( iDirection == Direction . IN || iDirection == Direction . BOTH ) { if ( settings . isUseVertexFieldsForEdgeLabels ( ) ) { // FIELDS THAT STARTS WITH "in_" if ( iFieldName . startsWith ( CONNECTION_IN_PREFIX ) ) { String connClass = getConnectionClass ( Direction . IN , iFieldName ) ; if ( iClassNames == null || iClassNames . length == 0 ) return new OPair < Direction , String > ( Direction . IN , connClass ) ; // CHECK AGAINST ALL THE CLASS NAMES OrientEdgeType edgeType = graph . getEdgeType ( connClass ) ; if ( edgeType != null ) { for ( String clsName : iClassNames ) { if ( edgeType . isSubClassOf ( clsName ) ) return new OPair < Direction , String > ( Direction . IN , connClass ) ; } } } } else if ( iFieldName . equals ( OrientBaseGraph . CONNECTION_IN ) ) // CHECK FOR "in" return new OPair < Direction , String > ( Direction . IN , null ) ; } // NOT FOUND return null ; }
Determines if a field is a connections or not .