当前位置: 首页>>代码示例>>Java>>正文


Java UriInfo.getStartEntitySet方法代码示例

本文整理汇总了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;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:26,代码来源:Processor.java

示例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;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:49,代码来源:Synchronizer.java


注:本文中的org.apache.olingo.odata2.api.uri.UriInfo.getStartEntitySet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。