本文整理汇总了Java中org.apache.olingo.odata2.api.exception.ODataApplicationException类的典型用法代码示例。如果您正苦于以下问题:Java ODataApplicationException类的具体用法?Java ODataApplicationException怎么用?Java ODataApplicationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ODataApplicationException类属于org.apache.olingo.odata2.api.exception包,在下文中一共展示了ODataApplicationException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: retrieveEntryResult
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public WriteEntryCallbackResult retrieveEntryResult(WriteEntryCallbackContext context)
throws ODataApplicationException
{
EntityProviderWriteProperties inlineProperties = EntityProviderWriteProperties
.serviceRoot(this.serviceRoot)
.expandSelectTree(context.getCurrentExpandSelectTreeNode())
.build();
WriteEntryCallbackResult result = new WriteEntryCallbackResult();
result.setInlineProperties(inlineProperties);
List<Map<String, Object>> data = getData(context);
if (data.size() > 1)
{
throw new IllegalStateException("cannot expand a feed as an entity");
}
if (data.size() == 1)
{
result.setEntryData(data.get(0));
}
return result;
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:25,代码来源:Expander.java
示例2: retrieveFeedResult
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public WriteFeedCallbackResult retrieveFeedResult(WriteFeedCallbackContext context)
throws ODataApplicationException
{
EntityProviderWriteProperties inlineProperties = EntityProviderWriteProperties
.serviceRoot(this.serviceRoot)
.expandSelectTree(context.getCurrentExpandSelectTreeNode())
.selfLink(context.getSelfLink())
.build();
WriteFeedCallbackResult result = new WriteFeedCallbackResult();
result.setInlineProperties(inlineProperties);
result.setFeedData(getData(context));
return result;
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:18,代码来源:Expander.java
示例3: getProducts
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
public List<Product> getProducts(User user, String uuid,
FilterExpression filter_expr, OrderByExpression order_expr, int skip,
int top) throws ExceptionVisitExpression, ODataApplicationException
{
ProductSQLVisitor expV = new ProductSQLVisitor();
Object visit_result = null;
if (filter_expr != null)
{
visit_result = filter_expr.accept(expV);
}
if (order_expr != null)
{
visit_result = order_expr.accept(expV);
}
return productService.getProducts((DetachedCriteria) visit_result, uuid,
skip, top);
}
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:20,代码来源:OlingoManager.java
示例4: getUsers
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
public List<User> getUsers(
FilterExpression filter_expr, OrderByExpression order_expr, int skip,
int top) throws ExceptionVisitExpression, ODataApplicationException
{
UserSQLVisitor expV = new UserSQLVisitor();
Object visit = null;
if (filter_expr != null)
{
visit = filter_expr.accept(expV);
}
if (order_expr != null)
{
visit = order_expr.accept(expV);
}
return userService.getUsers((DetachedCriteria) visit, skip, top);
}
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:17,代码来源:OlingoManager.java
示例5: readData
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public Object readData(final EdmEntitySet entitySet, final Map<String, Object> keys)
throws ODataNotFoundException, EdmException, ODataApplicationException {
DataStore<Object> store = getDataStore(entitySet);
if (store != null) {
Object keyInstance = store.createInstance();
ANNOTATION_HELPER.setKeyFields(keyInstance, keys);
Object result = store.read(keyInstance);
if (result != null) {
return result;
}
}
throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
}
开发者ID:mibo,项目名称:janos,代码行数:18,代码来源:AnnotationDataSource.java
示例6: readRelatedData
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public Object readRelatedData(final EdmEntitySet sourceEntitySet, final Object sourceData,
final EdmEntitySet targetEntitySet,
final Map<String, Object> targetKeys)
throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {
DataStore<?> sourceStore = dataStoreManager.getDataStore(sourceEntitySet.getName());
DataStore<?> targetStore = dataStoreManager.getDataStore(targetEntitySet.getName());
AnnotationHelper.AnnotatedNavInfo navInfo = ANNOTATION_HELPER.getCommonNavigationInfo(
sourceStore.getDataTypeClass(), targetStore.getDataTypeClass());
final Field sourceField;
if(navInfo.isBiDirectional()) {
sourceField = navInfo.getToField();
} else {
sourceField = navInfo.getFromField();
}
if (sourceField == null) {
throw new AnnotationRuntimeException("Missing source field for related data (sourceStore='" + sourceStore
+ "', targetStore='" + targetStore + "').");
}
List<Object> resultData = readResultData(targetStore, sourceData, sourceField, navInfo);
return extractResultData(targetStore, targetKeys, navInfo, resultData);
}
开发者ID:mibo,项目名称:janos,代码行数:26,代码来源:AnnotationDataSource.java
示例7: readBinaryData
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public BinaryData readBinaryData(final EdmEntitySet entitySet, final Object mediaLinkEntryData)
throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {
Object data = ANNOTATION_HELPER.getValueForField(mediaLinkEntryData, EdmMediaResourceContent.class);
Object mimeType = ANNOTATION_HELPER.getValueForField(mediaLinkEntryData, EdmMediaResourceMimeType.class);
if (data == null && mimeType == null) {
DataStore<Object> dataStore = getDataStore(entitySet);
Object readEntry = dataStore.read(mediaLinkEntryData);
if (readEntry != null) {
data = ANNOTATION_HELPER.getValueForField(readEntry, EdmMediaResourceContent.class);
mimeType = ANNOTATION_HELPER.getValueForField(readEntry, EdmMediaResourceMimeType.class);
}
}
return new BinaryData((byte[]) data, String.valueOf(mimeType));
}
开发者ID:mibo,项目名称:janos,代码行数:19,代码来源:AnnotationDataSource.java
示例8: writeBinaryData
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public void writeBinaryData(final EdmEntitySet entitySet, final Object mediaEntityInstance,
final BinaryData binaryData)
throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {
try {
DataStore<Object> dataStore = getDataStore(entitySet);
Object readEntry = dataStore.read(mediaEntityInstance);
if (readEntry == null) {
throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
} else {
ANNOTATION_HELPER.setValueForAnnotatedField(
mediaEntityInstance, EdmMediaResourceContent.class, binaryData.getData());
ANNOTATION_HELPER.setValueForAnnotatedField(
mediaEntityInstance, EdmMediaResourceMimeType.class, binaryData.getMimeType());
}
} catch (AnnotationHelper.ODataAnnotationException e) {
throw new AnnotationRuntimeException("Invalid media resource annotation at entity set '" + entitySet.getName()
+ "' with message '" + e.getMessage() + "'.", e);
}
}
开发者ID:mibo,项目名称:janos,代码行数:22,代码来源:AnnotationDataSource.java
示例9: readRelatedData
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public Object readRelatedData(final EdmEntitySet sourceEntitySet, final Object sourceData,
final EdmEntitySet targetEntitySet,
final Map<String, Object> targetKeys)
throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {
DataStore<?> sourceStore = dataStores.get(sourceEntitySet.getName());
DataStore<?> targetStore = dataStores.get(targetEntitySet.getName());
AnnotatedNavInfo navInfo = ANNOTATION_HELPER.getCommonNavigationInfo(
sourceStore.getDataTypeClass(), targetStore.getDataTypeClass());
final Field sourceField;
if(navInfo.isBiDirectional()) {
sourceField = navInfo.getToField();
} else {
sourceField = navInfo.getFromField();
}
if (sourceField == null) {
throw new AnnotationRuntimeException("Missing source field for related data (sourceStore='" + sourceStore
+ "', targetStore='" + targetStore + "').");
}
List<Object> resultData = readResultData(targetStore, sourceData, sourceField);
return extractResultData(targetStore, targetKeys, navInfo, resultData);
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:26,代码来源:AnnotationInMemoryDs.java
示例10: writeBinaryData
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public void writeBinaryData(final EdmEntitySet entitySet, final Object mediaEntityInstance,
final BinaryData binaryData)
throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {
try {
DataStore<Object> dataStore = getDataStore(entitySet);
Object readEntry = dataStore.read(mediaEntityInstance);
if (readEntry == null) {
throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
} else {
ANNOTATION_HELPER.setValueForAnnotatedField(
mediaEntityInstance, EdmMediaResourceContent.class, binaryData.getData());
ANNOTATION_HELPER.setValueForAnnotatedField(
mediaEntityInstance, EdmMediaResourceMimeType.class, binaryData.getMimeType());
}
} catch (ODataAnnotationException e) {
throw new AnnotationRuntimeException("Invalid media resource annotation at entity set '" + entitySet.getName()
+ "' with message '" + e.getMessage() + "'.", e);
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:AnnotationInMemoryDs.java
示例11: createInlineProperties
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
/**
* Create {@link EntityProviderReadProperties} which can be used for reading of inline properties/entrys of navigation
* links within
* this current read entry.
*
* @param readProperties
* @param navigationProperty
* @return
* @throws EntityProviderException
*/
private EntityProviderReadProperties createInlineProperties(final EntityProviderReadProperties readProperties,
final EdmNavigationProperty navigationProperty) throws EntityProviderException {
final OnReadInlineContent callback = readProperties.getCallback();
EntityProviderReadProperties currentReadProperties = EntityProviderReadProperties.initFrom(readProperties).build();
if (callback == null) {
return currentReadProperties;
} else {
try {
return callback.receiveReadProperties(currentReadProperties, navigationProperty);
} catch (ODataApplicationException e) {
throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
.getSimpleName()), e);
}
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:XmlEntryConsumer.java
示例12: readBinaryData
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
public BinaryData readBinaryData(final EdmEntitySet entitySet, final Object mediaLinkEntryData)
throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {
if (mediaLinkEntryData == null) {
throw new ODataNotFoundException(null);
}
if (ENTITYSET_1_1.equals(entitySet.getName()) || ENTITYSET_1_4.equals(entitySet.getName())) {
final Employee employee = (Employee) mediaLinkEntryData;
if (employee.getImage() == null) {
throw new ODataNotFoundException(null);
}
return new BinaryData(employee.getImage(), employee.getImageType());
} else if (ENTITYSET_2_1.equals(entitySet.getName())) {
final Photo photo = (Photo) mediaLinkEntryData;
return new BinaryData(photo.getImage(), photo.getImageType());
} else {
throw new ODataNotImplementedException();
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:ScenarioDataSource.java
示例13: writeBinaryData
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
public void
writeBinaryData(final EdmEntitySet entitySet, final Object mediaLinkEntryData, final BinaryData binaryData)
throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {
if (mediaLinkEntryData == null) {
throw new ODataNotFoundException(null);
}
if (ENTITYSET_1_1.equals(entitySet.getName()) || ENTITYSET_1_4.equals(entitySet.getName())) {
final Employee employee = (Employee) mediaLinkEntryData;
employee.setImage(binaryData.getData());
employee.setImageType(binaryData.getMimeType());
//Storing the binary data to be used for comparison in the tests
Util.getInstance().setBinaryContent(employee.getImage());
} else if (ENTITYSET_2_1.equals(entitySet.getName())) {
final Photo photo = (Photo) mediaLinkEntryData;
photo.setImage(binaryData.getData());
photo.setImageType(binaryData.getMimeType());
} else {
throw new ODataNotImplementedException();
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:ScenarioDataSource.java
示例14: createData
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
public void createData(final EdmEntitySet entitySet, final Object data) throws ODataNotImplementedException,
EdmException, ODataApplicationException {
if (ENTITYSET_1_1.equals(entitySet.getName())) {
dataContainer.getEmployees().add((Employee) data);
} else if (ENTITYSET_1_2.equals(entitySet.getName())) {
dataContainer.getTeams().add((Team) data);
} else if (ENTITYSET_1_3.equals(entitySet.getName())) {
dataContainer.getRooms().add((Room) data);
} else if (ENTITYSET_1_4.equals(entitySet.getName())) {
dataContainer.getManagers().add((Manager) data);
} else if (ENTITYSET_1_5.equals(entitySet.getName())) {
dataContainer.getBuildings().add((Building) data);
} else if (ENTITYSET_2_1.equals(entitySet.getName())) {
dataContainer.getPhotos().add((Photo) data);
} else {
throw new ODataNotImplementedException();
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:ScenarioDataSource.java
示例15: readEntity
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public ODataResponse readEntity(GetEntityUriInfo uriInfo, String contentType) throws ODataException {
HashMap<String, Object> data = new HashMap<String, Object>();
if ("Employees".equals(uriInfo.getTargetEntitySet().getName())) {
if ("2".equals(uriInfo.getKeyPredicates().get(0).getLiteral())) {
data.put("EmployeeId", "1");
data.put("TeamId", "420");
}
ODataContext context = getContext();
EntityProviderWriteProperties writeProperties =
EntityProviderWriteProperties.serviceRoot(context.getPathInfo().getServiceRoot()).build();
return EntityProvider.writeEntry(contentType, uriInfo.getTargetEntitySet(), data, writeProperties);
} else {
throw new ODataApplicationException("Wrong testcall", Locale.getDefault(), HttpStatusCodes.NOT_IMPLEMENTED);
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:InvalidDataInScenarioTest.java
示例16: handleError
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
@Override
public ODataResponse handleError(final ODataErrorContext context) throws ODataApplicationException {
Throwable rootCause = context.getException();
LOGGER.error("Error in the OData. Reason: " + rootCause.getMessage(), rootCause); //$NON-NLS-1$
Throwable innerCause = rootCause.getCause();
if (rootCause instanceof ODataJPAException && innerCause != null && innerCause instanceof AppODataException) {
context.setMessage(innerCause.getMessage());
Throwable childInnerCause = innerCause.getCause();
context.setInnerError(childInnerCause != null ? childInnerCause.getMessage() : ""); //$NON-NLS-1$
} else {
context.setMessage(HttpStatusCodes.INTERNAL_SERVER_ERROR.getInfo());
context.setInnerError(rootCause.getMessage());
}
context.setHttpStatus(HttpStatusCodes.INTERNAL_SERVER_ERROR);
return EntityProvider.writeErrorDocument(context);
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:19,代码来源:SimpleODataErrorCallback.java
示例17: handleError
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
/**
* Handle an error with adding the error message in the stream thanks to
* {@link EntityProvider#writeErrorDocument(ODataErrorContext)} method, but
* when the response stream is not identified as binary stream (uri contains
* $value), no ascii message is inserted into the stream.
*/
@Override
public ODataResponse handleError(ODataErrorContext ctx) throws ODataApplicationException
{
// Compute the error message
String message = ctx.getMessage();
if (ctx.getException() != null)
{
message = ctx.getException().getClass().getSimpleName();
if (ctx.getException().getMessage() != null)
{
message += " : " + ctx.getException().getMessage();
}
else if (ctx.getMessage() != null)
{
message += " : " + ctx.getMessage();
}
}
// Suppress in-stream error messages
// ExpectedException are never thrown while streaming the payload
if (ctx.getRequestUri().toString().endsWith("$value")
&& !(ctx.getException() instanceof ExpectedException))
{
return ODataResponse
.header("cause-message", message)
.status(HttpStatusCodes.INTERNAL_SERVER_ERROR)
.build();
}
return ODataResponse
.fromResponse(EntityProvider.writeErrorDocument(ctx))
.header("cause-message", message)
.build();
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:40,代码来源:ServiceLogger.java
示例18: SQLVisitor
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
protected SQLVisitor(Class entity, FilterExpression filter, OrderByExpression order)
throws ExceptionVisitExpression, ODataApplicationException
{
this.hqlPrefix = new StringBuilder(HQL_PREFIX).append(entity.getName()).append(" ").toString();
this.filterExpression = filter;
this.orderExpression = order;
this.hqlParameters = new LinkedList<>();
compute();
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:10,代码来源:SQLVisitor.java
示例19: compute
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
/**
* Calls accept method on the visitable expressions `filter` and `order by`.
*
* @throws ExceptionVisitExpression Exception occurred the OData library while traversing the tree
* @throws ODataApplicationException Exception thrown by the application who implemented the visitor
* @see Visitable#accept(ExpressionVisitor)
*/
private void compute() throws ExceptionVisitExpression, ODataApplicationException
{
if (filterExpression != null)
{
filterExpression.accept(this);
}
if (orderExpression != null)
{
orderExpression.accept(this);
}
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:19,代码来源:SQLVisitor.java
示例20: getDeletedProducts
import org.apache.olingo.odata2.api.exception.ODataApplicationException; //导入依赖的package包/类
public List<DeletedProduct> getDeletedProducts(FilterExpression filter_expr,
OrderByExpression order_expr, int skip, int top)
throws ExceptionVisitExpression, ODataApplicationException
{
DeletedProductSQLVisitor expV = new DeletedProductSQLVisitor(filter_expr, order_expr);
return deletedProductService.getProducts(expV, skip, top);
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:8,代码来源:OlingoManager.java
注:本文中的org.apache.olingo.odata2.api.exception.ODataApplicationException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论