Class BasicQueryLanguageProvider

java.lang.Object
org.apache.sling.jcr.resource.internal.helper.jcr.BasicQueryLanguageProvider
All Implemented Interfaces:
QueryLanguageProvider<org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderState>

public class BasicQueryLanguageProvider extends Object implements QueryLanguageProvider<org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderState>
  • Constructor Details

    • BasicQueryLanguageProvider

      public BasicQueryLanguageProvider(ProviderContext ctx)
  • Method Details

    • getSupportedLanguages

      public String[] getSupportedLanguages(@NotNull @NotNull ResolveContext<org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderState> ctx)
      Description copied from interface: QueryLanguageProvider
      The supported languages of the resource provider.
      Specified by:
      getSupportedLanguages in interface QueryLanguageProvider<org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderState>
      Parameters:
      ctx - The resolve context
      Returns:
      The array of supported languages
    • findResources

      public Iterator<Resource> findResources(@NotNull @NotNull ResolveContext<org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderState> ctx, String query, String language)
      Description copied from interface: QueryLanguageProvider
      Searches for resources using the given query formulated in the given language.

      The semantic meaning of the query and language depend on the actual implementation and storage used for the resources. For JCR repository being used as storage, the query and language parameters are used to create a JCR Query through the QueryManager. The result returned is then based on the NodeIterator provided by the query result.

      Specified by:
      findResources in interface QueryLanguageProvider<org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderState>
      Parameters:
      ctx - The resolve context
      query - The query string to use to find the resources.
      language - The language in which the query is formulated.
      Returns:
      An Iterator of Resource objects matching the query. If no resources match, null might be returned instead of an empty iterator.
    • queryResources

      public Iterator<ValueMap> queryResources(@NotNull @NotNull ResolveContext<org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderState> ctx, String query, String language)
      Description copied from interface: QueryLanguageProvider
      Queries the storage using the given query formulated in the given language.

      The semantic meaning of the query and language depend on the actual implementation and storage used for the resources. For JCR repository being used as storage, the query and language parameters are used to create a JCR Query through the QueryManager. The result returned is then based on the RowIterator provided by the query result. The map returned for each row is indexed by the column name and the column value is the JCR Value object converted into the respective Java object, such as Boolean for a value of property type Boolean.

      Specified by:
      queryResources in interface QueryLanguageProvider<org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderState>
      Parameters:
      ctx - The resolve context
      query - The query string to use to find the resources.
      language - The language in which the query is formulated.
      Returns:
      An Iterator of Map instances providing access to the query result. If no resources match, null might be returned instead of an empty iterator.