本文整理汇总了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;
}
}
示例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.");
}
示例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;
}
示例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;
}
示例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;
}
示例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.");
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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();
}
}
示例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.");
}
}
示例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());
}
示例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());
}