• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ODataException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.olingo.odata2.api.exception.ODataException的典型用法代码示例。如果您正苦于以下问题:Java ODataException类的具体用法?Java ODataException怎么用?Java ODataException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ODataException类属于org.apache.olingo.odata2.api.exception包,在下文中一共展示了ODataException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ODataScanner

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
public ODataScanner (String uri, boolean store_scan_list, String username,
   String password) throws URISyntaxException, IOException, ODataException
{
   super (store_scan_list);
   
   this.uri = uri;
   this.username = username;
   this.password = password;
   
   // Workaround: if we are using this scanner to transfer a product.
   // see ProcessProductTransfer.upload()
   if (!uri.endsWith ("$value"))
   {
      // Creates an ODataClient for `uri`.
      this.client = new ODataClient (uri, username, password);
      LOGGER.info (
         "ODataScanner on " + client.getServiceRoot () + " created.");
   }
   else
   {
      this.client = null;
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:24,代码来源:ODataScanner.java


示例2: getProperty

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object getProperty (String prop_name) throws ODataException
{
   if (prop_name.equals (ConnectionEntitySet.ID)) return uuid;
   if (prop_name.equals (ConnectionEntitySet.DATE))
      return getStartDate ();
   if (prop_name.equals (ConnectionEntitySet.REMOTEIP))
      return getRemoteAddress ();
   if (prop_name.equals (ConnectionEntitySet.REQUEST))
      return getRequest ();
   if (prop_name.equals (ConnectionEntitySet.DURATION))
      return getDurationMs ();
   if (prop_name.equals (ConnectionEntitySet.CONTENT_LENGTH))
      return getContentLength();
   if (prop_name.equals (ConnectionEntitySet.WRITTEN_CONTENT_LENGTH))
      return getWrittenContentLength();
   if (prop_name.equals (ConnectionEntitySet.STATUS))
      return getConnectionStatus ();
   if (prop_name.equals (ConnectionEntitySet.STATUS_MESSAGE))
      return getConnectionStatusMessage ();

   throw new ODataException ("Property '" + prop_name + "' not found.");
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:24,代码来源:Connection.java


示例3: navigate

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object navigate(NavigationSegment ns) throws ODataException
{
   Object res;

   if (ns.getEntitySet().getName().equals(Model.USER.getName()))
   {
      res = new UserMap().get(getUsername());
   }
   else
   {
      throw new InvalidTargetException(this.getClass().getSimpleName(), ns.getEntitySet().getName());
   }

   return res;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:17,代码来源:Connection.java


示例4: navigate

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object navigate(NavigationSegment ns) throws ODataException
{
   Object res;

   if (ns.getEntitySet().getName().equals(Model.CLASS.getName()))
   {
      res = new ClassMap(this);
      if (!ns.getKeyPredicates().isEmpty())
      {
         res = ((ClassMap)res).get(ns.getKeyPredicates().get(0).getLiteral());
      }
   }
   else
   {
      throw new InvalidTargetException(this.getClass().getSimpleName(), ns.getEntitySet().getName());
   }

   return res;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:21,代码来源:Class.java


示例5: navigate

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object navigate(NavigationSegment ns) throws ODataException
{
   Object res;

   if (ns.getEntitySet().getName().equals(Model.PRODUCT.getName()))
   {
      res = this.getProducts();
      if (!ns.getKeyPredicates().isEmpty())
      {
         res = ((CollectionProductsMap)res).get(ns.getKeyPredicates().get(0).getLiteral());
      }
   }
   else
   {
      throw new InvalidTargetException(this.getClass().getSimpleName(), ns.getEntitySet().getName());
   }

   return res;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:21,代码来源:Collection.java


示例6: getProperty

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object getProperty(String prop_name) throws ODataException
{
   switch (prop_name)
   {
      case DeletedProductEntitySet.ID: return getId();
      case DeletedProductEntitySet.NAME: return getName();
      case DeletedProductEntitySet.CREATION_DATE: return getCreationDate();
      case DeletedProductEntitySet.FOOTPRINT: return getFootPrint();
      case DeletedProductEntitySet.SIZE: return getSize();
      case DeletedProductEntitySet.INGESTION_DATE: return getIngestionDate();
      case DeletedProductEntitySet.DELETION_DATE: return getDeletionDate();
      case DeletedProductEntitySet.DELETION_CAUSE: return getDeletionCause();

      default: throw new ODataException("Property '" + prop_name + "' not found.");
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:18,代码来源:DeletedProduct.java


示例7: navigate

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object navigate(NavigationSegment ns) throws ODataException
{
   Object res;

   if (ns.getEntitySet().getName().equals(Model.CLASS.getName()))
   {
      res = getItemClass();
   }
   else
   {
      throw new InvalidTargetException(this.getClass().getSimpleName(), ns.getEntitySet().getName());
   }

   if (!ns.getKeyPredicates().isEmpty())
   {
      res = Map.class.cast(res).get(
            ns.getKeyPredicates().get(0).getLiteral());
   }

   return res;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:23,代码来源:DeletedProduct.java


示例8: delete

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
public static void delete(String uuid) throws ODataException
{
   if (Security.currentUserHasRole(Role.DATA_MANAGER))
   {
      fr.gael.dhus.database.object.DeletedProduct p = DELETED_PRODUCT_SERVICE.getProduct(uuid);
      if (p == null)
      {
         throw new InvalidKeyException(uuid, DeletedProduct.class.getSimpleName());
      }
      DELETED_PRODUCT_SERVICE.delete(p);
   }
   else
   {
      throw new NotAllowedException();
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:17,代码来源:DeletedProduct.java


示例9: getProperty

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object getProperty(String prop_name) throws ODataException
{
   Object res;
   switch (prop_name)
   {
      case ID:
         res = id; break;
      case STATUS:
         res = status.toString(); break;
      case STATUS_MESSAGE:
         res = statusMessage; break;
      case STATUS_DATE:
         res = statusDate; break;
      case MD5:
         res = md5; break;
      case FILENAME:
         res = filename; break;
      default:
         LOGGER.warn("Requested property " + prop_name + " does not exist");
         res = null;
   }
   return res;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:25,代码来源:Ingest.java


示例10: delete

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
/**
 * Delete an instance of Ingest whose id is `id`.
 * @param id of the Ingest instance to delete.
 * @throws ODataException no Ingest was found for the given id.
 */
public static void delete(long id) throws ODataException
{
   Ingest ingest;
   if ((ingest = UPLOADS.remove(id)) == null)
   {
      throw new InvalidKeyException(String.valueOf(id), Ingest.class.getSimpleName());
   }
   else
   {
      try
      {
         Files.delete(ingest.temp_file);
      }
      catch (IOException ex)
      {
         LOGGER.error("Cannot delete ingest temp file " + ingest.temp_file, ex);
      }
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:25,代码来源:Ingest.java


示例11: navigate

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object navigate(NavigationSegment ns) throws ODataException
{
   Object res;

   if (ns.getEntitySet().getName().equals(Model.NETWORKSTATISTIC.getName()))
   {
      res = new NetworkStatistic();
   }
   else
   {
      throw new InvalidTargetException(this.getClass().getSimpleName(), ns.getEntitySet().getName());
   }

   return res;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:17,代码来源:Network.java


示例12: delete

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
public static void delete(String uuid, String cause) throws ODataException
{
   if (Security.currentUserHasRole(Role.DATA_MANAGER))
   {
      fr.gael.dhus.database.object.Product p =
            PRODUCT_SERVICE.systemGetProduct (uuid);
      if (p == null)
      {
         throw new InvalidKeyException(uuid, Product.class.getSimpleName());
      }
      PRODUCT_SERVICE.systemDeleteProduct (p.getId (), true, cause);
   }
   else
   {
      throw new NotAllowedException();
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:18,代码来源:Product.java


示例13: getProperty

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object getProperty (String prop_name) throws ODataException
{
   switch (prop_name)
   {
      case SystemRoleEntitySet.NAME:
         return role.name ();

      case SystemRoleEntitySet.DESCRIPTION:
         return role.toString ();

      default:
         throw new ODataException (
               "Property '" + prop_name + "' not found.");
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:17,代码来源:SystemRole.java


示例14: createLink

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public void createLink(UriInfo link) throws ODataException
{
   EdmEntitySet target_es = link.getTargetEntitySet();
   if (!target_es.getName().equals(Model.PRODUCT.getName()))
   {
      throw new ODataException("Cannot create link from Users to " + target_es.getName());
   }

   String pdt_uuid_s = link.getTargetKeyPredicates().get(0).getLiteral();
   fr.gael.dhus.database.object.Product pta = PRODUCT_SERVICE.getProduct(pdt_uuid_s);
   if (pta == null)
   {
      throw new InvalidKeyException(pdt_uuid_s, this.getClass().getSimpleName());
   }

   PRODUCTCART_SERVICE.addProductToCart(this.user.getUUID(), pta.getId());
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:19,代码来源:User.java


示例15: deleteLink

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public void deleteLink(DeleteUriInfo link) throws ODataException
{
   EdmEntitySet target_es = link.getTargetEntitySet();
   if (!target_es.getName().equals(Model.PRODUCT.getName()))
   {
      throw new ODataException("Cannot create link from Users to " + target_es.getName());
   }

   String pdt_uuid_s = link.getTargetKeyPredicates().get(0).getLiteral();
   fr.gael.dhus.database.object.Product pta = PRODUCT_SERVICE.getProduct(pdt_uuid_s);
   if (pta == null)
   {
      throw new InvalidKeyException(pdt_uuid_s, this.getClass().getSimpleName());
   }

   PRODUCTCART_SERVICE.removeProductFromCart(this.user.getUUID(), pta.getId());
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:19,代码来源:User.java


示例16: getTargetCollection

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
/**
 * Returns the TargetCollection, or null if there is none.
 * 
 * @return the TargetCollection.
 */
public Collection getTargetCollection () throws ODataException
{
   String target = this.syncConf.getConfig ("target_collection");
   if (target == null)
   {
      return null;
   }

   fr.gael.dhus.database.object.Collection c =
      COLLECTION_SERVICE.getCollection (target);
   if (c == null)
   {
      throw new ODataException (
         "This synchronizer references a deleted collection");
   }

   return new Collection (c);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:24,代码来源:Synchronizer.java


示例17: navigate

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object navigate(NavigationSegment ns) throws ODataException
{
   Object res;

   if (ns.getEntitySet().getName().equals(Model.COLLECTION.getName()))
   {
      res = getTargetCollection();
      if (res == null)
      {
         throw new NoTargetException(SynchronizerEntitySet.TARGET_COLLECTION);
      }
   }
   else
   {
      throw new InvalidTargetException(this.getClass().getSimpleName(), ns.getEntitySet().getName());
   }

   return res;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:21,代码来源:Synchronizer.java


示例18: getProperty

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Object getProperty (String prop_name) throws ODataException
{
   switch (prop_name)
   {
      case RestrictionEntitySet.UUID:
         return restriction.getUUID ();

      case RestrictionEntitySet.REASON:
         return restriction.getBlockingReason ();

      case RestrictionEntitySet.RESTRICTION_TYPE:
         return restriction.getClass ().getSimpleName ();

      default:
         throw new ODataException (
               "Property '" + prop_name + "' not found.");
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:20,代码来源:Restriction.java


示例19: readPropertyValue

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
/**
 * Does the navigation and calls {@link AbstractEntity#getProperty(String)}.
 * @param uri_info contains the navigation segments and the name of the property to get.
 * @return the value of requested property (may be null).
 * @throws ODataException
 */
public Object readPropertyValue(GetSimplePropertyUriInfo uri_info)
      throws ODataException
{
   KeyPredicate startKP = uri_info.getKeyPredicates().get(0);
   EdmProperty target
         = uri_info.getPropertyPath()
         .get(uri_info.getPropertyPath().size() - 1);

   T t = Navigator.<T>navigate(uri_info.getStartEntitySet(), startKP,
         uri_info.getNavigationSegments(), null);

   // Case of complex property
   String propName = target.getName();
   if (uri_info.getPropertyPath().size() > 1)
   {
      return t.getComplexProperty(
            uri_info.getPropertyPath().get(0).getName()).get(propName);
   }
   return t.getProperty(propName);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:27,代码来源:AbstractEntitySet.java


示例20: getAssociation

import org.apache.olingo.odata2.api.exception.ODataException; //导入依赖的package包/类
@Override
public Association getAssociation(FullQualifiedName edm_fq_name) throws ODataException
{
   if (edm_fq_name != null && edm_fq_name.getNamespace().equals(NAMESPACE))
   {
      String assocName = edm_fq_name.getName();
      String entity = assocName.substring(0, assocName.indexOf("_"));
      for (Association assoc: ENTITYSETS.get(AbstractEntitySet.generateEntitySetName(entity)).getAssociations())
      {
         if (assoc.getName().equals(edm_fq_name.getName()))
         {
            return assoc;
         }
      }
   }
   return null;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:18,代码来源:Model.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConfigResolveOptions类代码示例发布时间:2022-05-22
下一篇:
Java SingleSampleMediaSource类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap