Class ODataJPAQueryExtensionEntityListener
- java.lang.Object
-
- org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneEntityListener
-
- org.apache.olingo.odata2.jpa.processor.api.ODataJPAQueryExtensionEntityListener
-
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 Description ODataJPAQueryExtensionEntityListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanauthorizeProperty(EdmEntityType entityType, EdmProperty property)booleanauthorizeProperty(EdmEntityType entityType, EdmProperty property, String method)booleancanOverrideDelete(UriInfo infoView)booleancanOverridePost(UriInfo infoView)booleancanOverridePut(UriInfo infoView)voidcheckAuthorization(DeleteUriInfo deleteView)voidcheckAuthorization(PostUriInfo postView)voidcheckAuthorization(PutMergePatchUriInfo putView)voidcheckEntityGetAuthorization(EdmEntityType entityType)voidcheckFilter(EdmEntityType entityType, FilterExpression filter)Objectconvert(Object obj, Class clazz)protected ODataJPARuntimeExceptioncreateApplicationError(String message, Locale locale)ObjectexecEvent(UriInfo infoView, EdmEntityType entityType, String type, Object data)StringgenerateDeltaToken(List<Object> deltas, javax.persistence.Query query)Implement this method to create a delta token.Map<String,Object>getCalcFieldValues(EdmEntityType entityType, Object data)List<ClientCallback>getClientCallbacks()Map<String,Object>getDefaultFieldValues(EdmEntityType entityType, Object data)javax.persistence.QuerygetQuery(DeleteUriInfo uriInfo, javax.persistence.EntityManager em)Override this method to build JPA Query for OData request - Delete; SELECT SINGLE with key in WHERE clausejavax.persistence.QuerygetQuery(GetEntityCountUriInfo uriInfo, javax.persistence.EntityManager em)Override this method to build JPA Query for OData request - GetEntity Count; SELECT SINGLE with key in WHERE clausejavax.persistence.QuerygetQuery(GetEntitySetCountUriInfo uriInfo, javax.persistence.EntityManager em)Override this method to build JPA Query for OData request - GetEntitySet Count; SELECT COUNT(*)javax.persistence.QuerygetQuery(GetEntitySetUriInfo uriInfo, javax.persistence.EntityManager em)Override this method to build JPA Query for OData request - GetEntitySet; SELECT *javax.persistence.QuerygetQuery(GetEntityUriInfo uriInfo, javax.persistence.EntityManager em)Override this method to build JPA Query for OData request - GetEntity; SELECT SINGLE with key in WHERE clausejavax.persistence.QuerygetQuery(PutMergePatchUriInfo uriInfo, javax.persistence.EntityManager em)Override this method to build JPA Query for OData request - Update; SELECT SINGLE with key in WHERE clausebooleanisTombstoneSupported()Implement this method to indicate whether the extended class can handle OData Tombstone feature as wellbooleanoverrideDelete(UriInfo infoView, Object entity)ObjectoverridePost(UriInfo infoView, Object entity)ObjectoverridePut(UriInfo infoView, Object entity)voidprepareQuery(javax.persistence.Query query)ObjectprocessNew(UriInfo infoView)-
Methods inherited from class org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneEntityListener
addToDelta
-
-
-
-
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:
getQueryin classODataJPATombstoneEntityListener- Parameters:
uriInfo- is a reference to OData requestem- is a reference toEntityManager- 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 requestem- is a reference toEntityManager- 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 requestem- is a reference toEntityManager- 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 requestem- is a reference toEntityManager- 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 requestem- is a reference toEntityManager- 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 requestem- is a reference toEntityManager- Returns:
- an instance of type
Query - Throws:
ODataJPARuntimeException
-
generateDeltaToken
public String generateDeltaToken(List<Object> deltas, javax.persistence.Query query)
Description copied from class:ODataJPATombstoneEntityListenerImplement this method to create a delta token.- Specified by:
generateDeltaTokenin classODataJPATombstoneEntityListener- Parameters:
deltas- is list of delta JPA Entitiesquery- is an instance of typeQuerythat 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:
isTombstoneSupportedin classODataJPATombstoneEntityListener- Returns:
- false by default
-
createApplicationError
protected ODataJPARuntimeException createApplicationError(String message, Locale locale)
-
authorizeProperty
public boolean authorizeProperty(EdmEntityType entityType, EdmProperty property, String method)
-
authorizeProperty
public boolean authorizeProperty(EdmEntityType entityType, EdmProperty property)
-
checkAuthorization
public void checkAuthorization(PostUriInfo postView) throws ODataJPARuntimeException
- Throws:
ODataJPARuntimeException
-
checkAuthorization
public void checkAuthorization(PutMergePatchUriInfo putView) throws ODataJPARuntimeException
- Throws:
ODataJPARuntimeException
-
checkAuthorization
public void checkAuthorization(DeleteUriInfo deleteView) throws ODataJPARuntimeException
- Throws:
ODataJPARuntimeException
-
checkEntityGetAuthorization
public void checkEntityGetAuthorization(EdmEntityType entityType) throws ODataJPARuntimeException
- Throws:
ODataJPARuntimeException
-
getDefaultFieldValues
public Map<String,Object> getDefaultFieldValues(EdmEntityType entityType, Object data) throws ODataJPARuntimeException
- Throws:
ODataJPARuntimeException
-
getCalcFieldValues
public Map<String,Object> getCalcFieldValues(EdmEntityType entityType, Object data) throws ODataJPARuntimeException
- Throws:
ODataJPARuntimeException
-
checkFilter
public void checkFilter(EdmEntityType entityType, FilterExpression filter) throws ODataJPARuntimeException
- Throws:
ODataJPARuntimeException
-
getClientCallbacks
public List<ClientCallback> getClientCallbacks()
-
execEvent
public Object execEvent(UriInfo infoView, EdmEntityType entityType, String type, Object data) throws ODataJPARuntimeException
- Throws:
ODataJPARuntimeException
-
canOverridePut
public boolean canOverridePut(UriInfo infoView)
-
canOverridePost
public boolean canOverridePost(UriInfo infoView)
-
canOverrideDelete
public boolean canOverrideDelete(UriInfo infoView)
-
prepareQuery
public void prepareQuery(javax.persistence.Query query)
-
-