if (!appliesFilter(data, uriInfo.getFilter())) {
throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
}
final List<EdmProperty> propertyPath = uriInfo.getPropertyPath();
final EdmProperty property = propertyPath.get(propertyPath.size() - 1);
data = getPropertyValue(data, propertyPath.subList(0, propertyPath.size() - 1));
ODataContext context = getContext();
int timingHandle = context.startRuntimeMeasurement("EntityConsumer", "readProperty");
Map<String, Object> values;
try {
values =
EntityProvider.readProperty(requestContentType, property, content, EntityProviderReadProperties.init()
.mergeSemantic(merge).build());
} catch (final EntityProviderException e) {
throw new ODataBadRequestException(ODataBadRequestException.BODY, e);
}
context.stopRuntimeMeasurement(timingHandle);
final Object value = values.get(property.getName());
if (property.isSimple()) {
valueAccess.setPropertyValue(data, property, value);
} else {
@SuppressWarnings("unchecked")
final Map<String, Object> propertyValue = (Map<String, Object>) value;
setStructuralTypeValuesFromMap(valueAccess.getPropertyValue(data, property),
(EdmStructuralType) property.getType(), propertyValue, merge);
}
return ODataResponse.newBuilder().eTag(constructETag(uriInfo.getTargetEntitySet(), data)).build();
}