public class SyncUtil extends Object
Modifier and Type | Field and Description |
---|---|
static SyncChangeListener |
DUMMY_LISTENER |
Constructor and Description |
---|
SyncUtil() |
Modifier and Type | Method and Description |
---|---|
static com.almworks.integers.LongLongMap |
add(ForestSource ufs,
ForestAction.Add add) |
static com.almworks.integers.LongLongMap |
add(ForestSource ufs,
ItemForest fragment,
long under,
long after)
Returns row ID replacements, if the add was successful; returns
null otherwise. |
static long |
getFilterId(Map<String,?> params,
String name,
com.atlassian.jira.bc.filter.SearchRequestService searchService,
com.atlassian.jira.web.action.JiraWebActionSupport action) |
static String |
getJqlQuery(Map<String,?> params,
String name,
StructurePluginHelper helper,
com.atlassian.jira.web.action.JiraWebActionSupport action) |
static void |
insert(ForestSource ufs,
ItemForestBuffer addedForest,
com.almworks.integers.LongList issues,
long under,
long after) |
static boolean |
merge(ForestSource ufs,
RowManager rowManager,
long row,
long targetRow) |
static boolean |
merge(ForestSource ufs,
RowManager rowManager,
long row,
long targetRow,
boolean followSymlinks) |
static boolean |
merge(ForestSource ufs,
RowManager rowManager,
long row,
long targetRow,
boolean followSymlinks,
boolean removeRow,
com.almworks.integers.WritableLongLongMap mergedRows)
Merges the subtree of
row under targetRow . |
static long |
move(ForestSource ufs,
com.almworks.integers.LongList rows,
long under,
long after,
boolean[] success) |
static long |
move(ForestSource ufs,
com.almworks.integers.LongList rows,
long under,
long after,
boolean invalidMoveExpected,
boolean[] success) |
static void |
processUpdateError(StructureException exception,
SyncLogger slog,
StringBuilder errorMessage) |
static void |
remove(ForestSource ufs,
com.almworks.integers.LongList rows) |
static boolean |
resolveMoveIntoOwnSubtree(long moveTo,
long row,
HierarchyHelper hh,
ForestSource ufs,
SyncLogger debugLog) |
public static final SyncChangeListener DUMMY_LISTENER
public static boolean merge(ForestSource ufs, RowManager rowManager, long row, long targetRow, boolean followSymlinks, boolean removeRow, @Nullable com.almworks.integers.WritableLongLongMap mergedRows) throws StructureException
Merges the subtree of row
under targetRow
.
See Synchronizers page on the wiki for the description of the merge-move operation.
In brief, this a recursive procedure: it ensures that all items in the subtree of row
are present in the subtree
of targetRow
, preserving the hierarchy; it is achieved by either moving rows for items that are not present
or recursively applying the same procedure to the rows for items that are present.
If any move fails because some items are inaccessible or because parent item permissions do not allow it,
the rows affected by that move and all their ancestors remain in place. Otherwise, row
is removed from the forest.
Most commonly, one would need to use the simpler merge(ForestSource, RowManager, long, long)
override.
ufs
- does the necessary changesrowManager
- row managerrow
- the "donor" row: its subtree will be merged/moved into the subtree of the target row, and it will be removed.
The exception is when some move fails, then the row will stay in place along with the rows that failed to move
and their ancestors.targetRow
- target row - the "receiver" row; 0 means that donor row children will be merged into roots recursivelyfollowSymlinks
- if true, when merging subtrees will consider cycle markers equal with the items they representremoveRow
- whether the "donor" row should be removed. Is not recursive: children of donor row that are merged
will be removed regardless of this settingmergedRows
- if not null, all merges will be recorded here: when a row is removed because a row for the same item
exists under the target row, a mapping removedRow -> rowForSameItemtrue
if the merge has started; that means that some rows might have been moved, some might have been deleted,
but it's also possible that nothing has happened.
false
if the merge hasn't started because some of the preconditions are not met: merged row is ancestor of target row, or
either merged row or target row is missing (target row 0 is considered to be "present").StructureException
- if any unrecoverable problem happens, such as: inaccessible structure, unlicensed usage,
an internal error, too many concurrent changes, etc.public static boolean merge(ForestSource ufs, RowManager rowManager, long row, long targetRow) throws StructureException
StructureException
public static boolean merge(ForestSource ufs, RowManager rowManager, long row, long targetRow, boolean followSymlinks) throws StructureException
StructureException
public static long move(ForestSource ufs, com.almworks.integers.LongList rows, long under, long after, boolean[] success) throws StructureException
success
- if move was successful, is not changed; if move wasn't successful, success[0] == falseStructureException
public static long move(ForestSource ufs, @Nullable com.almworks.integers.LongList rows, long under, long after, boolean invalidMoveExpected, boolean[] success) throws StructureException
success
- if move was successful, is not changed; if move wasn't successful, success[0] == falseStructureException
public static void remove(ForestSource ufs, @Nullable com.almworks.integers.LongList rows) throws StructureException
StructureException
@Nullable public static com.almworks.integers.LongLongMap add(ForestSource ufs, ItemForest fragment, long under, long after) throws StructureException
null
otherwise.StructureException
@Nullable public static com.almworks.integers.LongLongMap add(ForestSource ufs, ForestAction.Add add) throws StructureException
StructureException
public static void insert(ForestSource ufs, ItemForestBuffer addedForest, com.almworks.integers.LongList issues, long under, long after) throws StructureException
StructureException
public static void processUpdateError(StructureException exception, SyncLogger slog, StringBuilder errorMessage) throws StructureException
StructureException
public static boolean resolveMoveIntoOwnSubtree(long moveTo, long row, HierarchyHelper hh, ForestSource ufs, @Nullable SyncLogger debugLog) throws StructureException
StructureException
public static long getFilterId(@NotNull Map<String,?> params, @NotNull String name, com.atlassian.jira.bc.filter.SearchRequestService searchService, com.atlassian.jira.web.action.JiraWebActionSupport action)
@Nullable public static String getJqlQuery(@NotNull Map<String,?> params, @NotNull String name, StructurePluginHelper helper, com.atlassian.jira.web.action.JiraWebActionSupport action)
Copyright © 2017 ALM Works. All Rights Reserved.