public class

AbstractContentTreeCallback

extends Object
implements ContentTreeCallback3
java.lang.Object
   ↳ com.atlassian.stash.content.AbstractContentTreeCallback

Class Overview

Convenience implementation of ContentTreeCallback that provides no-op implementations for all methods.

Summary

Public Constructors
AbstractContentTreeCallback()
Public Methods
void onEnd(ContentTreeSummary summary)
Delegates to onEndPage(Page) to retain backwards compatibility for ContentTreeCallback.
void onEndPage(Page<?> page)
Called after onStartPage(int), after onTreeNode(String, String, ContentTreeNode.Type) is invoked for the last time.
void onStart(ContentTreeContext context)
Delegates to onStartPage(int) to retain backwards compatibility for ContentTreeCallback.
void onStartPage(int index)
Called before the first invocation of onTreeNode(String, String, ContentTreeNode.Type).
boolean onTreeNode(String contentId, String path, ContentTreeNode.Type type)
Called once for each file path.
boolean onTreeNode(ContentTreeNode node)
Delegates to onTreeNode(String, String, ContentTreeNode.Type) to retain backwards compatibility for ContentTreeCallback.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.stash.content.ContentTreeCallback
From interface com.atlassian.stash.content.ContentTreeCallback2
From interface com.atlassian.stash.content.ContentTreeCallback3

Public Constructors

public AbstractContentTreeCallback ()

Public Methods

public void onEnd (ContentTreeSummary summary)

Delegates to onEndPage(Page) to retain backwards compatibility for ContentTreeCallback.

Parameters
summary summarizes the tree request and the streamed nodes
Throws
IOException propagated if thrown by onEndPage(Page)

public void onEndPage (Page<?> page)

Called after onStartPage(int), after onTreeNode(String, String, ContentTreeNode.Type) is invoked for the last time.

onEnd(ContentTreeSummary) will replace this method in Stash 3.0.

Parameters
page information about the page streamed to the callback. The page.getValues() will return null as the callback has already received the data. This is used to know information about the number of elements processed and whether there is more content to be retrieved in the future
Throws
IOException

public void onStart (ContentTreeContext context)

Delegates to onStartPage(int) to retain backwards compatibility for ContentTreeCallback.

Parameters
context provides details about the tree request for which nodes are being streamed
Throws
IOException propagated if thrown by onStartPage(int)

public void onStartPage (int index)

Called before the first invocation of onTreeNode(String, String, ContentTreeNode.Type). It provides the callback the index of the starting element of the page.

onStart(ContentTreeContext) will replace this method in Stash 3.0. Until 3.0, the starting index can be retrieved using the deprecated getStart(). Plugin developers should implement onEnd(ContentTreeSummary) and use the ContentTreeSummary to retrieve paging details.

Parameters
index the index of the starting element of the page
Throws
IOException

public boolean onTreeNode (String contentId, String path, ContentTreeNode.Type type)

Called once for each file path. onStartPage(int) is called before any invocation of this method. onEndPage(Page) is called after all invocations of this method.

Parameters
contentId a unique identifier for the content node
path the path to the content node
type the type of the content node
Returns
  • true if additional nodes should be provided; otherwise, false if the provided node should be the last
Throws
IOException

public boolean onTreeNode (ContentTreeNode node)

Delegates to onTreeNode(String, String, ContentTreeNode.Type) to retain backwards compatibility for ContentTreeCallback.

If the node type is not DIRECTORY or FILE the node is ignored. Other types were never provided to onTreeNode(String, String, ContentTreeNode.Type), so ignoring nodes with other types is part of retaining backwards compatibility. Callbacks implementing the old interface cannot be expected to handle other types. If such types are expected, the callback should implement this method itself.

Parameters
node the current tree node
Returns
  • true if further nodes should be streamed; otherwise, false to stop streaming
Throws
IOException propagated if thrown by onTreeNode(String, String, ContentTreeNode.Type)