当前位置: 首页>>代码示例>>Java>>正文


Java ODataJPARuntimeException.throwException方法代码示例

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


在下文中一共展示了ODataJPARuntimeException.throwException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: parseURISegment

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入方法依赖的package包/类
public final UriInfo parseURISegment(final int segmentFromIndex, final int segmentToIndex)
    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, Collections.<String, String> emptyMap());
  } catch (ODataException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }
  return uriInfo;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:ODataEntityParser.java

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: build

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入方法依赖的package包/类
@Override
public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
  try {
    setType(JPQLContextType.JOIN_SINGLE);
    setJPAJoinClause(generateJoinClauses());

    if (!jpaJoinClauses.isEmpty()) {
      JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
      setJPAEntityName(joinClause.getEntityName());
      setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
    }

    setKeyPredicates(entityView.getKeyPredicates());

    setSelectExpression(generateSelectExpression());
    
    ODataExpressionParser.reInitializePositionalParameters();
    
  } catch (EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL, e);
  }

  return JPQLJoinSelectSingleContext.this;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:25,代码来源:JPQLJoinSelectSingleContext.java

示例9: getEntityProviderProperties

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

示例10: 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

示例11: parseBindingLink

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

示例12: getJPAClob

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入方法依赖的package包/类
@Override
public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException {
  try {
    return new JDBCClob(new String(characterData));
  } catch (SQLException e) {
    ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
  }
  return null;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:10,代码来源:OnDBWriteContent.java

示例13: build

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入方法依赖的package包/类
@Override
public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
  if (entitySetView != null) {

    try {

      if (isCountOnly) {
        setType(JPQLContextType.SELECT_COUNT);
      } else {
        setType(JPQLContextType.SELECT);
      }

      if (withPaging) {
        isPagingRequested(withPaging);
      }

      EdmEntityType entityType = entitySetView.getTargetEntitySet().getEntityType();
      EdmMapping mapping = entityType.getMapping();
      if (mapping != null) {
        setJPAEntityName(mapping.getInternalName());
      } else {
        setJPAEntityName(entityType.getName());
      }

      setJPAEntityAlias(generateJPAEntityAlias());

      setOrderByCollection(generateOrderByFileds());

      setSelectExpression(generateSelectExpression());

      setWhereExpression(generateWhereExpression());
    } catch (ODataException e) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
    }
  }

  return JPQLSelectContext.this;

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

示例14: getEdmProperties

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入方法依赖的package包/类
private List<EdmProperty> getEdmProperties(final EdmStructuralType structuralType) throws ODataJPARuntimeException {
  List<EdmProperty> edmProperties = new ArrayList<EdmProperty>();
  try {
    for (String propertyName : structuralType.getPropertyNames()) {
      edmProperties.add((EdmProperty) structuralType.getProperty(propertyName));
    }
  } catch (EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
  }
  return edmProperties;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:12,代码来源:JPAEntityParser.java

示例15: create

import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; //导入方法依赖的package包/类
/**
 * the method instantiates an instance of type JPQLContextBuilder.
 * 
 * @param contextType
 * indicates the type of JPQLContextBuilder to instantiate.
 * @param resultsView
 * is the OData request view
 * @return an instance of type
 * {@link org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder}
 * @throws ODataJPARuntimeException
 */
private static JPQLContextBuilder create(final JPQLContextType contextType, final Object resultsView,
    final boolean withPaging)
    throws ODataJPARuntimeException {
  JPQLContextBuilder contextBuilder =
      ODataJPAFactory.createFactory().getJPQLBuilderFactory().getContextBuilder(contextType);
  if (contextBuilder == null) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ERROR_JPQLCTXBLDR_CREATE, null);
  }
  contextBuilder.setResultsView(resultsView);
  contextBuilder.withPaging = withPaging;
  return contextBuilder;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:24,代码来源:JPQLContext.java


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