本文整理汇总了Java中org.apache.olingo.commons.api.data.Entity.getNavigationLinks方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.getNavigationLinks方法的具体用法?Java Entity.getNavigationLinks怎么用?Java Entity.getNavigationLinks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.commons.api.data.Entity
的用法示例。
在下文中一共展示了Entity.getNavigationLinks方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyEntityRecursively
import org.apache.olingo.commons.api.data.Entity; //导入方法依赖的package包/类
private Entity copyEntityRecursively(final EdmEntitySet edmEntitySet, final Entity entity) {
// Check if entity is already copied
if(containsEntityInCopyMap(edmEntitySet.getName(), entity)) {
return getEntityFromCopyMap(edmEntitySet.getName(), entity);
} else {
final Entity newEntity = copyEntity(entity);
addEntityToCopyMap(edmEntitySet.getName(), entity, newEntity);
// Create nested entities recursively
for(final Link link : entity.getNavigationLinks()) {
newEntity.getNavigationLinks().add(copyLink(edmEntitySet, link));
}
return newEntity;
}
}
示例2: transformEntityGraphToTree
import org.apache.olingo.commons.api.data.Entity; //导入方法依赖的package包/类
public Entity transformEntityGraphToTree(final Entity entity, final EdmBindingTarget edmEntitySet,
final ExpandOption expand, final ExpandItem parentExpandItem) throws ODataApplicationException {
final Entity newEntity = newEntity(entity);
if (hasExpandItems(expand)) {
final boolean expandAll = expandAll(expand);
final Set<String> expanded = expandAll ? null : getExpandedPropertyNames(expand.getExpandItems());
final EdmEntityType edmType = edmEntitySet.getEntityType();
for (final Link link : entity.getNavigationLinks()) {
final String propertyName = link.getTitle();
if (expandAll || expanded.contains(propertyName)) {
final EdmNavigationProperty edmNavigationProperty = edmType.getNavigationProperty(propertyName);
final EdmBindingTarget edmBindingTarget = edmEntitySet.getRelatedBindingTarget(propertyName);
final Link newLink = newLink(link);
newEntity.getNavigationLinks().add(newLink);
final ExpandItem expandItem = getInnerExpandItem(expand, propertyName);
if (edmNavigationProperty.isCollection()) {
newLink.setInlineEntitySet(transformEntitySetGraphToTree(link.getInlineEntitySet(),
edmBindingTarget, expandItem.getExpandOption(), expandItem));
} else {
newLink.setInlineEntity(transformEntityGraphToTree(link.getInlineEntity(),
edmBindingTarget,expandItem.getExpandOption(), expandItem));
}
}
}
}
return newEntity;
}
示例3: deriveEntityESAllPrimDeepInsert
import org.apache.olingo.commons.api.data.Entity; //导入方法依赖的package包/类
@Test
public void deriveEntityESAllPrimDeepInsert() throws Exception {
final String entityString = "{\"PropertyInt16\": 32767,"
+ "\"PropertyString\": \"First Resource - positive values\","
+ "\"PropertyBoolean\": true,"
+ "\"PropertyByte\": 255,"
+ "\"PropertySByte\": 127,"
+ "\"PropertyInt32\": 2147483647,"
+ "\"PropertyInt64\": 9223372036854775807,"
+ "\"PropertyDecimal\": 34,"
+ "\"PropertyBinary\": \"ASNFZ4mrze8=\","
+ "\"PropertyDate\": \"2012-12-03\","
+ "\"PropertyDateTimeOffset\": \"2012-12-03T07:16:23Z\","
+ "\"PropertyDuration\": \"PT6S\","
+ "\"PropertyGuid\": \"01234567-89ab-cdef-0123-456789abcdef\","
+ "\"PropertyTimeOfDay\": \"03:26:05\","
+ "\"NavPropertyETTwoPrimMany\": [{\"@odata.type\": \"#olingo.odata.test1.ETBase\","
+ "\"PropertyInt16\": -365,\"PropertyString\": \"Test String2\","
+ "\"AdditionalPropertyString_5\": \"Test String2\"},"
+ "{\"PropertyInt16\": -365,\"PropertyString\": \"Test String2\"}],"
+ "\"NavPropertyETTwoPrimOne\":"
+ "{\"@odata.type\": \"#olingo.odata.test1.ETBase\",\"PropertyInt16\": 32767,"
+ "\"PropertyString\": \"Test String4\","
+ "\"AdditionalPropertyString_5\": \"Test String2\"}}";
final Entity entity = deserialize(entityString, "ETAllPrim");
assertNotNull(entity);
List<Property> properties = entity.getProperties();
assertNotNull(properties);
assertEquals(14, properties.size());
List<Link> navProperties = entity.getNavigationLinks();
assertNotNull(navProperties);
assertEquals(2, navProperties.size());
assertNotNull(navProperties.get(1).getInlineEntitySet()
.getEntities().get(0).getProperty("AdditionalPropertyString_5"));
assertNotNull(navProperties.get(0).getInlineEntity().getProperty("AdditionalPropertyString_5"));
}