Class MicrosoftGraphQueryTranslator

java.lang.Object
com.atlassian.crowd.directory.query.MicrosoftGraphQueryTranslator

public class MicrosoftGraphQueryTranslator extends Object
Translates Crowd queries into filters used by Microsoft Graph.
  • Field Details

  • Constructor Details

    • MicrosoftGraphQueryTranslator

      public MicrosoftGraphQueryTranslator()
  • Method Details

    • convert

      public GraphQuery convert(EntityQuery query, String usernameAttribute)
      Converts a Crowd EntityQuery to a GraphQuery that should be used to fetch the first page of results. This will map the search restrictions, the columns to fetch, the start index and the amount of results to fetch
      Parameters:
      query - the Crowd query to convert
      usernameAttribute - name of the attribute that username restriction should be matched to
      Returns:
      a GraphQuery for fetching the first page of results
    • resolveAzureAdColumnsForSingleEntityTypeQuery

      public ODataSelect resolveAzureAdColumnsForSingleEntityTypeQuery(EntityDescriptor entity, Class<?> returnType)
      Parameters:
      entity - the entity for which we're querying
      returnType - the return type of the Crowd query
      Returns:
      an ODataSelect with the columns appropriate for the given entity and return type
    • translateSearchRestriction

      public ODataFilter translateSearchRestriction(EntityDescriptor entityDescriptor, SearchRestriction restriction, String usernameAttribute)
      Converts a search restriction to an ODataFilter, which can be used in a graph query
      Parameters:
      entityDescriptor - the entityDescriptor of the entity that will be queried for
      restriction - the restriction to translate
      usernameAttribute - name of the attribute that username restriction should be matched to
      Returns:
      the translated filter
    • resolveAzureAdColumnsForSingleEntityTypeQuery

      public ODataSelect resolveAzureAdColumnsForSingleEntityTypeQuery(EntityDescriptor entity, FetchMode fetchMode)
      Parameters:
      entity - the entity for which we're querying
      fetchMode - the types of columns that should be fetched
      Returns:
      an ODataSelect with the columns appropriate for the given entity and fetch mode
    • resolveAzureAdNavigationPropertiesForSingleEntityTypeQuery

      public ODataExpand resolveAzureAdNavigationPropertiesForSingleEntityTypeQuery(EntityDescriptor entity, FetchMode fetchMode)
      Parameters:
      entity - the entity for which we're querying
      fetchMode - the types of navigation properties that should be fetched
      Returns:
      an ODataExpand with the navigation properties appropriate for the given entity and fetch mode
    • translateColumnsForUsersAndGroupsQuery

      public ODataSelect translateColumnsForUsersAndGroupsQuery(FetchMode fetchMode)
      Parameters:
      fetchMode - the types of columns that should be fetched
      Returns:
      an ODataSelect with the columns appropriate for a query that will fetch both users and groups and the specified fetch mode