Class ActivityDefault

java.lang.Object
org.linkedopenactors.rdfpub.domain.commonsrdf.ActivityDefault
All Implemented Interfaces:
Activity, ActivityPubObject

public class ActivityDefault extends Object implements Activity
  • Constructor Details

    • ActivityDefault

      public ActivityDefault(org.apache.commons.rdf.api.RDF rdf, org.apache.commons.rdf.api.IRI subject, org.apache.commons.rdf.api.Graph graph, GraphToStringConverter graphToStringConverter, SubjectProvider subjectProvider, Vocabularies vocabularies)
  • Method Details

    • getObject

      public Set<org.apache.commons.rdf.api.IRI> getObject()
      Description copied from interface: Activity
      Describes an object of any kind. The Object type serves as the base type for most of the other kinds of objects defined in the Activity Vocabulary, including other Core types such as Activity, IntransitiveActivity, Collection and OrderedCollection.
      Specified by:
      getObject in interface Activity
      Returns:
      The object of this Activity
    • setObject

      public void setObject(Set<org.apache.commons.rdf.api.IRI> object)
      Description copied from interface: Activity
      Describes an ActivityPubObject of any kind.
      Specified by:
      setObject in interface Activity
      Parameters:
      object - (s)
    • addObject

      public void addObject(ActivityPubObject activityPubObject)
      Description copied from interface: Activity
      Describes an ActivityPubObject of any kind.
      Specified by:
      addObject in interface Activity
      Parameters:
      activityPubObject -
    • setObjects

      public void setObjects(Set<ActivityPubObject> activityPubObjects)
      Description copied from interface: Activity
      Describes an ActivityPubObject of any kind.
      Specified by:
      setObjects in interface Activity
      Parameters:
      activityPubObjects -
    • addObject

      public void addObject(org.apache.commons.rdf.api.IRI object)
      Description copied from interface: Activity
      Describes an ActivityPubObject of any kind.
      Specified by:
      addObject in interface Activity
      Parameters:
      object -
    • resolveObject

      public Set<ActivityPubObject> resolveObject()
      Description copied from interface: Activity
      Describes an ActivityPubObject of any kind.
      Specified by:
      resolveObject in interface Activity
      Returns:
      The object(s)
    • getActor

      public Set<org.apache.commons.rdf.api.IRI> getActor()
      Description copied from interface: Activity
      Describes one or more entities that either performed or are expected to perform the activity. Any single activity can have multiple actors.
      Specified by:
      getActor in interface Activity
      Returns:
      The actor id(s) of this Activity. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-actor
    • activityType

      public ActivityType activityType()
      Description copied from interface: Activity
      Abstraction of the type of this activity, for convenience.
      Specified by:
      activityType in interface Activity
      Returns:
      Abstraction of the activity type.
    • is

      public boolean is(ActivityType activityType)
      Specified by:
      is in interface Activity
      Parameters:
      activityType -
      Returns:
      True, if the activity has the passed type.
    • addActor

      public void addActor(org.apache.commons.rdf.api.IRI actor)
      Description copied from interface: Activity
      Describes one or more entities that either performed or are expected to perform the activity. Any single activity can have multiple actors. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-actor
      Specified by:
      addActor in interface Activity
      Parameters:
      actor -
    • setActor

      public void setActor(Set<org.apache.commons.rdf.api.IRI> actor)
      Description copied from interface: Activity
      Describes one or more entities that either performed or are expected to perform the activity. Any single activity can have multiple actors. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-actor
      Specified by:
      setActor in interface Activity
      Parameters:
      actor -
    • setTarget

      public void setTarget(org.apache.commons.rdf.api.IRI target)
      Description copied from interface: Activity
      Describes the indirect object, or target, of the activity. The precise meaning of the target is largely dependent on the type of action being described but will often be the object of the English preposition "to". For instance, in the activity "John added a movie to his wishlist", the target of the activity is John's wishlist. An activity can have more than one target. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-target
      Specified by:
      setTarget in interface Activity
      Parameters:
      target -
    • getTarget

      public Optional<org.apache.commons.rdf.api.IRI> getTarget()
      Description copied from interface: Activity
      Describes the indirect object, or target, of the activity. The precise meaning of the target is largely dependent on the type of action being described but will often be the object of the English preposition "to". For instance, in the activity "John added a movie to his wishlist", the target of the activity is John's wishlist. An activity can have more than one target. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-target
      Specified by:
      getTarget in interface Activity
      Returns:
      The target's id.
    • isActivity

      public boolean isActivity()
      Specified by:
      isActivity in interface ActivityPubObject
    • setWasAssociatedWith

      public void setWasAssociatedWith(org.apache.commons.rdf.api.IRI actor)
      Specified by:
      setWasAssociatedWith in interface Activity
    • getWasAssociatedWith

      public Optional<org.apache.commons.rdf.api.IRI> getWasAssociatedWith()
      Specified by:
      getWasAssociatedWith in interface Activity
    • unify

      public void unify()
      Description copied from interface: Activity
      Ensures that audience, cc, bcc, to, bto are identical in activity and objects
      Specified by:
      unify in interface Activity
    • replaceSubjects

      public void replaceSubjects(org.apache.commons.rdf.api.IRI actorsBaseSubject, SubjectProvider subjectProvider)
      Specified by:
      replaceSubjects in interface Activity
    • replaceSubjects

      public void replaceSubjects(org.apache.commons.rdf.api.IRI actorsBaseSubject, SubjectProvider subjectProvider, boolean includingObjects)
      Specified by:
      replaceSubjects in interface Activity
    • replaceSubjectsWithInternals

      public void replaceSubjectsWithInternals(SubjectProvider subjectProvider)
      Specified by:
      replaceSubjectsWithInternals in interface Activity
    • replaceObject

      public void replaceObject(ActivityPubObject existing)
      Specified by:
      replaceObject in interface Activity
    • hideBlindReceivers

      public void hideBlindReceivers()
      Description copied from interface: ActivityPubObject
      Removes AS.bcc() AND AS.bto()
      Specified by:
      hideBlindReceivers in interface ActivityPubObject
    • getAttributedtTo

      public Set<org.apache.commons.rdf.api.IRI> getAttributedtTo()
      Description copied from interface: ActivityPubObject
      Identifies one or more entities to which this object is attributed. The attributed entities might not be Actors. For instance, an object might be attributed to the completion of another activity. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto
      Specified by:
      getAttributedtTo in interface ActivityPubObject
      Returns:
      attributedtTo
    • setAttributedTo

      public void setAttributedTo(Set<org.apache.commons.rdf.api.IRI> attributedtTo)
      Description copied from interface: ActivityPubObject
      Identifies one or more entities to which this object is attributed. The attributed entities might not be Actors. For instance, an object might be attributed to the completion of another activity. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto
      Specified by:
      setAttributedTo in interface ActivityPubObject
      Parameters:
      attributedtTo -
    • addAttributedTo

      public void addAttributedTo(org.apache.commons.rdf.api.IRI attributedtTo)
      Description copied from interface: ActivityPubObject
      Identifies one or more entities to which this object is attributed. The attributed entities might not be Actors. For instance, an object might be attributed to the completion of another activity. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto
      Specified by:
      addAttributedTo in interface ActivityPubObject
      Parameters:
      attributedtTo -
    • getAudience

      public Set<org.apache.commons.rdf.api.IRI> getAudience()
      Description copied from interface: ActivityPubObject
      Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audience
      Specified by:
      getAudience in interface ActivityPubObject
      Returns:
      audience
    • setAudience

      public void setAudience(Set<org.apache.commons.rdf.api.IRI> audience)
      Description copied from interface: ActivityPubObject
      Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audience
      Specified by:
      setAudience in interface ActivityPubObject
      Parameters:
      audience -
    • addAudience

      public void addAudience(org.apache.commons.rdf.api.IRI audience)
      Description copied from interface: ActivityPubObject
      Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audience
      Specified by:
      addAudience in interface ActivityPubObject
      Parameters:
      audience -
    • getName

      public Optional<String> getName()
      Description copied from interface: ActivityPubObject
      Same as ActivityPubObject.getName() but without or with default language.
      Specified by:
      getName in interface ActivityPubObject
      Returns:
      name
    • setName

      public void setName(com.neovisionaries.i18n.LanguageCode languageCode, String name)
      Description copied from interface: ActivityPubObject
      A simple, human-readable, plain-text name for the object. HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-name
      Specified by:
      setName in interface ActivityPubObject
      Parameters:
      languageCode -
      name -
    • getContent

      public Optional<String> getContent()
      Specified by:
      getContent in interface ActivityPubObject
    • getName

      public Optional<String> getName(com.neovisionaries.i18n.LanguageCode languageCode)
      Description copied from interface: ActivityPubObject
      A simple, human-readable, plain-text name for the object. HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-name
      Specified by:
      getName in interface ActivityPubObject
      Parameters:
      languageCode -
      Returns:
      The name
    • setName

      public void setName(String name)
      Description copied from interface: ActivityPubObject
      Same as ActivityPubObject.setName(String) with default language.
      Specified by:
      setName in interface ActivityPubObject
      Parameters:
      name -
    • setContent

      public void setContent(String content)
      Specified by:
      setContent in interface ActivityPubObject
    • getPublished

      public Optional<Instant> getPublished()
      Description copied from interface: ActivityPubObject
      The date and time describing the actual or expected starting time of the object. When used with an Activity object, for instance, the startTime property specifies the moment the activity began or is scheduled to begin. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-published
      Specified by:
      getPublished in interface ActivityPubObject
      Returns:
      publishing date
    • setPublished

      public void setPublished(Instant instant)
      Description copied from interface: ActivityPubObject
      The date and time describing the actual or expected starting time of the object. When used with an Activity object, for instance, the startTime property specifies the moment the activity began or is scheduled to begin. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-published
      Specified by:
      setPublished in interface ActivityPubObject
      Parameters:
      instant -
    • setUpdated

      public void setUpdated(Instant instant)
      Specified by:
      setUpdated in interface ActivityPubObject
    • getSummary

      public Optional<String> getSummary()
      Description copied from interface: ActivityPubObject
      Same as ActivityPubObject.getSubject() but without language or with default language.
      Specified by:
      getSummary in interface ActivityPubObject
      Returns:
      summary
    • getSummary

      public Optional<String> getSummary(com.neovisionaries.i18n.LanguageCode languageCode)
      Description copied from interface: ActivityPubObject
      A natural language summarization of the object encoded as HTML. Multiple language tagged summaries MAY be provided.
      Specified by:
      getSummary in interface ActivityPubObject
      Parameters:
      languageCode -
      Returns:
      The summary
    • setSummary

      public void setSummary(com.neovisionaries.i18n.LanguageCode languageCode, String summary)
      Description copied from interface: ActivityPubObject
      A natural language summarization of the object encoded as HTML. Multiple language tagged summaries MAY be provided.
      Specified by:
      setSummary in interface ActivityPubObject
      Parameters:
      languageCode -
      summary -
    • setSummary

      public void setSummary(String summary)
      Description copied from interface: ActivityPubObject
      Same as ActivityPubObject.setSummary(String) but without language or with default language.
      Specified by:
      setSummary in interface ActivityPubObject
      Parameters:
      summary -
    • getTo

      public Set<org.apache.commons.rdf.api.IRI> getTo()
      Description copied from interface: ActivityPubObject
      Identifies an entity considered to be part of the public primary audience of an Object See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-to
      Specified by:
      getTo in interface ActivityPubObject
      Returns:
      to
    • setTo

      public void setTo(Set<org.apache.commons.rdf.api.IRI> to)
      Description copied from interface: ActivityPubObject
      Identifies an entity considered to be part of the public primary audience of an Object See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-to
      Specified by:
      setTo in interface ActivityPubObject
      Parameters:
      to -
    • addTo

      public void addTo(org.apache.commons.rdf.api.IRI to)
      Description copied from interface: ActivityPubObject
      Identifies an entity considered to be part of the public primary audience of an Object See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-to
      Specified by:
      addTo in interface ActivityPubObject
      Parameters:
      to -
    • getBto

      public Set<org.apache.commons.rdf.api.IRI> getBto()
      Description copied from interface: ActivityPubObject
      Identifies an Object that is part of the private primary audience of this Object. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-bto
      Specified by:
      getBto in interface ActivityPubObject
      Returns:
      bto
    • setBto

      public void setBto(Set<org.apache.commons.rdf.api.IRI> bto)
      Description copied from interface: ActivityPubObject
      Identifies an Object that is part of the private primary audience of this Object. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-bto
      Specified by:
      setBto in interface ActivityPubObject
      Parameters:
      bto -
    • addBto

      public void addBto(org.apache.commons.rdf.api.IRI bto)
      Description copied from interface: ActivityPubObject
      Identifies an Object that is part of the private primary audience of this Object. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-bto
      Specified by:
      addBto in interface ActivityPubObject
      Parameters:
      bto -
    • getCc

      public Set<org.apache.commons.rdf.api.IRI> getCc()
      Description copied from interface: ActivityPubObject
      Identifies an Object that is part of the public secondary audience of this Object. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-cc
      Specified by:
      getCc in interface ActivityPubObject
      Returns:
      cc
    • setCc

      public void setCc(Set<org.apache.commons.rdf.api.IRI> cc)
      Description copied from interface: ActivityPubObject
      Identifies an Object that is part of the public secondary audience of this Object. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-cc
      Specified by:
      setCc in interface ActivityPubObject
      Parameters:
      cc -
    • addCc

      public void addCc(org.apache.commons.rdf.api.IRI cc)
      Description copied from interface: ActivityPubObject
      Identifies an Object that is part of the public secondary audience of this Object. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-cc
      Specified by:
      addCc in interface ActivityPubObject
      Parameters:
      cc -
    • getBcc

      public Set<org.apache.commons.rdf.api.IRI> getBcc()
      Description copied from interface: ActivityPubObject
      Identifies one or more Objects that are part of the private secondary audience of this Object. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-bcc
      Specified by:
      getBcc in interface ActivityPubObject
      Returns:
      bcc
    • setBcc

      public void setBcc(Set<org.apache.commons.rdf.api.IRI> bcc)
      Description copied from interface: ActivityPubObject
      Identifies one or more Objects that are part of the private secondary audience of this Object. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-bcc
      Specified by:
      setBcc in interface ActivityPubObject
      Parameters:
      bcc -
    • addBcc

      public void addBcc(org.apache.commons.rdf.api.IRI bcc)
      Description copied from interface: ActivityPubObject
      Identifies one or more Objects that are part of the private secondary audience of this Object. See Also: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-bcc
      Specified by:
      addBcc in interface ActivityPubObject
      Parameters:
      bcc -
    • getReceivers

      public Set<org.apache.commons.rdf.api.IRI> getReceivers()
      Description copied from interface: ActivityPubObject
      Specified by:
      getReceivers in interface ActivityPubObject
      Returns:
      Set of all receivers.
    • getExternalReceivers

      public Set<org.apache.commons.rdf.api.IRI> getExternalReceivers()
      Description copied from interface: ActivityPubObject
      Same as ActivityPubObject.getReceivers(), but only the external ones.
      Specified by:
      getExternalReceivers in interface ActivityPubObject
      Returns:
      Set of all external receivers.
    • getInternalReceivers

      public Set<org.apache.commons.rdf.api.IRI> getInternalReceivers()
      Description copied from interface: ActivityPubObject
      Same as ActivityPubObject.getReceivers(), but only the internal ones.
      Specified by:
      getInternalReceivers in interface ActivityPubObject
      Returns:
      Set of all internal receivers.
    • isAttributedTo

      public boolean isAttributedTo(org.apache.commons.rdf.api.IRI requestedActorId)
      Description copied from interface: ActivityPubObject
      Checks, if the passed ActorId is in the AS.attributedTo() of the ActivityPubObject.
      Specified by:
      isAttributedTo in interface ActivityPubObject
      Parameters:
      requestedActorId -
      Returns:
      True, if the passed ActorId is in the AS.attributedTo() of the ActivityPubObject.
    • isReceiver

      public boolean isReceiver(org.apache.commons.rdf.api.IRI requestedActorId)
      Description copied from interface: ActivityPubObject
      Checks, if the passed ActorId is in ActivityPubObject.getReceivers()
      Specified by:
      isReceiver in interface ActivityPubObject
      Parameters:
      requestedActorId -
      Returns:
      True, if the passed ActorId is in ActivityPubObject.getReceivers()
    • getSubject

      public org.apache.commons.rdf.api.IRI getSubject()
      Specified by:
      getSubject in interface ActivityPubObject
    • getBaseSubject

      public org.apache.commons.rdf.api.IRI getBaseSubject()
      Description copied from interface: ActivityPubObject
      An ActivityPubObject has Versions, so the ActivityPubObject.getSubject() Method normally returns the subject of the current version. But sometimes you want the base url without the version 'extension'. Then you can use this method.
      Specified by:
      getBaseSubject in interface ActivityPubObject
      Returns:
      ActivityPubObjects base Subject
    • getExternalBaseSubject

      public org.apache.commons.rdf.api.IRI getExternalBaseSubject()
      Description copied from interface: ActivityPubObject
      Same as ActivityPubObject.getBaseSubject() but as external url.
      Specified by:
      getExternalBaseSubject in interface ActivityPubObject
      Returns:
      External url that points to the base of thet object. (TODO link to versioning docs!)
    • getObjectVersion

      public Optional<Long> getObjectVersion()
      Specified by:
      getObjectVersion in interface ActivityPubObject
    • setObjectVersion

      public void setObjectVersion(Long objectVersion)
      Specified by:
      setObjectVersion in interface ActivityPubObject
    • setType

      public void setType(Set<org.apache.commons.rdf.api.IRI> type)
      Description copied from interface: ActivityPubObject
      The RDF Type See Also: https://www.w3.org/TR/rdf12-schema/#ch_type
      Specified by:
      setType in interface ActivityPubObject
      Parameters:
      type -
    • setWasAttributedTo

      public void setWasAttributedTo(org.apache.commons.rdf.api.IRI actor)
      Specified by:
      setWasAttributedTo in interface ActivityPubObject
    • getWasAttributedTo

      public Optional<org.apache.commons.rdf.api.IRI> getWasAttributedTo()
      Specified by:
      getWasAttributedTo in interface ActivityPubObject
    • setWasGeneratedBy

      public void setWasGeneratedBy(org.apache.commons.rdf.api.IRI subject)
      Specified by:
      setWasGeneratedBy in interface ActivityPubObject
    • getWasGeneratedBy

      public Optional<org.apache.commons.rdf.api.IRI> getWasGeneratedBy()
      Specified by:
      getWasGeneratedBy in interface ActivityPubObject
    • setWasRevisionOf

      public void setWasRevisionOf(org.apache.commons.rdf.api.IRI subject)
      Specified by:
      setWasRevisionOf in interface ActivityPubObject
    • getWasRevisionOf

      public Optional<org.apache.commons.rdf.api.IRI> getWasRevisionOf()
      Specified by:
      getWasRevisionOf in interface ActivityPubObject
    • getSameAs

      public Optional<org.apache.commons.rdf.api.IRI> getSameAs()
      Specified by:
      getSameAs in interface ActivityPubObject
    • setSameAs

      public void setSameAs(org.apache.commons.rdf.api.IRI subject)
      Specified by:
      setSameAs in interface ActivityPubObject
    • addType

      public void addType(org.apache.commons.rdf.api.IRI type)
      Description copied from interface: ActivityPubObject
      The RDF Type See Also: https://www.w3.org/TR/rdf12-schema/#ch_type
      Specified by:
      addType in interface ActivityPubObject
      Parameters:
      type -
    • getTypes

      public Set<org.apache.commons.rdf.api.IRI> getTypes()
      Description copied from interface: ActivityPubObject
      The RDF Type See Also: https://www.w3.org/TR/rdf12-schema/#ch_type
      Specified by:
      getTypes in interface ActivityPubObject
      Returns:
      The type(s)
    • asGraph

      public org.apache.commons.rdf.api.Graph asGraph()
      Specified by:
      asGraph in interface ActivityPubObject
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(RdfFormat format)
      Specified by:
      toString in interface ActivityPubObject
    • toString

      public String toString(RdfFormat format, boolean resolveIris)
      Description copied from interface: ActivityPubObject
      Converts the passed graph/model iinto a string.
      Specified by:
      toString in interface ActivityPubObject
      Parameters:
      format - The format that the string should have, Turtle, Json-LD, ...
      resolveIris - True, if the internal iris should be replaced with external https:// urls.
      Returns:
      The graph/model as string in the passed format.
    • asConvertable

      public ActivityPubObjectConvertable asConvertable()
      Specified by:
      asConvertable in interface ActivityPubObject
    • partialUpdate

      public void partialUpdate(ActivityPubObject newOne)
      Specified by:
      partialUpdate in interface ActivityPubObject