private void notReflexive ( List < String > conditions , QueryNode node , QueryNode target ) { Validate . isTrue ( node != target , "notReflexive(...) implies that source " + "and target node are not the same, but someone is violating this constraint!" ) ; Validate . notNull ( node ) ; Validate . notNull ( target ) ; if ( node . getNodeAnnotations ( ) . isEmpty ( ) && target . getNodeAnnotations ( ) . isEmpty ( ) ) { joinOnNode ( conditions , node , target , "<>" , "id" , "id" ) ; } else if ( ! node . getNodeAnnotations ( ) . isEmpty ( ) && ! target . getNodeAnnotations ( ) . isEmpty ( ) ) { TableAccessStrategy tasNode = tables ( node ) ; TableAccessStrategy tasTarget = tables ( target ) ; String nodeDifferent = join ( "<>" , tasNode . aliasedColumn ( NODE_TABLE , "id" ) , tasTarget . aliasedColumn ( NODE_TABLE , "id" ) ) ; String annoCatDifferent = join ( "IS DISTINCT FROM" , tasNode . aliasedColumn ( NODE_ANNOTATION_TABLE , "category" ) , tasTarget . aliasedColumn ( NODE_ANNOTATION_TABLE , "category" ) ) ; conditions . add ( "(" + Joiner . on ( " OR " ) . join ( nodeDifferent , annoCatDifferent ) + ")" ) ; } }
Explicitly disallow reflexivity .