• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ODataJPARuntimeException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException的典型用法代码示例。如果您正苦于以下问题:Java ODataJPARuntimeException类的具体用法?Java ODataJPARuntimeException怎么用?Java ODataJPARuntimeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ODataJPARuntimeException类属于org.apache.olingo.odata2.jpa.processor.api.exception包,在下文中一共展示了ODataJPARuntimeException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseURISegmentWithCustomOptions

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
public final UriInfo parseURISegmentWithCustomOptions(final int segmentFromIndex, final int segmentToIndex,
    final Map<String, String> options) throws ODataJPARuntimeException {
  UriInfo uriInfo = null;
  if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) {
    return uriInfo;
  }
  try {
    edm = getEdm();
    List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments();
    List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex);
    uriInfo = UriParser.parse(edm, subPathSegments, options);
  } catch (ODataException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }
  return uriInfo;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:ODataEntityParser.java


示例2: parseLink

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
public final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType)
    throws ODataJPARuntimeException {

  String uriString = null;
  UriInfo uri = null;
  try {
    uriString = EntityProvider.readLink(contentType, entitySet, content);
    ODataContext odataContext = context.getODataContext();
    final String svcRoot = odataContext.getPathInfo().getServiceRoot().toString();
    final String path =
        uriString.startsWith(svcRoot.toString()) ? uriString.substring(svcRoot.length()) : uriString;
    final List<PathSegment> pathSegment = getPathSegment(path);
    edm = getEdm();
    uri = UriParser.parse(edm, pathSegment, Collections.<String, String> emptyMap());
  } catch (ODataException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }
  return uri;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:ODataEntityParser.java


示例3: parseLinkSegments

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
public UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options)
    throws ODataJPARuntimeException {
  List<PathSegment> pathSegments = new ArrayList<PathSegment>();
  for (String link : linkSegments) {
    List<PathSegment> pathSegment = getPathSegment(link);
    pathSegments.addAll(pathSegment);
  }
  UriInfo uriInfo = null;
  try {
    edm = getEdm();
    uriInfo = UriParser.parse(edm, pathSegments, options);
  } catch (ODataException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }
  return uriInfo;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:ODataEntityParser.java


示例4: getPropertyName

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
private static String getPropertyName(final CommonExpression whereExpression) throws EdmException,
    ODataJPARuntimeException {
  EdmTyped edmProperty = ((PropertyExpression) whereExpression).getEdmProperty();
  EdmMapping mapping;
  if (edmProperty instanceof EdmNavigationProperty) {
    EdmNavigationProperty edmNavigationProperty = (EdmNavigationProperty) edmProperty;
    mapping = edmNavigationProperty.getMapping();
  } else if(edmProperty instanceof EdmProperty) {
    EdmProperty property = (EdmProperty) edmProperty;
    mapping = property.getMapping();
  } else {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL, null);
  }

  return mapping != null ? mapping.getInternalName() : edmProperty.getName();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:ODataExpressionParser.java


示例5: createJPQLQuery

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
private String createJPQLQuery() throws ODataJPARuntimeException {

    StringBuilder jpqlQuery = new StringBuilder();
    String tableAlias = context.getJPAEntityAlias();
    String fromClause = context.getJPAEntityName() + JPQLStatement.DELIMITER.SPACE + tableAlias;

    jpqlQuery.append(JPQLStatement.KEYWORD.SELECT).append(JPQLStatement.DELIMITER.SPACE);
    jpqlQuery.append(context.getSelectExpression()).append(JPQLStatement.DELIMITER.SPACE);
    jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(JPQLStatement.DELIMITER.SPACE);
    jpqlQuery.append(fromClause);

    if (context.getKeyPredicates() != null && !context.getKeyPredicates().isEmpty()) {
      jpqlQuery.append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(JPQLStatement.KEYWORD.WHERE).append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(ODataExpressionParser
          .parseKeyPredicates(context.getKeyPredicates(), context.getJPAEntityAlias()));
    }

    return jpqlQuery.toString();

  }
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:JPQLSelectSingleStatementBuilder.java


示例6: firstBuild

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
private void firstBuild() throws ODataJPAModelException, ODataJPARuntimeException {
  firstBuild = false;
  if (principalRoleView == null && dependentRoleView == null) {

    principalRoleView =
        new JPAEdmReferentialConstraintRole(RoleType.PRINCIPAL, entityTypeView, propertyView, associationView);
    principalRoleView.getBuilder().build();

    dependentRoleView =
        new JPAEdmReferentialConstraintRole(RoleType.DEPENDENT, entityTypeView, propertyView, associationView);
    dependentRoleView.getBuilder().build();

    if (referentialConstraint == null) {
      referentialConstraint = new ReferentialConstraint();
    }
  }

}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:JPAEdmReferentialConstraint.java


示例7: buildSimpleProperty

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
private SimpleProperty buildSimpleProperty(final Attribute<?, ?> jpaAttribute, final SimpleProperty simpleProperty,
    final JoinColumn joinColumn)
    throws ODataJPAModelException, ODataJPARuntimeException {

  boolean isForeignKey = joinColumn != null;
  JPAEdmNameBuilder.build(JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming, isForeignKey);
  EdmSimpleTypeKind simpleTypeKind = JPATypeConverter
      .convertToEdmSimpleType(jpaAttribute
          .getJavaType(), jpaAttribute);
  simpleProperty.setType(simpleTypeKind);
  Facets facets = JPAEdmFacets.createAndSet(jpaAttribute, simpleProperty);
  if(isForeignKey) {
    facets.setNullable(joinColumn.nullable());
  }

  return simpleProperty;

}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:JPAEdmProperty.java


示例8: addForeignKey

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
private void addForeignKey(final Attribute<?, ?> jpaAttribute) throws ODataJPAModelException,
    ODataJPARuntimeException {

  AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
  joinColumnNames = null;
  if (annotatedElement == null) {
    return;
  }
  JoinColumn joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
  if (joinColumn == null) {
    JoinColumns joinColumns = annotatedElement.getAnnotation(JoinColumns.class);
    if (joinColumns != null) {
      for (JoinColumn jc : joinColumns.value()) {
        buildForeignKey(jc, jpaAttribute);
      }
    }
  } else {
    buildForeignKey(joinColumn, jpaAttribute);
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:JPAEdmProperty.java


示例9: process

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
@Override
public Object process(DeleteUriInfo uriParserResultView, final String contentType)
    throws ODataJPAModelException, ODataJPARuntimeException {
  if (uriParserResultView instanceof DeleteUriInfo) {
    if (((UriInfo) uriParserResultView).isLinks()) {
      return deleteLink(uriParserResultView);
    }
  }
  Object selectedObject = readEntity(new JPAQueryBuilder(oDataJPAContext).build(uriParserResultView));
  if (selectedObject != null) {
    try{
      boolean isLocalTransaction = setTransaction();
      em.remove(selectedObject);
      em.flush(); 
      if (isLocalTransaction) {
        oDataJPAContext.getODataJPATransaction().commit();
      }
    } catch(PersistenceException e){
      em.getTransaction().rollback();
      throw ODataJPARuntimeException.throwException(
          ODataJPARuntimeException.ERROR_JPQL_DELETE_REQUEST, e);
    }
  }
  return selectedObject;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:26,代码来源:JPAProcessorImpl.java


示例10: normalizeInlineEntries

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
private void normalizeInlineEntries(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
  List<ODataEntry> entries = null;
  try {
    for (String navigationPropertyName : oDataEntityType.getNavigationPropertyNames()) {
      Object inline = oDataEntryProperties.get(navigationPropertyName);
      if (inline instanceof ODataFeed) {
        entries = ((ODataFeed) inline).getEntries();
      } else if (inline instanceof ODataEntry) {
        entries = new ArrayList<ODataEntry>();
        entries.add((ODataEntry) inline);
      }
      if (entries != null) {
        oDataEntryProperties.put(navigationPropertyName, entries);
        entries = null;
      }
    }
  } catch (EdmException e) {
    throw ODataJPARuntimeException
        .throwException(ODataJPARuntimeException.GENERAL
            .addContent(e.getMessage()), e);
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:JPAEntity.java


示例11: build

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
public Query build(GetEntitySetCountUriInfo uriInfo) throws ODataJPARuntimeException {
  Query query = null;
  try {
    ODataJPAQueryExtensionEntityListener listener = getODataJPAQueryEntityListener((UriInfo) uriInfo);
    if (listener != null) {
      query = listener.getQuery(uriInfo, em);
    }
    if (query == null) {
      query = buildQuery((UriInfo) uriInfo, UriInfoType.GetEntitySetCount);
    }
  } catch (Exception e) {
    throw ODataJPARuntimeException.throwException(
        ODataJPARuntimeException.ERROR_JPQL_QUERY_CREATE, e);
  }
  return query;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:JPAQueryBuilder.java


示例12: testBuildSimpleQuery

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
/**
 * Test method for {@link org.apache.olingo.odata2.processor.jpa.jpql.JPQLSelectSingleStatementBuilder#build)}.
 * @throws EdmException
 * @throws ODataJPARuntimeException
 */

@Test
public void testBuildSimpleQuery() throws EdmException, ODataJPARuntimeException {
  EdmSimpleType edmType = EdmSimpleTypeKind.Int32.getEdmSimpleTypeInstance();
  JPQLSelectSingleContext JPQLSelectSingleContextImpl = createSelectContext(edmType);
  JPQLSelectSingleStatementBuilder = new JPQLSelectSingleStatementBuilder(JPQLSelectSingleContextImpl);

  String query = JPQLSelectSingleStatementBuilder.build().toString();
  query = query.substring(0, query.indexOf("?"));
  Map<String, Map<Integer, Object>> positionalParameters = 
      ODataParameterizedWhereExpressionUtil.getParameterizedQueryMap();
  for (Entry<String, Map<Integer, Object>> param : positionalParameters.entrySet()) {
    for (Entry<Integer, Object> postionalParam : param.getValue().entrySet()) {
      query += postionalParam.getValue();
    }
  }
  
  assertEquals("SELECT E1 FROM SalesOrderHeader E1 WHERE E1.Field1 = 1", query);

}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:26,代码来源:JPQLSelectSingleStatementBuilderTest.java


示例13: testBuild

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
@Test
public void testBuild() throws Exception {
  setUp(getJoinClauseList());
  JPQLJoinStatementBuilder jpqlJoinStatementBuilder = new JPQLJoinStatementBuilder(context);
  try {
    JPQLStatement jpqlStatement = jpqlJoinStatementBuilder.build();
    assertEquals(
        "SELECT mat FROM SOHeader soh JOIN soh.soItem soi JOIN soi.material mat WHERE soh.buyerId = 2 AND "
            +
            "soh.createdBy = 'Peter' AND soi.shId = soh.soId AND mat.id = 'abc' "
            +
            "ORDER BY mat.buyerId asc , mat.city desc",
            jpqlStatement.toString());
  } catch (ODataJPARuntimeException e) {
    fail("Should not have come here");
  }

}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:JPQLJoinStatementBuilderTest.java


示例14: initializeODataJPAContext

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的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);
     }
 }
 
开发者ID:AnujMehta07,项目名称:cloud-employeeslistapp,代码行数:14,代码来源:EmployeesListServiceFactory.java


示例15: initializeODataJPAContext

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的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;
}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:13,代码来源:JPAServiceFactory.java


示例16: getODataJPAContext

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的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;

}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:15,代码来源:JPAServiceFactory.java


示例17: validatePreConditions

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
private void validatePreConditions() throws ODataJPARuntimeException {

		if (oDataJPAContext.getEntityManagerFactory() == null) {
			throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ENTITY_MANAGER_NOT_INITIALIZED,
					null);
		}

	}
 
开发者ID:sapmentors,项目名称:lemonaid,代码行数:9,代码来源:JPAServiceFactory.java


示例18: initializeODataJPAContext

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的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;
}
 
开发者ID:jpenninkhof,项目名称:odata-boilerplate,代码行数:14,代码来源:JPAServiceFactory.java


示例19: initializeODataJPAContext

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的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);
   }

 }
 
开发者ID:SAP,项目名称:sap_mobile_platform_espm_olingo_services,代码行数:40,代码来源:ESPMServiceFactory.java


示例20: buildJPQLContext

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入依赖的package包/类
private JPQLContext buildJPQLContext(JPQLContextType contextType, UriInfo uriParserResultView)
		throws ODataJPAModelException, ODataJPARuntimeException {
	JPQLContext jpqlContext = null;
	if (pageSize > 0 && (contextType == JPQLContextType.SELECT || contextType == JPQLContextType.JOIN)) {
		jpqlContext = JPQLContext.createBuilder(contextType, uriParserResultView, true).build();
	} else {
		jpqlContext = JPQLContext.createBuilder(contextType, uriParserResultView).build();
	}
	return jpqlContext;
}
 
开发者ID:SAP,项目名称:cloud-olingo-identity-ochat,代码行数:11,代码来源:ConversationQueryListener.java



注:本文中的org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RoomUpdateListener类代码示例发布时间:2022-05-22
下一篇:
Java CommandSummon类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap