private Group getBackingGroup(String groupName) { try { return m_groupManager.getGroup(groupName); } catch (IOException e) { throw new WebRolesException("Error reading groups.xml config file", e); } }
/** {@inheritDoc} */ @Override public Group getGroup(String name) { try { return m_groupManager.getGroup(name); } catch (Throwable e) { throw CONFIG_OBJECT_EXCEPTION_TRANSLATOR.translate("getting group '" + name + "'", e); } }
public OnmsGroup getOnmsGroup(final String groupName) throws IOException { final Group xmlGroup = getGroup(groupName); if (xmlGroup == null) return null; return new OnmsGroupMapper().map(xmlGroup); }
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 int getUsersInTarget(Target target) throws IOException { int count = 0; String targetName = target.getName(); if (getGroupManager().hasGroup(targetName)) { count = getGroupManager().getGroup(targetName).getUsers().size(); } else if (getUserManager().hasOnCallRole(targetName)) { count = getUserManager().countUsersWithRole(targetName); } else if (getUserManager().hasUser(targetName)) { count = 1; } else if (targetName.indexOf('@') > -1) { count = 1; } return count; }
public synchronized void save(final OnmsGroup group) throws Exception { Group xmlGroup = getGroup(group.getName()); if (xmlGroup == null) { xmlGroup = new Group(); xmlGroup.setName(group.getName()); } xmlGroup.setComments(group.getComments()); xmlGroup.setUsers(group.getUsers()); saveGroup(group.getName(), xmlGroup); }