Class UserParentProvider
java.lang.Object
de.murmelmeister.murmelapi.user.parent.UserParentProvider
- All Implemented Interfaces:
UserParent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParent(int executorId, int userId, int parentId, long time) Adds a parent-child relationship for the specified user with an optional expiration time.voidclearParent(int userId) Clears all parent-child relationships for the specified user.booleanexistsParent(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.intgetCreatedBy(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.longgetExpiredTime(int userId, int parentId) Retrieves the expiration timestamp of the relationship between the specified user and parent.intgetHighestPriority(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.intgetModifiedBy(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.booleanisExpired(int userId, int parentId) Checks if the relationship between a specified user and parent has expired.voidloadExpired(User user) Loads and processes the expired parent-child relationships for a given user.voidremoveParent(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.static void
-
Constructor Details
-
UserParentProvider
-
-
Method Details
-
setup
-
existsParent
public boolean existsParent(int userId, int parentId) Description copied from interface:UserParentChecks if a parent-child relationship exists between a user and a parent.- Specified by:
existsParentin interfaceUserParent- Parameters:
userId- The ID of the user whose parent relationship is to be verifiedparentId- The ID of the parent to be checked- Returns:
- True if the user has the specified parent, false otherwise
-
addParent
public void addParent(int executorId, int userId, int parentId, long time) Description copied from interface:UserParentAdds a parent-child relationship for the specified user with an optional expiration time.- Specified by:
addParentin interfaceUserParent- 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
public void removeParent(int userId, int parentId) Description copied from interface:UserParentRemoves the parent-child relationship between a specified user and parent.- Specified by:
removeParentin interfaceUserParent- 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
public void clearParent(int userId) Description copied from interface:UserParentClears all parent-child relationships for the specified user.- Specified by:
clearParentin interfaceUserParent- Parameters:
userId- The ID of the user whose parent relationships are being cleared.
-
getParentIds
Description copied from interface:UserParentRetrieves the list of parent IDs associated with the specified user.- Specified by:
getParentIdsin interfaceUserParent- 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
Description copied from interface:UserParentRetrieves the list of parent names associated with the specified user within the given group.- Specified by:
getParentNamesin interfaceUserParent- 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
Description copied from interface:UserParentRetrieves the highest priority value for a specific user within the given group.- Specified by:
getHighestPriorityin interfaceUserParent- 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
public long getExpiredTime(int userId, int parentId) Description copied from interface:UserParentRetrieves the expiration timestamp of the relationship between the specified user and parent.- Specified by:
getExpiredTimein interfaceUserParent- 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
Description copied from interface:UserParentRetrieves the formatted expiration date of the relationship between the specified user and parent.- Specified by:
getExpiredDatein interfaceUserParent- 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
Description copied from interface:UserParentSets the expiration time for the relationship between a specified user and parent.- Specified by:
setExpiredTimein interfaceUserParent- 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
public boolean isExpired(int userId, int parentId) Description copied from interface:UserParentChecks if the relationship between a specified user and parent has expired.- Specified by:
isExpiredin interfaceUserParent- 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
public int getCreatedBy(int userId, int parentId) Description copied from interface:UserParentRetrieves the ID of the user who created the parent-child relationship between the specified user and parent.- Specified by:
getCreatedByin interfaceUserParent- 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
Description copied from interface:UserParentRetrieves the timestamp of when the parent-child relationship between a specified user and parent was created.- Specified by:
getCreatedAtin interfaceUserParent- 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
public int getModifiedBy(int userId, int parentId) Description copied from interface:UserParentRetrieves the ID of the user who last modified the relationship between the specified user and parent.- Specified by:
getModifiedByin interfaceUserParent- 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
Description copied from interface:UserParentRetrieves the timestamp indicating the last modification time of the relationship between the specified user and parent.- Specified by:
getModifiedAtin interfaceUserParent- 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
Timestampobject representing the last modification time of the relationship between the user and parent.
-
loadExpired
Description copied from interface:UserParentLoads and processes the expired parent-child relationships for a given user.- Specified by:
loadExpiredin interfaceUserParent- Parameters:
user- The user for whom expired relationships are to be loaded.
-