use of org.opennms.web.svclayer.model.LocationMonitorListModel in project opennms by OpenNMS.
the class LocationMonitorDetailsController method handle.
@RequestMapping(method = { RequestMethod.GET, RequestMethod.POST })
public ModelAndView handle(HttpServletRequest request, @ModelAttribute("command") LocationMonitorIdCommand cmd, BindingResult errors) {
m_validator.validate(cmd, errors);
LocationMonitorListModel model = null;
if (!errors.hasErrors()) {
model = m_distributedPollerService.getLocationMonitorDetails(cmd, errors);
}
if (errors.hasErrors()) {
return new ModelAndView(ERROR_VIEW);
} else {
ModelAndView modelAndView = new ModelAndView(SUCCESS_VIEW, "model", model);
if (request.isUserInRole(Authentication.ROLE_ADMIN)) {
modelAndView.addObject("isAdmin", "true");
}
return modelAndView;
}
}
use of org.opennms.web.svclayer.model.LocationMonitorListModel in project opennms by OpenNMS.
the class DefaultDistributedPollerService method getLocationMonitorList.
/**
* <p>getLocationMonitorList</p>
*
* @return a {@link org.opennms.web.svclayer.model.LocationMonitorListModel} object.
*/
@Override
public LocationMonitorListModel getLocationMonitorList() {
List<OnmsLocationMonitor> monitors = m_locationMonitorDao.findAll();
Collections.sort(monitors, m_comparator);
LocationMonitorListModel model = new LocationMonitorListModel();
for (OnmsLocationMonitor monitor : monitors) {
OnmsMonitoringLocation def = m_monitoringLocationDao.get(monitor.getLocation());
model.addLocationMonitor(new LocationMonitorModel(monitor, def));
}
return model;
}
use of org.opennms.web.svclayer.model.LocationMonitorListModel in project opennms by OpenNMS.
the class DefaultDistributedPollerService method getLocationMonitorDetails.
/**
* {@inheritDoc}
*/
@Override
public LocationMonitorListModel getLocationMonitorDetails(LocationMonitorIdCommand cmd, BindingResult errors) {
LocationMonitorListModel model = new LocationMonitorListModel();
model.setErrors(errors);
if (errors.getErrorCount() > 0) {
return model;
}
OnmsLocationMonitor monitor = m_locationMonitorDao.load(cmd.getMonitorId());
OnmsMonitoringLocation def = m_monitoringLocationDao.get(monitor.getLocation());
model.addLocationMonitor(new LocationMonitorModel(monitor, def));
return model;
}
use of org.opennms.web.svclayer.model.LocationMonitorListModel in project opennms by OpenNMS.
the class LocationMonitorListController method handleRequestInternal.
/**
* {@inheritDoc}
*/
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
LocationMonitorListModel model = m_distributedPollerService.getLocationMonitorList();
ModelAndView modelAndView = new ModelAndView("distributed/locationMonitorList", "model", model);
if (request.isUserInRole(Authentication.ROLE_ADMIN)) {
modelAndView.addObject("isAdmin", "true");
}
return modelAndView;
}
Aggregations