Search in sources :

Example 1 with OutageIdNotFoundException

use of org.opennms.web.outage.OutageIdNotFoundException in project opennms by OpenNMS.

the class OutageDetailController method handleRequestInternal.

/** {@inheritDoc} */
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
    int outageId = -1;
    String outageIdString = request.getParameter("id");
    if (outageIdString == null) {
        throw new MissingParameterException("id");
    }
    try {
        outageId = WebSecurityUtils.safeParseInt(WebSecurityUtils.sanitizeString(outageIdString, false));
    } catch (NumberFormatException e) {
        throw new OutageIdNotFoundException("The outage id must be an integer.", outageIdString);
    }
    Outage outage = m_webOutageRepository.getOutage(outageId);
    ModelAndView modelAndView = new ModelAndView(getSuccessView());
    modelAndView.addObject("outage", outage);
    return modelAndView;
}
Also used : Outage(org.opennms.web.outage.Outage) OutageIdNotFoundException(org.opennms.web.outage.OutageIdNotFoundException) ModelAndView(org.springframework.web.servlet.ModelAndView) MissingParameterException(org.opennms.web.servlet.MissingParameterException)

Aggregations

Outage (org.opennms.web.outage.Outage)1 OutageIdNotFoundException (org.opennms.web.outage.OutageIdNotFoundException)1 MissingParameterException (org.opennms.web.servlet.MissingParameterException)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1