本文整理汇总了Java中com.arangodb.ArangoDBException类的典型用法代码示例。如果您正苦于以下问题:Java ArangoDBException类的具体用法?Java ArangoDBException怎么用?Java ArangoDBException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArangoDBException类属于com.arangodb包,在下文中一共展示了ArangoDBException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:21,代码来源:ArangoExecutorAsync.java
示例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"));
}
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:22,代码来源:GraphTraversalsInAQLExample.java
示例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();
}
开发者ID:bbonnin,项目名称:zeppelin-arangodb-interpreter,代码行数:26,代码来源:AbstractArangoDbInterpreterTest.java
示例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);
}
}
开发者ID:bbonnin,项目名称:zeppelin-arangodb-interpreter,代码行数:23,代码来源:ArangoDbInterpreterTest.java
示例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;
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:25,代码来源:RedListDataArangoDBDriver.java
示例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;
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:17,代码来源:RedListDataArangoDBDriver.java
示例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());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:17,代码来源:RedListDataArangoDBDriver.java
示例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());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:17,代码来源:OccurrenceArangoDriver.java
示例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());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:20,代码来源:OccurrenceArangoDriver.java
示例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());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:20,代码来源:OccurrenceArangoDriver.java
示例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;
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:25,代码来源:OccurrenceArangoDriver.java
示例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());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:20,代码来源:OccurrenceArangoDriver.java
示例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());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:18,代码来源:OccurrenceReportArangoDriver.java
示例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());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:17,代码来源:OccurrenceReportArangoDriver.java
示例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());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:17,代码来源:OccurrenceReportArangoDriver.java
示例16: getRedListSheetsIsCollaborator
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public Iterator<TaxEnt> getRedListSheetsIsCollaborator(INodeKey userId, String territory, @NotNull TypeOfCollaboration typeOfCollaboration) throws DatabaseException {
Map<String, Object> bindVars = new HashMap<>();
bindVars.put("user", userId.toString());
bindVars.put("@redlistcollection", "redlist_" + territory);
if(typeOfCollaboration == null) return Collections.emptyIterator();
try {
switch (typeOfCollaboration) {
case TEXTAUTHOR:
return database.query(AQLOccurrenceQueries.getString("reportquery.1"), bindVars, null, TaxEnt.class);
case ASSESSOR:
return database.query(AQLOccurrenceQueries.getString("reportquery.1a"), bindVars, null, TaxEnt.class);
case REVIEWER:
return database.query(AQLOccurrenceQueries.getString("reportquery.1b"), bindVars, null, TaxEnt.class);
default: return Collections.emptyIterator();
}
} catch (ArangoDBException e) {
throw new DatabaseException(e.getMessage());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:24,代码来源:OccurrenceReportArangoDriver.java
示例17: getUser
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public User getUser(String name) throws FloraOnException {
if(name == null) return null;
ArangoCursor<User> cur;
Map<String, Object> bind = new HashMap<>();
bind.put("name", name);
try {
cur = database.query(AQLQueries.getString("Administration.4"), bind
, new AqlQueryOptions().count(true), User.class);
if(!cur.hasNext()) return null;
if(cur.getCount() > 1) throw new FloraOnException(Messages.getString("error.1", name));
return cur.next();
} catch (ArangoDBException e) {
throw new FloraOnException(e.getMessage());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:17,代码来源:Administration.java
示例18: initializeNewDatabase
import com.arangodb.ArangoDBException; //导入依赖的package包/类
/**
* Initializes a new database from scratch. Creates collections, graphs, etc.
* @param dbname
* @throws ArangoDBException
*/
private void initializeNewDatabase(String dbname) throws ArangoDBException {
System.out.println("Initializing a fresh new database");
/* UserEntity ue;
ue=new UserEntity();*/
UserEntity[] ue=new UserEntity[0];
driver.createDatabase(dbname);
database = driver.db(dbname);
checkCollections();
createTaxonomicGraph();
// database.collection(NodeTypes.specieslist.toString()).createGeoIndex(Arrays.asList("location"), new GeoIndexOptions().geoJson(false));
database.collection(NodeTypes.inventory.toString()).createGeoIndex(Arrays.asList("latitude", "longitude"), new GeoIndexOptions().geoJson(false));
// database.collection(NodeTypes.author.toString()).createHashIndex(Arrays.asList("idAut"), new HashIndexOptions().unique(true).sparse(false));
database.collection(NodeTypes.taxent.toString()).createHashIndex(Arrays.asList("oldId"), new HashIndexOptions().unique(false).sparse(true));
database.collection(NodeTypes.taxent.toString()).createHashIndex(Arrays.asList("rank"), new HashIndexOptions().unique(false).sparse(true));
database.collection(NodeTypes.taxent.toString()).createHashIndex(Arrays.asList("isSpeciesOrInf"), new HashIndexOptions().unique(false).sparse(false));
database.collection(NodeTypes.taxent.toString()).createHashIndex(Arrays.asList("name"), new HashIndexOptions().unique(false).sparse(true));
database.collection(NodeTypes.taxent.toString()).createFulltextIndex(Arrays.asList("name"), new FulltextIndexOptions());
database.collection(NodeTypes.territory.toString()).createHashIndex(Arrays.asList("shortName"), new HashIndexOptions().unique(true).sparse(false));
database.collection(NodeTypes.user.toString()).createHashIndex(Arrays.asList("userName"), new HashIndexOptions().unique(true).sparse(false));
database.collection(NodeTypes.toponym.toString()).createFulltextIndex(Collections.singleton("locality"), new FulltextIndexOptions().minLength(1));
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:29,代码来源:FloraOnArangoDriver.java
示例19: setNativeStatus
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public int setNativeStatus(INodeKey territory, NativeStatus status, OccurrenceStatus occurrenceStatus, AbundanceLevel abundanceLevel, PlantIntroducedStatus introducedStatus, PlantNaturalizationDegree naturalizationDegree, Boolean uncertainOccurrenceStatus) throws FloraOnException {
String query;
if(status == null) { // remove the EXISTS_IN link, if it exists
query=String.format(
AQLQueries.getString("TaxEntWrapperDriver.6")
,thisNode.toString()
,territory.toString());
} else { // create or update the EXISTS_IN link
EXISTS_IN eIn=new EXISTS_IN(status, occurrenceStatus, abundanceLevel, introducedStatus, naturalizationDegree, uncertainOccurrenceStatus, thisNode.toString(), territory.toString());
query=String.format(
AQLQueries.getString("TaxEntWrapperDriver.7")
,thisNode.toString()
,territory.toString()
,eIn.toJson().toString());
}
try {
return database.query(query,null,null,Integer.class).next();
} catch (ArangoDBException | NoSuchElementException e) {
throw new DatabaseException(e.getMessage());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:24,代码来源:TaxEntWrapperDriver.java
示例20: createRelationshipTo
import com.arangodb.ArangoDBException; //导入依赖的package包/类
@Override
public GraphUpdateResult createRelationshipTo(INodeKey parent,RelTypes type) throws FloraOnException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
String baseId=node.toString();
String parentId=parent.toString();
// checks whether there is already a relation of this type between these two nodes
String query=String.format(
"FOR e IN %3$s FILTER e._from=='%1$s' && e._to=='%2$s' COLLECT WITH COUNT INTO l RETURN l"
,baseId,parentId,type.toString());
try {
Integer nrel=database.query(query, null, null, Integer.class).next();
if(nrel==0) {
return new GraphUpdateResult(driver, new String[] {
// dbDriver.createEdge(type.toString(), type.getEdge(), baseId, parentId, false).getDocumentHandle()
database.graph(Constants.TAXONOMICGRAPHNAME).edgeCollection(type.toString()).insertEdge(type.getEdge(baseId, parentId)).getId()
, baseId, parentId
});
} else return GraphUpdateResult.emptyResult();
} catch (ArangoDBException | NoSuchElementException e) {
throw new DatabaseException(e.getMessage());
}
}
开发者ID:miguel-porto,项目名称:flora-on-server,代码行数:24,代码来源:NodeWrapperDriver.java
注:本文中的com.arangodb.ArangoDBException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论