本文整理汇总了Java中org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext类的典型用法代码示例。如果您正苦于以下问题:Java ODataJPAContext类的具体用法?Java ODataJPAContext怎么用?Java ODataJPAContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ODataJPAContext类属于org.apache.olingo.odata2.jpa.processor.api包,在下文中一共展示了ODataJPAContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEntityProviderProperties
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
private static EntityProviderWriteProperties getEntityProviderProperties(final ODataJPAContext odataJPAContext,
final GetEntityUriInfo resultsView) throws ODataJPARuntimeException {
ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;
ExpandSelectTreeNode expandSelectTree = null;
try {
entityFeedPropertiesBuilder =
EntityProviderWriteProperties.serviceRoot(odataJPAContext.getODataContext().getPathInfo().getServiceRoot());
expandSelectTree = UriParser.createExpandSelectTree(resultsView.getSelect(), resultsView.getExpand());
entityFeedPropertiesBuilder.expandSelectTree(expandSelectTree);
entityFeedPropertiesBuilder.callbacks(JPAExpandCallBack.getCallbacks(odataJPAContext.getODataContext()
.getPathInfo().getServiceRoot(), expandSelectTree, resultsView.getExpand()));
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
}
return entityFeedPropertiesBuilder.build();
}
示例2: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = this.getODataJPAContext();
try {
EntityManagerFactory emf = JpaEntityManagerFactory.getEntityManagerFactory();
oDataJPAContext.setEntityManagerFactory(emf);
oDataJPAContext.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
return oDataJPAContext;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例3: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = getODataJPAContext();
EntityManagerFactory factory = (EntityManagerFactory) SpringContextsUtil.getBean(ENTITY_MANAGER_FACTORY_ID);
oDataJPAContext.setEntityManagerFactory(factory);
oDataJPAContext.setPersistenceUnitName(DEFAULT_ENTITY_UNIT_NAME);
oDataJPAContext.setJPAEdmExtension(new JPAEdmExtension());
ODataContextUtil.setODataContext(oDataJPAContext.getODataContext());
return oDataJPAContext;
}
示例4: getODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
/**
* @return an instance of type {@link ODataJPAContext}
* @throws ODataJPARuntimeException
*/
public final ODataJPAContext getODataJPAContext() throws ODataJPARuntimeException {
if (oDataJPAContext == null) {
oDataJPAContext = ODataJPAFactory.createFactory().getODataJPAAccessFactory().createODataJPAContext();
}
if (oDataContext != null) {
oDataJPAContext.setODataContext(oDataContext);
}
return oDataJPAContext;
}
示例5: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
ODataJPAContext oDataJPAContext = getODataJPAContext();
EntityManagerFactory factory = (EntityManagerFactory) SpringContextsUtil.getBean(ENTITY_MANAGER_FACTORY_ID);
oDataJPAContext.setEntityManagerFactory(factory);
oDataJPAContext.setPersistenceUnitName(DEFAULT_ENTITY_UNIT_NAME);
oDataJPAContext.setJPAEdmExtension(new JPAEdmExtension());
ODataContextUtil.setODataContext(oDataJPAContext.getODataContext());
return oDataJPAContext;
}
示例6: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext()
throws ODataJPARuntimeException {
//LocalEdmExtensions ext = new LocalEdmExtensions();
ODataJPAContext oDatJPAContext = this.getODataJPAContext();
try {
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
// Load seed data
if (first_invocation) {
DataLoader m = new DataLoader( emf );
Utility.setEntityManagerFactory( emf );
m.loadData();
first_invocation = false;
}
oDatJPAContext.setEntityManagerFactory(emf);
oDatJPAContext.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
// This file must be located in the same folder as "WEB-INF" in the WAR archive
oDatJPAContext.setJPAEdmMappingModel("map-tuning.xml");
//oDatJPAContext.setJPAEdmExtension(ext);
setDetailErrors(true);
//setErrorLevel();
return oDatJPAContext;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
示例7: initializeODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
@Override
public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
ODataJPAContext context = getODataJPAContext();
context.setEntityManagerFactory(HerokuEntityManagerFactory.getInstance());
context.setPersistenceUnitName(HerokuEntityManagerFactory.PUNIT_NAME);
return context;
}
示例8: ODataEntityParser
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
public ODataEntityParser(final ODataJPAContext context) {
this.context = context;
try {
serviceRoot = context.getODataContext().getPathInfo().getServiceRoot().toString();
} catch (ODataException e) {
serviceRoot = "";
}
}
示例9: ODataJPAEdmProvider
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
public ODataJPAEdmProvider(final ODataJPAContext oDataJPAContext) {
if (oDataJPAContext == null) {
throw new IllegalArgumentException(ODataJPAException.ODATA_JPACTX_NULL);
}
entityTypes = new LinkedHashMap<String, EntityType>();
entityContainerInfos = new LinkedHashMap<String, EntityContainerInfo>();
complexTypes = new LinkedHashMap<String, ComplexType>();
associations = new LinkedHashMap<String, Association>();
functionImports = new LinkedHashMap<String, FunctionImport>();
jpaEdmModel = ODataJPAFactory.createFactory().getJPAAccessFactory().getJPAEdmModelView(oDataJPAContext);
}
示例10: getJPAEdmModelView
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
@Override
public JPAEdmModelView getJPAEdmModelView(final ODataJPAContext oDataJPAContext) {
JPAEdmModelView view = null;
view = new JPAEdmModel(oDataJPAContext);
return view;
}
示例11: getEntityProviderPropertiesforPost
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
private static EntityProviderWriteProperties getEntityProviderPropertiesforPost(
final ODataJPAContext odataJPAContext) throws ODataJPARuntimeException {
ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;
try {
entityFeedPropertiesBuilder =
EntityProviderWriteProperties.serviceRoot(odataJPAContext.getODataContext().getPathInfo().getServiceRoot());
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
}
return entityFeedPropertiesBuilder.build();
}
示例12: JPAEdmBaseViewImpl
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
public JPAEdmBaseViewImpl(final ODataJPAContext context) {
pUnitName = context.getPersistenceUnitName();
metaModel = context.getEntityManager().getMetamodel();
jpaEdmMappingModelAccess =
ODataJPAFactory.createFactory().getJPAAccessFactory().getJPAEdmMappingModelAccess(context);
jpaEdmExtension = context.getJPAEdmExtension();
jpaEdmMappingModelAccess.loadMappingModel();
skipDefaultNaming = !context.getDefaultNaming();
}
示例13: JPAEntity
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
public JPAEntity(final EdmEntityType oDataEntityType, final EdmEntitySet oDataEntitySet,
final ODataJPAContext context) {
this.oDataEntityType = oDataEntityType;
this.oDataEntitySet = oDataEntitySet;
oDataJPAContext = context;
try {
JPAEdmMapping mapping = (JPAEdmMapping) oDataEntityType.getMapping();
jpaType = mapping.getJPAType();
} catch (EdmException e) {
return;
}
jpaEntityParser = new JPAEntityParser();
onJPAWriteContent = oDataJPAContext.getODataContext().getServiceFactory().getCallback(OnJPAWriteContent.class);
}
示例14: JPAEdmMappingModelService
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
public JPAEdmMappingModelService(final ODataJPAContext ctx) {
JPAEdmExtension ext = null;
mappingModelName = ctx.getJPAEdmMappingModel();
if (mappingModelName == null) {
ext = ctx.getJPAEdmExtension();
if (ext != null) {
mappingModelStream = ext.getJPAEdmMappingModelStream();
}
}
mappingModelExists = mappingModelName != null || mappingModelStream != null;
}
示例15: getLocalmockODataJPAContext
import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; //导入依赖的package包/类
private ODataJPAContext getLocalmockODataJPAContext() {
ODataJPAContext odataJPAContext = EasyMock.createMock(ODataJPAContext.class);
EasyMock.expect(odataJPAContext.getPageSize()).andReturn(0).anyTimes();
EasyMock.expect(odataJPAContext.getPersistenceUnitName()).andStubReturn("salesorderprocessing");
EasyMock.expect(odataJPAContext.getEntityManagerFactory()).andStubReturn(mockEntityManagerFactory());
EasyMock.expect(odataJPAContext.getODataJPATransaction()).andStubReturn(getLocalJpaTransaction());
EasyMock.expect(odataJPAContext.getODataContext()).andStubReturn(getLocalODataContext());
odataJPAContext.setODataContext((ODataContext) EasyMock.anyObject());
EasyMock.expectLastCall().anyTimes();
EasyMock.expect(odataJPAContext.getEntityManager()).andStubReturn(getLocalEntityManager());
EasyMock.expect(odataJPAContext.isContainerManaged()).andReturn(false);
EasyMock.expectLastCall().anyTimes();
EasyMock.replay(odataJPAContext);
return odataJPAContext;
}