public void addAnnotationConditions ( Collection < String > conditions , int index , QueryAnnotation annotation , String table , TableAccessStrategy tas ) { TextMatching tm = annotation . getTextMatching ( ) ; String column = annotation . getNamespace ( ) == null ? "annotext" : "qannotext" ; Escaper escaper = tm != null && tm . isRegex ( ) ? regexEscaper : likeEscaper ; String val ; if ( tm == null ) { val = "%" ; } else { val = escaper . escape ( annotation . getValue ( ) ) ; } String prefix ; if ( annotation . getNamespace ( ) == null ) { prefix = escaper . escape ( annotation . getName ( ) ) + ":" ; } else { prefix = escaper . escape ( annotation . getNamespace ( ) ) + ":" + escaper . escape ( annotation . getName ( ) ) + ":" ; } if ( tm == null || tm == TextMatching . EXACT_EQUAL ) { conditions . add ( tas . aliasedColumn ( table , column , index ) + " LIKE '" + prefix + val + "'" ) ; } else if ( tm == TextMatching . EXACT_NOT_EQUAL ) { conditions . add ( tas . aliasedColumn ( table , column , index ) + " LIKE '" + prefix + "%'" ) ; conditions . add ( tas . aliasedColumn ( table , column , index ) + " NOT LIKE '" + prefix + val + "'" ) ; } else if ( tm == TextMatching . REGEXP_EQUAL ) { conditions . add ( tas . aliasedColumn ( table , column , index ) + " ~ '^(" + prefix + "(" + val + "))$'" ) ; } else if ( tm == TextMatching . REGEXP_NOT_EQUAL ) { conditions . add ( tas . aliasedColumn ( table , column , index ) + " LIKE '" + prefix + "%'" ) ; conditions . add ( tas . aliasedColumn ( table , column , index ) + " !~ '^(" + prefix + "(" + val + "))$'" ) ; } }
Adds annotation conditions for a single node .