org.apache.olingo.odata2.api.exception.ODataException Java Examples
The following examples show how to use
org.apache.olingo.odata2.api.exception.ODataException.
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: ListsProcessor.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private <T> T readEntryData(final List<T> data, final EdmEntityType entityType, final Map<String, Object> key) throws ODataException { for (final T entryData : data) { boolean found = true; for (final EdmProperty keyProperty : entityType.getKeyProperties()) { if (!valueAccess.getPropertyValue(entryData, keyProperty).equals(key.get(keyProperty.getName()))) { found = false; break; } } if (found) { return entryData; } } return null; }
Example #2
Source File: AtomEntryProducerTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void serializeAtomEntry() throws IOException, XpathException, SAXException, XMLStreamException, FactoryConfigurationError, ODataException { final EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).build(); AtomEntityProvider ser = createAtomEntityProvider(); ODataResponse response = ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"), roomData, properties); String xmlString = verifyResponse(response); assertXpathExists("/a:entry", xmlString); assertXpathEvaluatesTo(BASE_URI.toASCIIString(), "/a:entry/@xml:base", xmlString); assertXpathExists("/a:entry/a:content", xmlString); assertXpathEvaluatesTo(ContentType.APPLICATION_XML.toString(), "/a:entry/a:content/@type", xmlString); assertXpathExists("/a:entry/a:content/m:properties", xmlString); }
Example #3
Source File: EdmServiceMetadataImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public List<EdmEntitySetInfo> getEntitySetInfos() throws ODataException { if(edmProvider == null){ throw new ODataException(EDM_PROVIDER_EXEPTION); } if (entitySetInfos == null) { entitySetInfos = new ArrayList<EdmEntitySetInfo>(); if (schemas == null) { schemas = edmProvider.getSchemas(); } for (Schema schema : schemas) { for (EntityContainer entityContainer : listOrEmptyList(schema.getEntityContainers())) { for (EntitySet entitySet : listOrEmptyList(entityContainer.getEntitySets())) { EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, entityContainer); entitySetInfos.add(entitySetInfo); } } } } return entitySetInfos; }
Example #4
Source File: CustomerProcessor.java From cloud-espm-v2 with Apache License 2.0 | 6 votes |
/** * Function Import implementation for getting customer by email address * * @param emailAddress * email address of the customer * @return customer entity. * @throws ODataException */ @SuppressWarnings("unchecked") @EdmFunctionImport(name = "GetCustomerByEmailAddress", entitySet = "Customers", returnType = @ReturnType(type = Type.ENTITY, isCollection = true)) public List<Customer> getCustomerByEmailAddress( @EdmFunctionImportParameter(name = "EmailAddress") String emailAddress) throws ODataException { EntityManagerFactory emf = Utility.getEntityManagerFactory(); EntityManager em = emf.createEntityManager(); List<Customer> custList = null; try { Query query = em.createNamedQuery("Customer.getCustomerByEmailAddress"); query.setParameter("emailAddress", emailAddress); try { custList = query.getResultList(); return custList; } catch (NoResultException e) { throw new ODataApplicationException("No matching customer with Email Address:" + emailAddress, Locale.ENGLISH, HttpStatusCodes.BAD_REQUEST, e); } } finally { em.close(); } }
Example #5
Source File: ListsProcessor.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public ODataResponse executeFunctionImportValue(final GetFunctionImportUriInfo uriInfo, final String contentType) throws ODataException { final EdmFunctionImport functionImport = uriInfo.getFunctionImport(); final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType(); final Object data = dataSource.readData( functionImport, mapFunctionParameters(uriInfo.getFunctionImportParameters()), null); if (data == null) { throw new ODataNotFoundException(ODataHttpException.COMMON); } ODataResponse response; if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) { response = EntityProvider.writeBinary(((BinaryData) data).getMimeType(), ((BinaryData) data).getData()); } else { final String value = type.valueToString(data, EdmLiteralKind.DEFAULT, null); response = EntityProvider.writeText(value == null ? "" : value); } return ODataResponse.fromResponse(response).build(); }
Example #6
Source File: Attribute.java From DataHubSystem with GNU Affero General Public License v3.0 | 5 votes |
@Override public Object getProperty (String prop_name) throws ODataException { if (prop_name.equals (AttributeEntitySet.VALUE)) return getValue (); return super.getProperty (prop_name); }
Example #7
Source File: User.java From DataHubSystem with GNU Affero General Public License v3.0 | 5 votes |
@Override public Object getProperty (String prop_name) throws ODataException { if (prop_name.equals (UserEntitySet.USERNAME)) return user.getUsername (); if (prop_name.equals (UserEntitySet.EMAIL)) return user.getEmail (); if (prop_name.equals (UserEntitySet.FIRSTNAME)) return user.getFirstname (); if (prop_name.equals (UserEntitySet.LASTNAME)) return user.getLastname (); if (prop_name.equals (UserEntitySet.COUNTRY)) return user.getCountry (); if (prop_name.equals (UserEntitySet.PHONE)) return user.getPhone (); if (prop_name.equals (UserEntitySet.ADDRESS)) return user.getAddress (); if (prop_name.equals (UserEntitySet.DOMAIN)) return user.getDomain (); if (prop_name.equals (UserEntitySet.SUBDOMAIN)) return user.getSubDomain (); if (prop_name.equals (UserEntitySet.USAGE)) return user.getUsage (); if (prop_name.equals (UserEntitySet.SUBUSAGE)) return user.getSubUsage (); if (prop_name.equals(UserEntitySet.HASH)) { return user.getPasswordEncryption().getAlgorithmKey(); } if (prop_name.equals(UserEntitySet.PASSWORD)) { return user.getPassword(); } if (prop_name.equals(UserEntitySet.CREATED)) { return user.getCreated(); } throw new ODataException ("Property '" + prop_name + "' not found."); }
Example #8
Source File: CarEdmProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException { if (NAMESPACE.equals(edmFQName.getNamespace())) { if (COMPLEX_TYPE.getName().equals(edmFQName.getName())) { List<Property> properties = new ArrayList<Property>(); properties.add(new SimpleProperty().setName("Street").setType(EdmSimpleTypeKind.String)); properties.add(new SimpleProperty().setName("City").setType(EdmSimpleTypeKind.String)); properties.add(new SimpleProperty().setName("ZipCode").setType(EdmSimpleTypeKind.String)); properties.add(new SimpleProperty().setName("Country").setType(EdmSimpleTypeKind.String)); return new ComplexType().setName(COMPLEX_TYPE.getName()).setProperties(properties); } } return null; }
Example #9
Source File: JPAQueryBuilderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void buildGetEntitySetTest() { try { JPAQueryInfo info = builder.build((GetEntitySetUriInfo) mockURIInfoWithListener(false)); assertNotNull(info.getQuery()); assertEquals(true, info.isTombstoneQuery()); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } }
Example #10
Source File: BasicHttpTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override protected ODataSingleProcessor createProcessor() throws ODataException { final ODataSingleProcessor processor = mock(ODataSingleProcessor.class); when(((MetadataProcessor) processor).readMetadata(any(GetMetadataUriInfo.class), any(String.class))) .thenReturn(ODataResponse.entity("metadata").status(HttpStatusCodes.OK).build()); when( ((ServiceDocumentProcessor) processor).readServiceDocument(any(GetServiceDocumentUriInfo.class), any(String.class))) .thenReturn(ODataResponse.entity("service document").status(HttpStatusCodes.OK).build()); return processor; }
Example #11
Source File: AnnotationValueAccess.java From olingo-odata2 with Apache License 2.0 | 5 votes |
/** * Sets the value of an EDM property for the given data object. * @param data the Java data object * @param property the {@link EdmProperty} * @param value the new value of the property */ @Override public <T, V> void setPropertyValue(final T data, final EdmProperty property, final V value) throws ODataException { if (data != null) { if (annotationHelper.isEdmAnnotated(data)) { annotationHelper.setValueForProperty(data, property.getName(), value); } else { throw new ODataNotImplementedException(ODataNotImplementedException.COMMON); } } }
Example #12
Source File: JPAQueryBuilderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void buildPutEntityTestWithoutListener() { try { EdmMapping mapping = (EdmMapping) mockMapping(); assertNotNull(builder.build((PutMergePatchUriInfo) mockURIInfoForDeleteAndPut(mapping))); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } }
Example #13
Source File: JPQLBuilderFactoryTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testGetContextBuilderforSelect() throws ODataException { // Build JPQL ContextBuilder JPQLContextBuilder contextBuilder = new ODataJPAFactoryImpl().getJPQLBuilderFactory().getContextBuilder(JPQLContextType.SELECT); assertNotNull(contextBuilder); assertTrue(contextBuilder instanceof JPQLSelectContextBuilder); }
Example #14
Source File: RestUtil.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private static PathInfoImpl splitPath(final SubLocatorParameter param) throws ODataException { PathInfoImpl pathInfo = new PathInfoImpl(); List<javax.ws.rs.core.PathSegment> precedingPathSegments; List<javax.ws.rs.core.PathSegment> pathSegments; if (param.getPathSplit() == 0) { precedingPathSegments = Collections.emptyList(); pathSegments = param.getPathSegments(); } else { if (param.getPathSegments().size() < param.getPathSplit()) { throw new ODataBadRequestException(ODataBadRequestException.URLTOOSHORT); } precedingPathSegments = param.getPathSegments().subList(0, param.getPathSplit()); final int pathSegmentCount = param.getPathSegments().size(); pathSegments = param.getPathSegments().subList(param.getPathSplit(), pathSegmentCount); } // Percent-decode only the preceding path segments. // The OData path segments are decoded during URI parsing. pathInfo.setPrecedingPathSegment(convertPathSegmentList(precedingPathSegments)); List<PathSegment> odataSegments = new ArrayList<PathSegment>(); for (final javax.ws.rs.core.PathSegment segment : pathSegments) { if (segment.getMatrixParameters() == null || segment.getMatrixParameters().isEmpty()) { odataSegments.add(new ODataPathSegmentImpl(segment.getPath(), null)); } else { // post condition: we do not allow matrix parameters in OData path segments throw new ODataNotFoundException(ODataNotFoundException.MATRIX.addContent(segment.getMatrixParameters() .keySet(), segment.getPath())); } } pathInfo.setODataPathSegment(odataSegments); return pathInfo; }
Example #15
Source File: ListsProcessor.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public ODataResponse readEntityLink(final GetEntityLinkUriInfo uriInfo, final String contentType) throws ODataException { final Object data = retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments()); if (data == null) { throw new ODataNotFoundException(ODataNotFoundException.ENTITY); } final EdmEntitySet entitySet = uriInfo.getTargetEntitySet(); Map<String, Object> values = new HashMap<String, Object>(); for (final EdmProperty property : entitySet.getEntityType().getKeyProperties()) { values.put(property.getName(), valueAccess.getPropertyValue(data, property)); } ODataContext context = getContext(); final EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties .serviceRoot(context.getPathInfo().getServiceRoot()) .build(); final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "writeLink"); final ODataResponse response = EntityProvider.writeLink(contentType, entitySet, values, entryProperties); context.stopRuntimeMeasurement(timingHandle); return ODataResponse.fromResponse(response).build(); }
Example #16
Source File: AnnotationValueAccessTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void getPropertyValueNullData() throws ODataException { AnnotationValueAccess ava = new AnnotationValueAccess(); SimpleEntity data = null; EdmProperty property = mockProperty("Name"); Object value = ava.getPropertyValue(data, property); Assert.assertNull(value); }
Example #17
Source File: CxfCacheUriInfoIssueTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override protected ODataSingleProcessor createProcessor() throws ODataException { final ODataSingleProcessor processor = mock(ODataSingleProcessor.class); when(((MetadataProcessor) processor).readMetadata(any(GetMetadataUriInfo.class), any(String.class))).thenReturn( ODataResponse.entity("metadata").status(HttpStatusCodes.OK).build()); return processor; }
Example #18
Source File: NetworkStatistic.java From DataHubSystem with GNU Affero General Public License v3.0 | 5 votes |
@Override public Object getProperty (String prop_name) throws ODataException { if (prop_name.equals (NetworkStatisticEntitySet.ID)) return 0; if (prop_name.equals (NetworkStatisticEntitySet.ACTIVITYPERIOD)) return abuseMetrics.getPeriod (); if (prop_name.equals (NetworkStatisticEntitySet.CONNECTIONNUMBER)) return abuseMetrics.getCalls (); throw new ODataException ("Property '" + prop_name + "' not found."); }
Example #19
Source File: ODataJPAEdmProviderNegativeTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testNullGetEntityContainerInfo() { EntityContainerInfo entityContainer = null; try { entityContainer = edmProvider.getEntityContainerInfo("salesorderprocessingContainer"); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } assertNull(entityContainer); }
Example #20
Source File: ContextTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void checkHttpRequest() throws ClientProtocolException, IOException, ODataException { final HttpGet get = new HttpGet(URI.create(getEndpoint().toString() + "/$metadata")); getHttpClient().execute(get); final ODataContext ctx = getService().getProcessor().getContext(); assertNotNull(ctx); final Object requestObject = ctx.getParameter(ODataContext.HTTP_SERVLET_REQUEST_OBJECT); assertNotNull(requestObject); assertTrue(requestObject instanceof HttpServletRequest); }
Example #21
Source File: InvalidDataInScenarioTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType) throws ODataException { if ("Employees".equals(uriInfo.getTargetEntitySet().getName())) { ODataContext context = getContext(); EntityProviderWriteProperties writeProperties = EntityProviderWriteProperties.serviceRoot(context.getPathInfo().getServiceRoot()).build(); List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); data.add(new HashMap<String, Object>()); return EntityProvider.writeFeed(contentType, uriInfo.getTargetEntitySet(), data, writeProperties); } else { throw new ODataApplicationException("Wrong testcall", Locale.getDefault(), HttpStatusCodes.NOT_IMPLEMENTED); } }
Example #22
Source File: ODataJPADefaultProcessorTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private ODataContext getLocalODataContext() { ODataContext objODataContext = null; try { ODataContextMock contextMock = new ODataContextMock(); contextMock.setODataService(new ODataServiceMock().mock()); contextMock.setPathInfo(getLocalPathInfo()); objODataContext = contextMock.mock(); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } return objODataContext; }
Example #23
Source File: ScenarioEdmProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public Association getAssociation(final FullQualifiedName edmFQName) throws ODataException { if (NAMESPACE_1.equals(edmFQName.getNamespace())) { if (ASSOCIATION_1_1.getName().equals(edmFQName.getName())) { return new Association().setName(ASSOCIATION_1_1.getName()) .setEnd1( new AssociationEnd().setType(ENTITY_TYPE_1_1).setRole(ROLE_1_1).setMultiplicity(EdmMultiplicity.MANY)) .setEnd2( new AssociationEnd().setType(ENTITY_TYPE_1_4).setRole(ROLE_1_4).setMultiplicity(EdmMultiplicity.ONE)); } else if (ASSOCIATION_1_2.getName().equals(edmFQName.getName())) { return new Association().setName(ASSOCIATION_1_2.getName()) .setEnd1( new AssociationEnd().setType(ENTITY_TYPE_1_1).setRole(ROLE_1_1).setMultiplicity(EdmMultiplicity.MANY)) .setEnd2( new AssociationEnd().setType(ENTITY_TYPE_1_2).setRole(ROLE_1_2).setMultiplicity(EdmMultiplicity.ONE) .setOnDelete(new OnDelete().setAction(EdmAction.None))); } else if (ASSOCIATION_1_3.getName().equals(edmFQName.getName())) { return new Association().setName(ASSOCIATION_1_3.getName()) .setEnd1( new AssociationEnd().setType(ENTITY_TYPE_1_1).setRole(ROLE_1_1).setMultiplicity(EdmMultiplicity.MANY)) .setEnd2( new AssociationEnd().setType(ENTITY_TYPE_1_3).setRole(ROLE_1_3).setMultiplicity(EdmMultiplicity.ONE)); } else if (ASSOCIATION_1_4.getName().equals(edmFQName.getName())) { return new Association().setName(ASSOCIATION_1_4.getName()) .setEnd1( new AssociationEnd().setType(ENTITY_TYPE_1_5).setRole(ROLE_1_5).setMultiplicity(EdmMultiplicity.ONE)) .setEnd2( new AssociationEnd().setType(ENTITY_TYPE_1_3).setRole(ROLE_1_3).setMultiplicity(EdmMultiplicity.MANY)); } } return null; }
Example #24
Source File: ODataJPAResponseBuilderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private ODataContext getLocalODataContext() { ODataContext objODataContext = EasyMock.createMock(ODataContext.class); try { EasyMock.expect(objODataContext.getPathInfo()).andStubReturn(getLocalPathInfo()); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } EasyMock.replay(objODataContext); return objODataContext; }
Example #25
Source File: ListsProcessor.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private Object retrieveData(final EdmEntitySet startEntitySet, final List<KeyPredicate> keyPredicates, final EdmFunctionImport functionImport, final Map<String, Object> functionImportParameters, final List<NavigationSegment> navigationSegments) throws ODataException { Object data; final Map<String, Object> keys = mapKey(keyPredicates); ODataContext context = getContext(); final int timingHandle = context.startRuntimeMeasurement(getClass().getSimpleName(), "retrieveData"); try { data = functionImport == null ? keys.isEmpty() ? dataSource.readData(startEntitySet) : dataSource.readData(startEntitySet, keys) : dataSource.readData(functionImport, functionImportParameters, keys); EdmEntitySet currentEntitySet = functionImport == null ? startEntitySet : functionImport.getEntitySet(); for (NavigationSegment navigationSegment : navigationSegments) { data = dataSource.readRelatedData( currentEntitySet, data, navigationSegment.getEntitySet(), mapKey(navigationSegment.getKeyPredicates())); currentEntitySet = navigationSegment.getEntitySet(); } } finally { context.stopRuntimeMeasurement(timingHandle); } return data; }
Example #26
Source File: AnnotationServiceFactoryImplTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test(expected = ODataException.class) public void createFromClasses() throws ODataException { AnnotationServiceFactoryImpl factory = new AnnotationServiceFactoryImpl(); final Collection<Class<?>> notAnnotatedClasses = new ArrayList<Class<?>>(); notAnnotatedClasses.add(String.class); notAnnotatedClasses.add(Long.class); ODataService service = factory.createAnnotationService(notAnnotatedClasses); Assert.assertNotNull(service); }
Example #27
Source File: RestUtil.java From olingo-odata2 with Apache License 2.0 | 5 votes |
/** * Extracts the request content from the servlet as input stream. * @param param initialization parameters * @return the request content as input stream * @throws ODataException */ public static ServletInputStream extractRequestContent(final SubLocatorParameter param) throws ODataException { try { return param.getServletRequest().getInputStream(); } catch (final IOException e) { throw new ODataException("Error getting request content as ServletInputStream.", e); } }
Example #28
Source File: AnnotationEdmProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public Association getAssociation(final FullQualifiedName edmFQName) throws ODataException { Schema schema = namespace2Schema.get(edmFQName.getNamespace()); if (schema != null) { List<Association> associations = schema.getAssociations(); for (Association association : associations) { if (association.getName().equals(edmFQName.getName())) { return association; } } } return null; }
Example #29
Source File: UserSynchronizer.java From DataHubSystem with GNU Affero General Public License v3.0 | 5 votes |
/** * Creates an new UserSynchronizer from the given ODataEntry. * * @param odata_entry created by a POST request on the OData interface. * @throws ODataException if the given entry is malformed. */ public UserSynchronizer(ODataEntry odata_entry) throws ODataException { Map<String, Object> props = odata_entry.getProperties(); String label = (String) props.get(LABEL); String schedule = (String) props.get(SCHEDULE); String request = (String) props.get(REQUEST); String service_url = (String) props.get(SERVICE_URL); if (schedule == null || schedule.isEmpty() || service_url == null || service_url.isEmpty()) { throw new IncompleteDocException(); } if (request != null && !request.equals("start") && !request.equals("stop")) { throw new InvalidValueException(REQUEST, request); } try { this.syncConf = SYNC_SERVICE.createSynchronizer(label, "ODataUserSynchronizer", schedule); updateFromEntry(odata_entry); } catch (ParseException e) { throw new ExpectedException(e.getMessage()); } }
Example #30
Source File: ODataJPAResponseBuilderDefault.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public ODataResponse build(final GetEntityLinkUriInfo resultsView, final Object jpaEntity, final String contentType) throws ODataNotFoundException, ODataJPARuntimeException { if (jpaEntity == null) { throw new ODataNotFoundException(ODataNotFoundException.ENTITY); } EdmEntityType edmEntityType = null; ODataResponse odataResponse = null; try { EdmEntitySet entitySet = resultsView.getTargetEntitySet(); edmEntityType = entitySet.getEntityType(); Map<String, Object> edmPropertyValueMap = null; JPAEntityParser jpaResultParser = new JPAEntityParser(); edmPropertyValueMap = jpaResultParser.parse2EdmPropertyValueMap(jpaEntity, edmEntityType.getKeyProperties()); EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties.serviceRoot(oDataJPAContext.getODataContext().getPathInfo().getServiceRoot()) .build(); ODataResponse response = EntityProvider.writeLink(contentType, entitySet, edmPropertyValueMap, entryProperties); odataResponse = ODataResponse.fromResponse(response).build(); } catch (ODataException e) { throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e); } return odataResponse; }