com.holonplatform.datastore.jpa.jpql.context

## Interface JPQLStatementResolutionContext

- All Superinterfaces:
    com.holonplatform.core.ExpressionResolver.ExpressionResolverHandler, com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider, com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport, com.holonplatform.core.ExpressionResolver.ResolutionContext, JpaContext, JPQLResolutionContext

      public interface JPQLStatementResolutionContext
      extends JPQLResolutionContext

  A `JPQLResolutionContext` extension which supports statement alias generation and inspection.
  Since:
    5.1.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `JPQLStatementResolutionContext.AliasMode` Alias handling mode

    - ### Nested classes/interfaces inherited from interface com.holonplatform.datastore.jpa.jpql.context.JPQLResolutionContext

      `JPQLResolutionContext.JPQLStatementPreparationException`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JPQLStatementResolutionContext` | `asChild(JPQLResolutionContext parent, com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget, JPQLStatementResolutionContext.AliasMode aliasMode)` Create a new `JPQLStatementResolutionContext` as a child of given `JPQLResolutionContext`.
    `static JPQLStatementResolutionContext` | `create(JpaContext context, com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget, JPQLStatementResolutionContext.AliasMode aliasMode)` Create a new default `JPQLStatementResolutionContext`.
    `Optional<String>` | `getAlias(com.holonplatform.core.Path<?> path, boolean useParentContext)` Get the given `path` alias, if available and alias mode is not `JPQLStatementResolutionContext.AliasMode.UNSUPPORTED`.
    `default Optional<String>` | `getAliasOrRoot(com.holonplatform.core.Path<?> path)` Get the given `path` alias, falling back to query root alias if not available.
    `Optional<String>` | `getRootAlias()` Get the query root path (target) alias, if available and alias mode is not `JPQLStatementResolutionContext.AliasMode.UNSUPPORTED`.
    `com.holonplatform.core.datastore.relational.RelationalTarget<?>` | `getRootTarget()` Get the root target.

    - ### Methods inherited from interface com.holonplatform.datastore.jpa.jpql.context.JPQLResolutionContext

      `addNamedParameter, childContext, create, getContextSequence, getNamedParametersHandler, getParent, isJPQLResolutionContext, isStatementCompositionContext, resolve, resolveOrFail, setupQueryParameters`

    - ### Methods inherited from interface com.holonplatform.datastore.jpa.context.JpaContext

      `getDialect, getEntityManagerFactory, getORMPlatform, getValueDeserializer, getValueSerializer, trace, traceOperation`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverHandler

      `resolve`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider

      `getExpressionResolvers`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport

      `addExpressionResolver, addExpressionResolvers, removeExpressionResolver`

- - ### Method Detail

    - #### getRootTarget

          com.holonplatform.core.datastore.relational.RelationalTarget<?> getRootTarget()

      Get the root target.
      Returns:
        the root target

    - #### getRootAlias

          Optional<String> getRootAlias()

      Get the query root path (target) alias, if available and alias mode is not `JPQLStatementResolutionContext.AliasMode.UNSUPPORTED`.

      The alias will be the explicit alias name if the root path is `Aliasable`, or an auto generated name if alias mode is `JPQLStatementResolutionContext.AliasMode.AUTO`.

      Returns:
        the query root path alias, empty if not available

    - #### getAlias

          Optional<String> getAlias(com.holonplatform.core.Path<?> path,
                                    boolean useParentContext)

      Get the given `path` alias, if available and alias mode is not `JPQLStatementResolutionContext.AliasMode.UNSUPPORTED`.

      The alias will be the explicit alias name if the path is `Aliasable`, or an auto generated name if alias mode is `JPQLStatementResolutionContext.AliasMode.AUTO`.

      Parameters:
        `path` - Path for which to get the alias (not null)
        `useParentContext` - Whether to check in parent contexts if an alias is available when not available is current context
      Returns:
        the path alias, empty if not available

    - #### getAliasOrRoot

          default Optional<String> getAliasOrRoot(com.holonplatform.core.Path<?> path)

      Get the given `path` alias, falling back to query root alias if not available.
      Parameters:
        `path` - Path for which to get the alias (not null)
      Returns:
        the path alias, empty if not available

    - #### create

          static JPQLStatementResolutionContext create(JpaContext context,
                                                       com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget,
                                                       JPQLStatementResolutionContext.AliasMode aliasMode)

      Create a new default `JPQLStatementResolutionContext`.
      Parameters:
        `context` - JPA context to use (not null)
        `rootTarget` - Root target (not null)
        `aliasMode` - Alias handling mode (not null)
      Returns:
        A new `JPQLStatementResolutionContext`

    - #### asChild

          static JPQLStatementResolutionContext asChild(JPQLResolutionContext parent,
                                                        com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget,
                                                        JPQLStatementResolutionContext.AliasMode aliasMode)

      Create a new `JPQLStatementResolutionContext` as a child of given `JPQLResolutionContext`.
      Parameters:
        `parent` - Parent context (not null)
        `rootTarget` - Root target (not null)
        `aliasMode` - Alias handling mode (not null)
      Returns:
        A new `JPQLStatementResolutionContext`

Copyright © 2019 The Holon Platform. All rights reserved.