public class ManagerBackedItemForest extends Object implements ItemForest
IGNORE_MISSING_ROWS| Constructor and Description |
|---|
ManagerBackedItemForest(Forest forest,
RowManager rowManager) |
ManagerBackedItemForest(Forest forest,
RowManager rowManager,
ItemAccessMode defaultAccessMode) |
| Modifier and Type | Method and Description |
|---|---|
Forest |
getForest() |
StructureRow |
getRow(long rowId,
ItemAccessMode access)
Retrieves
StructureRow with additional information about how the calling code is going to use
method StructureRow.getItem(java.lang.Class<I>). |
void |
scanRows(LongIterable rows,
boolean sorted,
ItemAccessMode access,
LongCollector missingCollector,
Predicate<StructureRow> iteratee)
Loads multiple rows by their IDs and calls
iteratee with a StructureRow for each row ID in the input. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcollectItemIdscollectIssueIds, collectIssueIds, getRow, reduceOverRows, scanAllExistingRows, scanAllExistingRows, scanAllExistingRows, scanAllRows, scanAllRows, scanAllRows, scanAllRows, scanRows, scanRows, scanRowspublic ManagerBackedItemForest(@NotNull
Forest forest,
@NotNull
RowManager rowManager)
public ManagerBackedItemForest(@NotNull
Forest forest,
@NotNull
RowManager rowManager,
@Nullable
ItemAccessMode defaultAccessMode)
@NotNull public Forest getForest()
getForest in interface ItemForest@NotNull public StructureRow getRow(long rowId, @NotNull ItemAccessMode access) throws MissingRowException
RowRetrieverRetrieves StructureRow with additional information about how the calling code is going to use
method StructureRow.getItem(java.lang.Class<I>). The implementation may be optimized according to the access parameter.
If row's item is invisible or does not exist, StructureRow is returned anyway, but StructureRow.getItem(java.lang.Class<I>)
return null.
getRow in interface RowRetrieverrowId - row IDaccess - defines how item object is going to be accessedMissingRowException - if the specified row ID does not existItemAccessModepublic void scanRows(@Nullable
LongIterable rows,
boolean sorted,
@NotNull
ItemAccessMode access,
@Nullable
LongCollector missingCollector,
@NotNull
Predicate<StructureRow> iteratee)
throws MissingRowException
RowRetrieverLoads multiple rows by their IDs and calls iteratee with a StructureRow for each row ID in the input.
Use this method whenever you need to read a potentially large amount of rows and the order of retrieval is not important.
For example, use scanRows to iterate through the whole forest to see if it has a generator row,
or to process user input that has an array of row IDs.
The order in which iteratee is called is not guaranteed to be the same as the iteration order of rows.
Likewise, missingCollector may receive row IDs out of order.
The implementation of iteratee must be reasonably fast and avoid taking locks or accessing long-running services.
It's possible to call other RowRetriever methods inside iteratee.
It's possible to pass LongIterator as LongIterable - the iterator() method is guaranteed to be called only once.
You can choose an appropriate value for the access parameter based on what you're going to do with rows in the iteratee.
This allows the provider of StructureRow instances to optimize how StructureRow.getItem(java.lang.Class<I>) method works.
If a row ID in the input stream does not correspond to an existing row, the behavior depends on whether the missingCollector
parameter is set. If it's null, then the method will immediately throw a MissingRowException. If it's not null, the
collector will be called with the missing row ID.
To simply ignore the missing rows, you can use RowRetriever.IGNORE_MISSING_ROWS collector or use one of the RowRetriever.scanAllExistingRows(com.almworks.integers.LongIterable, boolean, com.almworks.jira.structure.api.row.ItemAccessMode, java.util.function.Consumer<com.almworks.jira.structure.api.row.StructureRow>) methods.
Note that if the current user does not have access to a row, but the row itself exists, it's not considered missing.
Note that normally a row retriever does not handle SuperRootRow in any special way, so it will be a case of a missing row. Some
implementations may, however, support accessing the super-root.
The default implementation is based on calling RowRetriever.getRow(long). Specific implementations should optimize this method for retrieving
multiple rows at once.
Do not override other bulk scanning methods, unless that allows for additional optimization.
scanRows in interface RowRetrieverrows - row IDs of the rows to scansorted - if true, then the caller guarantees the row IDs to be sorted - this can be used for optimizationaccess - indicates how the getItem() method of the provided StructureRow is going to be used and allows to skip the access checkingmissingCollector - a collector to receive non-existing row IDs, or nulliteratee - predicate to call for each resolved row; if it returns false, the iteration stops and the method returnsMissingRowException - if a row was not found and missingCollector is nullRowManager,
ItemAccessModeCopyright © 2021 ALM Works. All Rights Reserved.