Interface GroupDao

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void deleteGroup​(java.lang.String name)
      Removes the group from the list of groups.
      void deleteRole​(java.lang.String name)
      deleteRole
      void deleteUser​(java.lang.String name)
      Removes the user from the list of groups.
      java.util.List<Group> findGroupsForUser​(java.lang.String user)
      findGroupsForUser
      java.lang.String getDefaultMapForUser​(java.lang.String user)
      getDefaultMapForUser
      Group getGroup​(java.lang.String name)
      Get a group using its name
      java.util.List<java.lang.String> getGroupNames()
      getGroupNames
      java.util.Map<java.lang.String,​Group> getGroups()
      Get the groups
      Role getRole​(java.lang.String roleName)
      getRole
      java.lang.String[] getRoleNames()
      getRoleNames
      java.util.Collection<Role> getRoles()
      getRoles
      OwnedIntervalSequence getRoleScheduleEntries​(java.lang.String roleid, java.util.Date start, java.util.Date end)
      getRoleScheduleEntries
      java.util.List<Schedule> getSchedulesForRoleAt​(java.lang.String roleId, java.util.Date time)
      getSchedulesForRoleAt
      java.util.List<Schedule> getUserSchedulesForRole​(java.lang.String userId, java.lang.String roleid)
      getUserSchedulesForRole
      long groupNextOnDuty​(java.lang.String group, java.util.Calendar time)
      Determines when a group is next on duty.
      boolean hasGroup​(java.lang.String groupName)
      Returns a boolean indicating if the group name appears in the xml file
      boolean isGroupOnDuty​(java.lang.String group, java.util.Calendar time)
      Determines if a group is on duty at a given time.
      boolean isUserScheduledForRole​(java.lang.String userId, java.lang.String roleid, java.util.Date time)
      isUserScheduledForRole
      void renameGroup​(java.lang.String oldName, java.lang.String newName)
      Renames the group from the list of groups.
      void renameUser​(java.lang.String oldName, java.lang.String newName)
      When this method is called group name is changed, so also is the groupname belonging to the view.
      void saveGroup​(java.lang.String name, Group details)
      Adds a new user and overwrites the "groups.xml"
      void saveGroups()
      saveGroups
      void saveRole​(Role role)
      saveRole
      void setGroups​(java.util.Map<java.lang.String,​Group> groups)
      Set the groups data
      boolean userHasRole​(java.lang.String userId, java.lang.String roleid)
      userHasRole
    • Method Detail

      • setGroups

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

        java.util.Map<java.lang.String,​Group> getGroups()
        Get the groups
        Returns:
        a Map object.
      • hasGroup

        boolean hasGroup​(java.lang.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

        java.util.List<java.lang.String> getGroupNames()

        getGroupNames

        Returns:
        a List object.
      • getGroup

        Group getGroup​(java.lang.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​(java.lang.String group,
                              java.util.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​(java.lang.String group,
                             java.util.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​(java.lang.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​(java.lang.String name)
        Removes the user from the list of groups. Then overwrites to the "groups.xml"
        Parameters:
        name - a String object.
      • deleteGroup

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

        void deleteRole​(java.lang.String name)

        deleteRole

        Parameters:
        name - a String object.
      • renameGroup

        void renameGroup​(java.lang.String oldName,
                         java.lang.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​(java.lang.String oldName,
                        java.lang.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

        java.lang.String[] getRoleNames()

        getRoleNames

        Returns:
        an array of String objects.
      • getRoles

        java.util.Collection<Role> getRoles()

        getRoles

        Returns:
        a Collection object.
      • getRole

        Role getRole​(java.lang.String roleName)

        getRole

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

        boolean userHasRole​(java.lang.String userId,
                            java.lang.String roleid)

        userHasRole

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

        java.util.List<Schedule> getSchedulesForRoleAt​(java.lang.String roleId,
                                                       java.util.Date time)

        getSchedulesForRoleAt

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

        java.util.List<Schedule> getUserSchedulesForRole​(java.lang.String userId,
                                                         java.lang.String roleid)

        getUserSchedulesForRole

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

        boolean isUserScheduledForRole​(java.lang.String userId,
                                       java.lang.String roleid,
                                       java.util.Date time)

        isUserScheduledForRole

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

        OwnedIntervalSequence getRoleScheduleEntries​(java.lang.String roleid,
                                                     java.util.Date start,
                                                     java.util.Date end)

        getRoleScheduleEntries

        Parameters:
        roleid - a String object.
        start - a Date object.
        end - a Date object.
        Returns:
        a OwnedIntervalSequence object.
      • findGroupsForUser

        java.util.List<Group> findGroupsForUser​(java.lang.String user)

        findGroupsForUser

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

        java.lang.String getDefaultMapForUser​(java.lang.String user)

        getDefaultMapForUser

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