Class ActivitySpaceScopeResolver

java.lang.Object
io.meeds.mcp.server.tool.plugin.ActivitySpaceScopeResolver
All Implemented Interfaces:
io.meeds.mcp.server.plugin.SpaceScopeResolver

@Service("activitySpaceScopeResolver") public class ActivitySpaceScopeResolver extends Object implements io.meeds.mcp.server.plugin.SpaceScopeResolver
Tells which space an activity belongs to: the space whose stream holds it. A shared activity is a copy posted in the stream it was shared to, so it belongs to that space, and the activity it was shared from to its own. A comment, an activity of a user's stream and a missing one belong to no space. Read as the system, for the space scope decision only. For a write declaring space_role: editor, it also tells whether a person could edit the activity in person, by social's own rule.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name the activity tools' space_scope.resolver gives.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    canEdit(String objectId, String userName)
    Tells whether a person could change the activity in person, as social decides it for the post's own edit, image and publish actions (ActivityManager.isActivityEditable(ExoSocialActivity, Identity)): by default its poster, or, for a post scheduled for later, whoever may manage the space's content; an activity type's own plugin, and the platform's edit setting, decide first.
     
    spaceOf(String objectId)
     

    Methods inherited from class Object

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

  • Constructor Details

    • ActivitySpaceScopeResolver

      public ActivitySpaceScopeResolver()
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface io.meeds.mcp.server.plugin.SpaceScopeResolver
      Returns:
      "activity"
    • spaceOf

      public Long spaceOf(String objectId)
      Specified by:
      spaceOf in interface io.meeds.mcp.server.plugin.SpaceScopeResolver
      Parameters:
      objectId - the activity id
      Returns:
      the id of the space whose stream holds the activity, or null for a comment, a user stream's activity, a missing activity, an id that isn't one, or a lookup that fails
    • canEdit

      public Boolean canEdit(String objectId, String userName)
      Tells whether a person could change the activity in person, as social decides it for the post's own edit, image and publish actions (ActivityManager.isActivityEditable(ExoSocialActivity, Identity)): by default its poster, or, for a post scheduled for later, whoever may manage the space's content; an activity type's own plugin, and the platform's edit setting, decide first.
      Specified by:
      canEdit in interface io.meeds.mcp.server.plugin.SpaceScopeResolver
      Parameters:
      objectId - the activity id
      userName - the person a digital worker would change the activity for
      Returns:
      true when the person could change it; false for a comment, a missing activity, a deleted or disabled person, or a lookup that fails