use of org.opennms.web.group.WebGroup in project opennms by OpenNMS.
the class GroupController method saveGroup.
private ModelAndView saveGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpSession session = request.getSession(false);
if (session != null) {
WebGroup newGroup = (WebGroup) session.getAttribute("group.modifyGroup.jsp");
updateGroup(request, newGroup);
m_groupRepository.saveGroup(newGroup);
}
return cancel(request, response);
}
use of org.opennms.web.group.WebGroup in project opennms by OpenNMS.
the class GroupController method editGroup.
private ModelAndView editGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {
String groupName = request.getParameter("groupName");
WebGroup group = m_groupRepository.getGroup(groupName);
return editGroup(request, group);
}
use of org.opennms.web.group.WebGroup in project opennms by OpenNMS.
the class GroupController method removeDutySchedules.
private ModelAndView removeDutySchedules(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpSession userSession = request.getSession(true);
if (userSession != null) {
// group.modifyGroup.jsp
WebGroup newGroup = (WebGroup) userSession.getAttribute("group.modifyGroup.jsp");
updateGroup(request, newGroup);
userSession.setAttribute("group.modifyGroup.jsp", newGroup);
}
return new ModelAndView("admin/userGroupView/groups/modifyGroup");
}
use of org.opennms.web.group.WebGroup in project opennms by OpenNMS.
the class SaveGroupController method handleRequestInternal.
/**
* {@inheritDoc}
*/
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpSession user = request.getSession(false);
if (user != null) {
WebGroup newGroup = (WebGroup) user.getAttribute("group.modifyGroup.jsp");
m_groupRepository.saveGroup(newGroup);
}
return new ModelAndView("redirect:/admin/userGroupView/groups/list.jsp");
}
use of org.opennms.web.group.WebGroup in project opennms by OpenNMS.
the class UpdateGroupController method handleRequestInternal.
/**
* {@inheritDoc}
*/
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpSession userSession = request.getSession(false);
if (userSession != null) {
// group.modifyGroup.jsp
WebGroup newGroup = (WebGroup) userSession.getAttribute("group.modifyGroup.jsp");
// get the rest of the group information from the form
String[] users = request.getParameterValues("selectedUsers");
newGroup.setUsers(new ArrayList<String>(Arrays.asList(users)));
String[] selectedCategories = request.getParameterValues("selectedCategories");
newGroup.setAuthorizedCategories(new ArrayList<String>(Arrays.asList(selectedCategories)));
Vector<Object> newSchedule = new Vector<>();
ChoiceFormat days = new ChoiceFormat("0#Mo|1#Tu|2#We|3#Th|4#Fr|5#Sa|6#Su");
Collection<String> dutySchedules = newGroup.getDutySchedules();
dutySchedules.clear();
int dutyCount = WebSecurityUtils.safeParseInt(request.getParameter("dutySchedules"));
for (int duties = 0; duties < dutyCount; duties++) {
newSchedule.clear();
String deleteFlag = request.getParameter("deleteDuty" + duties);
// don't save any duties that were marked for deletion
if (deleteFlag == null) {
for (int i = 0; i < 7; i++) {
String curDayFlag = request.getParameter("duty" + duties + days.format(i));
if (curDayFlag != null) {
newSchedule.addElement(Boolean.TRUE);
} else {
newSchedule.addElement(Boolean.FALSE);
}
}
newSchedule.addElement(request.getParameter("duty" + duties + "Begin"));
newSchedule.addElement(request.getParameter("duty" + duties + "End"));
DutySchedule newDuty = new DutySchedule(newSchedule);
dutySchedules.add(newDuty.toString());
}
}
userSession.setAttribute("group.modifyGroup.jsp", newGroup);
}
return new ModelAndView(request.getParameter("redirect"));
}
Aggregations