本文整理汇总了Java中com.arangodb.ArangoDBException类的典型用法代码示例。如果您正苦于以下问题:Java ArangoDBException类的具体用法?Java ArangoDBException怎么用?Java ArangoDBException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArangoDBException类属于com.arangodb包,在下文中一共展示了ArangoDBException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.arangodb.ArangoDBException; //导入依赖的package包/类
public <T> CompletableFuture<T> execute(
final Request request,
final ResponseDeserializer<T> responseDeserializer,
final HostHandle hostHandle) {
final CompletableFuture<T> result = new CompletableFuture<>();
communication.execute(request, hostHandle).whenComplete((response, ex) -> {
if (response != null) {
try {
result.complete(responseDeserializer.deserialize(response));
} catch (final VPackException | ArangoDBException e) {
result.completeExceptionally(e);
}
} else if (ex != null) {
result.completeExceptionally(ex);
} else {
result.cancel(true);
}
});
return result;
}
示例2: queryOutboundInbound
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Test
public void queryOutboundInbound() throws ArangoDBException, InterruptedException, ExecutionException {
String queryString = "FOR v IN 1..3 OUTBOUND 'circles/E' GRAPH 'traversalGraph' return v._key";
ArangoCursorAsync<String> cursor = db.query(queryString, null, null, String.class).get();
Collection<String> result = cursor.asListRemaining();
assertThat(result.size(), is(1));
assertThat(result, hasItems("F"));
queryString = "FOR v IN 1..3 INBOUND 'circles/E' GRAPH 'traversalGraph' return v._key";
cursor = db.query(queryString, null, null, String.class).get();
result = cursor.asListRemaining();
assertThat(result.size(), is(2));
assertThat(result, hasItems("B", "A"));
queryString = "FOR v IN 1..3 ANY 'circles/E' GRAPH 'traversalGraph' return v._key";
cursor = db.query(queryString, null, null, String.class).get();
result = cursor.asListRemaining();
assertThat(result.size(), is(6));
assertThat(result, hasItems("F", "B", "C", "D", "A", "G"));
}
示例3: init
import com.arangodb.ArangoDBException; //导入依赖的package包/类
protected static void init(String dbName) {
AbstractArangoDbInterpreterTest.dbName = dbName;
arango = new ArangoDB.Builder()
.host(HOST, PORT)
.user(USERNAME).password(PASSWORD)
.build();
try {
arango.db(dbName).drop();
}
catch (final ArangoDBException e) {}
arango.createDatabase(dbName);
final Properties props = new Properties();
props.put(ArangoDbInterpreter.ARANGODB_HOST, HOST);
props.put(ArangoDbInterpreter.ARANGODB_PORT, "" + PORT);
props.put(ArangoDbInterpreter.ARANGODB_DATABASE, dbName);
props.put(ArangoDbInterpreter.ARANGODB_USER, USERNAME);
props.put(ArangoDbInterpreter.ARANGODB_PWD, PASSWORD);
interpreter = new ArangoDbInterpreter(props);
interpreter.open();
}
示例4: populate
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@BeforeClass
public static void populate() throws ArangoDBException, IOException {
init(DB_NAME);
arango.db(DB_NAME).createCollection(COLL_NAME);
for (Integer i = 0; i < 50; i++) {
final BaseDocument log = new BaseDocument();
log.setKey(i.toString());
log.addAttribute("date", new Date());
log.addAttribute("status", STATUS[RandomUtils.nextInt(STATUS.length)]);
log.addAttribute("content_length", RandomUtils.nextInt(2000));
final Map<String, Object> req = new HashMap<>();
req.put("method", METHODS[RandomUtils.nextInt(METHODS.length)]);
req.put("url", "/zeppelin/" + UUID.randomUUID().toString());
req.put("headers", Arrays.asList("Accept: *.*", "Host: apache.org"));
log.addAttribute("request", req);
arango.db(DB_NAME).collection(COLL_NAME).insertDocument(log);
}
}
示例5: getRedListSettings
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Map<String, RedListSettings> getRedListSettings(String territory) throws FloraOnException {
Map<String, Object> bindVars;
Iterator<RedListSettings> it;
Map<String, RedListSettings> out = new HashMap<>();
try {
if(territory == null) {
it = database.query(AQLRedListQueries.getString("redlistdata.9a"), null
, null, RedListSettings.class);
} else {
bindVars = new HashMap<>();
bindVars.put("terr", territory);
it = database.query(AQLRedListQueries.getString("redlistdata.9"), bindVars
, null, RedListSettings.class);
}
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
while(it.hasNext()) {
RedListSettings rls = it.next();
out.put(rls.getTerritory(), rls);
}
return out;
}
示例6: getRedListTags
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Set<String> getRedListTags(String territory) throws DatabaseException {
Set<String> out = new HashSet<>();
Object tmp;
try {
Iterator<Object> it = database.query(AQLRedListQueries.getString("redlistdata.5", territory), null
, null, Object.class);
while(it.hasNext()) {
tmp = it.next();
if(tmp != null) out.add((String) tmp);
}
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
return out;
}
示例7: addTagToRedListDataEntities
import com.arangodb.ArangoDBException; //导入依赖的package包/类
public int addTagToRedListDataEntities(String territory, String[] taxEntIds, String tag) throws FloraOnException {
Map<String, Object> bp = new HashMap<>();
bp.put("ids", taxEntIds);
Gson gs = new GsonBuilder().setPrettyPrinting().create();
/*
System.out.println(gs.toJson(bp));
System.out.println(AQLRedListQueries.getString("redlistdata.8", territory, tag));
*/
try {
ArangoCursor<String> c = database.query(AQLRedListQueries.getString("redlistdata.8", territory, tag)
, bp, new AqlQueryOptions().count(true), String.class);
return c.getCount();
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
}
示例8: getOccurrencesOfObserver
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Iterator<Inventory> getOccurrencesOfObserver(INodeKey authorId, Integer offset, Integer count) throws DatabaseException {
if(authorId == null) return getOccurrencesOfMaintainer(null, false, offset, count);
Map<String, Object> bindVars = new HashMap<>();
bindVars.put("observer", authorId.toString());
bindVars.put("off", offset == null ? 0 : offset);
bindVars.put("cou", count == null ? 999999 : count);
try {
return database.query(
AQLOccurrenceQueries.getString("occurrencequery.2")
, bindVars, null, Inventory.class);
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
}
示例9: getOccurrencesOfObserverWithinDates
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Iterator<Inventory> getOccurrencesOfObserverWithinDates(INodeKey authorId, Date from, Date to, Integer offset, Integer count) throws DatabaseException {
if(authorId == null) return getOccurrencesOfMaintainer(null, false, offset, count);
DateFormat df = Constants.dateFormatYMD.get();
Map<String, Object> bindVars = new HashMap<>();
bindVars.put("observer", authorId.toString());
bindVars.put("off", offset == null ? 0 : offset);
bindVars.put("cou", count == null ? 999999 : count);
bindVars.put("from", df.format(from));
bindVars.put("to", df.format(to));
try {
return database.query(
AQLOccurrenceQueries.getString("occurrencequery.2.date")
, bindVars, null, Inventory.class);
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
}
示例10: findInventoriesByFilter
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Iterator<Inventory> findInventoriesByFilter(String filter, INodeKey userId, Integer offset, Integer count) throws FloraOnException {
Map<String, Object> bindVars = new HashMap<>();
if(offset == null) offset = 0;
if(count == null) count = 999999;
bindVars.put("query", "%" + filter + "%");
bindVars.put("offset", offset);
bindVars.put("count", count);
if(userId != null)
bindVars.put("user", userId.toString());
try {
return database.query(
AQLOccurrenceQueries.getString(userId == null ? "occurrencequery.9a" : "occurrencequery.9")
, bindVars, null, Inventory.class);
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
}
示例11: deleteInventoriesOrOccurrences
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public int deleteInventoriesOrOccurrences(String[] inventoryId, String[] uuid) throws FloraOnException {
int count = 0;
for (int i = 0; i < inventoryId.length; i++) {
try {
if(StringUtils.isArrayEmpty(uuid) || uuid[i].trim().equals("")) {
// driver.getNodeWorkerDriver().deleteDocument(driver.asNodeKey(inventoryId[i])); // FIXME: check for connected links
driver.getNodeWorkerDriver().deleteVertexOrEdge(driver.asNodeKey(inventoryId[i]));
} else {
Inventory inv = database.query(
AQLOccurrenceQueries.getString("occurrencequery.3", inventoryId[i], uuid[i])
, null, null, Inventory.class).next();
// if the inventory became empty, delete the inventory
if(inv._getOccurrences().size() == 0)
driver.getNodeWorkerDriver().deleteDocument(driver.asNodeKey(inventoryId[i]));
}
} catch (ArangoDBException e) {
e.printStackTrace();
continue;
}
count++;
}
return count;
}
示例12: findOccurrencesByFilter
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Iterator<Inventory> findOccurrencesByFilter(String filter, INodeKey userId, Integer offset, Integer count) throws FloraOnException {
Map<String, Object> bindVars = new HashMap<>();
if(offset == null) offset = 0;
if(count == null) count = 999999;
bindVars.put("query", "%" + filter + "%");
bindVars.put("offset", offset);
bindVars.put("count", count);
if(userId != null)
bindVars.put("user", userId.toString());
try {
return database.query(
AQLOccurrenceQueries.getString(userId == null ? "occurrencequery.8a" : "occurrencequery.8")
, bindVars, null, Inventory.class);
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
}
示例13: getTaxaWithTag
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Iterator<TaxEnt> getTaxaWithTag(INodeKey userId, Date from, Date to, String territory, String tag, boolean withPhoto) throws DatabaseException {
Map<String, Object> bindVars = new HashMap<>();
DateFormat df = Constants.dateFormatYMD.get();
bindVars.put("user", userId.toString());
bindVars.put("from", df.format(from));
bindVars.put("to", df.format(to));
bindVars.put("tag", tag);
bindVars.put("@redlistcollection", "redlist_" + territory);
try {
return database.query(AQLOccurrenceQueries.getString(
withPhoto ? "occurrencereportquery.4" : "occurrencereportquery.3"), bindVars
, null, TaxEnt.class);
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
}
示例14: getTaxaWithTagCollected
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Iterator<StatisticPerTaxon> getTaxaWithTagCollected(INodeKey userId, Date from, Date to, String territory, String tag) throws DatabaseException {
Map<String, Object> bindVars = new HashMap<>();
DateFormat df = Constants.dateFormatYMD.get();
bindVars.put("user", userId.toString());
bindVars.put("from", df.format(from));
bindVars.put("to", df.format(to));
bindVars.put("tag", tag);
bindVars.put("@redlistcollection", "redlist_" + territory);
try {
return database.query(AQLOccurrenceQueries.getString("occurrencereportquery.5"), bindVars
, null, StatisticPerTaxon.class);
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
}
示例15: getTaxaWithTagEstimates
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Iterator<StatisticPerTaxon> getTaxaWithTagEstimates(INodeKey userId, Date from, Date to, String territory, String tag) throws DatabaseException {
Map<String, Object> bindVars = new HashMap<>();
DateFormat df = Constants.dateFormatYMD.get();
bindVars.put("user", userId.toString());
bindVars.put("from", df.format(from));
bindVars.put("to", df.format(to));
bindVars.put("tag", tag);
bindVars.put("@redlistcollection", "redlist_" + territory);
try {
return database.query(AQLOccurrenceQueries.getString("occurrencereportquery.7"), bindVars
, null, StatisticPerTaxon.class);
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
}