Package org.opennms.netmgt.config
Class GroupManager
- java.lang.Object
- 
- org.opennms.netmgt.config.GroupManager
 
- 
- All Implemented Interfaces:
- GroupConfig
 - Direct Known Subclasses:
- GroupFactory,- MockGroupManager
 
 public abstract class GroupManager extends java.lang.Object implements GroupConfig Abstract GroupManager class. - Author:
- David Hustace, Matt Brozowski, Bill Ayres, DJ Gregor
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classGroupManager.OnmsGroupListMapperstatic classGroupManager.OnmsGroupMapper
 - 
Field SummaryFields Modifier and Type Field Description protected static java.util.Map<java.lang.String,java.util.List<DutySchedule>>m_dutySchedulesThe duty schedules for each group
 - 
Constructor SummaryConstructors Constructor Description GroupManager()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddeleteGroup(java.lang.String name)Removes the group from the list of groups.voiddeleteRole(java.lang.String name)deleteRolevoiddeleteUser(java.lang.String name)Removes the user from the list of groups.java.util.List<Group>findGroupsForUser(java.lang.String user)findGroupsForUserGroupgetGroup(java.lang.String name)Get a group using its namejava.util.List<java.lang.String>getGroupNames()getGroupNamesjava.util.Map<java.lang.String,Group>getGroups()Get the groupsOnmsGroupgetOnmsGroup(java.lang.String groupName)getOnmsGroupOnmsGroupListgetOnmsGroupList()getOnmsGroupListRolegetRole(java.lang.String roleName)getRolejava.lang.String[]getRoleNames()getRoleNamesjava.util.Collection<Role>getRoles()getRolesOwnedIntervalSequencegetRoleScheduleEntries(java.lang.String roleid, java.util.Date start, java.util.Date end)getRoleScheduleEntriesjava.util.List<Schedule>getSchedulesForRoleAt(java.lang.String roleId, java.util.Date time)getSchedulesForRoleAtjava.util.List<Schedule>getUserSchedulesForRole(java.lang.String userId, java.lang.String roleId)getUserSchedulesForRolelonggroupNextOnDuty(java.lang.String group, java.util.Calendar time)Determines when a group is next on duty.booleanhasGroup(java.lang.String groupName)Returns a boolean indicating if the group name appears in the xml filebooleanisGroupOnDuty(java.lang.String group, java.util.Calendar time)Determines if a group is on duty at a given time.booleanisUserScheduledForRole(java.lang.String userId, java.lang.String roleId, java.util.Date time)isUserScheduledForRoleprotected voidparseXml(java.io.InputStream stream)parseXmlvoidrenameGroup(java.lang.String oldName, java.lang.String newName)Renames the group from the list of groups.voidrenameUser(java.lang.String oldName, java.lang.String newName)When this method is called group name is changed, so also is the group name belonging to the view.voidsave(OnmsGroup group)savevoidsaveGroup(java.lang.String name, Group details)Adds a new user and overwrites the "groups.xml"voidsaveGroups()saveGroupsvoidsaveRole(Role role)saveRoleprotected abstract voidsaveXml(java.lang.String data)saveXmlvoidsetGroups(java.util.Map<java.lang.String,Group> grp)Set the groups dataabstract voidupdate()updatebooleanuserHasRole(java.lang.String userId, java.lang.String roleid)userHasRole
 
- 
- 
- 
Field Detail- 
m_dutySchedulesprotected static java.util.Map<java.lang.String,java.util.List<DutySchedule>> m_dutySchedules The duty schedules for each group
 
- 
 - 
Method Detail- 
parseXmlprotected void parseXml(java.io.InputStream stream) throws java.io.IOExceptionparseXml - Parameters:
- stream- a- InputStreamobject.
- Throws:
- java.io.IOException
 
 - 
setGroupspublic void setGroups(java.util.Map<java.lang.String,Group> grp) Set the groups data- Specified by:
- setGroupsin interface- GroupConfig
- Parameters:
- grp- a- Mapobject.
 
 - 
getGroupspublic java.util.Map<java.lang.String,Group> getGroups() throws java.io.IOException Get the groups- Specified by:
- getGroupsin interface- GroupConfig
- Returns:
- a Mapobject.
- Throws:
- java.io.IOException- if any.
 
 - 
