本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}