org.opennms.netmgt.config
Class GroupManagerGroupDao

java.lang.Object
  extended by org.opennms.netmgt.config.GroupManagerGroupDao
All Implemented Interfaces:
GroupDao, org.springframework.beans.factory.InitializingBean

public class GroupManagerGroupDao
extends Object
implements GroupDao, org.springframework.beans.factory.InitializingBean

Author:
DJ Gregor

Nested Class Summary
static class GroupManagerGroupDao.GroupManagerCastorExceptionTranslator
           
 
Constructor Summary
GroupManagerGroupDao()
           
 
Method Summary
 void afterPropertiesSet()
           
 void deleteGroup(String name)
          Removes the group from the list of groups.
 void deleteRole(String name)
           
 void deleteUser(String name)
          Removes the user from the list of groups.
 List<Group> findGroupsForUser(String user)
           
 Group getGroup(String name)
          Get a group using its name
 GroupManager getGroupManager()
           
 List<String> getGroupNames()
           
 Map<String,Group> getGroups()
          Get the groups
 Role getRole(String name)
           
 String[] getRoleNames()
           
 Collection getRoles()
           
 OwnedIntervalSequence getRoleScheduleEntries(String role, Date start, Date end)
           
 List<Schedule> getSchedulesForRoleAt(String role, Date time)
           
 List getUserSchedulesForRole(String user, String role)
           
 long 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 file
 boolean isGroupOnDuty(String group, Calendar time)
          Determines if a group is on duty at a given time.
 boolean isUserScheduledForRole(String user, String role, Date time)
           
 void 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()
           
 void saveRole(Role name)
           
 void setGroupManager(GroupManager groupManager)
           
 void setGroups(Map<String,Group> groups)
          Set the groups data
 boolean userHasRole(String user, String role)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupManagerGroupDao

public GroupManagerGroupDao()
Method Detail

deleteGroup

public void deleteGroup(String name)
Description copied from interface: GroupDao
Removes the group from the list of groups. Then overwrites to the "groups.xml"

Specified by:
deleteGroup in interface GroupDao

deleteRole

public void deleteRole(String name)
Specified by:
deleteRole in interface GroupDao

deleteUser

public void deleteUser(String name)
Description copied from interface: GroupDao
Removes the user from the list of groups. Then overwrites to the "groups.xml"

Specified by:
deleteUser in interface GroupDao

findGroupsForUser

public List<Group> findGroupsForUser(String user)
Specified by:
findGroupsForUser in interface GroupDao

getGroup

public Group getGroup(String name)
Description copied from interface: GroupDao
Get a group using its name

Specified by:
getGroup in interface GroupDao
Parameters:
name - the name of the group to return
Returns:
Group, the group specified by name

getGroupNames

public List<String> getGroupNames()
Specified by:
getGroupNames in interface GroupDao

getGroups

public Map<String,Group> getGroups()
Description copied from interface: GroupDao
Get the groups

Specified by:
getGroups in interface GroupDao

getRole

public Role getRole(String name)
Specified by:
getRole in interface GroupDao

getRoleNames

public String[] getRoleNames()
Specified by:
getRoleNames in interface GroupDao

getRoleScheduleEntries

public OwnedIntervalSequence getRoleScheduleEntries(String role,
                                                    Date start,
                                                    Date end)
Specified by:
getRoleScheduleEntries in interface GroupDao

getRoles

public Collection getRoles()
Specified by:
getRoles in interface GroupDao

getSchedulesForRoleAt

public List<Schedule> getSchedulesForRoleAt(String role,
                                            Date time)
Specified by:
getSchedulesForRoleAt in interface GroupDao

getUserSchedulesForRole

public List getUserSchedulesForRole(String user,
                                    String role)
Specified by:
getUserSchedulesForRole in interface GroupDao

groupNextOnDuty

public long groupNextOnDuty(String group,
                            Calendar time)
Description copied from interface: GroupDao
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 interface GroupDao
Parameters:
group - the group whose duty schedule we want
time - 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)
Description copied from interface: GroupDao
Returns a boolean indicating if the group name appears in the xml file

Specified by:
hasGroup in interface GroupDao
Returns:
true if the group exists in the xml file, false otherwise

isGroupOnDuty

public boolean isGroupOnDuty(String group,
                             Calendar time)
Description copied from interface: GroupDao
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 interface GroupDao
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.

isUserScheduledForRole

public boolean isUserScheduledForRole(String user,
                                      String role,
                                      Date time)
Specified by:
isUserScheduledForRole in interface GroupDao

renameGroup

public void renameGroup(String oldName,
                        String newName)
Description copied from interface: GroupDao
Renames the group from the list of groups. Then overwrites to the "groups.xml"

Specified by:
renameGroup in interface GroupDao

renameUser

public void renameUser(String oldName,
                       String newName)
Description copied from interface: GroupDao
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 interface GroupDao

saveGroup

public void saveGroup(String name,
                      Group details)
Description copied from interface: GroupDao
Adds a new user and overwrites the "groups.xml"

Specified by:
saveGroup in interface GroupDao

saveGroups

public void saveGroups()
Specified by:
saveGroups in interface GroupDao

saveRole

public void saveRole(Role name)
Specified by:
saveRole in interface GroupDao

setGroups

public void setGroups(Map<String,Group> groups)
Description copied from interface: GroupDao
Set the groups data

Specified by:
setGroups in interface GroupDao

userHasRole

public boolean userHasRole(String user,
                           String role)
Specified by:
userHasRole in interface GroupDao

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

getGroupManager

public GroupManager getGroupManager()

setGroupManager

public void setGroupManager(GroupManager groupManager)


Copyright © 2009. All Rights Reserved.