Class JiraReader

Direct Known Subclasses:
JiraEpicReader, JiraIssueReader, JiraProjectReader, JiraSprintReader

public abstract class JiraReader extends IntegrationReader
Base class for readers that page through a Jira REST resource, returning each item of every page as a record.
  • Constructor Details

    • JiraReader

      public JiraReader(String domain, String username, String apiKey)
      Creates a reader for the Jira site at the domain base URL, authenticating with the username and API key.
  • Method Details

    • getIssuesRecord

      protected abstract Record getIssuesRecord()
      Fetches the next page as a record with an isLast flag and the item array (named values unless changed by setRecordsFieldName(String)), or returns null to end the read.
    • getPageOffset

      public int getPageOffset()
      Indicates the first offset to start returning.
    • setPageOffset

      protected JiraReader setPageOffset(int pageOffset)
      Indicates the first offset to start returning.
    • getBatchSize

      public int getBatchSize()
      Indicates the number of items to retrieve per batch.
    • setBatchSize

      public JiraReader setBatchSize(int batchSize)
      Indicates the number of items to retrieve per batch.
    • getTotalItems

      public long getTotalItems()
      Returns the number of items fetched so far, or -1 before the first page is fetched.
    • setTotalItems

      protected JiraReader setTotalItems(long totalItems)
      Sets the number of items fetched so far; no further pages are fetched once it reaches getMaxItems().
    • getMaxItems

      public long getMaxItems()
      Indicates the maximum number of items to return.
    • setMaxItems

      public JiraReader setMaxItems(long maxItems)
      Indicates the maximum number of items to return.
    • setIssuesRecord

      protected JiraReader setIssuesRecord(Record issuesRecord)
    • setRecordsFieldName

      protected JiraReader setRecordsFieldName(String recordsFieldName)
      Sets the name of the array field in each page that holds the items to return (defaults to "values").
    • getClient

      protected JiraClient getClient()
      Returns the Jira REST client created by open(); only valid while the reader is open.
    • open

      public void open() throws DataException
      Description copied from class: DataEndpoint
      Makes this endpoint ready for reading or writing.
      Overrides:
      open in class IntegrationReader
      Throws:
      DataException
    • close

      public void close() throws DataException
      Description copied from class: DataEndpoint
      Indicates that this endpoint has finished reading or writing.
      Overrides:
      close in class DataEndpoint
      Throws:
      DataException
    • readImpl

      protected Record readImpl()
      Description copied from class: DataReader
      Overridden by subclasses to read the next record from this DataReader. The default implementation of DataReader.read() now insures that this method will not be called again after it returns a null.

      If no record is available, null will be returned.

      Contract for subclasses (see also docs/authoring/DataReader.md):

      Specified by:
      readImpl in class DataReader
    • readNextBatch

      protected boolean readNextBatch()
      Fetches the next page via getIssuesRecord() and buffers its items; returns false after the last page, if the page is null or empty, or if at least getMaxItems() items were already fetched. The limit is only checked before a page is fetched, so up to one page more than the limit can be buffered.
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Description copied from class: Endpoint
      Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Overrides:
      addExceptionProperties in class DataReader