Class GroupParentProvider
java.lang.Object
de.murmelmeister.murmelapi.group.parent.GroupParentProvider
- All Implemented Interfaces:
GroupParent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParent(int executorId, int groupId, int parentId, long time) Adds a parent relationship for a group.voidclearParent(int groupId) Removes all parent associations for a specified group.booleanexistsParent(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.intgetCreatedBy(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.longgetExpiredTime(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.intgetModifiedBy(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.booleanisExpired(int groupId, int parentId) Determines if the association between the specified group and parent is expired.voidloadExpired(Group group) Loads all expired parent associations for the specified group.voidremoveParent(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
-
Constructor Details
-
GroupParentProvider
-
-
Method Details
-
setup
-
existsParent
public boolean existsParent(int groupId, int parentId) Description copied from interface:GroupParentChecks whether a parent exists for a specified group.- Specified by:
existsParentin interfaceGroupParent- 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:GroupParentAdds a parent relationship for a group. If the specified parent already exists for the group, the method will not perform any action.- Specified by:
addParentin interfaceGroupParent- 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:GroupParentRemoves the association between a specified parent and a group.- Specified by:
removeParentin interfaceGroupParent- 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:GroupParentRemoves all parent associations for a specified group.- Specified by:
clearParentin interfaceGroupParent- Parameters:
groupId- The unique identifier of the group whose parent associations should be cleared.
-
getParentIds
Description copied from interface:GroupParentRetrieves the list of IDs of all parent associations for the specified group.- Specified by:
getParentIdsin interfaceGroupParent- 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
Description copied from interface:GroupParentRetrieves the names of all parent entities associated with the specified group.- Specified by:
getParentNamesin interfaceGroupParent- Parameters:
group- The instance of theGroupinterface 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:GroupParentRetrieves the expiration time of the association between the specified group and parent.- Specified by:
getExpiredTimein interfaceGroupParent- 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
Description copied from interface:GroupParentRetrieves the expiration date of the association between the specified group and parent.- Specified by:
getExpiredDatein interfaceGroupParent- 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
Description copied from interface:GroupParentUpdates 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:
setExpiredTimein interfaceGroupParent- 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:GroupParentDetermines if the association between the specified group and parent is expired.- Specified by:
isExpiredin interfaceGroupParent- 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:GroupParentRetrieves the ID of the creator associated with the specified group and parent relationship.- Specified by:
getCreatedByin interfaceGroupParent- 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
Description copied from interface:GroupParentRetrieves the creation timestamp of the association between the specified group and parent.- Specified by:
getCreatedAtin interfaceGroupParent- Parameters:
groupId- The unique identifier of the group.parentId- The unique identifier of the parent.- Returns:
- A
Timestampobject representing the creation date and time of the association.
-
getModifiedBy
public int getModifiedBy(int groupId, int parentId) Description copied from interface:GroupParentRetrieves the unique identifier of the user who last modified the association between the specified group and parent.- Specified by:
getModifiedByin interfaceGroupParent- 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
Description copied from interface:GroupParentRetrieves the last modified timestamp of the association between the specified group and parent.- Specified by:
getModifiedAtin interfaceGroupParent- Parameters:
groupId- The unique identifier of the group.parentId- The unique identifier of the parent.- Returns:
- A
Timestamprepresenting 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
Description copied from interface:GroupParentLoads 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:
loadExpiredin interfaceGroupParent- Parameters:
group- The instance of theGrouprepresenting the group for which expired parent associations should be loaded.
-