public class BulkMoveBatchProcessingHelper extends Object
Constructor and Description |
---|
BulkMoveBatchProcessingHelper() |
Modifier and Type | Method and Description |
---|---|
List<List<Issue>> |
partition(List<Issue> selectedIssues,
int batchSize)
Returns consecutive sublists of a list, each of the same size except the last one that can have different size.
|
public List<List<Issue>> partition(@Nonnull List<Issue> selectedIssues, int batchSize)
Returns consecutive sublists of a list, each of the same size except the last one that can have different size.
There are two possible scenarios:
selectedIssues % batchSize != 1
Method returns batches created by Lists.partition(List, int)
selectedIssues % batchSize == 1
If the last batch contains one issue, some methods wrongly assume they are not performing a bulk operation. As a workaround, we merge last two batches.
An example of such behaviour is CommentSystemField.needsMove(Collection, Issue, FieldLayoutItem)
selectedIssues
- the list to partition and return batchesbatchSize
- the desired size of each batch (the last batch could have different size)IllegalArgumentException
- if batchSize is less than 2Copyright © 2002-2022 Atlassian. All Rights Reserved.