本文整理汇总了Java中org.apache.olingo.odata2.api.ep.EntityProviderReadProperties类的典型用法代码示例。如果您正苦于以下问题:Java EntityProviderReadProperties类的具体用法?Java EntityProviderReadProperties怎么用?Java EntityProviderReadProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityProviderReadProperties类属于org.apache.olingo.odata2.api.ep包,在下文中一共展示了EntityProviderReadProperties类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readFeed
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
/**
* Reads a feed (the content of an EntitySet).
*
* @param resource_path the resource path to the parent of the requested
* EntitySet, as defined in {@link #getResourcePath(URI)}.
* @param query_parameters Query parameters, as defined in {@link URI}.
*
* @return an ODataFeed containing the ODataEntries for the given
* {@code resource_path}.
*
* @throws HttpException if the server emits an HTTP error code.
* @throws IOException if the connection with the remote service fails.
* @throws EdmException if the EDM does not contain the given entitySetName.
* @throws EntityProviderException if reading of data (de-serialization)
* fails.
* @throws UriSyntaxException violation of the OData URI construction rules.
* @throws UriNotMatchingException URI parsing exception.
* @throws ODataException encapsulate the OData exceptions described above.
* @throws InterruptedException if running thread has been interrupted.
*/
public ODataFeed readFeed(String resource_path,
Map<String, String> query_parameters) throws IOException, ODataException, InterruptedException
{
if (resource_path == null || resource_path.isEmpty ())
throw new IllegalArgumentException (
"resource_path must not be null or empty.");
ContentType contentType = ContentType.APPLICATION_ATOM_XML;
String absolutUri = serviceRoot.toString () + '/' + resource_path;
// Builds the query parameters string part of the URL.
absolutUri = appendQueryParam (absolutUri, query_parameters);
InputStream content = execute (absolutUri, contentType, "GET");
return EntityProvider.readFeed (contentType.type (),
getEntitySet (resource_path), content,
EntityProviderReadProperties.init ().build ());
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:41,代码来源:ODataClient.java
示例2: readEntry
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
/**
* Reads an entry (an Entity, a property, a complexType, ...).
*
* @param resource_path the resource path to the parent of the requested
* EntitySet, as defined in {@link #getResourcePath(URI)}.
* @param query_parameters Query parameters, as defined in {@link URI}.
*
* @return an ODataEntry for the given {@code resource_path}.
*
* @throws HttpException if the server emits an HTTP error code.
* @throws IOException if the connection with the remote service fails.
* @throws EdmException if the EDM does not contain the given entitySetName.
* @throws EntityProviderException if reading of data (de-serialization)
* fails.
* @throws UriSyntaxException violation of the OData URI construction rules.
* @throws UriNotMatchingException URI parsing exception.
* @throws ODataException encapsulate the OData exceptions described above.
* @throws InterruptedException if running thread has been interrupted.
*/
public ODataEntry readEntry(String resource_path,
Map<String, String> query_parameters) throws IOException, ODataException, InterruptedException
{
if (resource_path == null || resource_path.isEmpty ())
throw new IllegalArgumentException (
"resource_path must not be null or empty.");
ContentType contentType = ContentType.APPLICATION_ATOM_XML;
String absolutUri = serviceRoot.toString () + '/' + resource_path;
// Builds the query parameters string part of the URL.
absolutUri = appendQueryParam (absolutUri, query_parameters);
InputStream content = execute (absolutUri, contentType, "GET");
return EntityProvider.readEntry(contentType.type (),
getEntitySet (resource_path), content,
EntityProviderReadProperties.init ().build ());
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:40,代码来源:ODataClient.java
示例3: readEntry
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
public ODataEntry readEntry(String serviceUri, String contentType,
String entitySetName, String keyValue, SystemQueryOptions options)
throws IllegalStateException, IOException, EdmException,
EntityProviderException {
EdmEntityContainer entityContainer = readEdm()
.getDefaultEntityContainer();
logger.info("Entity container is => " + entityContainer.getName());
String absolutUri = createUri(serviceUri, entitySetName, keyValue,
options);
InputStream content = executeGet(absolutUri, contentType);
return EntityProvider.readEntry(contentType,
entityContainer.getEntitySet(entitySetName), content,
EntityProviderReadProperties.init().build());
}
开发者ID:SAP,项目名称:C4CODATAAPIDEVGUIDE,代码行数:17,代码来源:ServiceTicketODataConsumer.java
示例4: updateEntity
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@Override
public ODataResponse updateEntity(final PutMergePatchUriInfo uriInfo, final InputStream content,
final String requestContentType, final boolean merge, final String contentType) throws ODataException {
Object data = retrieveData(
uriInfo.getStartEntitySet(),
uriInfo.getKeyPredicates(),
uriInfo.getFunctionImport(),
mapFunctionParameters(uriInfo.getFunctionImportParameters()),
uriInfo.getNavigationSegments());
if (!appliesFilter(data, uriInfo.getFilter())) {
throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
}
final EdmEntitySet entitySet = uriInfo.getTargetEntitySet();
final EdmEntityType entityType = entitySet.getEntityType();
final EntityProviderReadProperties properties = EntityProviderReadProperties.init()
.mergeSemantic(merge)
.addTypeMappings(getStructuralTypeTypeMap(data, entityType))
.build();
final ODataEntry entryValues = parseEntry(entitySet, content, requestContentType, properties);
setStructuralTypeValuesFromMap(data, entityType, entryValues.getProperties(), merge);
return ODataResponse.newBuilder().eTag(constructETag(entitySet, data)).build();
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:ListsProcessor.java
示例5: parseEntry
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
private ODataEntry parseEntry(final EdmEntitySet entitySet, final InputStream content,
final String requestContentType, final EntityProviderReadProperties properties) throws ODataBadRequestException {
ODataContext context = getContext();
final int timingHandle = context.startRuntimeMeasurement("EntityConsumer", "readEntry");
ODataEntry entryValues;
try {
entryValues = EntityProvider.readEntry(requestContentType, entitySet, content, properties);
} catch (final EntityProviderException e) {
throw new ODataBadRequestException(ODataBadRequestException.BODY, e);
}
context.stopRuntimeMeasurement(timingHandle);
return entryValues;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:ListsProcessor.java
示例6: readEntryNullProperty
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@Test
public void readEntryNullProperty() throws Exception {
final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
final String content = EMPLOYEE_1_XML.replace("<d:EntryDate>1999-01-01T00:00:00</d:EntryDate>",
"<d:EntryDate m:null='true' />");
InputStream contentBody = createContentAsStream(content);
final ODataEntry result =
new XmlEntityConsumer().readEntry(entitySet, contentBody, EntityProviderReadProperties.init().mergeSemantic(
true).build());
final Map<String, Object> properties = result.getProperties();
assertEquals(9, properties.size());
assertTrue(properties.containsKey("EntryDate"));
assertNull(properties.get("EntryDate"));
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:XmlEntityConsumerTest.java
示例7: readFunctionImport
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@Override
public Object readFunctionImport(final EdmFunctionImport functionImport, InputStream content,
final EntityProviderReadProperties properties) throws EntityProviderException {
try {
if (functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY) {
return new XmlEntityConsumer().readEntry(functionImport.getEntitySet(), content, properties);
} else {
final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport);
return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ?
new XmlEntityConsumer().readCollection(info, content, properties) :
new XmlEntityConsumer().readProperty(info, content, properties).get(info.getName());
}
} catch (final EdmException e) {
throw new EntityProviderException(e.getMessageReference(), e);
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:AtomEntityProvider.java
示例8: RoomEntryWithInlineEmployeeInlineTeam
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
/**
* Room has inline entity to Employees and has inline entry To Team
* Scenario of 1:n:1 navigation
* E.g: Rooms('1')?$expand=nr_Employees/ne_Team
* @throws Exception
*/
@Test
public void RoomEntryWithInlineEmployeeInlineTeam() throws Exception {
InputStream stream = getFileAsStream("Room_InlineEmployeesToTeam.xml");
assertNotNull(stream);
FeedCallback callback = new FeedCallback();
EntityProviderReadProperties readProperties = EntityProviderReadProperties.init()
.mergeSemantic(false).callback(callback).build();
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
XmlEntityConsumer xec = new XmlEntityConsumer();
ODataEntry result =
xec.readEntry(entitySet, stream, readProperties);
assertNotNull(result);
assertEquals(4, result.getProperties().size());
Map<String, Object> inlineEntries = callback.getNavigationProperties();
getExpandedData(inlineEntries, result);
assertEquals(5, result.getProperties().size());
for (ODataEntry employeeEntry : ((ODataFeed)result.getProperties().get("nr_Employees")).getEntries()) {
assertEquals(10, employeeEntry.getProperties().size());
assertEquals(3, ((ODataEntry)employeeEntry.getProperties().get("ne_Team")).getProperties().size());
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:31,代码来源:XmlEntityConsumerTest.java
示例9: RoomEntryWithEmptyInlineEmployeeInlineTeam
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
/**
* Room has empty inline entity to Employees and has inline entry To Team
* E.g: Rooms('10')?$expand=nr_Employees/ne_Team
* @throws Exception
*/
@Test
public void RoomEntryWithEmptyInlineEmployeeInlineTeam() throws Exception {
InputStream stream = getFileAsStream("Room_EmptyInlineEmployeesToTeam.xml");
assertNotNull(stream);
FeedCallback callback = new FeedCallback();
EntityProviderReadProperties readProperties = EntityProviderReadProperties.init()
.mergeSemantic(false).callback(callback).build();
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
XmlEntityConsumer xec = new XmlEntityConsumer();
ODataEntry result =
xec.readEntry(entitySet, stream, readProperties);
assertNotNull(result);
assertEquals(4, result.getProperties().size());
Map<String, Object> inlineEntries = callback.getNavigationProperties();
getExpandedData(inlineEntries, result);
assertEquals(5, result.getProperties().size());
assertEquals(0, ((ODataFeed)result.getProperties().get("nr_Employees")).getEntries().size());
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:XmlEntityConsumerTest.java
示例10: handleStartedTag
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
private void handleStartedTag(final XMLStreamReader reader, final EntityInfoAggregator eia,
final EntityProviderReadProperties readProperties)
throws EntityProviderException, XMLStreamException, EdmException {
currentHandledStartTagName = reader.getLocalName();
if (FormatXml.ATOM_ID.equals(currentHandledStartTagName)) {
readId(reader);
} else if (FormatXml.ATOM_ENTRY.equals(currentHandledStartTagName)) {
readEntry(reader);
} else if (FormatXml.ATOM_LINK.equals(currentHandledStartTagName)) {
readLink(reader, eia, readProperties);
} else if (FormatXml.ATOM_CONTENT.equals(currentHandledStartTagName)) {
readContent(reader, eia, readProperties);
} else if (FormatXml.M_PROPERTIES.equals(currentHandledStartTagName)) {
readProperties(reader, eia, readProperties);
} else if (!readProperties.getMergeSemantic()) {
readCustomElement(reader, currentHandledStartTagName, eia, readProperties);
} else {
skipStartedTag(reader);
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:XmlEntryConsumer.java
示例11: createInlineProperties
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
/**
* Create {@link EntityProviderReadProperties} which can be used for reading of inline properties/entrys of navigation
* links within
* this current read entry.
*
* @param readProperties
* @param navigationProperty
* @return
* @throws EntityProviderException
*/
private EntityProviderReadProperties createInlineProperties(final EntityProviderReadProperties readProperties,
final EdmNavigationProperty navigationProperty) throws EntityProviderException {
final OnReadInlineContent callback = readProperties.getCallback();
EntityProviderReadProperties currentReadProperties = EntityProviderReadProperties.initFrom(readProperties).build();
if (callback == null) {
return currentReadProperties;
} else {
try {
return callback.receiveReadProperties(currentReadProperties, navigationProperty);
} catch (ODataApplicationException e) {
throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
.getSimpleName()), e);
}
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:XmlEntryConsumer.java
示例12: readFeed
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
/**
*
* @param reader
* @param eia
* @param readProperties
* @return {@link ODataDeltaFeed} object
* @throws EntityProviderException
*/
public ODataDeltaFeed readFeed(final XMLStreamReader reader, final EntityInfoAggregator eia,
final EntityProviderReadProperties readProperties) throws EntityProviderException {
try {
// read xml tag
reader.require(XMLStreamConstants.START_DOCUMENT, null, null);
reader.nextTag();
// read feed tag
reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_FEED);
Map<String, String> foundPrefix2NamespaceUri = extractNamespacesFromTag(reader);
foundPrefix2NamespaceUri.putAll(readProperties.getValidatedPrefixNamespaceUris());
checkAllMandatoryNamespacesAvailable(foundPrefix2NamespaceUri);
EntityProviderReadProperties entryReadProperties =
EntityProviderReadProperties.initFrom(readProperties).addValidatedPrefixes(foundPrefix2NamespaceUri).build();
// read feed data (metadata and entries)
return readFeedData(reader, eia, entryReadProperties);
} catch (XMLStreamException e) {
throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
.getSimpleName()), e);
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:31,代码来源:XmlFeedConsumer.java
示例13: readEntryWithNullProperty
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@Test
public void readEntryWithNullProperty() throws Exception {
final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
final String content = "{\"Id\":\"99\",\"Seats\":null}";
for (final boolean merge : new boolean[] { false, true }) {
final ODataEntry result = new JsonEntityConsumer().readEntry(entitySet, createContentAsStream(content),
EntityProviderReadProperties.init().mergeSemantic(merge).build());
final Map<String, Object> properties = result.getProperties();
assertNotNull(properties);
assertEquals(2, properties.size());
assertEquals("99", properties.get("Id"));
assertTrue(properties.containsKey("Seats"));
assertNull(properties.get("Seats"));
assertTrue(result.getMetadata().getAssociationUris("nr_Employees").isEmpty());
checkMediaDataInitial(result.getMediaMetadata());
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:JsonEntryConsumerTest.java
示例14: readFunctionImport
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@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);
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:JsonEntityProvider.java
示例15: complexPropertyNullValueNotAllowedButNotValidated
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@Test
public void complexPropertyNullValueNotAllowedButNotValidated() throws Exception {
final String xml = "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08
+ "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee")
.getProperty("Location");
EdmFacets facets = mock(EdmFacets.class);
when(facets.isNullable()).thenReturn(false);
when(property.getFacets()).thenReturn(facets);
final EntityProviderReadProperties readProperties = mock(EntityProviderReadProperties.class);
final Map<String, Object> resultMap = new XmlPropertyConsumer()
.readProperty(createReaderForTest(xml, true), property, readProperties);
assertFalse(resultMap.isEmpty());
assertNull(resultMap.get("Location"));
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:XmlPropertyConsumerTest.java
示例16: readEntry
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@Test
public void readEntry() throws Exception {
final String contentType = ContentType.APPLICATION_ATOM_XML_ENTRY.toContentTypeString();
final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
InputStream content = new ByteArrayInputStream(EMPLOYEE_1_XML.getBytes("UTF-8"));
final ODataEntry result =
new ProviderFacadeImpl().readEntry(contentType, entitySet, content, EntityProviderReadProperties.init()
.mergeSemantic(true).build());
assertNotNull(result);
assertFalse(result.containsInlineEntry());
assertNotNull(result.getExpandSelectTree());
assertTrue(result.getExpandSelectTree().isAll());
assertNotNull(result.getMetadata());
assertNull(result.getMetadata().getEtag());
assertNotNull(result.getMediaMetadata());
assertEquals(HttpContentType.APPLICATION_OCTET_STREAM, result.getMediaMetadata().getContentType());
assertNotNull(result.getProperties());
assertEquals(52, result.getProperties().get("Age"));
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:ProviderFacadeImplTest.java
示例17: readEntryTooManyValues
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@Test(expected = EntityProviderException.class)
public void readEntryTooManyValues() throws Exception {
// prepare
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
String content =
EMPLOYEE_1_XML.replace("<d:Age>52</d:Age>",
"<d:Age>52</d:Age><d:SomeUnknownTag>SomeUnknownValue</d:SomeUnknownTag>");
InputStream contentBody = createContentAsStream(content);
// execute
try {
new XmlEntityConsumer().readEntry(entitySet, contentBody, EntityProviderReadProperties.init()
.mergeSemantic(false).build());
} catch (EntityProviderException e) {
// do some assertions...
assertEquals(EntityProviderException.INVALID_PROPERTY.getKey(), e.getMessageReference().getKey());
assertEquals("SomeUnknownTag", e.getMessageReference().getContent().get(0));
// ...and then re-throw
throw e;
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:XmlEntityConsumerTest.java
示例18: testReadSkipTag
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@Test
public void testReadSkipTag() throws Exception {
// prepare
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
InputStream contentBody = createContentAsStream(EMPLOYEE_1_XML
.replace("<title type=\"text\">Walter Winter</title>",
"<title type=\"text\"><title>Walter Winter</title></title>"));
// execute
XmlEntityConsumer xec = new XmlEntityConsumer();
ODataEntry result =
xec.readEntry(entitySet, contentBody, EntityProviderReadProperties.init().mergeSemantic(false).build());
// verify
String id = result.getMetadata().getId();
assertEquals("http://localhost:19000/Employees('1')", id);
Map<String, Object> properties = result.getProperties();
assertEquals(9, properties.size());
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:XmlEntityConsumerTest.java
示例19: readDeltaFeed
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
@Test
public void readDeltaFeed() throws Exception {
// prepare
String content = readFile("feed_with_deleted_entries.xml");
assertNotNull(content);
EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
InputStream reqContent = createContentAsStream(content);
XmlEntityConsumer xec = new XmlEntityConsumer();
EntityProviderReadProperties consumerProperties = EntityProviderReadProperties.init().build();
ODataDeltaFeed deltaFeed = xec.readFeed(entitySet, reqContent, consumerProperties);
assertNotNull(deltaFeed);
assertNotNull(deltaFeed.getDeletedEntries());
assertNotNull(deltaFeed.getEntries());
assertEquals(1, deltaFeed.getEntries().size());
assertEquals(1, deltaFeed.getDeletedEntries().size());
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:XmlFeedConsumerTest.java
示例20: roomsFeedWithRoomsToEmployeesInlineTeams
import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties; //导入依赖的package包/类
/**
* Rooms navigate to Employees and has inline entry Teams
* E.g: Rooms('1')/nr_Employees?$expand=ne_Team
* @throws Exception
*/
@Test
public void roomsFeedWithRoomsToEmployeesInlineTeams() throws Exception {
InputStream stream = getFileAsStream("RoomsToEmployeesWithInlineTeams.xml");
assertNotNull(stream);
FeedCallback callback = new FeedCallback();
EntityProviderReadProperties readProperties = EntityProviderReadProperties.init()
.mergeSemantic(false).callback(callback).build();
ODataFeed feed =
EntityProvider.readFeed("application/atom+xml", MockFacade.getMockEdm().getDefaultEntityContainer()
.getEntitySet(
"Employees"), stream, readProperties);
assertNotNull(feed);
assertEquals(2, feed.getEntries().size());
Map<String, Object> inlineEntries = callback.getNavigationProperties();
getExpandedData(inlineEntries, feed);
for (ODataEntry entry : feed.getEntries()) {
assertEquals(10, entry.getProperties().size());
assertEquals(3, ((ODataEntry)entry.getProperties().get("ne_Team")).getProperties().size());
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:29,代码来源:XmlFeedConsumerTest.java
注:本文中的org.apache.olingo.odata2.api.ep.EntityProviderReadProperties类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论