Interface ODataJPAContext
-
public interface ODataJPAContextThis class does the compilation of context objects required for OData JPA Runtime. The context object should be properly initialized with values else the behavior of processor and EDM provider can result in exception. Following are the mandatory parameter to be set into the context object- Persistence Unit Name
- An instance of Java Persistence Entity Manager Factory
@org.apache.olingo.odata2.DoNotImplement- See Also:
ODataJPAFactory,ODataJPAAccessFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<Object,Map<String,Object>>getCreatedEntities()booleangetDefaultNaming()The method returns whether the library should consider default naming for EdmProperty EdmComplexProperty EdmNavigationPropertyEdmProvidergetEdmProvider()The method gets the EDM provider for JPA from the context.javax.persistence.EntityManagergetEntityManager()The method returns an instance of type entity manager.javax.persistence.EntityManagerFactorygetEntityManagerFactory()The method gets the Java Persistence Entity Manager factory from the context.JPAEdmExtensiongetJPAEdmExtension()The method returns the JPA Edm Extension instance set into the context.StringgetJPAEdmMappingModel()The method gets the JPA EDM mapping model name from the context.ODataContextgetODataContext()The method gets OData Context into the context.ODataJPAQueryExtensionEntityListenergetODataJPAQueryExtensionEntityListener()ODataJPATransactiongetODataJPATransaction()The method returns the ODataJPATransaction.ODataProcessorgetODataProcessor()The method gets the OData Processor for JPA from the context.intgetPageSize()The method gets the server side page size to the contextJPAPaginggetPaging()The method returns the server side paging objectStringgetPersistenceUnitName()The method gets the Java Persistence Unit Name set into the context.booleanisContainerManaged()The method returnstrueif the underlying entity manager is container managed.voidsetContainerManaged(boolean containerManaged)Set the state whether the underlying entity manager is container managed (or not).voidsetDefaultNaming(boolean defaultNaming)The method sets into the context whether the library should consider default naming for EdmProperty EdmComplexProperty EdmNavigationPropertyvoidsetEdmProvider(EdmProvider edmProvider)The method sets EDM provider into the contextvoidsetEntityManager(javax.persistence.EntityManager em)The method sets the Entity Manager into the ContextvoidsetEntityManagerFactory(javax.persistence.EntityManagerFactory emf)The method sets the Java Persistence Entity Manager factory into the context.voidsetJPAEdmExtension(JPAEdmExtension jpaEdmExtension)The method sets the JPA Edm Extension instance into the context.voidsetJPAEdmMappingModel(String name)The method sets the JPA EDM mapping model name into the context.voidsetODataContext(ODataContext ctx)The method sets OData context into the context.voidsetoDataJPAQueryExtensionEntityListener(ODataJPAQueryExtensionEntityListener oDataJPAQueryExtensionEntityListener)voidsetODataProcessor(ODataProcessor processor)The method sets the OData Processor for JPA into the context.voidsetPageSize(int size)The method sets the server side page size to the contextvoidsetPaging(JPAPaging paging)The method sets the server side paging objectvoidsetPersistenceUnitName(String pUnitName)The method sets the Java Persistence Unit Name into the context.
-
-
-
Method Detail
-
getPersistenceUnitName
String getPersistenceUnitName()
The method gets the Java Persistence Unit Name set into the context.- Returns:
- Java Persistence Unit Name
-
setPersistenceUnitName
void setPersistenceUnitName(String pUnitName)
The method sets the Java Persistence Unit Name into the context.- Parameters:
pUnitName- is the Java Persistence Unit Name.
-
getODataProcessor
ODataProcessor getODataProcessor()
The method gets the OData Processor for JPA from the context.- Returns:
- OData JPA Processor
-
setODataProcessor
void setODataProcessor(ODataProcessor processor)
The method sets the OData Processor for JPA into the context.- Parameters:
processor- is the specific implementation ofODataJPAProcessorfor processing OData service requests.
-
getEdmProvider
EdmProvider getEdmProvider()
The method gets the EDM provider for JPA from the context.- Returns:
- EDM provider
-
setEdmProvider
void setEdmProvider(EdmProvider edmProvider)
The method sets EDM provider into the context- Parameters:
edmProvider- is the specific implementation ofEdmProviderfor transforming Java persistence models to Entity Data Model
-
getEntityManagerFactory
javax.persistence.EntityManagerFactory getEntityManagerFactory()
The method gets the Java Persistence Entity Manager factory from the context.
CAUTION:- Don't use the Entity Manager Factory to instantiate Entity Managers. Instead get reference to Entity Manager usinggetEntityManager()- Returns:
- an instance of Java Persistence Entity Manager Factory
-
setEntityManagerFactory
void setEntityManagerFactory(javax.persistence.EntityManagerFactory emf)
The method sets the Java Persistence Entity Manager factory into the context.- Parameters:
emf- is of typeEntityManagerFactory
-
getODataContext
ODataContext getODataContext()
The method gets OData Context into the context.- Returns:
- OData Context
-
setODataContext
void setODataContext(ODataContext ctx)
The method sets OData context into the context.- Parameters:
ctx- is an OData context of typeODataContext
-
setJPAEdmMappingModel
void setJPAEdmMappingModel(String name)
The method sets the JPA EDM mapping model name into the context. JPA EDM mapping model is an XML document based on JPAEDMMappingModel.xsd- Parameters:
name- is the name of JPA EDM mapping model
-
getJPAEdmMappingModel
String getJPAEdmMappingModel()
The method gets the JPA EDM mapping model name from the context.- Returns:
- name of JPA EDM mapping model
-
setEntityManager
void setEntityManager(javax.persistence.EntityManager em)
The method sets the Entity Manager into the Context- Parameters:
em- EntityManager
-
getEntityManager
javax.persistence.EntityManager getEntityManager()
The method returns an instance of type entity manager. The entity manager thus returns a single persistence context for the current OData request. Hence all entities that are accessed within JPA processor are managed by single entity manager.- Returns:
- an instance of type
EntityManager
-
setJPAEdmExtension
void setJPAEdmExtension(JPAEdmExtension jpaEdmExtension)
The method sets the JPA Edm Extension instance into the context. There can be at most only one extension for a context. Invoking the method several times overwrites already set extension instance in the context.- Parameters:
jpaEdmExtension- is an instance of typeJPAEdmExtension
-
getJPAEdmExtension
JPAEdmExtension getJPAEdmExtension()
The method returns the JPA Edm Extension instance set into the context.- Returns:
- an instance of type
JPAEmbeddableTypeMapType
-
setDefaultNaming
void setDefaultNaming(boolean defaultNaming)
The method sets into the context whether the library should consider default naming for- EdmProperty
- EdmComplexProperty
- EdmNavigationProperty
- Parameters:
defaultNaming- is a boolean value that indicates if set to- true - default naming is considered in case no mapping is provided.
- false - default naming is not considered in case no mapping is provided. The name provided in JPA Entity Model is considered.
-
getDefaultNaming
boolean getDefaultNaming()
The method returns whether the library should consider default naming for- EdmProperty
- EdmComplexProperty
- EdmNavigationProperty
- Returns:
- true - default naming is considered in case no mapping is provided.
- false - default naming is not considered in case no mapping is provided. The name provided in JPA Entity Model is considered.
-
getPageSize
int getPageSize()
The method gets the server side page size to the context- Returns:
- the page size
-
setPageSize
void setPageSize(int size)
The method sets the server side page size to the context- Parameters:
size- Tamanho
-
setPaging
void setPaging(JPAPaging paging)
The method sets the server side paging object- Parameters:
paging- an instance of typeJPAPaging
-
getPaging
JPAPaging getPaging()
The method returns the server side paging object- Returns:
- an instance of type
JPAPaging
-
getODataJPATransaction
ODataJPATransaction getODataJPATransaction()
The method returns the ODataJPATransaction.- Returns:
- ODataJPATransaction
-
setContainerManaged
void setContainerManaged(boolean containerManaged)
Set the state whether the underlying entity manager is container managed (or not). (Default isfalse)- Parameters:
containerManaged-truefor container managed entity manager
-
isContainerManaged
boolean isContainerManaged()
The method returnstrueif the underlying entity manager is container managed. (Default isfalse)- Returns:
trueif the underlying entity manger is container manged.
-
getODataJPAQueryExtensionEntityListener
ODataJPAQueryExtensionEntityListener getODataJPAQueryExtensionEntityListener()
-
setoDataJPAQueryExtensionEntityListener
void setoDataJPAQueryExtensionEntityListener(ODataJPAQueryExtensionEntityListener oDataJPAQueryExtensionEntityListener)
-
-