Class AzureAdPagingWrapper

java.lang.Object
com.atlassian.crowd.directory.rest.AzureAdPagingWrapper

public class AzureAdPagingWrapper extends Object
Wrapper class to facilitate paging results from Microsoft Graph
  • Constructor Details

    • AzureAdPagingWrapper

      public AzureAdPagingWrapper(AzureAdRestClient azureAdRestClient)
  • Method Details

    • fetchAppropriateAmountOfResults

      public <V extends PageableGraphList<T>, T> List<T> fetchAppropriateAmountOfResults(V firstPage, int startIndex, int maxResults) throws OperationFailedException
      Will fetch results from Microsoft Graph until the desired amount of results is reached or until the results are exhausted
      Type Parameters:
      V - Class representing a page of results
      T - Class representing the entries contained in a page
      Parameters:
      firstPage - The first page of the results
      maxResults - the amount of results that should be fetched in the same format as used by EntityQuery
      Returns:
      list of search result entries of size up to maxResults
      Throws:
      OperationFailedException
    • fetchAllMatchingResults

      public <V extends PageableGraphList<T>, T> List<T> fetchAllMatchingResults(V firstPage, Predicate<T> filter) throws OperationFailedException
      Will fetch all results from Microsoft Graph that match the specified predicate
      Type Parameters:
      V - Class representing a page of results
      T - Class representing the entries contained in a page
      Parameters:
      firstPage - The first page of the results
      filter - the filter that results should match
      Returns:
      list of search result entries matching the specified predicate
      Throws:
      OperationFailedException
    • fetchAllResults

      public <V extends PageableGraphList<T>, T> List<T> fetchAllResults(V firstPage) throws OperationFailedException
      Will fetch all results from Microsoft Graph
      Type Parameters:
      V - Class representing a page of results
      T - Class representing the entries contained in a page
      Parameters:
      firstPage - The first page of the results
      Returns:
      list of search result entries matching the specified predicate
      Throws:
      OperationFailedException
    • pageForElement

      public <V extends PageableGraphList<T>, T> Optional<T> pageForElement(V firstPage, Predicate<T> predicate) throws OperationFailedException
      Retrieves the first element matching the specified predicate, if any, paging for it if necessary
      Type Parameters:
      V - Class representing a page of results
      T - Class representing the entries contained in a page
      Parameters:
      firstPage - The first page of the results
      predicate - The predicate against which search items will be matched
      Returns:
      an Optional containing the matching element if found
      Throws:
      OperationFailedException
    • fetchAllDeltaQueryResults

      public <V extends PageableDeltaQueryGraphList<T>, T> GraphDeltaQueryResult<T> fetchAllDeltaQueryResults(V firstPage) throws OperationFailedException
      Throws:
      OperationFailedException