本文整理汇总了Java中org.apache.olingo.odata2.api.uri.UriInfo.getStartEntitySet方法的典型用法代码示例。如果您正苦于以下问题:Java UriInfo.getStartEntitySet方法的具体用法?Java UriInfo.getStartEntitySet怎么用?Java UriInfo.getStartEntitySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.odata2.api.uri.UriInfo
的用法示例。
在下文中一共展示了UriInfo.getStartEntitySet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLinkFromES
import org.apache.olingo.odata2.api.uri.UriInfo; //导入方法依赖的package包/类
/**
* Extract the 'From' ES of an EntityLink.
* @param uri_info path to resource, eg: /Collections(10)/$links/Products
* @returns the EntitySet of the nav segment before the "$link" segment.
*/
private EdmEntitySet getLinkFromES(UriInfo uri_info)
{
EdmEntitySet res;
/* `uri_info`:
* StartEntitySet/Foo/bar/baz/$links/TargetEntitySet
* \__________/ \______________/
* Navigation Segments */
List<NavigationSegment> navsegs = uri_info.getNavigationSegments();
if (navsegs.size() >= 2) // `navsegs` contains at least the target segment
{
res = navsegs.get(navsegs.size()-1).getEntitySet();
}
else
{
res = uri_info.getStartEntitySet();
}
return res;
}
示例2: getTargetCollection
import org.apache.olingo.odata2.api.uri.UriInfo; //导入方法依赖的package包/类
private static Collection getTargetCollection(ODataEntry entry)
throws ODataException
{
String navLinkName = SynchronizerEntitySet.TARGET_COLLECTION;
List<String> nll = entry.getMetadata ().getAssociationUris (navLinkName);
if (nll != null && !nll.isEmpty ())
{
if (nll.size () > 1)
{
throw new ODataException (
"A synchronizer accepts only one collection");
}
String uri = nll.get(0);
// Nullifying
if (uri == null || uri.isEmpty())
{
return null;
}
Edm edm = RuntimeDelegate.createEdm(new Model());
UriParser urip = RuntimeDelegate.getUriParser (edm);
List<PathSegment> path_segments = new ArrayList<> ();
StringTokenizer st = new StringTokenizer (uri, "/");
while (st.hasMoreTokens ())
{
path_segments.add (UriParser.createPathSegment (st.nextToken (),
null));
}
UriInfo uinfo =
urip
.parse (path_segments, Collections.<String, String> emptyMap ());
EdmEntitySet sync_ees = uinfo.getStartEntitySet ();
KeyPredicate kp = uinfo.getKeyPredicates ().get (0);
List<NavigationSegment> ns_l = uinfo.getNavigationSegments ();
Collection c = Navigator.<Collection>navigate(sync_ees, kp, ns_l, Collection.class);
return c;
}
return null;
}