Class GroupParentProvider

java.lang.Object
de.murmelmeister.murmelapi.group.parent.GroupParentProvider
All Implemented Interfaces:
GroupParent

public final class GroupParentProvider extends Object implements GroupParent
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addParent(int executorId, int groupId, int parentId, long time)
    Adds a parent relationship for a group.
    void
    clearParent(int groupId)
    Removes all parent associations for a specified group.
    boolean
    existsParent(int groupId, int parentId)
    Checks whether a parent exists for a specified group.
    getCreatedAt(int groupId, int parentId)
    Retrieves the creation timestamp of the association between the specified group and parent.
    int
    getCreatedBy(int groupId, int parentId)
    Retrieves the ID of the creator associated with the specified group and parent relationship.
    getExpiredDate(int groupId, int parentId)
    Retrieves the expiration date of the association between the specified group and parent.
    long
    getExpiredTime(int groupId, int parentId)
    Retrieves the expiration time of the association between the specified group and parent.
    getModifiedAt(int groupId, int parentId)
    Retrieves the last modified timestamp of the association between the specified group and parent.
    int
    getModifiedBy(int groupId, int parentId)
    Retrieves the unique identifier of the user who last modified the association between the specified group and parent.
    getParentIds(int groupId)
    Retrieves the list of IDs of all parent associations for the specified group.
    getParentNames(Group group, int groupId)
    Retrieves the names of all parent entities associated with the specified group.
    boolean
    isExpired(int groupId, int parentId)
    Determines if the association between the specified group and parent is expired.
    void
    Loads all expired parent associations for the specified group.
    void
    removeParent(int groupId, int parentId)
    Removes the association between a specified parent and a group.
    setExpiredTime(int executorId, int groupId, int parentId, long time)
    Updates the expiration time for the association between the specified group and parent.
    static void
    setup(Database database)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GroupParentProvider

      public GroupParentProvider(Database database)
  • Method Details

    • setup

      public static void setup(Database database)
    • existsParent

      public boolean existsParent(int groupId, int parentId)
      Description copied from interface: GroupParent
      Checks whether a parent exists for a specified group.
      Specified by:
      existsParent in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group.
      parentId - The unique identifier of the parent to check.
      Returns:
      True if the specified parent exists for the group; otherwise, false.
    • addParent

      public void addParent(int executorId, int groupId, int parentId, long time)
      Description copied from interface: GroupParent
      Adds a parent relationship for a group. If the specified parent already exists for the group, the method will not perform any action.
      Specified by:
      addParent in interface GroupParent
      Parameters:
      executorId - The unique identifier of the user performing this action.
      groupId - The unique identifier of the group to which the parent will be added.
      parentId - The unique identifier of the parent to be added.
      time - The duration in milliseconds until the parent relationship expires. Use -1 for no expiration.
    • removeParent

      public void removeParent(int groupId, int parentId)
      Description copied from interface: GroupParent
      Removes the association between a specified parent and a group.
      Specified by:
      removeParent in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group whose parent should be removed.
      parentId - The unique identifier of the parent to be removed.
    • clearParent

      public void clearParent(int groupId)
      Description copied from interface: GroupParent
      Removes all parent associations for a specified group.
      Specified by:
      clearParent in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group whose parent associations should be cleared.
    • getParentIds

      public List<Integer> getParentIds(int groupId)
      Description copied from interface: GroupParent
      Retrieves the list of IDs of all parent associations for the specified group.
      Specified by:
      getParentIds in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group whose parent IDs are being retrieved.
      Returns:
      A list of integers representing the IDs of the parents associated with the specified group.
    • getParentNames

      public List<String> getParentNames(Group group, int groupId)
      Description copied from interface: GroupParent
      Retrieves the names of all parent entities associated with the specified group.
      Specified by:
      getParentNames in interface GroupParent
      Parameters:
      group - The instance of the Group interface representing the group.
      groupId - The unique identifier of the group whose parent names are to be retrieved.
      Returns:
      A list of strings representing the names of the parent entities associated with the group.
    • getExpiredTime

      public long getExpiredTime(int groupId, int parentId)
      Description copied from interface: GroupParent
      Retrieves the expiration time of the association between the specified group and parent.
      Specified by:
      getExpiredTime in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group.
      parentId - The unique identifier of the parent.
      Returns:
      The expiration time of the association, represented as a long value in milliseconds since the epoch. If the association does not have an expiration, it may return a specific value to indicate such a case (e.g., -1).
    • getExpiredDate

      public String getExpiredDate(int groupId, int parentId)
      Description copied from interface: GroupParent
      Retrieves the expiration date of the association between the specified group and parent.
      Specified by:
      getExpiredDate in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group.
      parentId - The unique identifier of the parent.
      Returns:
      A string representing the expiration date of the association. If no expiration is set, it may return a specific value indicating such a case.
    • setExpiredTime

      public String setExpiredTime(int executorId, int groupId, int parentId, long time)
      Description copied from interface: GroupParent
      Updates the expiration time for the association between the specified group and parent. If the expiration is successfully updated, returns a confirmation status or message.
      Specified by:
      setExpiredTime in interface GroupParent
      Parameters:
      executorId - The unique identifier of the user performing this action.
      groupId - The unique identifier of the group whose parent association is being updated.
      parentId - The unique identifier of the parent whose association expiration is being updated.
      time - The new expiration time in milliseconds since the epoch. Use -1 for no expiration.
      Returns:
      A string representing the result of the operation, such as confirmation or error details.
    • isExpired

      public boolean isExpired(int groupId, int parentId)
      Description copied from interface: GroupParent
      Determines if the association between the specified group and parent is expired.
      Specified by:
      isExpired in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group.
      parentId - The unique identifier of the parent.
      Returns:
      True if the association is expired; otherwise, false.
    • getCreatedBy

      public int getCreatedBy(int groupId, int parentId)
      Description copied from interface: GroupParent
      Retrieves the ID of the creator associated with the specified group and parent relationship.
      Specified by:
      getCreatedBy in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group.
      parentId - The unique identifier of the parent.
      Returns:
      An integer representing the ID of the creator of the group-parent relationship.
    • getCreatedAt

      public Timestamp getCreatedAt(int groupId, int parentId)
      Description copied from interface: GroupParent
      Retrieves the creation timestamp of the association between the specified group and parent.
      Specified by:
      getCreatedAt in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group.
      parentId - The unique identifier of the parent.
      Returns:
      A Timestamp object representing the creation date and time of the association.
    • getModifiedBy

      public int getModifiedBy(int groupId, int parentId)
      Description copied from interface: GroupParent
      Retrieves the unique identifier of the user who last modified the association between the specified group and parent.
      Specified by:
      getModifiedBy in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group.
      parentId - The unique identifier of the parent.
      Returns:
      An integer representing the ID of the user who last modified the association.
    • getModifiedAt

      public Timestamp getModifiedAt(int groupId, int parentId)
      Description copied from interface: GroupParent
      Retrieves the last modified timestamp of the association between the specified group and parent.
      Specified by:
      getModifiedAt in interface GroupParent
      Parameters:
      groupId - The unique identifier of the group.
      parentId - The unique identifier of the parent.
      Returns:
      A Timestamp representing the last modified time of the association. If the association does not exist or has not been modified, it may return null or a specific value to indicate such a case.
    • loadExpired

      public void loadExpired(Group group)
      Description copied from interface: GroupParent
      Loads all expired parent associations for the specified group. This operation is performed on behalf of a specific user, and it handles any necessary processing related to expired associations within the given group.
      Specified by:
      loadExpired in interface GroupParent
      Parameters:
      group - The instance of the Group representing the group for which expired parent associations should be loaded.