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 TypeMethodDescriptionlongcleanDeletedRelatedVersions(long parentIssueId) longcleanDeletedVersion(long entityId) longcleanDeletedVersionsOlderThan(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) getCurrentEntityVersions(List<Long> entityIds) getCurrentVersion(long entityId) Return the version for the entity identified byentityIdorOptional.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.voidincrementEntityVersionsRelatedToIssue(long parentIssueId) Bumps the version for all entities related to the specifiedparentIssueIdin 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 dblonginsertNewRow(long entityId, long parentIssueId, LocalDateTime updateTime, long version, String deleted) longmarkDeletedAndUpdateVersion(long entityId) Marks the specified entity as deleted and bumps its version by 1.markDeletedAndUpdateVersionAndGet(long entityId) Marks the specified entity as deleted, bumps its version by 1 and retrieves the new version within the same transaction.longmarkRelatedToIssueAsDeletedAndUpdateVersion(long parentIssueId) Marks all entities related to the specifiedparentIssueIdas 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 invalid input: '&' whose version number to bump- Returns:
- the number of updated rows
-
markDeletedAndUpdateVersionAndGet
Marks the specified entity as deleted, bumps its version by 1 and retrieves the new version within the same transaction.- Parameters:
entityId- identifier for entity to mark as deleted invalid input: '&' whose version number to bump- Returns:
- the latest entity version
-
markRelatedToIssueAsDeletedAndUpdateVersion
public long markRelatedToIssueAsDeletedAndUpdateVersion(long parentIssueId) Marks all entities related to the specifiedparentIssueIdas 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 byentityIdorOptional.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
-
getCurrentEntityVersions
-
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 specifiedparentIssueIdin 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.
-