@Override public ODataResponse readEntitySimplePropertyValue(final GetSimplePropertyUriInfo 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.getMapping() == null || property.getMapping().getMediaResourceMimeTypeKey() == null ? getPropertyValue(data, propertyPath) : getSimpleTypeValueMap(data, propertyPath); return ODataResponse.fromResponse(EntityProvider.writePropertyValue(property, value)).eTag( constructETag(uriInfo.getTargetEntitySet(), data)).build(); }
@Override public IDataProviderResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, ODataContext context) throws ODataException { GetSimplePropertyUriInfo resolvedUriInfo = resolveCrossServiceNavigation((UriInfo) uriInfo, context); IDataProvider provider = getTargetDataProvider(resolvedUriInfo.getFunctionImport(), resolvedUriInfo.getStartEntitySet()); if (provider == null) { throw new DataProviderException(DataProviderException.NOT_IMPLEMENTED.addContent("readEntitySimpleProperty"), context.getAcceptableLanguages().get(0)); } else { return provider.readEntitySimpleProperty(resolvedUriInfo, context); } }
this.gwlog.debug("readEntitySimpleProperty(): " + TraceUtil.getEntitySetLog(uriInfo.getStartEntitySet()) + ", " + TraceUtil.getPropertyPathLog(uriInfo.getPropertyPath()) + ", content type = " + (contentType == null ? "<null>" : contentType)); Map<String, Object> sapStatMap = null; ODataContext context = getContext(); if (uriInfo.getFunctionImport() == null) { if (getContext().isInBatchMode()) { IReadEntitySimplePropertyParameter parameter = new ReadEntitySimplePropertyParameter(
@Override public ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType) throws ODataException { ODataResponse oDataResponse = null; try { EdmType type = uriInfo.getTargetType(); ((UriInfoImpl) uriInfo).setTargetType(uriInfo.getTargetEntitySet().getEntityType()); oDataJPAContext.setODataContext(getContext()); Object jpaEntity = jpaProcessor.process((GetEntityUriInfo) uriInfo); ((UriInfoImpl) uriInfo).setTargetType(type); oDataResponse = responseBuilder.build((GetEntityUriInfo) uriInfo, jpaEntity, contentType); } finally { close(); } return oDataResponse; }
private ODataResponse getReadEntitySimplePropertyValueResponse(GetSimplePropertyUriInfo uriInfo, 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.writePropertyValue( propertyPath.get(propertyPath.size() - 1), resultProperty)); responseBuilder.status(HttpStatusCodes.OK); setCacheControlHeader(responseBuilder, dataProviderResponse); ODataResponse response = responseBuilder.build(); setSapStatistics(getContext(), sapStatMap, response); return response; }
this.gwlog.debug("readEntitySimplePropertyValue(): " + TraceUtil.getEntitySetLog(uriInfo.getStartEntitySet()) + ", " + TraceUtil.getPropertyPathLog(uriInfo.getPropertyPath()) + ", content type = " + (contentType == null ? "<null>" : contentType)); Map<String, Object> sapStatMap = null; ODataContext context = getContext(); if (uriInfo.getFunctionImport() == null) { if (getContext().isInBatchMode()) { IReadEntitySimplePropertyParameter parameter =
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(); }
@Override public ODataResponse readEntitySimplePropertyValue(final GetSimplePropertyUriInfo 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.getMapping() == null || property.getMapping().getMediaResourceMimeTypeKey() == null ? getPropertyValue(data, propertyPath) : getSimpleTypeValueMap(data, propertyPath); return ODataResponse.fromResponse(EntityProvider.writePropertyValue(property, value)).eTag( constructETag(uriInfo.getTargetEntitySet(), data)).build(); }
@Override public ODataResponse readEntitySimplePropertyValue(final GetSimplePropertyUriInfo 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.getMapping() == null || property.getMapping().getMimeType() == null ? getPropertyValue(data, propertyPath) : getSimpleTypeValueMap(data, propertyPath); return ODataResponse.fromResponse(EntityProvider.writePropertyValue(property, value)).eTag( constructETag(uriInfo.getTargetEntitySet(), data)).build(); }