Interface LexoRankDao
- All Known Implementing Classes:
LexoRankDaoImpl
public interface LexoRankDao
DAO for LexoRank AOs.
-
Method Summary
Modifier and TypeMethodDescriptionacquireLock
(LexoRankRow rowToLock) Attempts the acquire a database lock on the given LexoRankRow that represents a row in the LexoRank table.acquireLock
(LexoRankRow[] rowsToLock) Attempts the acquire a database lock on the given LexoRankRows that represent rows in the LexoRank table.acquireLock
(Long rowIdToLock) Attempts the acquire a database lock on the ID that represents a row in the LexoRank table.acquireLock
(Set<LexoRankRow> rowsToLock) Attempts the acquire a database lock on the given LexoRankRows that represent rows in the LexoRank table.acquireLockByFieldId
(Long fieldId) Attempts the acquire a database lock on all rows in the LexoRank table whom's fieldId matches the given fieldId.countDuplicateRowsForFieldId
(Long fieldId) Returns a map of duplicate rank values and the amount of occurences of that rank value.Create a row in the db for the given rank, issueId and fieldIdvoid
createMarkerRowsForRankField
(long fieldId) Creates the 'marker' rows for the given fieldId in the db.Deletes all rows.deleteByFieldId
(Lock lock, Long fieldId) Deletes rows for the given fieldIddeleteByFieldIdAndIssueId
(Lock lock, Long fieldId, Long issueId) Deletes a single rank row for the given fieldId and issueIddeleteByFieldIdNoLock
(Long fieldId) Deletes all rows for a given fieldId without locking them first.deleteByIssueId
(Lock lock, Long issueId) Deletes rows for the given issueIddeleteByLimitedIssueIds
(Lock lock, List<Long> issueIds) Deletes rows for the given issueIdsboolean
existsRankForFieldId
(Long rankFieldId, String rank) Checks if the given rank value already exists for the given rank field id.io.atlassian.fugue.Option
<LexoRankRow> findByFieldAndIssueId
(long fieldId, long issueId) Finds a single rank row for the given fieldId and issueIdfindByFieldId
(long fieldId) WARNING: Do not use unless you know what you are doing because it returns all issues (which can be 100k+) Returns all ranking rows by field idfindByIssueId
(long issueId) Returns all rank rows for a given issueId.findByIssueIds
(long fieldId, Iterable<Long> issueIds) Returns all rank rows for given item IDs.findByIssueIds
(Iterable<Long> issueIds) Returns all rank rows for a given issueIds.Retrieves a Collection of rank row IDs that require balancing.findIssueIdsByFieldId
(long fieldId) Retrieves a Set of issueIds of rank rows for the given fieldIdio.atlassian.fugue.Option
<LexoRankRow> findMaximumMarkerRow
(long fieldId) Finds the maximum marker row for the given fieldIdio.atlassian.fugue.Option
<LexoRankRow> findMaximumRankLengthRow
(long fieldId) Finds the issue row with the longest rank for the given fieldIdio.atlassian.fugue.Option
<LexoRankRow> findMinimumMarkerRow
(long fieldId) Finds the minimum marker row for the given fieldIdfindNextOneByRank
(long fieldId, String rank) Find the next rank row (skipping over any duplicates)Finds fields that no longer have a corresponding entry in Jira Core's customfield table.getByFieldAndIssueId
(long fieldId, long issueId) Gets a single LexoRankRow object with the given fieldId and issueIdDeprecated.please do not use this method anymore, is an exposure of AO entity manager wrapped that it is not needed to be out of this interface If you see method calls to any test or class please remove them.getMaximumMarkerRow
(long fieldId) getMaximumMarkerRowAndPreviousRow
(long fieldId) Returns the maximum rank marker row and the previous row ranked before the maximum marker row for the given fieldIdgetMinimumMarkerRow
(long fieldId) getMinimumMarkerRowAndNextRow
(long fieldId) Returns the minimum rank marker row and the next row ranked behind the minimum marker row for the given fieldIdlong
getNumRowsWithInvalidBucket
(Long fieldId) getRowByRankAndNextRow
(long fieldId, String rank) Returns the rank row with the given rank and the row ranked after that row.getRowByRankAndNextRows
(long fieldId, String rank, int howMany) Returns the rank row with the given rank andhowMany
rows ranked after that row.getRowByRankAndPreviousRow
(long fieldId, String rank) Returns the rank row with the given rank and the row ranked before that row.getRowByRankAndPreviousRows
(long fieldId, String rank, int howMany) Returns the rank row with the given rank andhowMany
rows ranked before that row.getRowCountForFieldId
(Long fieldId) Get the number of rows for a given rank field.long
getRowCountInBucket
(Long fieldId, LexoRankBucket containingBucket) Get the number of rows for a given fieldId and bucket.long
getRowCountInBucket
(Long fieldId, LexoRankBucket containingBucket, LexoRankRow.RankRowType rankRowType) Get the number of rows for a given fieldId, bucket and type.getRowsAtBalanceBoundaryForFieldId
(Long fieldId, LexoRankBucket bucketBeingMigratedFrom, LexoRankBucket bucketBeingMigratedTo) Finds the 2 rows at the balance boundary for the given field id and bucket.listByFieldIdAndRank
(Long fieldId, String rank) Lists all the LexoRankRows for the given rank field id that have the given rank.listIssueIdsBetween
(long startIdInclusive, long endIdInclusive) Get the stored issue IDs between startIdInclusive and endIdInclusivelistIssueIdsByFieldIdAndIssueIds
(long fieldId, List<Long> issueIds) Returns a list of issue IDs for which a LexoRank row with fieldId and one of the given issueIds exists.Gets the number of distinct ranks for a field in the dbvoid
releaseLock
(Lock lock) Releases the lock on all rows locked by the given lock.save
(Lock lock, LexoRankRow lexoRankRow) Update a LexoRankRow.unlockedSave
(LexoRankRow lexoRankRow) Update a LexoRankRow, without the need for it to be locked.
-
Method Details
-
createMarkerRowsForRankField
void createMarkerRowsForRankField(long fieldId) Creates the 'marker' rows for the given fieldId in the db. These marker rows represent the minimum and maximum rank rows for a rank field. They aid in rank to top and bottom operations.- Parameters:
fieldId
-
-
create
Create a row in the db for the given rank, issueId and fieldId- Parameters:
fieldId
-issueId
-rank
-- Returns:
-
findByFieldId
WARNING: Do not use unless you know what you are doing because it returns all issues (which can be 100k+) Returns all ranking rows by field id- Parameters:
fieldId
- the field id- Returns:
- the ranking rows for this field id
-
findByIssueId
Returns all rank rows for a given issueId.- Parameters:
issueId
-- Returns:
-
findByIssueIds
Returns all rank rows for a given issueIds.- Parameters:
issueIds
-- Returns:
-
findByIssueIds
Returns all rank rows for given item IDs.- Parameters:
fieldId
-issueIds
-- Returns:
-
findByFieldAndIssueId
Finds a single rank row for the given fieldId and issueId- Parameters:
fieldId
-issueId
-- Returns:
-
listIssueIdsByFieldIdAndIssueIds
Returns a list of issue IDs for which a LexoRank row with fieldId and one of the given issueIds exists.- Parameters:
fieldId
-issueIds
-- Returns:
-
listIssueIdsBetween
Get the stored issue IDs between startIdInclusive and endIdInclusive- Parameters:
startIdInclusive
-endIdInclusive
-- Returns:
-
getByFieldAndIssueId
Gets a single LexoRankRow object with the given fieldId and issueId- Parameters:
fieldId
-issueId
-- Returns:
-
getMinimumMarkerRowAndNextRow
Returns the minimum rank marker row and the next row ranked behind the minimum marker row for the given fieldId- Parameters:
fieldId
-- Returns:
-
getMaximumMarkerRowAndPreviousRow
Returns the maximum rank marker row and the previous row ranked before the maximum marker row for the given fieldId- Parameters:
fieldId
-- Returns:
-
getRowByRankAndNextRow
Returns the rank row with the given rank and the row ranked after that row. The values are returned in ascending order sorted by rank field.- Parameters:
fieldId
-rank
-- Returns:
-
getRowByRankAndNextRows
Returns the rank row with the given rank andhowMany
rows ranked after that row. The values are returned in ascending order sorted by rank field.- Parameters:
fieldId
-rank
-- Returns:
- the rank row with the given rank and
howMany
rows ranked after that row
-
getRowByRankAndPreviousRow
Returns the rank row with the given rank and the row ranked before that row. The values are returned in descending order sorted by rank field.- Parameters:
fieldId
-rank
-- Returns:
-
getRowByRankAndPreviousRows
Returns the rank row with the given rank andhowMany
rows ranked before that row. The values are returned in descending order sorted by rank field.- Parameters:
fieldId
-rank
-- Returns:
- the rank row with the given rank and
howMany
rows ranked before that row
-
findNextOneByRank
Find the next rank row (skipping over any duplicates)- Parameters:
fieldId
- is the rank fieldrank
- is the rank value- Returns:
- the rank row
-
findMinimumMarkerRow
Finds the minimum marker row for the given fieldId- Parameters:
fieldId
-- Returns:
-
getMinimumMarkerRow
-
findMaximumMarkerRow
Finds the maximum marker row for the given fieldId- Parameters:
fieldId
-- Returns:
-
getMaximumMarkerRow
-
findMaximumRankLengthRow
Finds the issue row with the longest rank for the given fieldId- Parameters:
fieldId
-- Returns:
-
findIssueIdsByFieldId
Retrieves a Set of issueIds of rank rows for the given fieldId- Parameters:
fieldId
-- Returns:
-
findFieldIdsInLexoRankTable
Collection<Long> findFieldIdsInLexoRankTable()Retrieves a Collection of rank row IDs that require balancing.- Returns:
-
findObsoleteFields
Collection<Long> findObsoleteFields()Finds fields that no longer have a corresponding entry in Jira Core's customfield table.- Returns:
-
ranksCountByField
Gets the number of distinct ranks for a field in the db- Returns:
-
getContext
Deprecated.please do not use this method anymore, is an exposure of AO entity manager wrapped that it is not needed to be out of this interface If you see method calls to any test or class please remove them.Returns a LexoRankDaoContext object that should be passed to any methods on the LexoRankDao that require it. Once finished, the context should be closed.- Returns:
- the lexorank context
-
acquireLock
Attempts the acquire a database lock on the ID that represents a row in the LexoRank table. If successfull, a LockOutcome object is returned which can be used to unlock the rows this lock operation locked.- Parameters:
rowIdToLock
-- Returns:
-
acquireLock
Attempts the acquire a database lock on the given LexoRankRow that represents a row in the LexoRank table. If successfull, a LockOutcome object is returned which can be used to unlock the rows this lock operation locked.- Parameters:
rowToLock
-- Returns:
-
acquireLock
Attempts the acquire a database lock on the given LexoRankRows that represent rows in the LexoRank table. If successfull, a LockOutcome object is returned which can be used to unlock the rows this lock operation locked.- Parameters:
rowsToLock
-- Returns:
-
acquireLock
Attempts the acquire a database lock on the given LexoRankRows that represent rows in the LexoRank table. If successfull, a LockOutcome object is returned which can be used to unlock the rows this lock operation locked.- Parameters:
rowsToLock
-- Returns:
-
acquireLockByFieldId
Attempts the acquire a database lock on all rows in the LexoRank table whom's fieldId matches the given fieldId. If successfull, a LockOutcome object is returned which can be used to unlock the rows this lock operation locked.- Parameters:
fieldId
-- Returns:
-
releaseLock
Releases the lock on all rows locked by the given lock. This will clear out the lockHash and lockTime column for rows whom's current value match the given Lock object's hash and time.- Parameters:
lock
-
-
save
Update a LexoRankRow.- Parameters:
lock
- is the lock objects.lexoRankRow
- the LexoRankRow to persist.- Returns:
- outcome of the save.
-
unlockedSave
Update a LexoRankRow, without the need for it to be locked.- Parameters:
lexoRankRow
- the LexoRankRow to save- Returns:
- service outcome.
-
deleteByIssueId
Deletes rows for the given issueId- Parameters:
lock
-issueId
-- Returns:
-
deleteByLimitedIssueIds
Deletes rows for the given issueIds- Parameters:
lock
-issueIds
- of the issues. Must have less than 1000 elements otherwise the queries could fail on certain databases.- Returns:
-
deleteAll
ServiceResult deleteAll()Deletes all rows.- Returns:
-
deleteByFieldIdNoLock
Deletes all rows for a given fieldId without locking them first.- Parameters:
fieldId
-- Returns:
-
deleteByFieldId
Deletes rows for the given fieldId- Parameters:
lock
-fieldId
-- Returns:
-
deleteByFieldIdAndIssueId
Deletes a single rank row for the given fieldId and issueId- Parameters:
lock
-fieldId
-issueId
-- Returns:
-
getRowsAtBalanceBoundaryForFieldId
LexoRankRow[] getRowsAtBalanceBoundaryForFieldId(Long fieldId, LexoRankBucket bucketBeingMigratedFrom, LexoRankBucket bucketBeingMigratedTo) Finds the 2 rows at the balance boundary for the given field id and bucket. The balance boundary is where the last migrated rank row and the next rank row to be migrated meet. An array with 2 LexoRankRow objects is returned where the first row is the row to be migrated and the second row is the row that was last migrated- Parameters:
fieldId
-bucketBeingMigratedFrom
-bucketBeingMigratedTo
-- Returns:
-
existsRankForFieldId
Checks if the given rank value already exists for the given rank field id.- Parameters:
rankFieldId
-rank
-- Returns:
-
countDuplicateRowsForFieldId
Returns a map of duplicate rank values and the amount of occurences of that rank value.- Parameters:
fieldId
-- Returns:
-
listByFieldIdAndRank
Lists all the LexoRankRows for the given rank field id that have the given rank.- Parameters:
fieldId
-rank
-- Returns:
-
getRowCountForFieldId
Get the number of rows for a given rank field.- Parameters:
fieldId
- Id of the rank field- Returns:
- Number of rows for the specified rank field
-
getRowCountInBucket
Get the number of rows for a given fieldId and bucket.- Parameters:
fieldId
- Id of the rank fieldcontainingBucket
-- Returns:
- the number of rows for a given fieldId and bucket.
-
getRowCountInBucket
long getRowCountInBucket(Long fieldId, LexoRankBucket containingBucket, @Nullable LexoRankRow.RankRowType rankRowType) Get the number of rows for a given fieldId, bucket and type.- Parameters:
fieldId
- Id of the rank fieldcontainingBucket
-rankRowType
-- Returns:
- the number of rows for a given fieldId, rowType and bucket.
-
getNumRowsWithInvalidBucket
- Parameters:
fieldId
- is the rank field id- Returns:
- the number of rows where BUCKET doesn't match the bucket encoded in the RANK field.
-