Package com.atlassian.jira.versioning
Class VersioningDao<Q extends JiraRelationalPathBase<?>,D extends DTO>
java.lang.Object
com.atlassian.jira.versioning.VersioningDao<Q,D>
-
Method Summary
Modifier and TypeMethodDescriptionlong
cleanDeletedRelatedVersions
(long parentIssueId) long
cleanDeletedVersion
(long entityId) long
cleanDeletedVersionsOlderThan
(Duration ageThreshold) Removes all entity version records marked as deleted and older thanduration
.fetchAllRows
(int limit) fetchOneRow
(long entityId) findVersionsUpdatedInTheLast
(Duration duration) Searches for entity versions that were updated (including deletes) within the last 'duration' amount of time.getCurrentEntityVersion
(long entityId) getCurrentVersion
(long entityId) Return the version for the entity identified byentityId
orOptional.empty()
if there is no version.getEntityVersionsRelatedToIssue
(long parentIssueId) Grabs the most recently updated issue version, regardless of whether or not it's marked as deleted.void
incrementEntityVersionsRelatedToIssue
(long parentIssueId) Bumps the version for all entities related to the specifiedparentIssueId
in a single batch update which are not marked as deleted.
Note: no new rows will be added for entities that don't already have a version in the dblong
insertNewRow
(long entityId, long parentIssueId, LocalDateTime updateTime, long version, String deleted) long
markDeletedAndUpdateVersion
(long entityId) Marks the specified entity as deleted and bumps its version by 1.long
markRelatedToIssueAsDeletedAndUpdateVersion
(long parentIssueId) Marks all entities related to the specifiedparentIssueId
as deleted and bumps the version in a single batch update.
-
Method Details
-
markDeletedAndUpdateVersion
public long markDeletedAndUpdateVersion(long entityId) Marks the specified entity as deleted and bumps its version by 1.- Parameters:
entityId
- identifier for entity to mark as deleted & whose version number to bump- Returns:
- the number of updated rows
-
markRelatedToIssueAsDeletedAndUpdateVersion
public long markRelatedToIssueAsDeletedAndUpdateVersion(long parentIssueId) Marks all entities related to the specifiedparentIssueId
as deleted and bumps the version in a single batch update.- Parameters:
parentIssueId
- identifier for the Issue whose related entities will be marked as deleted and have their versions bumped- Returns:
- the number of updated rows
-
getCurrentVersion
Return the version for the entity identified byentityId
orOptional.empty()
if there is no version.- Parameters:
entityId
- identifies the entity whose current version will be retrieved- Returns:
- An optional containing the current version for the specified entity; an empty optional if no version is found.
-
getCurrentEntityVersion
-
getEntityVersionsRelatedToIssue
-
cleanDeletedVersionsOlderThan
Removes all entity version records marked as deleted and older thanduration
.- Parameters:
ageThreshold
- threshold for deletion; entities marked as deleted and older than this will be removed.- Returns:
- the number of rows that were deleted.
-
cleanDeletedVersion
public long cleanDeletedVersion(long entityId) -
cleanDeletedRelatedVersions
public long cleanDeletedRelatedVersions(long parentIssueId) -
fetchAllRows
-
fetchOneRow
-
insertNewRow
public long insertNewRow(long entityId, long parentIssueId, LocalDateTime updateTime, long version, String deleted) -
incrementEntityVersionsRelatedToIssue
public void incrementEntityVersionsRelatedToIssue(long parentIssueId) Bumps the version for all entities related to the specifiedparentIssueId
in a single batch update which are not marked as deleted.
Note: no new rows will be added for entities that don't already have a version in the db- Parameters:
parentIssueId
- identifier for the Issue whose related entities will have their versions bumped
-
findVersionsUpdatedInTheLast
Searches for entity versions that were updated (including deletes) within the last 'duration' amount of time. That is, for versions updated between (currDbTime - duration) and currDbTime.- Parameters:
duration
- how far back from the present to search for updated entities- Returns:
- DTOs for entity versions that were updated since 'duration' ago
-
getMostRecentlyUpdatedVersion
Grabs the most recently updated issue version, regardless of whether or not it's marked as deleted.- Returns:
- an Optional with the latest versioning entry; an empty Optional if there's no entries found.
-