private Criterion applyRestriction(){
  final Object convertedValue=convertValueType(searchField,searchString);
  if (searchOper.equals("eq"))   return Restrictions.eq(searchField,convertedValue);
 else   if (searchOper.equals("ne"))   return Restrictions.ne(searchField,convertedValue);
  if (convertedValue instanceof String) {
    if (searchOper.equals("bw"))     return Restrictions.ilike(searchField,searchString + "%");
 else     if (searchOper.equals("cn"))     return Restrictions.ilike(searchField,"%" + searchString + "%");
 else     if (searchOper.equals("ew"))     return Restrictions.ilike(searchField,"%" + searchString);
 else     if (searchOper.equals("bn"))     return Restrictions.not(Restrictions.ilike(searchField,searchString + "%"));
 else     if (searchOper.equals("en"))     return Restrictions.not(Restrictions.ilike(searchField,"%" + searchString));
 else     if (searchOper.equals("nc"))     return Restrictions.not(Restrictions.ilike(searchField,"%" + searchString + "%"));
 else     if (searchOper.equals("in"))     return Restrictions.in(searchField,searchString.split(","));
 else     if (searchOper.equals("ni"))     return Restrictions.not(Restrictions.in(searchField,searchString.split(",")));
  }
 else   if (searchOper.equals("lt"))   return Restrictions.lt(searchField,convertedValue);
 else   if (searchOper.equals("le"))   return Restrictions.le(searchField,convertedValue);
 else   if (searchOper.equals("gt"))   return Restrictions.gt(searchField,convertedValue);
 else   if (searchOper.equals("ge"))   return Restrictions.ge(searchField,convertedValue);
  return null;
}

private Criterion applyRestriction ( ) { final Object convertedValue = convertValueType ( searchField , searchString ) ; if ( searchOper . equals ( "eq" ) ) return Restrictions . eq ( searchField , convertedValue ) ; else if ( searchOper . equals ( "ne" ) ) return Restrictions . ne ( searchField , convertedValue ) ; if ( convertedValue instanceof String ) { if ( searchOper . equals ( "bw" ) ) return Restrictions . ilike ( searchField , searchString + "%" ) ; else if ( searchOper . equals ( "cn" ) ) return Restrictions . ilike ( searchField , "%" + searchString + "%" ) ; else if ( searchOper . equals ( "ew" ) ) return Restrictions . ilike ( searchField , "%" + searchString ) ; else if ( searchOper . equals ( "bn" ) ) return Restrictions . not ( Restrictions . ilike ( searchField , searchString + "%" ) ) ; else if ( searchOper . equals ( "en" ) ) return Restrictions . not ( Restrictions . ilike ( searchField , "%" + searchString ) ) ; else if ( searchOper . equals ( "nc" ) ) return Restrictions . not ( Restrictions . ilike ( searchField , "%" + searchString + "%" ) ) ; else if ( searchOper . equals ( "in" ) ) return Restrictions . in ( searchField , searchString . split ( "," ) ) ; else if ( searchOper . equals ( "ni" ) ) return Restrictions . not ( Restrictions . in ( searchField , searchString . split ( "," ) ) ) ; } else if ( searchOper . equals ( "lt" ) ) return Restrictions . lt ( searchField , convertedValue ) ; else if ( searchOper . equals ( "le" ) ) return Restrictions . le ( searchField , convertedValue ) ; else if ( searchOper . equals ( "gt" ) ) return Restrictions . gt ( searchField , convertedValue ) ; else if ( searchOper . equals ( "ge" ) ) return Restrictions . ge ( searchField , convertedValue ) ; return null ; }
used to convert jqgrid search operator to hibernate restriction .
