private ODataResponse getReadEntitySimplePropertyResponse(GetSimplePropertyUriInfo uriInfo, IDataProviderResponse dataProviderResponse, String contentType) throws ODataException, EntityProviderException { Map<String, Object> sapStatMap = null; List<EdmProperty> propertyPath = uriInfo.getPropertyPath(); Object resultProperty = dataProviderResponse.getResultProperty(propertyPath); ODataResponseBuilder responseBuilder = ODataResponse.fromResponse(EntityProvider.writeProperty(contentType, propertyPath.get(propertyPath.size() - 1), resultProperty)); setCacheControlHeader(responseBuilder, dataProviderResponse); responseBuilder.status(HttpStatusCodes.OK); setSapStatistics(getContext(), sapStatMap, null); setHeaders(responseBuilder, dataProviderResponse, contentType); return responseBuilder.build(); }
responseContentType = TEXT_PLAIN_WITH_CS_UTF_8.toString(); } else { response = EntityProvider.writeProperty(getContentType(), simpleProperty, content); response = EntityProvider.writeProperty(responseContentType, complexProperty, content); break;
responseContentType = TEXT_PLAIN_WITH_CS_UTF_8.toString(); } else { response = EntityProvider.writeProperty(getContentType(), simpleProperty, content); response = EntityProvider.writeProperty(responseContentType, complexProperty, content); break;
private ODataResponse getEntityComplexPropertyResponse( GetComplexPropertyUriInfo uriInfo, String contentType, IDataProviderResponse dataProviderResponse) throws ODataException, EntityProviderException { Map<String, Object> sapStatMap = null; List<EdmProperty> propertyPath = uriInfo.getPropertyPath(); Object resultProperty = dataProviderResponse.getResultProperty(propertyPath); ODataResponseBuilder responseBuilder = ODataResponse.fromResponse(EntityProvider.writeProperty(contentType, propertyPath.get(propertyPath.size() - 1), resultProperty)); responseBuilder.status(HttpStatusCodes.OK); //ODataResponse response = responseBuilder.build(); setSapStatistics(getContext(), sapStatMap, null); setHeaders(responseBuilder, dataProviderResponse, contentType); setCacheControlHeader(responseBuilder, dataProviderResponse); return responseBuilder.build(); }
} else { odataResponse = EntityProvider.writeProperty(contentType, property, edmPropertyValueMap.get(property.getName()));
@Override public ODataResponse readEntityComplexProperty(final GetComplexPropertyUriInfo uriInfo, final String contentType) throws ODataException { Object data = retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments()); // if (!appliesFilter(data, uriInfo.getFilter())) if (data == null) { throw new ODataNotFoundException(ODataNotFoundException.ENTITY); } final List<EdmProperty> propertyPath = uriInfo.getPropertyPath(); final EdmProperty property = propertyPath.get(propertyPath.size() - 1); final Object value = property.isSimple() ? property.getMapping() == null || property.getMapping().getMimeType() == null ? getPropertyValue(data, propertyPath) : getSimpleTypeValueMap(data, propertyPath) : getStructuralTypeValueMap(getPropertyValue(data, propertyPath), (EdmStructuralType) property.getType()); ODataContext context = getContext(); final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "writeProperty"); final ODataResponse response = EntityProvider.writeProperty(contentType, property, value); context.stopRuntimeMeasurement(timingHandle); return ODataResponse.fromResponse(response).eTag(constructETag(uriInfo.getTargetEntitySet(), data)).build(); }
} else { odataResponse = EntityProvider.writeProperty(contentType, property, edmPropertyValueMap.get(property.getName()));
@Override public ODataResponse readEntityComplexProperty(final GetComplexPropertyUriInfo uriInfo, final String contentType) throws ODataException { Object data = retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments()); if (data == null) { throw new ODataNotFoundException(ODataNotFoundException.ENTITY); } final List<EdmProperty> propertyPath = uriInfo.getPropertyPath(); final EdmProperty property = propertyPath.get(propertyPath.size() - 1); final Object value = property.isSimple() ? property.getMapping() == null || property.getMapping().getMediaResourceMimeTypeKey() == null ? getPropertyValue(data, propertyPath) : getSimpleTypeValueMap(data, propertyPath) : getStructuralTypeValueMap(getPropertyValue(data, propertyPath), (EdmStructuralType) property.getType()); ODataContext context = getContext(); final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "writeProperty"); final ODataResponse response = EntityProvider.writeProperty(contentType, property, value); context.stopRuntimeMeasurement(timingHandle); return ODataResponse.fromResponse(response).eTag(constructETag(uriInfo.getTargetEntitySet(), data)).build(); }
@Override public ODataResponse readEntityComplexProperty(final GetComplexPropertyUriInfo uriInfo, final String contentType) throws ODataException { Object data = retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments()); if (data == null) { throw new ODataNotFoundException(ODataNotFoundException.ENTITY); } final List<EdmProperty> propertyPath = uriInfo.getPropertyPath(); final EdmProperty property = propertyPath.get(propertyPath.size() - 1); final Object value = property.isSimple() ? property.getMapping() == null || property.getMapping().getMediaResourceMimeTypeKey() == null ? getPropertyValue(data, propertyPath) : getSimpleTypeValueMap(data, propertyPath) : getStructuralTypeValueMap(getPropertyValue(data, propertyPath), (EdmStructuralType) property.getType()); ODataContext context = getContext(); final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "writeProperty"); final ODataResponse response = EntityProvider.writeProperty(contentType, property, value); context.stopRuntimeMeasurement(timingHandle); return ODataResponse.fromResponse(response).eTag(constructETag(uriInfo.getTargetEntitySet(), data)).build(); }