use of org.opennms.web.filter.NormalizedQueryParameters in project opennms by OpenNMS.
the class AlarmFilterController method createListModelAndView.
private ModelAndView createListModelAndView(HttpServletRequest request, List<Filter> filterList, AcknowledgeType ackType) {
final AlarmQueryParms parms = createAlarmQueryParms(request, filterList, ackType);
AlarmCriteria queryCriteria = new AlarmCriteria(parms);
AlarmCriteria countCriteria = new AlarmCriteria(filterList, ackType);
final OnmsAlarm[] alarms = m_webAlarmRepository.getMatchingAlarms(AlarmUtil.getOnmsCriteria(queryCriteria));
final long alarmCount = m_webAlarmRepository.countMatchingAlarms(AlarmUtil.getOnmsCriteria(countCriteria));
final ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("alarms", alarms);
modelAndView.addObject("alarmCount", alarmCount);
modelAndView.addObject("parms", new NormalizedQueryParameters(parms));
modelAndView.addObject("callback", getFilterCallback());
modelAndView.addObject("favorites", favoriteService.getFavorites(request.getRemoteUser(), OnmsFilterFavorite.Page.ALARM).toArray());
return modelAndView;
}
use of org.opennms.web.filter.NormalizedQueryParameters in project opennms by OpenNMS.
the class EventController method createListModelAndView.
private ModelAndView createListModelAndView(HttpServletRequest request, List<Filter> filterList, AcknowledgeType ackType) {
final EventQueryParms parms = createEventQueryParms(request, filterList, ackType);
final EventCriteria queryCriteria = new EventCriteria(parms);
final Event[] events = m_webEventRepository.getMatchingEvents(queryCriteria);
final ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("events", events);
modelAndView.addObject("parms", new NormalizedQueryParameters(parms));
modelAndView.addObject("callback", getFilterCallback());
modelAndView.addObject("favorites", favoriteService.getFavorites(request.getRemoteUser(), OnmsFilterFavorite.Page.EVENT).toArray());
if (m_showEventCount) {
EventCriteria countCriteria = new EventCriteria(filterList, ackType);
modelAndView.addObject("eventCount", m_webEventRepository.countMatchingEvents(countCriteria));
} else {
modelAndView.addObject("eventCount", Integer.valueOf(-1));
}
return modelAndView;
}
use of org.opennms.web.filter.NormalizedQueryParameters in project opennms by OpenNMS.
the class FiltersTag method getLeading.
private String getLeading() {
StringBuffer leadingString = new StringBuffer();
if (isShowAcknowledgeFilter()) {
NormalizedQueryParameters params = new NormalizedQueryParameters(parameters);
if (isAcknowledgeType()) {
params.setAckType(NormalizedAcknowledgeType.UNACKNOWLEDGED);
leadingString.append(FILTER_TEMPLATE.replaceAll("\\{FILTER_DESCRIPTION\\}", getAcknowledgeFilterPrefix() + " acknowledged").replaceAll("\\{REMOVE_LINK\\}", isShowRemoveLink() ? filterCallback.createLink(getUrlBase(), params, favorite) : "").replaceAll("\\{REMOVE_LINK_TITLE\\}", isShowRemoveLink() ? "Show outstanding " + getAcknowledgeFilterSuffix() : ""));
} else if (isUnacknowledgeType()) {
params.setAckType(NormalizedAcknowledgeType.ACKNOWLEDGED);
leadingString.append(FILTER_TEMPLATE.replaceAll("\\{FILTER_DESCRIPTION\\}", getAcknowledgeFilterPrefix() + " outstanding").replaceAll("\\{REMOVE_LINK\\}", isShowRemoveLink() ? filterCallback.createLink(getUrlBase(), params, favorite) : "").replaceAll("\\{REMOVE_LINK_TITLE\\}", isShowRemoveLink() ? "Show acknowledged " + getAcknowledgeFilterSuffix() : ""));
}
}
return leadingString.toString();
}
use of org.opennms.web.filter.NormalizedQueryParameters in project opennms by OpenNMS.
the class FiltersTag method doStartTag.
@Override
public int doStartTag() throws JspException {
final String leadingString = getLeading();
final StringBuffer filterBuffer = new StringBuffer();
for (Filter eachFilter : getFilters()) {
NormalizedQueryParameters params = new NormalizedQueryParameters(parameters);
params.getFilters().remove(eachFilter);
filterBuffer.append(FILTER_TEMPLATE.replaceAll("\\{FILTER_DESCRIPTION\\}", WebSecurityUtils.sanitizeString(eachFilter.getTextDescription())).replaceAll("\\{REMOVE_LINK\\}", isShowRemoveLink() ? filterCallback.createLink(getUrlBase(), params, favorite) : "").replaceAll("\\{REMOVE_LINK_TITLE\\}", isShowRemoveLink() ? "Remove filter" : ""));
}
out(TEMPLATE.replaceAll("\\{LEADING\\}", leadingString).replaceAll("\\{FILTERS\\}", filterBuffer.toString()));
return EVAL_BODY_INCLUDE;
}
Aggregations