Package io.github.mastodonContentMover
Class Post
java.lang.Object
io.github.mastodonContentMover.Post
Holds in an XML-persistable object all the data associated with a Mastodon status,
   using 
MediaFile objects to store metadata
   associated with media files.
   - Since:
- 0.01.00
- See Also:
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedPost(String postId, String mastodonId, PostArchive pa) Loads thePostobject with the specified archiveId in the specifiedPostArchivefrom file if it is available, or creates a newPostobject if no data is found for that archiveId on the filesystem within the given data directory for the specifiedPostArchive.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddMastodonId(String mi) protected voidprotected Stringprotected longObtains as a primitivelongthe number of a count of favourites for the status represented by thisPostobject.protected Stringprotected Stringprotected StringReturns the most recent Mastodon instance id used for thisPoston the instance specified as a parameter.protected String[]getMedia()protected longObtains as a primitivelongthe number of times the Mastodon status represented by thisPostobject was reblogged.protected Stringprotected StringRetrieves the value of the Mastodonspoiler_textfield stored for thisPostobject.protected StringgetText()Retrieves the plain text that comprises the body of the Mastodon status thisPostobject represents.protected Stringprotected booleanhasMastodonId(String mi) protected booleanhasMedia()Indicates whether thisPostobject has any media attachments.protected booleanprotected booleanprotected booleanObtains a primitivebooleanvalue that indicates whether the Mastodon status represented by thisPostobject is bookmarked by the account used to save it to the archive.protected booleanObtains a primitivebooleanvalue that indicates whether the Mastodon status represented by thisPostobject is favourited by the account used to save it to the archive.protected booleanisPinned()Obtains a primitivebooleanvalue that indicates whether the Mastodon status represented by thisPostobject is pinned by the account used to save it to the archive.protected booleanObtains as a primitivebooleanvalue the sensitivity of the Mastodon status represented by thisPostobject.protected voidHalts the saving to file of changes to thisPostobject as and when they are made, until this behaviour is restored with .protected voidResumes the saving to file of changes to thisPostobject as and when they are made, and saves its current state to file.protected voidsetFavouritesCount(long fc) Stores as a primitivelongthe number of favourites for the Mastodon status represented by thisPostobject, and saves the change to file if persistance has not been paused.protected voidsetInReplyToArchiveId(String irtai) protected voidsetIsBookmarked(boolean ib) Stores as a primitivebooleanwhether the Mastodon status represented by thisPostobject is bookmarked by the account used to save it to the archive, and saves the change to file if persistance has not been paused.protected voidsetIsFavourited(boolean ifav) Stores as a primitivebooleanwhether the Mastodon status represented by thisPostobject is favourited by the account used to save it to the archive, and saves the change to file if persistance has not been paused.protected voidsetIsPinned(boolean ip) Stores as a primitivebooleanwhether the Mastodon status represented by thisPostobject is pinned by the account used to save it to the archive, and saves the change to file if persistance has not been paused.protected voidsetIsSensitive(boolean is) Stores as a primitivebooleanvalue the sensitivity of the Mastodon status represented by thisPostobject, and saves the change to file if persistance has not been paused.protected voidprotected voidsetReblogsCount(long rc) Stores as a primitivelongthe number of times the Mastodon status represented by thisPostobject was reblogged, and saves the change to file if persistance has not been paused.protected voidsetReblogUrl(String ru) protected voidsetSpoilerText(String st) Stores the value of the Mastodonspoiler_textfield in thisPostobject, and saves the change to file if persistance has not been paused.protected voidStores the Mastodon StatusSource, which is the plain text used to compose the status, to thisPostobject, and saves the change to file if persistance has not been paused.protected void
- 
Constructor Details- 
Postprotected Post(String postId, String mastodonId, PostArchive pa) throws jakarta.xml.bind.JAXBException, IOException Loads thePostobject with the specified archiveId in the specifiedPostArchivefrom file if it is available, or creates a newPostobject if no data is found for that archiveId on the filesystem within the given data directory for the specifiedPostArchive.
 Currently themastodonIdparameter can be null, but it would be better if a separate constructor was made without themastodonIdparameter. This constructor could then call that constructor and perform the processing required for themastodonIdspecified after receiving thePostobject from that constructor (including registering it with the archive). Then parameters would never need to be null. Also the postId parameter would really be better if it was named archiveId. (TODO)
 Would also be good to mention in this doc info when this is likely to be called (TODO)- Parameters:
- postId- the MastodonContentMover internal archiveId for this post
- mastodonId- the id for this post on a specific Mastodon instance
- pa- the- PostArchivefrom which to load the- Postobject
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- IllegalStateException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
 
