Package org.opennms.netmgt.config
Class GroupManagerGroupDao
- java.lang.Object
-
- org.opennms.netmgt.config.GroupManagerGroupDao
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GroupManagerGroupDao.GroupManagerConfigObjectExceptionTranslator
-
Constructor Summary
Constructors Constructor Description GroupManagerGroupDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
afterPropertiesSetvoid
deleteGroup(String name)
Removes the group from the list of groups.void
deleteRole(String name)
deleteRolevoid
deleteUser(String name)
Removes the user from the list of groups.List<Group>
findGroupsForUser(String user)
findGroupsForUserString
getDefaultMapForUser(String user)
getDefaultMapForUserGroup
getGroup(String name)
Get a group using its nameGroupManager
getGroupManager()
getGroupManagerList<String>
getGroupNames()
getGroupNamesMap<String,Group>
getGroups()
getGroupsRole
getRole(String name)
getRoleString[]
getRoleNames()
getRoleNamesCollection<Role>
getRoles()
getRolesOwnedIntervalSequence
getRoleScheduleEntries(String role, Date start, Date end)
getRoleScheduleEntriesList<Schedule>
getSchedulesForRoleAt(String role, Date time)
getSchedulesForRoleAtList<Schedule>
getUserSchedulesForRole(String user, String role)
getUserSchedulesForRolelong
groupNextOnDuty(String group, Calendar time)
Determines when a group is next on duty.boolean
hasGroup(String name)
Returns a boolean indicating if the group name appears in the xml fileboolean
isGroupOnDuty(String group, Calendar time)
Determines if a group is on duty at a given time.boolean
isUserScheduledForRole(String user, String role, Date time)
isUserScheduledForRolevoid
renameGroup(String oldName, String newName)
Renames the group from the list of groups.void
renameUser(String oldName, String newName)
When this method is called group name is changed, so also is the groupname belonging to the view.void
saveGroup(String name, Group details)
Adds a new user and overwrites the "groups.xml"void
saveGroups()
saveGroupsvoid
saveRole(Role name)
saveRolevoid
setGroupManager(GroupManager groupManager)
setGroupManagervoid
setGroups(Map<String,Group> groups)
Set the groups databoolean
userHasRole(String user, String role)
userHasRole
-
-
-
Method Detail
-
deleteGroup
public void deleteGroup(String name)
Removes the group from the list of groups. Then overwrites to the "groups.xml"- Specified by:
deleteGroup
in interfaceGroupDao
- Parameters:
name
- aString
object.
-
deleteRole
public void deleteRole(String name)
deleteRole
- Specified by:
deleteRole
in interfaceGroupDao
- Parameters:
name
- aString
object.
-
deleteUser
public void deleteUser(String name)
Removes the user from the list of groups. Then overwrites to the "groups.xml"- Specified by:
deleteUser
in interfaceGroupDao
- Parameters:
name
- aString
object.
-
findGroupsForUser
public List<Group> findGroupsForUser(String user)
findGroupsForUser
- Specified by:
findGroupsForUser
in interfaceGroupDao
- Parameters:
user
- aString
object.- Returns:
- a
List
object.
-
getGroupNames
public List<String> getGroupNames()
getGroupNames
- Specified by:
getGroupNames
in interfaceGroupDao
- Returns:
- a
List
object.
-
getRoleNames
public String[] getRoleNames()
getRoleNames
- Specified by:
getRoleNames
in interfaceGroupDao
- Returns:
- an array of
String
objects.
-
getRoleScheduleEntries
public OwnedIntervalSequence getRoleScheduleEntries(String role, Date start, Date end)
getRoleScheduleEntries
- Specified by:
getRoleScheduleEntries
in interfaceGroupDao
- Parameters:
role
- aString
object.start
- aDate
object.end
- aDate
object.- Returns:
- a
OwnedIntervalSequence
object.
-
getRoles
public Collection<Role> getRoles()
getRoles
- Specified by:
getRoles
in interfaceGroupDao
- Returns:
- a
Collection
object.
-
getSchedulesForRoleAt
public List<Schedule> getSchedulesForRoleAt(String role, Date time)
getSchedulesForRoleAt
- Specified by:
getSchedulesForRoleAt
in interfaceGroupDao
- Parameters:
role
- aString
object.time
- aDate
object.- Returns:
- a
List
object.
-
getUserSchedulesForRole
public List<Schedule> getUserSchedulesForRole(String user, String role)
getUserSchedulesForRole
- Specified by:
getUserSchedulesForRole
in interfaceGroupDao
- Parameters:
user
- aString
object.role
- aString
object.- Returns:
- a
List
object.
-
groupNextOnDuty
public long groupNextOnDuty(String group, Calendar time)
Determines when a group is next on duty. If a group has no duty schedules listed in the config file, that group is assumed to always be on duty.- Specified by:
groupNextOnDuty
in interfaceGroupDao
- Parameters:
group
- the group whose duty schedule we wanttime
- the time to check for a duty schedule- Returns:
- long, the time in millisec until the group is next on duty
-
hasGroup
public boolean hasGroup(String name)
Returns a boolean indicating if the group name appears in the xml file
-
isGroupOnDuty
public boolean isGroupOnDuty(String group, Calendar time)
Determines if a group is on duty at a given time. If a group has no duty schedules listed in the config file, that group is assumed to always be on duty.- Specified by:
isGroupOnDuty
in interfaceGroupDao
- Parameters:
group
- the group whose duty schedule we wanttime
- the time to check for a duty schedule- Returns:
- boolean, true if the group is on duty, false otherwise.
-
isUserScheduledForRole
public boolean isUserScheduledForRole(String user, String role, Date time)
isUserScheduledForRole
- Specified by:
isUserScheduledForRole
in interfaceGroupDao
- Parameters:
user
- aString
object.role
- aString
object.time
- aDate
object.- Returns:
- a boolean.
-
renameGroup
public void renameGroup(String oldName, String newName)
Renames the group from the list of groups. Then overwrites to the "groups.xml"- Specified by:
renameGroup
in interfaceGroupDao
- Parameters:
oldName
- aString
object.newName
- aString
object.
-
renameUser
public void renameUser(String oldName, String newName)
When this method is called group name is changed, so also is the groupname belonging to the view. Also overwrites the "groups.xml" file- Specified by:
renameUser
in interfaceGroupDao
- Parameters:
oldName
- aString
object.newName
- aString
object.
-
saveGroup
public void saveGroup(String name, Group details)
Adds a new user and overwrites the "groups.xml"
-
saveGroups
public void saveGroups()
saveGroups
- Specified by:
saveGroups
in interfaceGroupDao
-
saveRole
public void saveRole(Role name)
saveRole
-
userHasRole
public boolean userHasRole(String user, String role)
userHasRole
- Specified by:
userHasRole
in interfaceGroupDao
- Parameters:
user
- aString
object.role
- aString
object.- Returns:
- a boolean.
-
afterPropertiesSet
public void afterPropertiesSet()
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getGroupManager
public GroupManager getGroupManager()
getGroupManager
- Returns:
- a
GroupManager
object.
-
setGroupManager
public void setGroupManager(GroupManager groupManager)
setGroupManager
- Parameters:
groupManager
- aGroupManager
object.
-
-