org.apache.olingo.odata2.jpa.processor.api.jpql

## Class JPQLContext

- java.lang.Object
- - org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext

- All Implemented Interfaces:
    JPQLContextView

      public abstract class JPQLContext
      extends Object
      implements JPQLContextView

  The abstract class is a compilation of objects required for building `JPQLStatement`. Extend this class to implement specific implementations of JPQL context types (Select, Join). A JPQL Context is constructed from an OData request. Depending on OData CRUD operation performed on an Entity, a corresponding JPQL context object is built. The JPQL context object thus built can be used for constructing JPQL statements.
  A default implementation is provided by the library.
  See Also:
    `JPQLStatement`, `JPQLContextType`, `JPQLBuilderFactory`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JPQLContext.JPQLContextBuilder` The abstract class is extended by specific JPQLContext builder for building JPQLContexts.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `jpaEntityAlias` An alias for Java Persistence Entity
    `protected String` | `jpaEntityName` Java Persistence Entity name
    `protected static ThreadLocal<JPQLContext>` | `jpqlContext`
    `protected boolean` | `pagingRequested`
    `protected JPQLContextType` | `type` The type of JPQL context.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JPQLContext()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JPQLContext.JPQLContextBuilder` | `createBuilder(JPQLContextType contextType, Object resultsView)` the method returns an instance of type `JPQLContext.JPQLContextBuilder` based on the JPQLContextType.
    `static JPQLContext.JPQLContextBuilder` | `createBuilder(JPQLContextType contextType, Object resultsView, boolean withPaging)` the method returns an instance of type `JPQLContext.JPQLContextBuilder` based on the JPQLContextType.
    `String` | `getJPAEntityAlias()` gets the JPA entity alias name set into the context
    `String` | `getJPAEntityName()` gets the JPA entity name set into the context
    `static JPQLContext` | `getJPQLContext()`
    `JPQLContextType` | `getType()` gets the JPQL context type set into the context
    `protected void` | `isPagingRequested(boolean pagingRequested)`
    `static void` | `removeJPQLContext()`
    `protected void` | `setJPAEntityAlias(String jpaEntityAlias)` sets JPA Entity alias name into the context
    `protected void` | `setJPAEntityName(String jpaEntityName)` sets JPA Entity Name into the context
    `protected static void` | `setJPQLContext(JPQLContext context)`
    `protected void` | `setType(JPQLContextType type)` sets the JPQL context type into the context

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextView

      `getJPQLStatement, setJPQLStatement`

- - ### Field Detail

    - #### jpaEntityAlias

          protected String jpaEntityAlias

      An alias for Java Persistence Entity

    - #### jpaEntityName

          protected String jpaEntityName

      Java Persistence Entity name

    - #### type

          protected JPQLContextType type

      The type of JPQL context. Based on the type JPQL statements can be built.

    - #### pagingRequested

          protected boolean pagingRequested

    - #### jpqlContext

          protected static final ThreadLocal<JPQLContext> jpqlContext

  - ### Constructor Detail

    - #### JPQLContext

          public JPQLContext()

  - ### Method Detail

    - #### setJPAEntityName

          protected final void setJPAEntityName(String jpaEntityName)

      sets JPA Entity Name into the context
      Parameters:
        `jpaEntityName` - is the name of JPA Entity

    - #### setJPAEntityAlias

          protected final void setJPAEntityAlias(String jpaEntityAlias)

      sets JPA Entity alias name into the context
      Parameters:
        `jpaEntityAlias` - is the JPA entity alias name

    - #### getJPAEntityAlias

          public final String getJPAEntityAlias()

      gets the JPA entity alias name set into the context
      Specified by:
        `getJPAEntityAlias` in interface `JPQLContextView`
      Returns:
        JPA entity alias name

    - #### setType

          protected final void setType(JPQLContextType type)

      sets the JPQL context type into the context
      Parameters:
        `type` - is JPQLContextType

    - #### getJPAEntityName

          public final String getJPAEntityName()

      gets the JPA entity name set into the context
      Specified by:
        `getJPAEntityName` in interface `JPQLContextView`
      Returns:
        JPA entity name

    - #### getType

          public final JPQLContextType getType()

      gets the JPQL context type set into the context
      Specified by:
        `getType` in interface `JPQLContextView`
      Returns:
        an instance of type `JPQLContextType`

    - #### isPagingRequested

          protected void isPagingRequested(boolean pagingRequested)

    - #### createBuilder

          public static final JPQLContext.JPQLContextBuilder createBuilder(JPQLContextType contextType,
                                                                           Object resultsView)
                                                                    throws ODataJPARuntimeException

      the method returns an instance of type `JPQLContext.JPQLContextBuilder` based on the JPQLContextType. The context builder can be used for building different JPQL contexts.
      Parameters:
        `contextType` - is the JPQLContextType
        `resultsView` - is the OData request view
      Returns:
        an instance of type `JPQLContext.JPQLContextBuilder`
      Throws:
        `ODataJPARuntimeException`

    - #### createBuilder

          public static final JPQLContext.JPQLContextBuilder createBuilder(JPQLContextType contextType,
                                                                           Object resultsView,
                                                                           boolean withPaging)
                                                                    throws ODataJPARuntimeException

      the method returns an instance of type `JPQLContext.JPQLContextBuilder` based on the JPQLContextType. The context builder can be used for building different JPQL contexts.
      Parameters:
        `contextType` - is the JPQLContextType
        `resultsView` - is the OData request view
        `withPaging` - indicates whether to build the context with paging
      Returns:
        an instance of type `JPQLContext.JPQLContextBuilder`
      Throws:
        `ODataJPARuntimeException`

    - #### setJPQLContext

          protected static void setJPQLContext(JPQLContext context)

    - #### getJPQLContext

          public static final JPQLContext getJPQLContext()

    - #### removeJPQLContext

          public static final void removeJPQLContext()

Copyright © 2013-2023 The Apache Software Foundation. All Rights Reserved.