Interface GroupDao

    • Method Detail

      • setGroups

        void setGroups​(Map<String,​Group> groups)
        Set the groups data
        Parameters:
        groups - a Map object.
      • hasGroup

        boolean hasGroup​(String groupName)
        Returns a boolean indicating if the group name appears in the xml file
        Parameters:
        groupName - a String object.
        Returns:
        true if the group exists in the xml file, false otherwise
      • getGroupNames

        List<String> getGroupNames()

        getGroupNames

        Returns:
        a List object.
      • getGroup

        Group getGroup​(String name)
        Get a group using its name
        Parameters:
        name - the name of the group to return
        Returns:
        Group, the group specified by name
      • saveGroups

        void saveGroups()

        saveGroups

      • isGroupOnDuty

        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.
        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.
      • groupNextOnDuty

        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.
        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
      • saveGroup

        void saveGroup​(String name,
                       Group details)
        Adds a new user and overwrites the "groups.xml"
        Parameters:
        name - a String object.
        details - a Group object.
      • saveRole

        void saveRole​(Role role)

        saveRole

        Parameters:
        role - a Role object.
      • deleteUser

        void deleteUser​(String name)
        Removes the user from the list of groups. Then overwrites to the "groups.xml"
        Parameters:
        name - a String object.
      • deleteGroup

        void deleteGroup​(String name)
        Removes the group from the list of groups. Then overwrites to the "groups.xml"
        Parameters:
        name - a String object.
      • deleteRole

        void deleteRole​(String name)

        deleteRole

        Parameters:
        name - a String object.
      • renameGroup

        void renameGroup​(String oldName,
                         String newName)
        Renames the group from the list of groups. Then overwrites to the "groups.xml"
        Parameters:
        oldName - a String object.
        newName - a String object.
      • renameUser

        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
        Parameters:
        oldName - a String object.
        newName - a String object.
      • getRoleNames

        String[] getRoleNames()

        getRoleNames

        Returns:
        an array of String objects.
      • getRole

        Role getRole​(String roleName)

        getRole

        Parameters:
        roleName - a String object.
        Returns:
        a Role object.
      • userHasRole

        boolean userHasRole​(String userId,
                            String roleid)

        userHasRole

        Parameters:
        userId - a String object.
        roleid - a String object.
        Returns:
        a boolean.
      • getSchedulesForRoleAt

        List<Schedule> getSchedulesForRoleAt​(String roleId,
                                             Date time)

        getSchedulesForRoleAt

        Parameters:
        roleId - a String object.
        time - a Date object.
        Returns:
        a List object.
      • getUserSchedulesForRole

        List<Schedule> getUserSchedulesForRole​(String userId,
                                               String roleid)

        getUserSchedulesForRole

        Parameters:
        userId - a String object.
        roleid - a String object.
        Returns:
        a List object.
      • isUserScheduledForRole

        boolean isUserScheduledForRole​(String userId,
                                       String roleid,
                                       Date time)

        isUserScheduledForRole

        Parameters:
        userId - a String object.
        roleid - a String object.
        time - a Date object.
        Returns:
        a boolean.
      • findGroupsForUser

        List<Group> findGroupsForUser​(String user)

        findGroupsForUser

        Parameters:
        user - a String object.
        Returns:
        a List object.
      • getDefaultMapForUser

        String getDefaultMapForUser​(String user)

        getDefaultMapForUser

        Parameters:
        user - a String object.
        Returns:
        a String object.