Class 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
    • 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.
      • 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
      • 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.
      • 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
      • setGroupManager

        public void setGroupManager​(GroupManager groupManager)

        setGroupManager

        Parameters:
        groupManager - a GroupManager object.