Class ActivityMcpTool

java.lang.Object
io.meeds.mcp.server.tool.ActivityMcpTool
All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin

@Service public class ActivityMcpTool extends Object implements io.meeds.mcp.server.plugin.McpToolPlugin
  • Constructor Details

    • ActivityMcpTool

      public ActivityMcpTool()
  • Method Details

    • getActivitiesSinceDays

      public List<ActivityModel> getActivitiesSinceDays(Long spaceId, Long days) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getActivities

      public List<ActivityModel> getActivities(Long spaceId, Integer offset, Integer limit) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getUserActivityStream

      public List<ActivityModel> getUserActivityStream(String username, Integer offset, Integer limit) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getActivity

      public ActivityModel getActivity(long activityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getActivityComment

      public ActivityCommentModel getActivityComment(long activityCommentId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • createActivity

      public ActivityModel createActivity(Long spaceId, String htmlContent, String publicationStartTime) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • createActivityWithImage

      public ActivityModel createActivityWithImage(Long spaceId, String htmlContent, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId, String altText) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • attachImageToActivity

      public ActivityModel attachImageToActivity(long activityId, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId, String altText) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • updateActivity

      public ActivityModel updateActivity(long activityId, String htmlContent, String publicationStartTime) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getScheduledActivities

      public List<ActivityModel> getScheduledActivities(Long spaceId, Integer offset, Integer limit) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Lists the activities the current user has scheduled but not yet published. These are deliberately absent from streams and from search_activities, so this is their only discovery path.
      Parameters:
      spaceId - restrict to one space, or null for every space the user sees
      offset - index of the first activity to retrieve
      limit - maximum number of activities to retrieve
      Returns:
      the list of pending scheduled activities, soonest first
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • publishScheduledActivityNow

      public ActivityModel publishScheduledActivityNow(long activityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Publishes a scheduled activity immediately instead of waiting for its publication time. Publication is idempotent on the social side: publishing an already published activity simply returns its current state.
      Parameters:
      activityId - id of the scheduled activity to publish now
      Returns:
      the published activity
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • deleteActivity

      public void deleteActivity(long activityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • pinActivity

      public void pinActivity(long activityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Pins an activity to its space stream as the current user. The activity must be viewable by the user before the pin permission is even evaluated, as the REST layer does.
      Parameters:
      activityId - identifier of the activity to pin
      Throws:
      IllegalAccessException - when the activity isn't viewable by the current user or the user can't pin it
      org.exoplatform.commons.exception.ObjectNotFoundException - when the activity doesn't exist
    • unpinActivity

      public void unpinActivity(long activityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Unpins an activity from its space stream as the current user. The activity must be viewable by the user before the pin permission is even evaluated, as the REST layer does.
      Parameters:
      activityId - identifier of the activity to unpin
      Throws:
      IllegalAccessException - when the activity isn't viewable by the current user or the user can't unpin it
      org.exoplatform.commons.exception.ObjectNotFoundException - when the activity doesn't exist
    • getActivityComments

      public List<ActivityCommentModel> getActivityComments(long activityId, Integer offset, Integer limit) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Reads the discussion under an activity as the current user: its top-level comments and the replies threaded under them, in thread order. Social places every reply right after the comment it answers and the reply carries that comment as parentCommentId, so a flat list keeps the thread structure visible; a top-level comment has no parentCommentId. Social threads one level deep, so a reply is always the child of a top-level comment.

      offset and limit page the top-level comments only: each page carries the replies of the comments it holds, so the number of rows returned can exceed limit.

      Parameters:
      activityId - identifier of the activity (post) whose thread is read
      offset - index of the first top-level comment, defaults to McpToolPlugin.DEFAULT_OFFSET
      limit - number of top-level comments per page, defaults to McpToolPlugin.DEFAULT_LIMIT
      Returns:
      the comments of the page with their replies, in thread order
      Throws:
      IllegalAccessException - when the current user can't view the activity
      org.exoplatform.commons.exception.ObjectNotFoundException - when no activity has that identifier
    • createActivityComment

      public ActivityCommentModel createActivityComment(long activityId, String comment, Long parentCommentId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Posts a comment on an activity as the current user. With a parentCommentId the comment is posted as a threaded reply to that comment, exactly as the "Reply" action of the activity stream does; without one it is a top-level comment, as before this parameter existed. The ACL check is the activity's own view check in both cases: a reply is a comment of the same activity and inherits its visibility, so no second check is needed and none is added.
      Parameters:
      activityId - identifier of the activity to comment on
      comment - comment text
      parentCommentId - identifier of the comment to reply to, or null for a top-level comment
      Returns:
      the created comment
      Throws:
      IllegalAccessException - when the activity isn't viewable by the current user
      org.exoplatform.commons.exception.ObjectNotFoundException - when the activity or the parent comment doesn't exist
    • createActivityCommentWithImage

      public ActivityCommentModel createActivityCommentWithImage(long activityId, String comment, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId, String altText) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Posts a top-level comment carrying an image, as the current user. The comment is created through createActivityComment(long, java.lang.String, java.lang.Long) without a parent, then the image is attached to it; when the attachment fails the comment is deleted again so nothing half-posted remains.
      Parameters:
      activityId - identifier of the activity to comment on
      comment - comment text
      imageUrl - URL of the image to attach, may be null
      imageBase64 - base64 content of the image to attach, may be null
      attachmentObjectType - type of the object an existing attachment is copied from, may be null
      attachmentObjectId - identifier of the object an existing attachment is copied from, may be null
      altText - alternative text of the image, may be null
      Returns:
      the created comment
      Throws:
      IllegalAccessException - when the activity isn't viewable by the current user
      org.exoplatform.commons.exception.ObjectNotFoundException - when the activity doesn't exist
    • attachImageToComment

      public ActivityCommentModel attachImageToComment(long commentId, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId, String altText) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getActivityAttachments

      public List<AttachmentModel> getActivityAttachments(long activityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getCommentAttachments

      public List<AttachmentModel> getCommentAttachments(long commentId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • removeImageFromActivity

      public ActivityModel removeImageFromActivity(long activityId, String fileId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • removeImageFromComment

      public ActivityCommentModel removeImageFromComment(long commentId, String fileId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • updateComment

      public ActivityCommentModel updateComment(long activityCommentId, String comment) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • shareActivityToSpace

      public ActivityModel shareActivityToSpace(long activityId, long spaceId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getActivityLikers

      public List<UserModel> getActivityLikers(long activityId, Integer offset, Integer limit) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • likeTheActivity

      public void likeTheActivity(long activityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • unlikeTheActivity

      public void unlikeTheActivity(long activityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • searchActivities

      public List<ActivityModel> searchActivities(String query, Long spaceId, Boolean isFavorite, Integer offset, Integer limit) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException