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(java.lang.String name)
Removes the group from the list of groups.void
deleteRole(java.lang.String name)
deleteRolevoid
deleteUser(java.lang.String name)
Removes the user from the list of groups.java.util.List<Group>
findGroupsForUser(java.lang.String user)
findGroupsForUserjava.lang.String
getDefaultMapForUser(java.lang.String user)
getDefaultMapForUserGroup
getGroup(java.lang.String name)
Get a group using its nameGroupManager
getGroupManager()
getGroupManagerjava.util.List<java.lang.String>
getGroupNames()
getGroupNamesjava.util.Map<java.lang.String,Group>
getGroups()
getGroupsRole
getRole(java.lang.String name)
getRolejava.lang.String[]
getRoleNames()
getRoleNamesjava.util.Collection<Role>
getRoles()
getRolesOwnedIntervalSequence
getRoleScheduleEntries(java.lang.String role, java.util.Date start, java.util.Date end)
getRoleScheduleEntriesjava.util.List<Schedule>
getSchedulesForRoleAt(java.lang.String role, java.util.Date time)
getSchedulesForRoleAtjava.util.List<Schedule>
getUserSchedulesForRole(java.lang.String user, java.lang.String role)
getUserSchedulesForRolelong
groupNextOnDuty(java.lang.String group, java.util.Calendar time)
Determines when a group is next on duty.boolean
hasGroup(java.lang.String name)
Returns a boolean indicating if the group name appears in the xml fileboolean
isGroupOnDuty(java.lang.String group, java.util.Calendar time)
Determines if a group is on duty at a given time.boolean
isUserScheduledForRole(java.lang.String user, java.lang.String role, java.util.Date time)
isUserScheduledForRolevoid
renameGroup(java.lang.String oldName, java.lang.String newName)
Renames the group from the list of groups.void
renameUser(java.lang.String oldName, java.lang.String newName)
When this method is called group name is changed, so also is the groupname belonging to the view.void
saveGroup(java.lang.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(java.util.Map<java.lang.String,Group> groups)
Set the groups databoolean
userHasRole(java.lang.String user, java.lang.String role)
userHasRole
-
-
-
Method Detail
-
deleteGroup
public void deleteGroup(java.lang.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(java.lang.String name)
deleteRole
- Specified by:
deleteRole
in interfaceGroupDao
- Parameters:
name
- aString
object.
-
deleteUser
public void deleteUser(java.lang.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 java.util.List<Group> findGroupsForUser(java.lang.String user)
findGroupsForUser
- Specified by:
findGroupsForUser
in interfaceGroupDao
- Parameters:
user
- aString
object.- Returns:
- a
List
object.
-
getGroup
public Group getGroup(java.lang.String name)
Get a group using its name
-
getGroupNames
public java.util.List<java.lang.String> getGroupNames()
getGroupNames
- Specified by:
getGroupNames
in interfaceGroupDao
- Returns:
- a
List
object.
-
getGroups
public java.util.Map<java.lang.String,Group> getGroups()
getGroups
-
getRole
public Role getRole(java.lang.String name)
getRole
-
getRoleNames
public java.lang.String[] getRoleNames()
getRoleNames
- Specified by:
getRoleNames
in interfaceGroupDao
- Returns:
- an array of
String
objects.
-
getRoleScheduleEntries
public OwnedIntervalSequence getRoleScheduleEntries(java.lang.String role, java.util.Date start, java.util.Date end)
getRoleScheduleEntries
- Specified by:
getRoleScheduleEntries
in interfaceGroupDao
- Parameters:
role
- aString
object.start
- aDate
object.end
- aDate
object.- Returns:
- a
OwnedIntervalSequence
object.
-
getRoles
public java.util.Collection<Role> getRoles()
getRoles
-
getSchedulesForRoleAt
public java.util.List<Schedule> getSchedulesForRoleAt(java.lang.String role, java.util.Date time)
getSchedulesForRoleAt
- Specified by:
getSchedulesForRoleAt
in interfaceGroupDao
- Parameters:
role
- aString
object.time
- aDate
object.- Returns:
- a
List
object.
-
getUserSchedulesForRole
public java.util.List<Schedule> getUserSchedulesForRole(java.lang.String user, java.lang.String role)
getUserSchedulesForRole
- Specified by:
getUserSchedulesForRole
in interfaceGroupDao
- Parameters:
user
- aString
object.role
- aString
object.- Returns:
- a
List
object.
-
groupNextOnDuty
public long groupNextOnDuty(java.lang.String group, java.util.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(java.lang.String name)
Returns a boolean indicating if the group name appears in the xml file
-
isGroupOnDuty
public boolean isGroupOnDuty(java.lang.String group, java.util.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(java.lang.String user, java.lang.String role, java.util.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(java.lang.String oldName, java.lang.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(java.lang.String oldName, java.lang.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(java.lang.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
-
setGroups
public void setGroups(java.util.Map<java.lang.String,Group> groups)
Set the groups data
-
userHasRole
public boolean userHasRole(java.lang.String user, java.lang.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.
-
getDefaultMapForUser
public java.lang.String getDefaultMapForUser(java.lang.String user)
getDefaultMapForUser
- Specified by:
getDefaultMapForUser
in interfaceGroupDao
- Parameters:
user
- aString
object.- Returns:
- a
String
object.
-
-