use of org.opennms.web.group.WebGroup in project opennms by OpenNMS.
the class GroupController method showGroup.
private ModelAndView showGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {
String groupName = request.getParameter("groupName");
if (!StringUtils.hasText(groupName)) {
throw new ServletException("The groupName parameter is required");
}
WebGroup group = m_groupRepository.getGroup(groupName);
return new ModelAndView("/admin/userGroupView/groups/groupDetail", "group", group);
}
use of org.opennms.web.group.WebGroup in project opennms by OpenNMS.
the class GroupController method addGroup.
private ModelAndView addGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {
String groupName = request.getParameter("groupName");
String groupComment = request.getParameter("groupComment");
if (groupComment == null) {
groupComment = "";
}
boolean hasGroup = false;
try {
hasGroup = m_groupRepository.groupExists(groupName);
} catch (Throwable e) {
throw new ServletException("Can't determine if group " + groupName + " already exists in groups.xml.", e);
}
if (hasGroup) {
return new ModelAndView("admin/userGroupView/groups/newGroup", "action", "redo");
} else {
WebGroup newGroup = new WebGroup();
newGroup.setName(groupName);
newGroup.setComments(groupComment);
return editGroup(request, newGroup);
}
}
use of org.opennms.web.group.WebGroup in project opennms by OpenNMS.
the class GroupController method addDutySchedules.
private ModelAndView addDutySchedules(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpSession userSession = request.getSession(true);
if (userSession != null) {
// group.modifyGroup.jsp
WebGroup group = (WebGroup) userSession.getAttribute("group.modifyGroup.jsp");
updateGroup(request, group);
Vector<Object> newSchedule = new Vector<>();
int dutyAddCount = WebSecurityUtils.safeParseInt(request.getParameter("numSchedules"));
for (int j = 0; j < dutyAddCount; j++) {
// add 7 false boolean values for each day of the week
for (int i = 0; i < 7; i++) {
newSchedule.addElement(Boolean.FALSE);
}
// add two strings for the begin and end time
newSchedule.addElement("0");
newSchedule.addElement("0");
group.addDutySchedule((new DutySchedule(newSchedule)).toString());
}
userSession.setAttribute("group.modifyGroup.jsp", group);
}
return new ModelAndView("admin/userGroupView/groups/modifyGroup");
}
Aggregations