- 
- 
Method Details- 
getArchiveIdGives the MastodonContentMover internal id for thisPostobject, based on the creation date of the Mastodon post that was first downloaded and from which thisPostobject, in this archive, was first created.
 For example, if you create an archive from "instance #1", use that archive to populate "instance #2", then create a fresh archive from "instance #2", the date that will be used for this comparison will be the date you used your initial archive to populate "instance #2" (not the date you first created the post on "instance #1").- Returns:
- the archiveId of this Postobject
- Since:
- 0.01.00
 
- 
getLatestMastodonIdReturns the most recent Mastodon instance id used for thisPoston the instance specified as a parameter.- Parameters:
- i- the instance address or hostname, specified as a- String
- Returns:
- the most recent Mastodon instance id, comprised of the address or hostname for that
           instance and the internal id for this post on that instance, that was
           retrieved when reposting this Postfrom this archive to the instance specified.
- Since:
- 0.01.00
- See Also:
 
- 
addMastodonIdAssociates with thisPostobject a new mastodonIdStringvalue, comprised of the Mastodon instance hostname/address concatenated with the id used for the status on that instance, and saves the change to file if persistance has not been paused.- Parameters:
- mi- a Mastodon instance hostname/address concatenated with a separator and the id used for the status on that instance
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
hasMastodonIdChecks whether the specified mastodonIdStringvalue, comprised of a Mastodon instance hostname/address concatenated with the id used for the status on that instance, is already among those associated with thisPostobject.- Parameters:
- mi- a Mastodon instance hostname/address concatenated with a separator and the id used for the status on that instance
- Since:
- 0.01.05
 
- 
getMastodonIdsObtains an ordered primitiveStringarray of all the mastodonId values associated with thisPostobject, each comprised of a Mastodon instance hostname/address concatenated with the id used for the status on that instance.
 The array is ordered according to the sequence in which thisPostobject was reposted to each Mastodon instance. The same Mastodon instance may appear more than once in the list (although presumably not with the same id - if that has happened it probably means something has gone wrong, as the alternative of the same status having been assigned the same numeric id by the same instance on two separate occasions is highly unlikely - TODO: check for duplicates on adding?)- Returns:
- an array of Stringobjects each containing a Mastodon instance hostname/address concatenated with a separator and the id used for the status on that instance
- Since:
- 0.01.00
- See Also:
 
- 
pausePersistenceprotected void pausePersistence()Halts the saving to file of changes to thisPostobject as and when they are made, until this behaviour is restored with .- Since:
- 0.01.00
 
- 
resumePersistenceResumes the saving to file of changes to thisPostobject as and when they are made, and saves its current state to file.- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
 
- 
setTextStores the Mastodon StatusSource, which is the plain text used to compose the status, to thisPostobject, and saves the change to file if persistance has not been paused.- Parameters:
- pt- the plain text that comprises the body of this post
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
 
- 
getTextRetrieves the plain text that comprises the body of the Mastodon status thisPostobject represents.- Returns:
- the body text of this Postobject in plain text
- Since:
- 0.01.00
 
- 
setSpoilerTextStores the value of the Mastodonspoiler_textfield in thisPostobject, and saves the change to file if persistance has not been paused.- Parameters:
- st- the text used to apply a spoiler or content warning on this post, also known elsewhere on ActivityPub as a summary
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
getSpoilerText- Returns:
- the text used to apply a spoiler or content warning on this post, also
             known elsewhere on ActivityPub as a summary
   
- Since:
- 0.01.00
- See Also:
 
- 
setVisibilityStores as aStringvalue the visibility of the Mastodon status represented by thisPostobject, and saves the change to file if persistance has not been paused.
 As specified in the Mastodon API documentation, and must match the value used in the BigBone API used by this tool to interact with the Mastodon API.
 At time of writing, values are:
 - public = Visible to everyone, shown in public timelines.
- unlisted = Visible to public, but not included in public timelines.
- private = Visible to followers only, and to any mentioned users.
- direct = Visible only to mentioned users.
 - Parameters:
- v- the visibility of the status represented by this- Postobject
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
getVisibilityObtains as aStringvalue the visibility of the Mastodon status represented by thisPostobject.
 As specified in the Mastodon API documentation, and must match the value used in the BigBone API used by this tool to interact with the Mastodon API.
 At time of writing, values are:
 - public = Visible to everyone, shown in public timelines.
- unlisted = Visible to public, but not included in public timelines.
- private = Visible to followers only, and to any mentioned users.
- direct = Visible only to mentioned users.
 - Returns:
- the visibility of the status represented by this Postobject
- Since:
- 0.01.00
- See Also:
 
- 
setIsSensitiveStores as a primitivebooleanvalue the sensitivity of the Mastodon status represented by thisPostobject, and saves the change to file if persistance has not been paused.- Parameters:
- is-- truefor statuses that should be concealed beneath a spoiler or content warning, or- falsewhere that is not the case
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
isSensitiveprotected boolean isSensitive()Obtains as a primitivebooleanvalue the sensitivity of the Mastodon status represented by thisPostobject.- Returns:
- truefor statuses that should be concealed beneath a spoiler or content warning, or- falsewhere that is not the case
- Since:
- 0.01.00
- See Also:
 
- 
setInReplyToArchiveIdprotected void setInReplyToArchiveId(String irtai) throws jakarta.xml.bind.JAXBException, IOException Stores the MastodonContentMover internal archiveId for aPostobject to which thisPostobject is a reply, and saves the change to file if persistance has not been paused.
 This tool only links self-replies in this way, not replies to statuses by other users.- Parameters:
- irtai- the- archiveIdfor a- Postobject to which this- Postobject is a reply
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
getInReplyToArchiveIdObtains the MastodonContentMover internal archiveId for aPostobject to which thisPostobject is a reply.
 This tool only links self-replies in this way, not replies to statuses by other users.
- 
setReblogUrlStores as aStringthe URL of a Mastodon status that was reblogged in the status thisPostobject represents, and saves the change to file if persistance has not been paused.- Parameters:
- ru- the url of a Mastodon status reblogged in this- Postobject
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
getReblogUrlObtains as aStringthe URL of a Mastodon status that was reblogged in the status thisPostobject represents.
 In order to repost this reblogged status, it is necessary to search for this URL on the Mastodon instance where thisPostobject is being reposted, using "resolve=true", to get the status id on that instance. (This is not implemented yet - TODO!)- Returns:
- the url of a Mastodon status reblogged in this Postobject
- Since:
- 0.01.00
- See Also:
 
- 
setLanguageStores as aStringvalue an ISO 639 Part 1 two-letter language code for the Mastodon status represented by thisPostobject, and saves the change to file if persistance has not been paused.
 As specified in the Mastodon API documentation, and must match the value used in the BigBone API used by this tool to interact with the Mastodon API.- Parameters:
- l- an ISO 639 Part 1 two-letter language code for the status represented by this- Postobject
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
getLanguageObtains as aStringvalue an ISO 639 Part 1 two-letter language code for the Mastodon status represented by thisPostobject.
 As specified in the Mastodon API documentation, and must match the value used in the BigBone API used by this tool to interact with the Mastodon API.- Returns:
- an ISO 639 Part 1 two-letter language code for the status represented by
            this Postobject
- Since:
- 0.01.00
- See Also:
 
- 
setIsFavouritedStores as a primitivebooleanwhether the Mastodon status represented by thisPostobject is favourited by the account used to save it to the archive, and saves the change to file if persistance has not been paused.
 This field may later be used to determine whether a status created when thisPostis reposted should be favourited again, based also on the parameters specified when the tool is run. (TODO)- Parameters:
- ifav-- truefor statuses that have been favourited by the account used to save it to the archive, or- falseotherwise
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
isFavouritedprotected boolean isFavourited()Obtains a primitivebooleanvalue that indicates whether the Mastodon status represented by thisPostobject is favourited by the account used to save it to the archive.
 This field may later be used to determine whether a status created when thisPostis reposted should be favourited again, based also on the parameters specified when the tool is run. (TODO)- Returns:
- truefor statuses that have been favourited by the account used to save it to the archive, or- falseotherwise
- Since:
- 0.01.00
- See Also:
 
- 
setIsBookmarkedStores as a primitivebooleanwhether the Mastodon status represented by thisPostobject is bookmarked by the account used to save it to the archive, and saves the change to file if persistance has not been paused.
 This field is used to determine whether a status created when thisPostis reposted should be bookmarked again, based also on the parameters specified when the tool is run.- Parameters:
- ib-- truefor statuses that have been bookmarked by the account used to save it to the archive, or- falseotherwise
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
isBookmarkedprotected boolean isBookmarked()Obtains a primitivebooleanvalue that indicates whether the Mastodon status represented by thisPostobject is bookmarked by the account used to save it to the archive.
 This field is used to determine whether a status created when thisPostis reposted should be bookmarked again, based also on the parameters specified when the tool is run.- Returns:
- truefor statuses that have been bookmarked by the account used to save it to the archive, or- falseotherwise
- Since:
- 0.01.00
- See Also:
 