getOnmsGroupListpublic OnmsGroupList getOnmsGroupList() throws java.io.IOException Description copied from interface:GroupConfiggetOnmsGroupList - Specified by:
- getOnmsGroupListin interface- GroupConfig
- Returns:
- an OnmsGroupList
- Throws:
- java.io.IOException
 
 - 
getOnmsGrouppublic OnmsGroup getOnmsGroup(java.lang.String groupName) throws java.io.IOException Description copied from interface:GroupConfiggetOnmsGroup - Specified by:
- getOnmsGroupin interface- GroupConfig
- Returns:
- an OnmsGroup
- Throws:
- java.io.IOException
 
 - 
savepublic void save(OnmsGroup group) throws java.lang.Exception Description copied from interface:GroupConfigsave - Specified by:
- savein interface- GroupConfig
- Throws:
- java.lang.Exception
 
 - 
updatepublic abstract void update() throws java.io.IOExceptionupdate - Throws:
- java.io.IOException- if any.
 
 - 
hasGrouppublic boolean hasGroup(java.lang.String groupName) throws java.io.IOExceptionReturns a boolean indicating if the group name appears in the xml file- Specified by:
- hasGroupin interface- GroupConfig
- Parameters:
- groupName- a- Stringobject.
- Returns:
- true if the group exists in the xml file, false otherwise
- Throws:
- java.io.IOException- if any.
 
 - 
getGroupNamespublic java.util.List<java.lang.String> getGroupNames() throws java.io.IOExceptiongetGroupNames - Specified by:
- getGroupNamesin interface- GroupConfig
- Returns:
- a Listobject.
- Throws:
- java.io.IOException- if any.
 
 - 
getGrouppublic Group getGroup(java.lang.String name) throws java.io.IOException Get a group using its name- Specified by:
- getGroupin interface- GroupConfig
- Parameters:
- name- the name of the group to return
- Returns:
- Group, the group specified by name
- Throws:
- java.io.IOException- if any.
 
 - 
saveGroupspublic void saveGroups() throws java.lang.ExceptionsaveGroups - Specified by:
- saveGroupsin interface- GroupConfig
- Throws:
- java.lang.Exception- if any.
 
 - 
isGroupOnDutypublic boolean isGroupOnDuty(java.lang.String group, java.util.Calendar time) throws java.io.IOExceptionDetermines if a group is on duty at a given time. If a group has no duty schedules listed in the configuration file, that group is assumed to always be on duty.- Specified by:
- isGroupOnDutyin interface- GroupConfig
- Parameters:
- group- the group whose duty schedule we want
- time- the time to check for a duty schedule
- Returns:
- boolean, true if the group is on duty, false otherwise.
- Throws:
- java.io.IOException- if any.
 
 - 
groupNextOnDutypublic long groupNextOnDuty(java.lang.String group, java.util.Calendar time) throws java.io.IOExceptionDetermines when a group is next on duty. If a group has no duty schedules listed in the configuration file, that group is assumed to always be on duty.- Specified by:
- groupNextOnDutyin interface- GroupConfig
- Parameters:
- group- the group whose duty schedule we want
- time- the time to check for a duty schedule
- Returns:
- long, the time in milliseconds until the group is next on duty
- Throws:
- java.io.IOException- if any.
 
 - 
saveXmlprotected abstract void saveXml(java.lang.String data) throws java.io.IOExceptionsaveXml - Parameters:
- data- a- Stringobject.
- Throws:
- java.io.IOException- if any.
 
 - 
saveGrouppublic void saveGroup(java.lang.String name, Group details) throws java.lang.ExceptionAdds a new user and overwrites the "groups.xml"- Specified by:
- saveGroupin interface- GroupConfig
- Parameters:
- name- a- Stringobject.
- details- a- Groupobject.
- Throws:
- java.lang.Exception- if any.
 
 - 
saveRolepublic void saveRole(Role role) throws java.lang.Exception saveRole - Specified by:
- saveRolein interface- GroupConfig
- Parameters:
- role- a- Roleobject.
- Throws:
- java.lang.Exception- if any.
 
 - 
deleteUserpublic void deleteUser(java.lang.String name) throws java.lang.ExceptionRemoves the user from the list of groups. Then overwrites to the "groups.xml"- Specified by:
- deleteUserin interface- GroupConfig
- Parameters:
- name- a- Stringobject.
- Throws:
- java.lang.Exception- if any.
 
 - 
deleteGrouppublic void deleteGroup(java.lang.String name) throws java.lang.ExceptionRemoves the group from the list of groups. Then overwrites to the "groups.xml"- Specified by:
- deleteGroupin interface- GroupConfig
- Parameters:
- name- a- Stringobject.
- Throws:
- java.lang.Exception- if any.
 
 - 
