use of org.springframework.web.servlet.ModelAndView in project opennms by OpenNMS.
the class ChooseUeisController method handleRequestInternal.
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
// Pull the notice from the session
HttpSession session = request.getSession(true);
Notification newNotice = (Notification) session.getAttribute("newNotice");
// If the notice is not present in the session, redirect to the first page of the wizard
if (newNotice == null) {
return new ModelAndView(new RedirectView(NotificationWizardServlet.SOURCE_PAGE_NOTICES));
}
return new ModelAndView("/admin/notification/noticeWizard/chooseUeis", "model", createModel(newNotice));
}
use of org.springframework.web.servlet.ModelAndView in project opennms by OpenNMS.
the class EventController method deleteFavorite.
public ModelAndView deleteFavorite(HttpServletRequest request, HttpServletResponse response) throws Exception {
// delete
String favoriteId = request.getParameter("favoriteId");
boolean success = favoriteService.deleteFavorite(favoriteId, request.getRemoteUser());
ModelAndView resultView = list(request, (OnmsFilterFavorite) null);
// we deleted the favorite
resultView.addObject("favorite", null);
if (!StringUtils.isEmpty(request.getParameter("redirect"))) {
// change to redirect View
resultView.setViewName(request.getParameter("redirect"));
}
if (!success) {
AlertTag.addAlertToRequest(resultView, "Favorite couldn't be deleted.", AlertType.ERROR);
} else {
AlertTag.addAlertToRequest(resultView, "Favorite deleted successfully.", AlertType.SUCCESS);
}
return resultView;
}
use of org.springframework.web.servlet.ModelAndView 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.springframework.web.servlet.ModelAndView in project opennms by OpenNMS.
the class EventController method list.
private ModelAndView list(HttpServletRequest request, OnmsFilterFavorite favorite) {
AcknowledgeType ackType = getAcknowledgeType(request);
ModelAndView modelAndView = createListModelAndView(request, getFilterCallback().parse(request.getParameterValues("filter")), ackType);
modelAndView.addObject("favorite", favorite);
modelAndView.setViewName("event/list");
return modelAndView;
}
use of org.springframework.web.servlet.ModelAndView in project opennms by OpenNMS.
the class EventController method index.
// index view
public ModelAndView index(HttpServletRequest request, HttpServletResponse response) throws Exception {
List<OnmsFilterFavorite> userFilterList = favoriteService.getFavorites(request.getRemoteUser(), OnmsFilterFavorite.Page.EVENT);
ModelAndView modelAndView = new ModelAndView("event/index");
modelAndView.addObject("favorites", userFilterList.toArray());
modelAndView.addObject("callback", getFilterCallback());
return modelAndView;
}
Aggregations