@Override public void saveGroup(Group group) { m_groupDao.saveGroup(group.getName(), group); }
@Override public void saveGroup(Group group) { m_groupDao.saveGroup(group.getName(), group); }
ManagedGroup(Group group) { super(group.getName()); List<WebUser> users = new ArrayList<>(); for (String userId : getUsers(group)) { users.add(getWebUser(userId)); } super.setUsers(users); }
NotificationTask[] makeGroupTasks(long startTime, Map<String, String> params, int noticeId, String targetName, String[] command, List<NotificationTask> targetSiblings, String autoNotify, long interval) throws IOException { Group group = getGroupManager().getGroup(targetName); Calendar startCal = Calendar.getInstance(); startCal.setTimeInMillis(startTime); long next = getGroupManager().groupNextOnDuty(group.getName(), startCal); // it the group is not on duty if (next < 0) { LOG.debug("The group {} is not scheduled to come back on duty. No notification will be sent to this group.", group.getName()); return null; } LOG.debug("The group {} is on duty in {} millisec.", group.getName(), next); String[] users = group.getUsers().toArray(new String[0]); // There are no users in the group if (users == null || users.length == 0) { LOG.debug("Not sending notice, no users specified for group {}", group.getName()); return null; } return constructTasksFromUserList(users, startTime, next, params, noticeId, command, targetSiblings, autoNotify, interval); }
private void initializeGroupsAndRoles(Groupinfo groupinfo) { List<Group> groups = groupinfo.getGroups(); m_groups = new LinkedHashMap<String, Group>(); m_oldHeader = groupinfo.getHeader(); for (Group curGroup : groups) { m_groups.put(curGroup.getName(), curGroup); } buildDutySchedules(m_groups); if (groupinfo.getRoles().size() > 0) { m_roles = new LinkedHashMap<String, Role>(); for (final Role role : groupinfo.getRoles()) { m_roles.put(role.getName(), role); } } }
map.put(group.getName(), group);
groupNames = new String[groups.size()]; for(int i = 0; i < groups.size(); i++) { groupNames[i] = groups.get(i).getName();
public OnmsGroup map(Group inputGroup) { if (inputGroup == null) return null; final OnmsGroup xmlGroup = new OnmsGroup(inputGroup.getName()); xmlGroup.setComments(inputGroup.getComments().orElse(null)); xmlGroup.setUsers(inputGroup.getUsers()); return xmlGroup; }
/** * {@inheritDoc} */ @Override public View selectDefaultViewForUsername(String username) { LOG.debug("Looking for surveillance view that matches user '{}'", username); View userView = SurveillanceViewProvider.getInstance().getView(username); if (userView != null) { LOG.debug("Found surveillance view '{}' matching user name '{}'", userView.getName(), username); return userView; } List<Group> groups = m_groupDao.findGroupsForUser(username); for (Group group : groups) { View groupView = SurveillanceViewProvider.getInstance().getView(group.getName()); if (groupView != null) { LOG.debug("Found surveillance view '{}' matching group '{}' name for user '{}'", groupView.getName(), group.getName(), username); return groupView; } } View defaultView = SurveillanceViewProvider.getInstance().getDefaultView(); if (defaultView == null) { String message = "There is no default surveillance view and we could not find a surveillance view for the user's username ('" + username + "') or any of their groups"; LOG.warn(message); throw new ObjectRetrievalFailureException(View.class, message); } LOG.debug("Did not find a surveillance view matching the user's user name or one of their group names. Using the default view for user '{}'", username); return defaultView; }
/** * {@inheritDoc} */ @Override public View selectDefaultViewForUsername(String username) { LOG.debug("Looking for surveillance view that matches user '{}'", username); View userView = SurveillanceViewProvider.getInstance().getView(username); if (userView != null) { LOG.debug("Found surveillance view '{}' matching user name '{}'", userView.getName(), username); return userView; } List<Group> groups = m_groupDao.findGroupsForUser(username); for (Group group : groups) { View groupView = SurveillanceViewProvider.getInstance().getView(group.getName()); if (groupView != null) { LOG.debug("Found surveillance view '{}' matching group '{}' name for user '{}'", groupView.getName(), group.getName(), username); return groupView; } } View defaultView = SurveillanceViewProvider.getInstance().getDefaultView(); if (defaultView == null) { String message = "There is no default surveillance view and we could not find a surveillance view for the user's username ('" + username + "') or any of their groups"; LOG.warn(message); throw new ObjectRetrievalFailureException(View.class, message); } LOG.debug("Did not find a surveillance view matching the user's user name or one of their group names. Using the default view for user '{}'", username); return defaultView; }