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

GroupManagerGroupDao class.

Version:
$Id: $
Author:
DJ Gregor

Nested Class Summary
static class GroupManagerGroupDao.GroupManagerCastorExceptionTranslator
           
 
Constructor Summary
GroupManagerGroupDao()
           
 
Method Summary
 void afterPropertiesSet()
          afterPropertiesSet
 void deleteGroup(String name)
          Removes the group from the list of groups.
 void deleteRole(String name)
          deleteRole
 void deleteUser(String name)
          Removes the user from the list of groups.
 List<Group> findGroupsForUser(String user)
          findGroupsForUser
 String getDefaultMapForUser(String user)
          getDefaultMapForUser
 Group getGroup(String name)
          Get a group using its name
 GroupManager getGroupManager()
          getGroupManager
 List<String> getGroupNames()
          getGroupNames
 Map<String,Group> getGroups()
          getGroups
 Role getRole(String name)
          getRole
 String[] getRoleNames()
          getRoleNames
 Collection<Role> getRoles()
          getRoles
 OwnedIntervalSequence getRoleScheduleEntries(String role, Date start, Date end)
          getRoleScheduleEntries
 List<Schedule> getSchedulesForRoleAt(String role, Date time)
          getSchedulesForRoleAt
 List<Schedule> getUserSchedulesForRole(String user, String role)
          getUserSchedulesForRole
 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)
          isUserScheduledForRole
 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()
          saveGroups
 void saveRole(Role name)
          saveRole
 void setGroupManager(GroupManager groupManager)
          setGroupManager
 void setGroups(Map<String,Group> groups)
          Set the groups data
 boolean userHasRole(String user, String role)
          userHasRole
 
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)
Removes the group from the list of groups. Then overwrites to the "groups.xml"

Specified by:
deleteGroup in interface GroupDao
Parameters:
name - a String object.

deleteRole

public void deleteRole(String name)

deleteRole

Specified by:
deleteRole in interface GroupDao
Parameters:
name - a String 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 interface GroupDao
Parameters:
name - a String object.

findGroupsForUser

public List<Group> findGroupsForUser(String user)

findGroupsForUser

Specified by:
findGroupsForUser in interface GroupDao
Parameters:
user - a String object.
Returns:
a List object.

getGroup

public Group getGroup(String name)
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()

getGroupNames

Specified by:
getGroupNames in interface GroupDao
Returns:
a List object.

getGroups

public Map<String,Group> getGroups()

getGroups

Specified by:
getGroups in interface GroupDao
Returns:
a Map object.

getRole

public Role getRole(String name)

getRole

Specified by:
getRole in interface GroupDao
Parameters:
name - a String object.
Returns:
a Role object.

getRoleNames

public String[] getRoleNames()

getRoleNames

Specified by:
getRoleNames in interface GroupDao
Returns:
an array of String objects.

getRoleScheduleEntries

public OwnedIntervalSequence getRoleScheduleEntries(String role,
                                                    Date start,
                                                    Date end)

getRoleScheduleEntries

Specified by:
getRoleScheduleEntries in interface GroupDao
Parameters:
role - a String object.
start - a Date object.
end - a Date object.
Returns:
a OwnedIntervalSequence object.

getRoles

public Collection<Role> getRoles()

getRoles

Specified by:
getRoles in interface GroupDao
Returns:
a Collection object.

getSchedulesForRoleAt

public List<Schedule> getSchedulesForRoleAt(String role,
                                            Date time)

getSchedulesForRoleAt

Specified by:
getSchedulesForRoleAt in interface GroupDao
Parameters:
role - a String object.
time - a Date object.
Returns:
a List object.

getUserSchedulesForRole

public List<Schedule> getUserSchedulesForRole(String user,
                                              String role)

getUserSchedulesForRole

Specified by:
getUserSchedulesForRole in interface GroupDao
Parameters:
user - a String object.
role - a String 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 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)
Returns a boolean indicating if the group name appears in the xml file

Specified by:
hasGroup in interface GroupDao
Parameters:
name - a String object.
Returns:
true if the group exists in the xml file, false otherwise

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 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)

isUserScheduledForRole

Specified by:
isUserScheduledForRole in interface GroupDao
Parameters:
user - a String object.
role - a String object.
time - a Date 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 interface GroupDao
Parameters:
oldName - a String object.
newName - a String 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 interface GroupDao
Parameters:
oldName - a String object.
newName - a String object.

saveGroup

public void saveGroup(String name,
                      Group details)
Adds a new user and overwrites the "groups.xml"

Specified by:
saveGroup in interface GroupDao
Parameters:
name - a String object.
details - a Group object.

saveGroups

public void saveGroups()

saveGroups

Specified by:
saveGroups in interface GroupDao

saveRole

public void saveRole(Role name)

saveRole

Specified by:
saveRole in interface GroupDao
Parameters:
name - a Role object.

setGroups

public void setGroups(Map<String,Group> groups)
Set the groups data

Specified by:
setGroups in interface GroupDao
Parameters:
groups - a Map object.

userHasRole

public boolean userHasRole(String user,
                           String role)

userHasRole

Specified by:
userHasRole in interface GroupDao
Parameters:
user - a String object.
role - a String object.
Returns:
a boolean.

afterPropertiesSet

public void afterPropertiesSet()

afterPropertiesSet

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

getGroupManager

public GroupManager getGroupManager()

getGroupManager

Returns:
a GroupManager object.

setGroupManager

public void setGroupManager(GroupManager groupManager)

setGroupManager

Parameters:
groupManager - a GroupManager object.

getDefaultMapForUser

public String getDefaultMapForUser(String user)

getDefaultMapForUser

Specified by:
getDefaultMapForUser in interface GroupDao
Parameters:
user - a String object.
Returns:
a String object.


Copyright © 2011. All Rights Reserved.