deleteRolepublic void deleteRole(java.lang.String name) throws java.lang.ExceptiondeleteRole - Specified by:
- deleteRolein interface- GroupConfig
- Parameters:
- name- a- Stringobject.
- Throws:
- java.lang.Exception- if any.
 
 - 
renameGrouppublic void renameGroup(java.lang.String oldName, java.lang.String newName) throws java.lang.ExceptionRenames the group from the list of groups. Then overwrites to the "groups.xml"- Specified by:
- renameGroupin interface- GroupConfig
- Parameters:
- oldName- a- Stringobject.
- newName- a- Stringobject.
- Throws:
- java.lang.Exception- if any.
 
 - 
renameUserpublic void renameUser(java.lang.String oldName, java.lang.String newName) throws java.lang.ExceptionWhen this method is called group name is changed, so also is the group name belonging to the view. Also overwrites the "groups.xml" file- Specified by:
- renameUserin interface- GroupConfig
- Parameters:
- oldName- a- Stringobject.
- newName- a- Stringobject.
- Throws:
- java.lang.Exception- if any.
 
 - 
getRoleNamespublic java.lang.String[] getRoleNames() getRoleNames - Specified by:
- getRoleNamesin interface- GroupConfig
- Returns:
- an array of Stringobjects.
 
 - 
getRolespublic java.util.Collection<Role> getRoles() getRoles - Specified by:
- getRolesin interface- GroupConfig
- Returns:
- a Collectionobject.
 
 - 
getRolepublic Role getRole(java.lang.String roleName) getRole - Specified by:
- getRolein interface- GroupConfig
- Parameters:
- roleName- a- Stringobject.
- Returns:
- a Roleobject.
 
 - 
userHasRolepublic boolean userHasRole(java.lang.String userId, java.lang.String roleid) throws java.io.IOExceptionuserHasRole - Specified by:
- userHasRolein interface- GroupConfig
- Parameters:
- userId- a- Stringobject.
- roleid- a- Stringobject.
- Returns:
- a boolean.
- Throws:
- java.io.IOException- if any.
 
 - 
getSchedulesForRoleAtpublic java.util.List<Schedule> getSchedulesForRoleAt(java.lang.String roleId, java.util.Date time) throws java.io.IOException getSchedulesForRoleAt - Specified by:
- getSchedulesForRoleAtin interface- GroupConfig
- Parameters:
- roleId- a- Stringobject.
- time- a- Dateobject.
- Returns:
- a Listobject.
- Throws:
- java.io.IOException- if any.
 
 - 
getUserSchedulesForRolepublic java.util.List<Schedule> getUserSchedulesForRole(java.lang.String userId, java.lang.String roleId) throws java.io.IOException getUserSchedulesForRole - Specified by:
- getUserSchedulesForRolein interface- GroupConfig
- Parameters:
- userId- a- Stringobject.
- roleId- a- Stringobject.
- Returns:
- a Listobject.
- Throws:
- java.io.IOException- if any.
 
 - 
isUserScheduledForRolepublic boolean isUserScheduledForRole(java.lang.String userId, java.lang.String roleId, java.util.Date time) throws java.io.IOExceptionisUserScheduledForRole - Specified by:
- isUserScheduledForRolein interface- GroupConfig
- Parameters:
- userId- a- Stringobject.
- roleId- a- Stringobject.
- time- a- Dateobject.
- Returns:
- a boolean.
- Throws:
- java.io.IOException- if any.
 
 - 
getRoleScheduleEntriespublic OwnedIntervalSequence getRoleScheduleEntries(java.lang.String roleid, java.util.Date start, java.util.Date end) throws java.io.IOException getRoleScheduleEntries - Specified by:
- getRoleScheduleEntriesin interface- GroupConfig
- Parameters:
- roleid- a- Stringobject.
- start- a- Dateobject.
- end- a- Dateobject.
- Returns:
- a OwnedIntervalSequenceobject.
- Throws:
- java.io.IOException- if any.
 
 - 
findGroupsForUserpublic java.util.List<Group> findGroupsForUser(java.lang.String user) findGroupsForUser - Specified by:
- findGroupsForUserin interface- GroupConfig
- Parameters:
- user- a- Stringobject.
- Returns:
- a Listobject.
 
 
- 
 
-