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

## Class ODataJPAQueryExtensionEntityListener

- java.lang.Object
- - org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneEntityListener
  - - org.apache.olingo.odata2.jpa.processor.api.ODataJPAQueryExtensionEntityListener

- Direct Known Subclasses:
    CustomerQueryExtension

      public abstract class ODataJPAQueryExtensionEntityListener
      extends ODataJPATombstoneEntityListener

  Extend this class to build JPA Query object for a given OData request. The extended class can be registered as JPA entity listeners.The implemented JPA Entity Listener classes will be called back from OData JPA Processor Library.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ODataJPAQueryExtensionEntityListener()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ODataJPARuntimeException` | `createApplicationError(String message, Locale locale)`
    `String` | `generateDeltaToken(List<Object> deltas, javax.persistence.Query query)` Implement this method to create a delta token.
    `javax.persistence.Query` | `getQuery(DeleteUriInfo uriInfo, javax.persistence.EntityManager em)` Override this method to build JPA Query for OData request - Delete; SELECT SINGLE with key in WHERE clause
    `javax.persistence.Query` | `getQuery(GetEntityCountUriInfo uriInfo, javax.persistence.EntityManager em)` Override this method to build JPA Query for OData request - GetEntity Count; SELECT SINGLE with key in WHERE clause
    `javax.persistence.Query` | `getQuery(GetEntitySetCountUriInfo uriInfo, javax.persistence.EntityManager em)` Override this method to build JPA Query for OData request - GetEntitySet Count; SELECT COUNT(*)
    `javax.persistence.Query` | `getQuery(GetEntitySetUriInfo uriInfo, javax.persistence.EntityManager em)` Override this method to build JPA Query for OData request - GetEntitySet; SELECT *
    `javax.persistence.Query` | `getQuery(GetEntityUriInfo uriInfo, javax.persistence.EntityManager em)` Override this method to build JPA Query for OData request - GetEntity; SELECT SINGLE with key in WHERE clause
    `javax.persistence.Query` | `getQuery(PutMergePatchUriInfo uriInfo, javax.persistence.EntityManager em)` Override this method to build JPA Query for OData request - Update; SELECT SINGLE with key in WHERE clause
    `boolean` | `isTombstoneSupported()` Implement this method to indicate whether the extended class can handle OData Tombstone feature as well

    - ### Methods inherited from class org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneEntityListener

      `addToDelta`

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

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

- - ### Constructor Detail

    - #### ODataJPAQueryExtensionEntityListener

          public ODataJPAQueryExtensionEntityListener()

  - ### Method Detail

    - #### getQuery

          public javax.persistence.Query getQuery(GetEntitySetUriInfo uriInfo,
                                                  javax.persistence.EntityManager em)
                                           throws ODataJPARuntimeException

      Override this method to build JPA Query for OData request - GetEntitySet; SELECT *
      Specified by:
        `getQuery` in class `ODataJPATombstoneEntityListener`
      Parameters:
        `uriInfo` - is a reference to OData request
        `em` - is a reference to `EntityManager`
      Returns:
        an instance of type `Query`
      Throws:
        `ODataJPARuntimeException`

    - #### getQuery

          public javax.persistence.Query getQuery(GetEntityUriInfo uriInfo,
                                                  javax.persistence.EntityManager em)
                                           throws ODataJPARuntimeException

      Override this method to build JPA Query for OData request - GetEntity; SELECT SINGLE with key in WHERE clause
      Parameters:
        `uriInfo` - is a reference to OData request
        `em` - is a reference to `EntityManager`
      Returns:
        an instance of type `Query`
      Throws:
        `ODataJPARuntimeException`

    - #### getQuery

          public javax.persistence.Query getQuery(GetEntityCountUriInfo uriInfo,
                                                  javax.persistence.EntityManager em)
                                           throws ODataJPARuntimeException

      Override this method to build JPA Query for OData request - GetEntity Count; SELECT SINGLE with key in WHERE clause
      Parameters:
        `uriInfo` - is a reference to OData request
        `em` - is a reference to `EntityManager`
      Returns:
        an instance of type `Query`
      Throws:
        `ODataJPARuntimeException`

    - #### getQuery

          public javax.persistence.Query getQuery(GetEntitySetCountUriInfo uriInfo,
                                                  javax.persistence.EntityManager em)
                                           throws ODataJPARuntimeException

      Override this method to build JPA Query for OData request - GetEntitySet Count; SELECT COUNT(*)
      Parameters:
        `uriInfo` - is a reference to OData request
        `em` - is a reference to `EntityManager`
      Returns:
        an instance of type `Query`
      Throws:
        `ODataJPARuntimeException`

    - #### getQuery

          public javax.persistence.Query getQuery(PutMergePatchUriInfo uriInfo,
                                                  javax.persistence.EntityManager em)
                                           throws ODataJPARuntimeException

      Override this method to build JPA Query for OData request - Update; SELECT SINGLE with key in WHERE clause
      Parameters:
        `uriInfo` - is a reference to OData request
        `em` - is a reference to `EntityManager`
      Returns:
        an instance of type `Query`
      Throws:
        `ODataJPARuntimeException`

    - #### getQuery

          public javax.persistence.Query getQuery(DeleteUriInfo uriInfo,
                                                  javax.persistence.EntityManager em)
                                           throws ODataJPARuntimeException

      Override this method to build JPA Query for OData request - Delete; SELECT SINGLE with key in WHERE clause
      Parameters:
        `uriInfo` - is a reference to OData request
        `em` - is a reference to `EntityManager`
      Returns:
        an instance of type `Query`
      Throws:
        `ODataJPARuntimeException`

    - #### generateDeltaToken

          public String generateDeltaToken(List<Object> deltas,
                                           javax.persistence.Query query)

      Description copied from class: `ODataJPATombstoneEntityListener`
      Implement this method to create a delta token.
      Specified by:
        `generateDeltaToken` in class `ODataJPATombstoneEntityListener`
      Parameters:
        `deltas` - is list of delta JPA Entities
        `query` - is an instance of type `Query` that was used for handling delta entites
      Returns:
        a delta token of type String

    - #### isTombstoneSupported

          public boolean isTombstoneSupported()

      Implement this method to indicate whether the extended class can handle OData Tombstone feature as well
      Overrides:
        `isTombstoneSupported` in class `ODataJPATombstoneEntityListener`
      Returns:
        false by default

    - #### createApplicationError

          protected ODataJPARuntimeException createApplicationError(String message,
                                                                    Locale locale)

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