Interface UserParent

All Known Implementing Classes:
UserParentProvider

public sealed interface UserParent permits UserParentProvider
User parent interface to manage user parents.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addParent(int executorId, int userId, int parentId, long time)
    Adds a parent-child relationship for the specified user with an optional expiration time.
    void
    clearParent(int userId)
    Clears all parent-child relationships for the specified user.
    boolean
    existsParent(int userId, int parentId)
    Checks if a parent-child relationship exists between a user and a parent.
    getCreatedAt(int userId, int parentId)
    Retrieves the timestamp of when the parent-child relationship between a specified user and parent was created.
    int
    getCreatedBy(int userId, int parentId)
    Retrieves the ID of the user who created the parent-child relationship between the specified user and parent.
    getExpiredDate(int userId, int parentId)
    Retrieves the formatted expiration date of the relationship between the specified user and parent.
    long
    getExpiredTime(int userId, int parentId)
    Retrieves the expiration timestamp of the relationship between the specified user and parent.
    int
    getHighestPriority(Group group, int userId)
    Retrieves the highest priority value for a specific user within the given group.
    getModifiedAt(int userId, int parentId)
    Retrieves the timestamp indicating the last modification time of the relationship between the specified user and parent.
    int
    getModifiedBy(int userId, int parentId)
    Retrieves the ID of the user who last modified the relationship between the specified user and parent.
    getParentIds(int userId)
    Retrieves the list of parent IDs associated with the specified user.
    getParentNames(Group group, int userId)
    Retrieves the list of parent names associated with the specified user within the given group.
    boolean
    isExpired(int userId, int parentId)
    Checks if the relationship between a specified user and parent has expired.
    void
    Loads and processes the expired parent-child relationships for a given user.
    void
    removeParent(int userId, int parentId)
    Removes the parent-child relationship between a specified user and parent.
    setExpiredTime(int executorId, int userId, int parentId, long time)
    Sets the expiration time for the relationship between a specified user and parent.
  • Method Details

    • existsParent

      boolean existsParent(int userId, int parentId)
      Checks if a parent-child relationship exists between a user and a parent.
      Parameters:
      userId - The ID of the user whose parent relationship is to be verified
      parentId - The ID of the parent to be checked
      Returns:
      True if the user has the specified parent, false otherwise
    • addParent

      void addParent(int executorId, int userId, int parentId, long time)
      Adds a parent-child relationship for the specified user with an optional expiration time.
      Parameters:
      executorId - The ID of the user performing the log action.
      userId - The ID of the user for whom the parent relationship is being added.
      parentId - The ID of the parent to be associated with the user.
      time - The duration (in milliseconds) until this relationship expires. Use -1 for a relationship that does not expire.
    • removeParent

      void removeParent(int userId, int parentId)
      Removes the parent-child relationship between a specified user and parent.
      Parameters:
      userId - The ID of the user whose parent relationship is being removed.
      parentId - The ID of the parent to be removed from the user.
    • clearParent

      void clearParent(int userId)
      Clears all parent-child relationships for the specified user.
      Parameters:
      userId - The ID of the user whose parent relationships are being cleared.
    • getParentIds

      List<Integer> getParentIds(int userId)
      Retrieves the list of parent IDs associated with the specified user.
      Parameters:
      userId - The ID of the user whose parent IDs are to be fetched.
      Returns:
      A list of integers representing the parent IDs associated with the user.
    • getParentNames

      List<String> getParentNames(Group group, int userId)
      Retrieves the list of parent names associated with the specified user within the given group.
      Parameters:
      group - The group context in which the parent names are to be retrieved.
      userId - The ID of the user whose parent names are to be fetched.
      Returns:
      A list of strings representing the names of the parents associated with the specified user.
    • getHighestPriority

      int getHighestPriority(Group group, int userId)
      Retrieves the highest priority value for a specific user within the given group.
      Parameters:
      group - The group context to retrieve the priority for the user.
      userId - The ID of the user whose highest priority is being determined.
      Returns:
      The highest priority value associated with the user in the specified group.
    • getExpiredTime

      long getExpiredTime(int userId, int parentId)
      Retrieves the expiration timestamp of the relationship between the specified user and parent.
      Parameters:
      userId - The ID of the user whose relationship expiration time is being retrieved.
      parentId - The ID of the parent involved in the relationship.
      Returns:
      The expiration timestamp of the relationship in milliseconds since the epoch. Returns -1 if the relationship does not expire.
    • getExpiredDate

      String getExpiredDate(int userId, int parentId)
      Retrieves the formatted expiration date of the relationship between the specified user and parent.
      Parameters:
      userId - The ID of the user whose relationship expiration date is being retrieved.
      parentId - The ID of the parent involved in the relationship.
      Returns:
      A string representation of the expiration date of the relationship in a human-readable format.
    • setExpiredTime

      String setExpiredTime(int executorId, int userId, int parentId, long time)
      Sets the expiration time for the relationship between a specified user and parent.
      Parameters:
      executorId - The ID of the user performing the log action.
      userId - The ID of the user whose parent relationship is being updated.
      parentId - The ID of the parent associated with the user.
      time - The new expiration timestamp for the relationship in milliseconds since the epoch. Use -1 for a relationship that does not expire.
      Returns:
      A string message indicating the result of the operation.
    • isExpired

      boolean isExpired(int userId, int parentId)
      Checks if the relationship between a specified user and parent has expired.
      Parameters:
      userId - The ID of the user whose parent relationship is being checked.
      parentId - The ID of the parent to check for expiration.
      Returns:
      True if the relationship has expired, false otherwise.
    • getCreatedBy

      int getCreatedBy(int userId, int parentId)
      Retrieves the ID of the user who created the parent-child relationship between the specified user and parent.
      Parameters:
      userId - The ID of the user associated with the relationship.
      parentId - The ID of the parent associated with the relationship.
      Returns:
      The ID of the user who created the relationship.
    • getCreatedAt

      Timestamp getCreatedAt(int userId, int parentId)
      Retrieves the timestamp of when the parent-child relationship between a specified user and parent was created.
      Parameters:
      userId - The ID of the user whose parent relationship creation timestamp is being retrieved.
      parentId - The ID of the parent involved in the relationship.
      Returns:
      The timestamp representing the creation time of the relationship.
    • getModifiedBy

      int getModifiedBy(int userId, int parentId)
      Retrieves the ID of the user who last modified the relationship between the specified user and parent.
      Parameters:
      userId - The ID of the user associated with the relationship.
      parentId - The ID of the parent associated with the relationship.
      Returns:
      The ID of the user who last modified the relationship.
    • getModifiedAt

      Timestamp getModifiedAt(int userId, int parentId)
      Retrieves the timestamp indicating the last modification time of the relationship between the specified user and parent.
      Parameters:
      userId - The ID of the user whose relationship modification timestamp is being retrieved.
      parentId - The ID of the parent involved in the relationship.
      Returns:
      A Timestamp object representing the last modification time of the relationship between the user and parent.
    • loadExpired

      void loadExpired(User user)
      Loads and processes the expired parent-child relationships for a given user.
      Parameters:
      user - The user for whom expired relationships are to be loaded.