Search in sources :

Example 6 with ISearchTerm

use of de.janrufmonitor.repository.search.ISearchTerm in project janrufmonitor by tbrandt77.

the class HsqldbMultiPhoneCallerDatabaseHandler method createSearchTerm.

private String createSearchTerm(ISearchTerm[] searchTerms) {
    if (searchTerms == null)
        return "";
    if (searchTerms.length == 0)
        return "";
    StringBuffer sql = new StringBuffer();
    sql.append(" (");
    ISearchTerm st = null;
    for (int i = 0, j = searchTerms.length; i < j; i++) {
        st = searchTerms[i];
        sql.append("LOWER(content) like LOWER('%");
        // remove % signs in search term
        sql.append(StringUtils.replaceString(st.getSearchTerm(), "%", ""));
        sql.append("%')");
        if (i < (j - 1)) {
            sql.append(" ");
            sql.append(st.getOperator().toString());
            sql.append(" ");
        }
    }
    sql.append(")");
    return sql.toString();
}
Also used : ISearchTerm(de.janrufmonitor.repository.search.ISearchTerm)

Aggregations

ISearchTerm (de.janrufmonitor.repository.search.ISearchTerm)6 IFilter (de.janrufmonitor.repository.filter.IFilter)3 SearchTermSeriarlizer (de.janrufmonitor.repository.search.SearchTermSeriarlizer)3 HandlerException (de.janrufmonitor.service.commons.http.handler.HandlerException)3 OutputStream (java.io.OutputStream)3 ICallList (de.janrufmonitor.framework.ICallList)2 ICallManager (de.janrufmonitor.repository.ICallManager)2 IReadCallRepository (de.janrufmonitor.repository.types.IReadCallRepository)2 ICallerList (de.janrufmonitor.framework.ICallerList)1 ICallerManager (de.janrufmonitor.repository.ICallerManager)1 Operator (de.janrufmonitor.repository.search.Operator)1 IReadCallerRepository (de.janrufmonitor.repository.types.IReadCallerRepository)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 StringTokenizer (java.util.StringTokenizer)1