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


Java ODataException类代码示例

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


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


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