
com.almworks.jira.structure.api2g.row.RowManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of structure-api Show documentation
Show all versions of structure-api Show documentation
Public API for the Structure Plugin for JIRA
package com.almworks.jira.structure.api2g.row;
import com.almworks.integers.LongCollector;
import com.almworks.integers.LongIterator;
import com.almworks.jira.structure.api2g.forest.Forest;
import com.almworks.jira.structure.api2g.item.ItemIdentity;
import com.almworks.jira.structure.api2g.v2.MissingRowException;
import com.almworks.jira.structure.util.La;
import com.atlassian.annotations.Internal;
import com.atlassian.annotations.PublicApi;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author che
*/
@PublicApi
public interface RowManager {
long createRow(ItemIdentity itemId, long semantics);
long createTransientRow(ItemIdentity itemId, long semantics, long creatorId, long originalId);
@NotNull
LongIterator findRows(ItemIdentity itemId);
LongIterator findRows(ItemIdentity itemId, long creatorId);
@NotNull
StructureRow getRow(long rowId) throws MissingRowException;
@NotNull
@Internal
StructureRow getRow(long rowId, boolean itemVisible) throws MissingRowException;
/**
* Bulk rows processing, could be optimized by the implementation.
*
* The order in which iteratee is called is not guaranteed to be the same as rows. The same for missingCollector.
* todo 1) revise usages when the efficient implementation is ready: is the order of iteration still unpredictable?
* todo 2) revise the effect of sorted and possibly simplify usages
* todo 3) is it reentrant? If not, update StructureJqlFunction.
* todo 3a) can one call getRow from iteratee? If not, update QueryContext.resolveRowIdsToIssues().
*
* Iteratee must be reasonably fast and avoid taking locks or accessing long-running services.
*
* @param rows rows to read
* @param sorted if true, then rows is sorted - can be used by the optimized code
* @param missingCollector if not null, all missing rows will be added to the collector; if null, any missing row will cause
* MissingRowException
* @param iteratee predicate to call for each resolved row; if it returns false, the iteration stops
* @throws MissingRowException if a row was not found and missingCollector is null
*/
void scanRows(LongIterator rows, boolean sorted, @Nullable LongCollector missingCollector,
La iteratee) throws MissingRowException;
// todo convenience method to extract ItemIdentitySet from LongIterator rows
RowMapper createMapper(Forest forest);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy