Java Code Examples for org.apache.olingo.odata2.api.edm.EdmMultiplicity#MANY
The following examples show how to use
org.apache.olingo.odata2.api.edm.EdmMultiplicity#MANY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlMetadataConsumer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void validateFunctionImport() throws EntityProviderException { for (FunctionImport functionImport : edmFunctionImportList) { ReturnType returnType = functionImport.getReturnType(); if (returnType != null) { String entitySet = functionImport.getEntitySet(); FullQualifiedName fqn = returnType.getTypeName(); if (returnType.getMultiplicity() == EdmMultiplicity.MANY && entitySet == null && entityTypesMap.get( fqn) != null) { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } else if (returnType.getMultiplicity() != EdmMultiplicity.MANY && entitySet != null && entityTypesMap.get( fqn) == null) { throw new EntityProviderException(EntityProviderException.INVALID_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } } } }
Example 2
Source File: AtomSerializerDeserializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public Object readFunctionImport(EdmFunctionImport functionImport, EntityStream content) throws EntityProviderException { try { if (functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY) { return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ? new XmlEntityDeserializer().readFeed(functionImport.getEntitySet(), content) : new XmlEntityDeserializer().readEntry(functionImport.getEntitySet(), content); } else { final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport); return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ? new XmlEntityDeserializer().readCollection(info, content) : new XmlEntityDeserializer().readProperty(info, content).get(info.getName()); } } catch (final EdmException e) { throw new EntityProviderException(e.getMessageReference(), e); } }
Example 3
Source File: XmlMetadataDeserializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void validateFunctionImport() throws EntityProviderException, EdmException { for (EdmFunctionImport functionImport : edmFunctionImportList) { EdmTyped returnType = functionImport.getReturnType(); if (returnType != null) { FullQualifiedName fqn = extractFQName(returnType.toString()); String entitySet = ((EdmFunctionImportImpl)functionImport).getEntitySetName(); if (returnType.getMultiplicity() == EdmMultiplicity.MANY && entitySet == null && entityTypesMap.get( fqn) != null) { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } else if (returnType.getMultiplicity() != EdmMultiplicity.MANY && entitySet != null && entityTypesMap.get( fqn) == null) { throw new EntityProviderException(EntityProviderException.INVALID_ATTRIBUTE.addContent("EntitySet = " + entitySet, XmlMetadataConstants.EDM_FUNCTION_IMPORT + " = " + functionImport.getName())); } } } }
Example 4
Source File: JsonEntityProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public Object readFunctionImport(final EdmFunctionImport functionImport, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { try { if (functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY) { return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ? new JsonEntityConsumer().readFeed(functionImport.getEntitySet(), content, properties) : new JsonEntityConsumer().readEntry(functionImport.getEntitySet(), content, properties); } else { final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport); return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ? new JsonEntityConsumer().readCollection(info, content, properties) : new JsonEntityConsumer().readProperty(info, content, properties).get(info.getName()); } } catch (final EdmException e) { throw new EntityProviderException(e.getMessageReference(), e); } }
Example 5
Source File: JsonEntityProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public ODataResponse writeFunctionImport(final EdmFunctionImport functionImport, final Object data, final EntityProviderWriteProperties properties) throws EntityProviderException { try { if(functionImport.getReturnType() !=null){ if (functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY) { @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) data; return writeEntry(functionImport.getEntitySet(), map, properties); } final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport); if (functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY) { return writeCollection(info, (List<?>) data); } else { return writeSingleTypedElement(info, data); } }else{ return ODataResponse.newBuilder().status(HttpStatusCodes.ACCEPTED).build(); } } catch (final EdmException e) { throw new EntityProviderProducerException(e.getMessageReference(), e); } }
Example 6
Source File: AnnotationInMemoryDs.java From olingo-odata2 with Apache License 2.0 | 6 votes |
/** * Extract the <code>result data</code> from the <code>resultData</code> list based on * <code>navigation information</code> and <code>targetKeys</code>. * * @param targetStore * @param targetKeys * @param navInfo * @param resultData * @return * @throws DataStoreException */ private Object extractResultData(final DataStore<?> targetStore, final Map<String, Object> targetKeys, final AnnotatedNavInfo navInfo, final List<Object> resultData) throws DataStoreException { if (navInfo.getToMultiplicity() == EdmMultiplicity.MANY) { if (targetKeys.isEmpty()) { return resultData; } else { Object keyInstance = targetStore.createInstance(); ANNOTATION_HELPER.setKeyFields(keyInstance, targetKeys); for (Object result : resultData) { if (targetStore.isKeyEqualChecked(result, keyInstance)) { return result; } } return null; } } else { if (resultData.isEmpty()) { return null; } return resultData.get(0); } }
Example 7
Source File: AtomEntryEntityProducer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void appendAdditinalLinks(final XMLStreamWriter writer, final EntityInfoAggregator eia, final Map<String, Object> data) throws EntityProviderException, EdmException, URISyntaxException { final Map<String, Map<String, Object>> links = properties.getAdditionalLinks(); if (links != null && !links.isEmpty()) { for (Entry<String, Map<String, Object>> entry : links.entrySet()) { Map<String, Object> navigationKeyMap = entry.getValue(); final boolean isFeed = (eia.getNavigationPropertyInfo(entry.getKey()).getMultiplicity() == EdmMultiplicity.MANY); if (navigationKeyMap != null && !navigationKeyMap.isEmpty()) { final EntityInfoAggregator targetEntityInfo = EntityInfoAggregator.create( eia.getEntitySet().getRelatedEntitySet( (EdmNavigationProperty) eia.getEntityType().getProperty(entry.getKey()))); appendAtomNavigationLink(writer, createSelfLink(targetEntityInfo, navigationKeyMap, null), entry.getKey(), isFeed, eia, data); } } } }
Example 8
Source File: AtomEntityProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public ODataResponse writeFunctionImport(final EdmFunctionImport functionImport, final Object data, final EntityProviderWriteProperties properties) throws EntityProviderException { try { if(functionImport.getReturnType() !=null){ final EdmType type = functionImport.getReturnType().getType(); final boolean isCollection = functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY; if (type.getKind() == EdmTypeKind.ENTITY) { @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) data; return writeEntry(functionImport.getEntitySet(), map, properties); } final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport); if (isCollection) { return writeCollection(info, (List<?>) data); } else { return writeSingleTypedElement(info, data); } }else{ return ODataResponse.newBuilder().status(HttpStatusCodes.ACCEPTED).build(); } } catch (EdmException e) { throw new EntityProviderProducerException(e.getMessageReference(), e); } }
Example 9
Source File: AnnotationEdmProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private Association mergeAssociations(final Association associationOne, final Association associationTwo) { AssociationEnd oneEnd1 = associationOne.getEnd1(); AssociationEnd oneEnd2 = associationOne.getEnd2(); AssociationEnd twoEnd1 = associationTwo.getEnd1(); AssociationEnd twoEnd2 = associationTwo.getEnd2(); AssociationEnd[] oneEnds = new AssociationEnd[] { oneEnd1, oneEnd2 }; for (AssociationEnd associationEnd : oneEnds) { if (associationEnd.getRole().equals(twoEnd1.getRole())) { if (twoEnd1.getMultiplicity() == EdmMultiplicity.MANY) { associationEnd.setMultiplicity(EdmMultiplicity.MANY); } } else if (associationEnd.getRole().equals(twoEnd2.getRole())) { if (twoEnd2.getMultiplicity() == EdmMultiplicity.MANY) { associationEnd.setMultiplicity(EdmMultiplicity.MANY); } } } return associationOne; }
Example 10
Source File: EdmURIBuilderImpl.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private void addNavigationSegment(EdmNavigationProperty property) { try { state = property.getMultiplicity() == EdmMultiplicity.MANY? SegmentType.NAVIGATION_TO_MANY: SegmentType.NAVIGATION_TO_ONE; segments.add(new Segment(state, property.getName())); } catch (EdmException e) { throw new RuntimeException("Unexpected EDM Exception: ", e);//NOSONAR } }
Example 11
Source File: AtomEntryEntityProducer.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private void appendAtomNavigationLinks(final XMLStreamWriter writer, final EntityInfoAggregator eia, final Map<String, Object> data) throws EntityProviderException, EdmException, URISyntaxException { for (String name : eia.getSelectedNavigationPropertyNames()) { final boolean isFeed = (eia.getNavigationPropertyInfo(name).getMultiplicity() == EdmMultiplicity.MANY); final Map<String, Map<String, Object>> links = properties.getAdditionalLinks(); final Map<String, Object> key = links == null ? null : links.get(name); if (key == null || key.isEmpty()) { appendAtomNavigationLink(writer, createSelfLink(eia, data, name), name, isFeed, eia, data); } else { final EntityInfoAggregator targetEntityInfo = EntityInfoAggregator.create( eia.getEntitySet().getRelatedEntitySet((EdmNavigationProperty) eia.getEntityType().getProperty(name))); appendAtomNavigationLink(writer, createSelfLink(targetEntityInfo, key, null), name, isFeed, eia, data); } } }
Example 12
Source File: AnnotationHelper.java From olingo-odata2 with Apache License 2.0 | 5 votes |
public EdmMultiplicity mapMultiplicity(final Multiplicity multiplicity) { switch (multiplicity) { case ZERO_OR_ONE: return EdmMultiplicity.ZERO_TO_ONE; case ONE: return EdmMultiplicity.ONE; case MANY: return EdmMultiplicity.MANY; default: throw new AnnotationRuntimeException("Unknown type '" + multiplicity + "' for mapping to EdmMultiplicity."); } }
Example 13
Source File: AnnotationHelper.java From olingo-odata2 with Apache License 2.0 | 5 votes |
public EdmMultiplicity extractMultiplicity(final EdmNavigationProperty enp, final Field field) { EdmMultiplicity multiplicity = mapMultiplicity(enp.toMultiplicity()); final boolean isCollectionType = field.getType().isArray() || Collection.class.isAssignableFrom(field.getType()); if (multiplicity == EdmMultiplicity.ONE && isCollectionType) { return EdmMultiplicity.MANY; } return multiplicity; }
Example 14
Source File: FilterParserImpl.java From olingo-odata2 with Apache License 2.0 | 5 votes |
protected void validateEdmPropertyOfStructuredType(final EdmStructuralType parentType, final PropertyExpressionImpl property, final Token propertyToken) throws ExpressionParserException, ExpressionParserInternalError { try { String propertyName = property.getUriLiteral(); EdmTyped edmProperty = parentType.getProperty(propertyName); if (edmProperty != null) { property.setEdmProperty(edmProperty); property.setEdmType(edmProperty.getType()); if(isLastFilterElement(propertyName)) { if (edmProperty.getMultiplicity() == EdmMultiplicity.MANY) { throw new ExpressionParserException( ExpressionParserException.INVALID_MULTIPLICITY.create() .addContent(propertyName) .addContent(propertyToken.getPosition() + 1)); } } } else { // Tested with TestParserExceptions.TestPMvalidateEdmProperty CASE 3 throw FilterParserExceptionImpl.createPROPERTY_NAME_NOT_FOUND_IN_TYPE(parentType, property, propertyToken, curExpression); } } catch (EdmException e) { // not Tested, should not occur throw ExpressionParserInternalError.createERROR_ACCESSING_EDM(e); } }
Example 15
Source File: EdmURIBuilderImpl.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public EdmURIBuilder appendFunctionImportSegment(EdmFunctionImport functionImport) { try { state = functionImport.getReturnType() != null ? (functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY && functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY ? SegmentType.FUNCTIONIMPORT_MANY : SegmentType.FUNCTIONIMPORT) : SegmentType.FUNCTIONIMPORT; segments.add(new Segment(state, functionImport.getName())); } catch (EdmException e) { throw new RuntimeException("Unexpected EDM Exception: ", e);//NOSONAR } return this; }
Example 16
Source File: JPALinkTest.java From olingo-odata2 with Apache License 2.0 | 4 votes |
private List<NavigationSegment> mockNavigationSegments(boolean isReverse) throws EdmException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { Class<?> type = null; String entityTypeName = null; String keyLiteral = null; EdmMultiplicity multiplicity = null; String navPropertyName = null; String toRole = null; String associationName = null; if (isReverse) { type = SalesOrderHeader.class; entityTypeName = "SalesOrder"; keyLiteral = "1"; multiplicity = EdmMultiplicity.ONE; navPropertyName = "salesOrderHeader"; toRole = "SalesOrder"; associationName = "Note_SalesOrder"; } else { type = List.class; entityTypeName = "Note"; keyLiteral = "2"; multiplicity = EdmMultiplicity.MANY; navPropertyName = "NotesDetails"; toRole = "Note"; associationName = "Note_SalesOrder"; } JPAEdmMapping mapping = new JPAEdmMappingImpl(); mapping.setJPAType(type); KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class); EasyMock.expect(keyPredicate.getProperty()).andReturn( edm.getEntityType("SalesOrderProcessing", entityTypeName).getKeyProperties().get(0)).anyTimes(); EasyMock.expect(keyPredicate.getLiteral()).andReturn(keyLiteral); EasyMock.replay(keyPredicate); List<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>(); keyPredicates.add(keyPredicate); NavigationSegment navigationSegment = EasyMock.createMock(NavigationSegment.class); EasyMock.expect(navigationSegment.getKeyPredicates()).andReturn(keyPredicates); EdmNavigationProperty navProperty = EasyMock.createMock(EdmNavigationProperty.class); EasyMock.expect(navProperty.getMapping()).andReturn((EdmMapping) mapping).anyTimes(); EasyMock.expect(navProperty.getMultiplicity()).andReturn(multiplicity).anyTimes(); EasyMock.expect(navProperty.getName()).andReturn(navPropertyName).anyTimes(); EasyMock.expect(navProperty.getToRole()).andReturn(toRole).anyTimes(); EasyMock.expect(navProperty.getRelationship()).andReturn( edm.getAssociation("SalesOrderProcessing", associationName)); EasyMock.replay(navProperty); EdmEntityType edmEntityType = edm.getAssociation("SalesOrderProcessing", associationName).getEnd(toRole).getEntityType(); Field field = EdmEntityTypeImplProv.class.getDeclaredField("entityType"); field.setAccessible(true); EntityType entityType = (EntityType) field.get(edmEntityType); entityType.setMapping((Mapping) mapping); EasyMock.expect(navigationSegment.getNavigationProperty()).andReturn(navProperty).anyTimes(); EasyMock.replay(navigationSegment); List<NavigationSegment> navigationSegments = new ArrayList<NavigationSegment>(); navigationSegments.add(navigationSegment); return navigationSegments; }
Example 17
Source File: UriParserImpl.java From olingo-odata2 with Apache License 2.0 | 4 votes |
private void handleNavigationProperties() throws UriSyntaxException, UriNotMatchingException, EdmException { final Matcher matcher = NAVIGATION_SEGMENT_PATTERN.matcher(currentPathSegment); if (!matcher.matches()) { throw new UriNotMatchingException(UriNotMatchingException.MATCHPROBLEM.addContent(currentPathSegment)); } final String navigationPropertyName = percentDecode(matcher.group(1)); final String keyPredicateName = matcher.group(2); final String emptyParentheses = matcher.group(3); final EdmTyped property = uriResult.getTargetEntitySet().getEntityType().getProperty(navigationPropertyName); if (property == null) { throw new UriNotMatchingException(UriNotMatchingException.PROPERTYNOTFOUND.addContent(navigationPropertyName)); } switch (property.getType().getKind()) { case SIMPLE: case COMPLEX: if (keyPredicateName != null || emptyParentheses != null) { throw new UriSyntaxException(UriSyntaxException.INVALIDSEGMENT.addContent(currentPathSegment)); } if (uriResult.isLinks()) { throw new UriSyntaxException(UriSyntaxException.NONAVIGATIONPROPERTY.addContent(property)); } handlePropertyPath((EdmProperty) property); break; case ENTITY: // navigation properties point to entities final EdmNavigationProperty navigationProperty = (EdmNavigationProperty) property; if (keyPredicateName != null || emptyParentheses != null) { if (navigationProperty.getMultiplicity() != EdmMultiplicity.MANY) { throw new UriSyntaxException(UriSyntaxException.INVALIDSEGMENT.addContent(currentPathSegment)); } } addNavigationSegment(keyPredicateName, navigationProperty); boolean many = false; if (navigationProperty.getMultiplicity() == EdmMultiplicity.MANY) { many = keyPredicateName == null; } if (pathSegments.isEmpty()) { if (many) { if (uriResult.isLinks()) { uriResult.setUriType(UriType.URI7B); } else { uriResult.setUriType(UriType.URI6B); } } else if (uriResult.isLinks()) { uriResult.setUriType(UriType.URI7A); } else { uriResult.setUriType(UriType.URI6A); } } else if (many || uriResult.isLinks()) { currentPathSegment = pathSegments.remove(0); checkCount(); if (!uriResult.isCount()) { throw new UriSyntaxException(UriSyntaxException.INVALIDSEGMENT.addContent(currentPathSegment)); } if (many) { if (uriResult.isLinks()) { uriResult.setUriType(UriType.URI50B); } else { uriResult.setUriType(UriType.URI15); } } else { uriResult.setUriType(UriType.URI50A); } } else { handleNavigationPathOptions(); } break; default: throw new UriSyntaxException(UriSyntaxException.INVALIDPROPERTYTYPE.addContent(property.getType().getKind())); } }
Example 18
Source File: UriParserImpl.java From olingo-odata2 with Apache License 2.0 | 4 votes |
private void handleFunctionImport(final EdmFunctionImport functionImport, final String emptyParentheses, final String keyPredicate) throws UriSyntaxException, UriNotMatchingException, EdmException { final EdmTyped returnType = functionImport.getReturnType(); if (returnType != null && returnType.getType() != null) { final EdmType type = returnType.getType(); final boolean isCollection = returnType.getMultiplicity() == EdmMultiplicity.MANY; if (type.getKind() == EdmTypeKind.ENTITY && isCollection) { handleEntitySet(functionImport.getEntitySet(), keyPredicate); return; } if (emptyParentheses != null) { throw new UriSyntaxException(UriSyntaxException.INVALIDSEGMENT.addContent(emptyParentheses)); } uriResult.setTargetType(type); switch (type.getKind()) { case SIMPLE: uriResult.setUriType(isCollection ? UriType.URI13 : UriType.URI14); break; case COMPLEX: uriResult.setUriType(isCollection ? UriType.URI11 : UriType.URI12); break; case ENTITY: uriResult.setUriType(UriType.URI10); break; default: throw new UriSyntaxException(UriSyntaxException.INVALIDRETURNTYPE.addContent(type.getKind())); } if (!pathSegments.isEmpty()) { if (uriResult.getUriType() == UriType.URI14) { currentPathSegment = pathSegments.remove(0); if ("$value".equals(percentDecode(currentPathSegment))) { uriResult.setValue(true); } else { throw new UriSyntaxException(UriSyntaxException.INVALIDSEGMENT.addContent(currentPathSegment)); } } } } else { uriResult.setUriType(UriType.URI14); } ensureLastSegment(); }
Example 19
Source File: ListsProcessor.java From olingo-odata2 with Apache License 2.0 | 4 votes |
@Override public ODataResponse executeFunctionImport(final GetFunctionImportUriInfo uriInfo, final String contentType) throws ODataException { final EdmFunctionImport functionImport = uriInfo.getFunctionImport(); final EdmType type = functionImport.getReturnType().getType(); final Object data = dataSource.readData( functionImport, mapFunctionParameters(uriInfo.getFunctionImportParameters()), null); if (data == null) { throw new ODataNotFoundException(ODataHttpException.COMMON); } Object value; if (type.getKind() == EdmTypeKind.SIMPLE) { value = type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance() ? ((BinaryData) data).getData() : data; } else if (functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY) { List<Map<String, Object>> values = new ArrayList<Map<String, Object>>(); for (final Object typeData : (List<?>) data) { values.add(getStructuralTypeValueMap(typeData, (EdmStructuralType) type)); } value = values; } else { value = getStructuralTypeValueMap(data, (EdmStructuralType) type); } ODataContext context = getContext(); final EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties .serviceRoot(context.getPathInfo().getServiceRoot()).build(); final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "writeFunctionImport"); final ODataResponse response = EntityProvider.writeFunctionImport(contentType, functionImport, value, entryProperties); context.stopRuntimeMeasurement(timingHandle); return ODataResponse.fromResponse(response).build(); }
Example 20
Source File: ListsProcessor.java From olingo-odata2 with Apache License 2.0 | 4 votes |
@Override public ODataResponse executeFunctionImport(final GetFunctionImportUriInfo uriInfo, final String contentType) throws ODataException { final EdmFunctionImport functionImport = uriInfo.getFunctionImport(); final EdmType type = functionImport.getReturnType().getType(); final Object data = dataSource.readData( functionImport, mapFunctionParameters(uriInfo.getFunctionImportParameters()), null); if (data == null) { throw new ODataNotFoundException(ODataHttpException.COMMON); } Object value; if (type.getKind() == EdmTypeKind.SIMPLE) { value = type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance() ? ((BinaryData) data).getData() : data; } else if (functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY) { List<Map<String, Object>> values = new ArrayList<Map<String, Object>>(); for (final Object typeData : (List<?>) data) { values.add(getStructuralTypeValueMap(typeData, (EdmStructuralType) type)); } value = values; } else { value = getStructuralTypeValueMap(data, (EdmStructuralType) type); } ODataContext context = getContext(); final EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties .serviceRoot(context.getPathInfo().getServiceRoot()).build(); final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "writeFunctionImport"); final ODataResponse response = EntityProvider.writeFunctionImport(contentType, functionImport, value, entryProperties); context.stopRuntimeMeasurement(timingHandle); return ODataResponse.fromResponse(response).build(); }