public class EntityVersioningManagerWithStats extends Object implements EntityVersioningManager
Constructor and Description |
---|
EntityVersioningManagerWithStats(VersioningDaoFactory factory,
TransactionSupport transactionSupport,
com.atlassian.event.api.EventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
long |
cleanAllDeletedEntityVersionsOlderThan(java.time.Duration duration)
Removes all entity version records (issues, comments, & worklogs) for entites marked as deleted and older than
duration . |
List<EntityVersion> |
findEntityVersionsUpdatedInTheLast(IndexDirectoryFactory.Name indexName,
java.time.Duration duration)
Looks up all the entities whose version changed during the last
duration amount of time. |
Optional<Long> |
getCommentVersion(long commentId)
Return the comment version for the comment identified by
commentId or Optional.empty() if there is no version. |
Optional<Long> |
getIssueVersion(long issueId)
Return the issue version for the issue identified by
issueId or Optional.empty() if there is no version. |
Optional<EntityVersion> |
getLatestEntityUpdate(IndexDirectoryFactory.Name indexName)
Looks up the Version & related info for the most recently modified entity version.
|
Map<Long,Optional<Long>> |
getLocalVersions(Set<Long> entityIds,
IndexDirectoryFactory.Name indexName)
Returns the corresponding entity version from the specified local lucene index for each of the ids passed in with
entityIds in
the form of a map of ids to versions. |
Map<Long,Long> |
getRelatedCommentVersions(long parentIssueId)
Return the comment versions for for all comments associated with the specified
parentIssueId . |
Map<Long,Long> |
getRelatedWorklogVersions(long parentIssueId)
Return the worklog versions for for all worklogs associated with the specified
parentIssueId . |
Optional<Long> |
getWorklogVersion(long worklogId)
Return the worklog version for the worklog identified by
worklogId or Optional.empty() if there is no version. |
void |
incrementCommentVersion(long commentId,
long parentIssueId)
Increments the version number for the specified comment.
|
void |
incrementIssueVersion(long issueId)
Increments the version number for the specified issue.
|
void |
incrementRelatedCommentVersions(long parentIssueId)
Bumps the versions for all comments associated with the specified
parentIssueId . |
void |
incrementRelatedWorklogVersions(long parentIssueId)
Bumps the versions for all worklogs associated with the specified
parentIssueId . |
void |
incrementWorklogVersion(long worklogId,
long parentIssueId)
Increments the version number for the specified worklog.
|
void |
markCommentDeletedAndIncrementVersion(long commentId)
Marks the specified comment as deleted and bumps its version by 1.
|
void |
markIssueDeletedAndIncrementVersion(long issueId)
Marks the specified issue and all its related comments and worklogs as deleted bumps their versions by 1.
|
void |
markWorklogDeletedAndIncrementVersion(long worklogId)
Marks the specified worklog as deleted and bumps its version by 1.
|
void |
onPluginFrameworkShutdown(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event) |
void |
onPluginFrameworkStarted(com.atlassian.plugin.event.events.PluginFrameworkStartedEvent event) |
public EntityVersioningManagerWithStats(VersioningDaoFactory factory, TransactionSupport transactionSupport, com.atlassian.event.api.EventPublisher eventPublisher)
@EventListener public void onPluginFrameworkStarted(com.atlassian.plugin.event.events.PluginFrameworkStartedEvent event)
@EventListener public void onPluginFrameworkShutdown(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event)
public void incrementIssueVersion(long issueId) throws IncrementDeletedEntityVersionException
EntityVersioningManager
incrementIssueVersion
in interface EntityVersioningManager
issueId
- identifier for the issue whose version should be bumpedIncrementDeletedEntityVersionException
- if issueId
is related to an issue version which is marked as deletedpublic void incrementCommentVersion(long commentId, long parentIssueId) throws IncrementDeletedEntityVersionException
EntityVersioningManager
incrementCommentVersion
in interface EntityVersioningManager
commentId
- identifier for the comment whose version should be bumpedparentIssueId
- identifier for the Issue
that the comment belongs toIncrementDeletedEntityVersionException
- if commentId
is related to a deleted comment version which is marked as deletedpublic void incrementWorklogVersion(long worklogId, long parentIssueId) throws IncrementDeletedEntityVersionException
EntityVersioningManager
incrementWorklogVersion
in interface EntityVersioningManager
worklogId
- identifier for the worklog whose version should be bumpedparentIssueId
- identifier for the Issue
that the worklog belongs toIncrementDeletedEntityVersionException
- if worklogId
is related to a deleted worklog version which is marked as deletedpublic void incrementRelatedCommentVersions(long parentIssueId)
EntityVersioningManager
parentIssueId
. If there isn't a
version record associated with a given comment, it will be added.incrementRelatedCommentVersions
in interface EntityVersioningManager
parentIssueId
- identifier for the Issue whose comments will be bumped.public void incrementRelatedWorklogVersions(long parentIssueId)
EntityVersioningManager
parentIssueId
. If there isn't a
version record associated with a given worklog, it will be added.incrementRelatedWorklogVersions
in interface EntityVersioningManager
parentIssueId
- identifier for the Issue whose worklogs will be bumped.public void markIssueDeletedAndIncrementVersion(long issueId)
EntityVersioningManager
markIssueDeletedAndIncrementVersion
in interface EntityVersioningManager
issueId
- identifier for issue and all its related comments and worklogs to mark as deleted & whose version number to bumppublic void markCommentDeletedAndIncrementVersion(long commentId)
EntityVersioningManager
markCommentDeletedAndIncrementVersion
in interface EntityVersioningManager
commentId
- identifier for comment to mark as deleted & whose version number to bumppublic void markWorklogDeletedAndIncrementVersion(long worklogId)
EntityVersioningManager
markWorklogDeletedAndIncrementVersion
in interface EntityVersioningManager
worklogId
- identifier for worklog to mark as deleted & whose version number to bumppublic Optional<Long> getIssueVersion(long issueId)
EntityVersioningManager
issueId
or Optional.empty()
if there is no version.getIssueVersion
in interface EntityVersioningManager
issueId
- identifies the issue whose current version will be retrievedpublic Optional<Long> getCommentVersion(long commentId)
EntityVersioningManager
commentId
or Optional.empty()
if there is no version.getCommentVersion
in interface EntityVersioningManager
commentId
- identifies the comment whose current version will be retrievedpublic Optional<Long> getWorklogVersion(long worklogId)
EntityVersioningManager
worklogId
or Optional.empty()
if there is no version.getWorklogVersion
in interface EntityVersioningManager
worklogId
- identifies the worklog whose current version will be retrievedpublic Map<Long,Long> getRelatedCommentVersions(long parentIssueId)
EntityVersioningManager
parentIssueId
.getRelatedCommentVersions
in interface EntityVersioningManager
parentIssueId
- identifier for the Issue whose comments will be retrievedpublic Map<Long,Long> getRelatedWorklogVersions(long parentIssueId)
EntityVersioningManager
parentIssueId
.getRelatedWorklogVersions
in interface EntityVersioningManager
parentIssueId
- identifier for the Issue whose worklogs will be retrievedpublic Map<Long,Optional<Long>> getLocalVersions(Set<Long> entityIds, IndexDirectoryFactory.Name indexName) throws IOException
EntityVersioningManager
entityIds
in
the form of a map of ids to versions. Which local index to retrieve the versions from is determined by indexName
.getLocalVersions
in interface EntityVersioningManager
entityIds
- Set of entity ids whose versions we want to look up in the local index referred to by indexName
indexName
- Specifies which local Lucene index the versions should be retrieved fromOptional
s, with empty values for versions that were not found.IOException
- if an I/O problem arises when searching the target lucene indexpublic long cleanAllDeletedEntityVersionsOlderThan(java.time.Duration duration)
EntityVersioningManager
duration
.cleanAllDeletedEntityVersionsOlderThan
in interface EntityVersioningManager
duration
- threshold for deletion; entries marked as deleted and older than this will be removed.public List<EntityVersion> findEntityVersionsUpdatedInTheLast(IndexDirectoryFactory.Name indexName, java.time.Duration duration)
EntityVersioningManager
duration
amount of time. A data object
containing the entity's id, version, whether or not it was deleted, etc. is returned for every entity-version modified
since the duration.findEntityVersionsUpdatedInTheLast
in interface EntityVersioningManager
indexName
- which type of entity to get the updated versions forduration
- how far back in time to look for entity versions that have been updatedpublic Optional<EntityVersion> getLatestEntityUpdate(IndexDirectoryFactory.Name indexName)
EntityVersioningManager
getLatestEntityUpdate
in interface EntityVersioningManager
indexName
- which type of entity to get the latest update forCopyright © 2002-2022 Atlassian. All Rights Reserved.