Collection filters = (Collection) params.get(FILTERS);
if (filters!=null){
Iterator it = filters.iterator();
while (it.hasNext()) {
queryText.append(AND);
BaseFilterConfig filter = (BaseFilterConfig) it.next();
if (!"asignado".equals(filter.getField())){
queryText.append(" T." + filter.getField());
String operator = (String)operatorOnWhere.get(filter.getClass().getName());
if (operator !=null){
queryText.append(operator);
} else {
if (filter instanceof BaseDateFilterConfig) {
BaseDateFilterConfig dateFilter = (BaseDateFilterConfig) filter;
if ("before".equals(dateFilter.getComparison())){
queryText.append(" < ");
} else if ("after".equals(dateFilter.getComparison())){
queryText.append(" > ");
} else {
queryText.append(EQUAL);
}
} else {
queryText.append(EQUAL);
}
}
queryText.append(QUESTION_SYMBOL);
} else {
HttpServletRequest request = (HttpServletRequest) params.get(ParamsConst.REQUEST);
User user = null;
if (request != null) {
user = (User) request.getSession().getAttribute(ParamsConst.USER);
}
Map<String, User> users = null;
if (user != null) {
try {
users = LDAPUtils.getUsersMap(user.getId(), user.getPassword());
} catch (Exception e) {
logger.error(Tools.getStackTrace(e));
}
if ((users!=null)&&(users.size()>0)){
queryText.append(" T.id_usuario");
queryText.append(" IN ( ");
Collection values = users.values();
Iterator itValues = values.iterator();
queryText.append("''");
while (itValues.hasNext()) {
User actual = (User) itValues.next();
if (actual.getName().indexOf((String)filter.getValue())>=0){
queryText.append(",'"+actual.getId()+"'");
}
}
queryText.append(" )");