- 
setIsPinnedStores as a primitivebooleanwhether the Mastodon status represented by thisPostobject is pinned by the account used to save it to the archive, and saves the change to file if persistance has not been paused.
 This field is used to determine whether a status created when thisPostis reposted should be pinned again, based also on the parameters specified when the tool is run.- Parameters:
- ip-- truefor statuses that have been pinned by the account used to save it to the archive, or- falseotherwise
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
isPinnedprotected boolean isPinned()Obtains a primitivebooleanvalue that indicates whether the Mastodon status represented by thisPostobject is pinned by the account used to save it to the archive.
 This field is used to determine whether a status created when thisPostis reposted should be pinned again, based also on the parameters specified when the tool is run.- Returns:
- truefor statuses that have been pinned by the account used to save it to the archive, or- falseotherwise
- Since:
- 0.01.00
- See Also:
 
- 
setFavouritesCountStores as a primitivelongthe number of favourites for the Mastodon status represented by thisPostobject, and saves the change to file if persistance has not been paused.
 This field may later be used to determine whether or not to repost thisPostobject, based on a threshold specified when the tool is run. (TODO)- Parameters:
- fc- the number of favourites for the Mastodon status represented by this- Postobject when it was saved to the archive
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
getFavouritesCountprotected long getFavouritesCount()Obtains as a primitivelongthe number of a count of favourites for the status represented by thisPostobject.
 This may later be used to determine whether or not to repost thisPostobject, based on a threshold specified when the tool is run. (TODO)- Returns:
- the count of favourites for the Mastodon status represented by this 
            Postobject when it was saved to the archive
- Since:
- 0.01.00
- See Also:
 
- 
setReblogsCountStores as a primitivelongthe number of times the Mastodon status represented by thisPostobject was reblogged, and saves the change to file if persistance has not been paused.
 This field may later be used to determine whether or not to repost thisPostobject, based on a threshold specified when the tool is run. (TODO)- Parameters:
- rc- the number of times the Mastodon status represented by this- Postobject had been reblogged when it was saved to the archive
- Throws:
- jakarta.xml.bind.JAXBException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
getReblogsCountprotected long getReblogsCount()Obtains as a primitivelongthe number of times the Mastodon status represented by thisPostobject was reblogged.
 This may later be used to determine whether or not to repost thisPostobject, based on a threshold specified when the tool is run. (TODO)- Returns:
- the number of times the Mastodon status represented by this Postobject had been reblogged when it was saved to the archive
- Since:
- 0.01.00
- See Also:
 
- 
addMediaprotected void addMedia(String u, String mmt, String tu, String at, float x, float y) throws FileNotFoundException, MalformedURLException, IOException Saves media from a URL and attaches it to thisPostobject, together with its thumbnail (when it is a video) and other metadata used by Mastodon, as aMediaFileobject.- Parameters:
- u- the URL for the media file
- mmt- the media type as specified by/for Mastodon
- tu- the URL of the thumbnail for this media
- at- the "alt text" or description of this media
- x- the x-coordinate of the Mastodon focal point for this media
- y- the y-coordinate of the Mastodon focal point for this media
- Throws:
- FileNotFoundException- (TODO: add more info here on when this happens)
- MalformedURLException- (TODO: add more info here on when this happens)
- IOException- (TODO: add more info here on when this happens)
- Since:
- 0.01.00
- See Also:
 
- 
hasMediaprotected boolean hasMedia()- Returns:
- trueif this- Postobject has any media attachments, or- falseotherwise
- Since:
- 0.01.00
 
- 
getMediaObtains media attached to thisPostobject, as aListofMediaFileobjects.
 A read-only, deep-cloned version *should* be returned here; right now the objects returned are the actual data objects held within thisPostobject, when there is no need to modify them programmatically. This should be fixed *asap* as inadvertent changes to the data within could then be persisted and the archive may be damaged (TODO: make MediaFile cloneable then do a deep copy of the array list here)
- 
isAfterDetermines whether thisPostobject was created (so far as the tool is aware) after the given date and time, specified as an ISO 8601 compliantString.
 This relies on the archiveId of the post, which in turn is based on the creation date of the Mastodon post that was first downloaded and from which thisPostobject, in this archive, was first created.
 Handling of dates and their conversion into archiveIds is done byPostArchive
- 
isBeforeDetermines whether thisPostobject was created (so far as the tool is aware) before the given date and time, specified as an ISO 8601 compliantString.
 This relies on the archiveId of the post, which in turn is based on the creation date of the Mastodon post that was first downloaded and from which thisPostobject, in this archive, was first created.
 Handling of dates and their conversion into archiveIds is done byPostArchive
 
-