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 classGroupManagerGroupDao.GroupManagerConfigObjectExceptionTranslator
-
Constructor Summary
Constructors Constructor Description GroupManagerGroupDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()afterPropertiesSetvoiddeleteGroup(String name)Removes the group from the list of groups.voiddeleteRole(String name)deleteRolevoiddeleteUser(String name)Removes the user from the list of groups.List<Group>findGroupsForUser(String user)findGroupsForUserStringgetDefaultMapForUser(String user)getDefaultMapForUserGroupgetGroup(String name)Get a group using its nameGroupManagergetGroupManager()getGroupManagerList<String>getGroupNames()getGroupNamesMap<String,Group>getGroups()getGroupsRolegetRole(String name)getRoleString[]getRoleNames()getRoleNamesCollection<Role>getRoles()getRolesOwnedIntervalSequencegetRoleScheduleEntries(String role, Date start, Date end)getRoleScheduleEntriesList<Schedule>getSchedulesForRoleAt(String role, Date time)getSchedulesForRoleAtList<Schedule>getUserSchedulesForRole(String user, String role)getUserSchedulesForRolelonggroupNextOnDuty(String group, Calendar time)Determines when a group is next on duty.booleanhasGroup(String name)Returns a boolean indicating if the group name appears in the xml filebooleanisGroupOnDuty(String group, Calendar time)Determines if a group is on duty at a given time.booleanisUserScheduledForRole(String user, String role, Date time)isUserScheduledForRolevoidrenameGroup(String oldName, String newName)Renames the group from the list of groups.voidrenameUser(String oldName, String newName)When this method is called group name is changed, so also is the groupname belonging to the view.voidsaveGroup(String name, Group details)Adds a new user and overwrites the "groups.xml"voidsaveGroups()saveGroupsvoidsaveRole(Role name)saveRolevoidsetGroupManager(GroupManager groupManager)setGroupManagervoidsetGroups(Map<String,Group> groups)Set the groups databooleanuserHasRole(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:
deleteGroupin interfaceGroupDao- Parameters:
name- aStringobject.
-
deleteRole
public void deleteRole(String name)
deleteRole
- Specified by:
deleteRolein interfaceGroupDao- Parameters:
name- aStringobject.
-
deleteUser
public void deleteUser(String name)
Removes the user from the list of groups. Then overwrites to the "groups.xml"- Specified by:
deleteUserin interfaceGroupDao- Parameters:
name- aStringobject.
-
findGroupsForUser
public List<Group> findGroupsForUser(String user)
findGroupsForUser
- Specified by:
findGroupsForUserin interfaceGroupDao- Parameters:
user- aStringobject.- Returns:
- a
Listobject.
-
getGroupNames
public List<String> getGroupNames()
getGroupNames
- Specified by:
getGroupNamesin interfaceGroupDao- Returns:
- a
Listobject.
-
getRoleNames
public String[] getRoleNames()
getRoleNames
- Specified by:
getRoleNamesin interfaceGroupDao- Returns:
- an array of
Stringobjects.
-
getRoleScheduleEntries
public OwnedIntervalSequence getRoleScheduleEntries(String role, Date start, Date end)
getRoleScheduleEntries
- Specified by:
getRoleScheduleEntriesin interfaceGroupDao- Parameters:
role- aStringobject.start- aDateobject.end- aDateobject.- Returns:
- a
OwnedIntervalSequenceobject.
-
getRoles
public Collection<Role> getRoles()
getRoles
- Specified by:
getRolesin interfaceGroupDao- Returns:
- a
Collectionobject.
-
getSchedulesForRoleAt
public List<Schedule> getSchedulesForRoleAt(String role, Date time)
getSchedulesForRoleAt
- Specified by:
getSchedulesForRoleAtin interfaceGroupDao- Parameters:
role- aStringobject.time- aDateobject.- Returns:
- a
Listobject.
-
getUserSchedulesForRole
public List<Schedule> getUserSchedulesForRole(String user, String role)
getUserSchedulesForRole
- Specified by:
getUserSchedulesForRolein interfaceGroupDao- Parameters:
user- aStringobject.role- aStringobject.- Returns:
- a
Listobject.
-
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:
groupNextOnDutyin 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:
isGroupOnDutyin 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:
isUserScheduledForRolein interfaceGroupDao- Parameters:
user- aStringobject.role- aStringobject.time- aDateobject.- 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:
renameGroupin interfaceGroupDao- Parameters:
oldName- aStringobject.newName- aStringobject.
-
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:
renameUserin interfaceGroupDao- Parameters:
oldName- aStringobject.newName- aStringobject.
-
saveGroup
public void saveGroup(String name, Group details)
Adds a new user and overwrites the "groups.xml"
-
saveGroups
public void saveGroups()
saveGroups
- Specified by:
saveGroupsin interfaceGroupDao
-
saveRole
public void saveRole(Role name)
saveRole
-
userHasRole
public boolean userHasRole(String user, String role)
userHasRole
- Specified by:
userHasRolein interfaceGroupDao- Parameters:
user- aStringobject.role- aStringobject.- Returns:
- a boolean.
-
afterPropertiesSet
public void afterPropertiesSet()
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getGroupManager
public GroupManager getGroupManager()
getGroupManager
- Returns:
- a
GroupManagerobject.
-
setGroupManager
public void setGroupManager(GroupManager groupManager)
setGroupManager
- Parameters:
groupManager- aGroupManagerobject.
-
-