Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2012 tamtam180
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.arangodb;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.arangodb.entity.AdminLogEntity;
import com.arangodb.entity.AqlFunctionsEntity;
import com.arangodb.entity.ArangoUnixTime;
import com.arangodb.entity.ArangoVersion;
import com.arangodb.entity.BatchResponseEntity;
import com.arangodb.entity.BooleanResultEntity;
import com.arangodb.entity.CollectionEntity;
import com.arangodb.entity.CollectionKeyOption;
import com.arangodb.entity.CollectionOptions;
import com.arangodb.entity.CollectionsEntity;
import com.arangodb.entity.CursorEntity;
import com.arangodb.entity.DatabaseEntity;
import com.arangodb.entity.DefaultEntity;
import com.arangodb.entity.DeletedEntity;
import com.arangodb.entity.DocumentEntity;
import com.arangodb.entity.DocumentResultEntity;
import com.arangodb.entity.EdgeDefinitionEntity;
import com.arangodb.entity.EdgeEntity;
import com.arangodb.entity.Endpoint;
import com.arangodb.entity.GraphEntity;
import com.arangodb.entity.GraphsEntity;
import com.arangodb.entity.ImportResultEntity;
import com.arangodb.entity.IndexEntity;
import com.arangodb.entity.IndexType;
import com.arangodb.entity.IndexesEntity;
import com.arangodb.entity.JobsEntity;
import com.arangodb.entity.PlainEdgeEntity;
import com.arangodb.entity.Policy;
import com.arangodb.entity.QueriesResultEntity;
import com.arangodb.entity.QueryCachePropertiesEntity;
import com.arangodb.entity.QueryTrackingPropertiesEntity;
import com.arangodb.entity.ReplicationApplierConfigEntity;
import com.arangodb.entity.ReplicationApplierStateEntity;
import com.arangodb.entity.ReplicationInventoryEntity;
import com.arangodb.entity.ReplicationLoggerConfigEntity;
import com.arangodb.entity.ReplicationLoggerStateEntity;
import com.arangodb.entity.ReplicationSyncEntity;
import com.arangodb.entity.RestrictType;
import com.arangodb.entity.ScalarExampleEntity;
import com.arangodb.entity.ShortestPathEntity;
import com.arangodb.entity.SimpleByResultEntity;
import com.arangodb.entity.StatisticsDescriptionEntity;
import com.arangodb.entity.StatisticsEntity;
import com.arangodb.entity.StringsResultEntity;
import com.arangodb.entity.TransactionEntity;
import com.arangodb.entity.TransactionResultEntity;
import com.arangodb.entity.TraversalEntity;
import com.arangodb.entity.UserEntity;
import com.arangodb.entity.marker.VertexEntity;
import com.arangodb.http.BatchHttpManager;
import com.arangodb.http.BatchPart;
import com.arangodb.http.HttpManager;
import com.arangodb.http.InvocationHandlerImpl;
import com.arangodb.impl.ImplFactory;
import com.arangodb.impl.InternalBatchDriverImpl;
import com.arangodb.util.AqlQueryOptions;
import com.arangodb.util.DumpHandler;
import com.arangodb.util.GraphEdgesOptions;
import com.arangodb.util.GraphVerticesOptions;
import com.arangodb.util.JsonUtils;
import com.arangodb.util.MapBuilder;
import com.arangodb.util.ShortestPathOptions;
import com.arangodb.util.TraversalQueryOptions;
/**
* ArangoDB driver. All of the functionality to use ArangoDB is provided via
* this class.
*
* @author tamtam180 - kirscheless at gmail.com
* @author gschwab
* @author fbartels
* @author a-brandt
*
* @version 2.2.
*
* @see ArangoDB
* documentation
*/
public class ArangoDriver extends BaseArangoDriver {
private static final String GRAPH_NAME = "graphName";
private static final String VERTEX_EXAMPLE = "vertexExample";
private ArangoConfigure configure;
private BatchHttpManager httpManager;
private InternalCursorDriver cursorDriver;
private InternalBatchDriverImpl batchDriver;
private InternalCollectionDriver collectionDriver;
private InternalDocumentDriver documentDriver;
private InternalIndexDriver indexDriver;
private InternalAdminDriver adminDriver;
private InternalJobsDriver jobsDriver;
private InternalAqlFunctionsDriver aqlFunctionsDriver;
private InternalSimpleDriver simpleDriver;
private InternalUsersDriver usersDriver;
private InternalImportDriver importDriver;
private InternalDatabaseDriver databaseDriver;
private InternalEndpointDriver endpointDriver;
private InternalReplicationDriver replicationDriver;
private InternalGraphDriver graphDriver;
private InternalEdgeDriver edgeDriver;
private InternalTransactionDriver transactionDriver;
private InternalTraversalDriver traversalDriver;
private InternalQueryCacheDriver queryCacheDriver;
private String database;
/**
* Constructor to create an instance of the driver that uses the default
* database.
*
* @param configure
* A configuration object.
*/
public ArangoDriver(ArangoConfigure configure) {
this(configure, null);
}
/**
* Constructor to create an instance of the driver that uses the provided
* database.
*
* @param configure
* A configuration object.
* @param database
* the name of the database that will be used.
*/
public ArangoDriver(ArangoConfigure configure, String database) {
this.database = configure.getDefaultDatabase();
if (database != null) {
this.database = database;
}
this.configure = configure;
this.httpManager = configure.getHttpManager();
this.createModuleDrivers(false);
}
/**
* This method enables batch execution. Until 'cancelBatchMode' or
* 'executeBatch' is called every other call is stacked and will be either
* executed or discarded when the batch mode is canceled. Each call will
* return a 'requestId' in the HTTP response, that can be used to select the
* matching result from the batch execution.
*
* @see com.arangodb.ArangoDriver#cancelBatchMode()
* @see ArangoDriver#executeBatch()
* @see ArangoDriver#getBatchResponseByRequestId(String)
* @throws com.arangodb.ArangoException
*/
public void startBatchMode() throws ArangoException {
if (this.httpManager.isBatchModeActive()) {
throw new ArangoException("BatchMode is already active.");
}
this.httpManager.emptyCallStack();
this.httpManager.setBatchModeActive(true);
this.createModuleDrivers(true);
}
/**
* This method sets the driver to asynchronous execution. If the parameter
* 'fireAndforget' is set to true each call to ArangoDB will be send without
* a return value. If set to false the return value will be the 'job id'.
* Each job result can be received by the method 'getJobResult'.
*
* @param fireAndForget
* if set to true the asynchronous mode is set to 'fire and
* forget'.
* @see ArangoDriver#stopAsyncMode()
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobs(com.arangodb.entity.JobsEntity.JobState,
* int)
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
* @throws com.arangodb.ArangoException
*/
public void startAsyncMode(boolean fireAndForget) throws ArangoException {
if (this.httpManager.getHttpMode().equals(HttpManager.HttpMode.ASYNC)
|| this.httpManager.getHttpMode().equals(HttpManager.HttpMode.FIREANDFORGET)) {
throw new ArangoException("Arango driver already set to asynchronous mode.");
}
HttpManager.HttpMode mode = fireAndForget ? HttpManager.HttpMode.FIREANDFORGET : HttpManager.HttpMode.ASYNC;
this.httpManager.setHttpMode(mode);
this.createModuleDrivers(true);
this.httpManager.resetJobs();
}
/**
* This method sets the driver back to synchronous execution.
*
* @see ArangoDriver#startAsyncMode(boolean)
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobs(com.arangodb.entity.JobsEntity.JobState,
* int)
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
* @throws com.arangodb.ArangoException
*/
public void stopAsyncMode() throws ArangoException {
if (this.httpManager.getHttpMode().equals(HttpManager.HttpMode.SYNC)) {
throw new ArangoException("Arango driver already set to synchronous mode.");
}
this.httpManager.setHttpMode(HttpManager.HttpMode.SYNC);
this.createModuleDrivers(false);
}
/**
* Returns the identifier of the last asynchronous executed job.
*
* @return String the identifier
* @see ArangoDriver#startAsyncMode(boolean)
* @see ArangoDriver#stopAsyncMode()
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobs(com.arangodb.entity.JobsEntity.JobState,
* int)
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
*/
public String getLastJobId() {
return this.httpManager.getLastJobId();
}
/**
* Returns a list of all job identifiers of asynchronous executed jobs.
*
* @return List the list of all job identifiers
* @see ArangoDriver#startAsyncMode(boolean)
* @see ArangoDriver#stopAsyncMode()
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobs(com.arangodb.entity.JobsEntity.JobState,
* int)
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
*/
public List getJobIds() {
return this.httpManager.getJobIds();
}
/**
* Returns a list of all job identifiers of asynchronous executed jobs,
* filtered by job state.
*
* @param jobState
* the job state as a filter.
* @param count
* a limit for the result set.
* @return List list of all job identifiers
* @see ArangoDriver#startAsyncMode(boolean)
* @see ArangoDriver#stopAsyncMode()
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobIds()
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
*/
public List getJobs(JobsEntity.JobState jobState, int count) throws ArangoException {
return this.jobsDriver.getJobs(getDefaultDatabase(), jobState, count);
}
/**
* Returns a list of all job identifiers of asynchronous executed jobs,
* filtered by job state.
*
*
* @param jobState
* the job state as a filter.
* @return List list of all job identifiers
* @see ArangoDriver#startAsyncMode(boolean)
* @see ArangoDriver#stopAsyncMode()
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobIds()
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
*/
public List getJobs(JobsEntity.JobState jobState) throws ArangoException {
return this.jobsDriver.getJobs(getDefaultDatabase(), jobState);
}
/**
* Deletes all job from ArangoDB.
*
* @see ArangoDriver#startAsyncMode(boolean)
* @see ArangoDriver#stopAsyncMode()
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobIds()
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
*/
public void deleteAllJobs() throws ArangoException {
this.jobsDriver.deleteAllJobs(getDefaultDatabase());
this.httpManager.resetJobs();
}
/**
* Deletes a job from ArangoDB.
*
* @param jobId
* the identifier of the job
* @see ArangoDriver#startAsyncMode(boolean)
* @see ArangoDriver#stopAsyncMode()
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobIds()
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
*/
public void deleteJobById(String jobId) throws ArangoException {
this.jobsDriver.deleteJobById(getDefaultDatabase(), jobId);
}
/**
* Deletes all jobs by a provided expiration date.
*
* @param timeStamp
* a unix timestamp, every older job is deleted.
* @see ArangoDriver#startAsyncMode(boolean)
* @see ArangoDriver#stopAsyncMode()
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobIds()
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
*/
public void deleteExpiredJobs(int timeStamp) throws ArangoException {
this.jobsDriver.deleteExpiredJobs(getDefaultDatabase(), timeStamp);
}
/**
* Returns the job result for a given job id.
*
* @param jobId
* the job id.
* @return - A generic return value, containing the job result
* @see ArangoDriver#startAsyncMode(boolean)
* @see ArangoDriver#stopAsyncMode()
* @see com.arangodb.ArangoDriver#getJobResult(String)
* @see com.arangodb.ArangoDriver#getJobIds()
* @see com.arangodb.ArangoDriver#deleteExpiredJobs(int)
* @see ArangoDriver#getLastJobId()
*/
public T getJobResult(String jobId) throws ArangoException {
return this.jobsDriver.getJobResult(getDefaultDatabase(), jobId);
}
/**
* This method sends all stacked requests as batch to ArangoDB.
*
* @see ArangoDriver#startBatchMode()
* @see com.arangodb.ArangoDriver#cancelBatchMode()
* @throws com.arangodb.ArangoException
*/
public DefaultEntity executeBatch() throws ArangoException {
if (!this.httpManager.isBatchModeActive()) {
throw new ArangoException("BatchMode is not active.");
}
List callStack = this.httpManager.getCallStack();
this.cancelBatchMode();
return this.batchDriver.executeBatch(callStack, this.getDefaultDatabase());
}
/**
* This method returns the result of a call to ArangoDB executed within a
* batch request.
*
* @param requestId
* the id of a request.
* @return - A generic return value, containing the result.
* @see ArangoDriver#startBatchMode()
* @see ArangoDriver#executeBatch()
* @see com.arangodb.ArangoDriver#cancelBatchMode()
* @throws com.arangodb.ArangoException
*/
@SuppressWarnings("unchecked")
public T getBatchResponseByRequestId(String requestId) throws ArangoException {
BatchResponseEntity batchResponseEntity = this.batchDriver.getBatchResponseListEntity()
.getResponseFromRequestId(requestId);
try {
this.httpManager.setPreDefinedResponse(batchResponseEntity.getHttpResponseEntity());
T result = (T) batchResponseEntity.getInvocationObject().getMethod().invoke(
batchResponseEntity.getInvocationObject().getArangoDriver(),
batchResponseEntity.getInvocationObject().getArgs());
this.httpManager.setPreDefinedResponse(null);
return result;
} catch (InvocationTargetException e) {
T result = (T) createEntity(batchResponseEntity.getHttpResponseEntity(), DefaultEntity.class);
this.httpManager.setPreDefinedResponse(null);
return result;
} catch (Exception e) {
this.httpManager.setPreDefinedResponse(null);
throw new ArangoException(e);
}
}
/**
* This method cancels the batch execution mode. All stacked calls are
* discarded.
*
* @see ArangoDriver#startBatchMode()
* @see ArangoDriver#executeBatch()
* @throws com.arangodb.ArangoException
*/
public void cancelBatchMode() throws ArangoException {
if (!this.httpManager.isBatchModeActive()) {
throw new ArangoException("BatchMode is not active.");
}
this.httpManager.setBatchModeActive(false);
this.createModuleDrivers(false);
this.httpManager.emptyCallStack();
this.httpManager.setPreDefinedResponse(null);
}
/**
* Returns the default database.
*
* @return String
*/
public String getDefaultDatabase() {
return database;
}
/**
* Sets the default database.
*
* @param database
*/
public void setDefaultDatabase(String database) {
this.database = database;
}
/**
* Creates a new collection.
*
* @param name
* the name of the collection
* @return CollectionEntity - the created collectionEntity.
* @throws ArangoException
*/
public CollectionEntity createCollection(String name) throws ArangoException {
return collectionDriver.createCollection(getDefaultDatabase(), name, new CollectionOptions());
}
/**
* Creates a new collection.
*
* @param name
* the name of the collection
* @param collectionOptions
* an object containing the various options.
* @return CollectionEntity - the created collectionEntity.
* @throws ArangoException
*/
public CollectionEntity createCollection(String name, CollectionOptions collectionOptions) throws ArangoException {
return collectionDriver.createCollection(getDefaultDatabase(), name, collectionOptions);
}
/**
* Returns a collection from ArangoDB by id
*
* @param id
* the id of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollection(long id) throws ArangoException {
return getCollection(String.valueOf(id));
}
/**
* Returns a collection from ArangoDB by name
*
* @param name
* the name of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollection(String name) throws ArangoException {
return collectionDriver.getCollection(getDefaultDatabase(), name);
}
/**
* Returns a collection from ArangoDB including all properties by id
*
* @param id
* the id of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollectionProperties(long id) throws ArangoException {
return getCollectionProperties(String.valueOf(id));
}
/**
* Returns a collection from ArangoDB including all properties by name
*
* @param name
* the name of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollectionProperties(String name) throws ArangoException {
return collectionDriver.getCollectionProperties(getDefaultDatabase(), name);
}
/**
* Returns a collection from ArangoDB including revision by id
*
* @param id
* the identifier of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollectionRevision(long id) throws ArangoException {
return getCollectionRevision(String.valueOf(id));
}
/**
* Returns a collection from ArangoDB including revision by name
*
* @param name
* the name of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollectionRevision(String name) throws ArangoException {
return collectionDriver.getCollectionRevision(getDefaultDatabase(), name);
}
/**
* Returns a collection from ArangoDB by id including the document count
*
* @param id
* the id of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollectionCount(long id) throws ArangoException {
return getCollectionCount(String.valueOf(id));
}
/**
* Returns a collection from ArangoDB by name including the document count
*
* @param name
* the name of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollectionCount(String name) throws ArangoException {
return collectionDriver.getCollectionCount(getDefaultDatabase(), name);
}
/**
* Returns a collection from ArangoDB by id including the collection figures
*
* @param id
* the id of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollectionFigures(long id) throws ArangoException {
return getCollectionFigures(String.valueOf(id));
}
/**
* Returns a collection from ArangoDB by name including the collection
* figures
*
* @param name
* the name of the collection.
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollectionFigures(String name) throws ArangoException {
return collectionDriver.getCollectionFigures(getDefaultDatabase(), name);
}
/**
* Returns a collection from ArangoDB by name including the collection
* checksum
*
* @param name
* the id of the collection.
* @param withRevisions
* includes the revision into the checksum calculation
* @param withData
* includes the collections data into the checksum calculation
* @return CollectionEntity - the requested collectionEntity.
* @throws ArangoException
*/
public CollectionEntity getCollectionChecksum(String name, Boolean withRevisions, Boolean withData)
throws ArangoException {
return collectionDriver.getCollectionChecksum(getDefaultDatabase(), name, withRevisions, withData);
}
/**
* Returns all collections from ArangoDB
*
* @return CollectionsEntity - the CollectionsEntity.
* @throws ArangoException
*/
public CollectionsEntity getCollections() throws ArangoException {
return collectionDriver.getCollections(getDefaultDatabase(), null);
}
/**
* Returns all collections from ArangoDB
*
* @param excludeSystem
* if set to true system collections will not be added to the
* result
* @return CollectionsEntity - the CollectionsEntity.
* @throws ArangoException
*/
public CollectionsEntity getCollections(Boolean excludeSystem) throws ArangoException {
return collectionDriver.getCollections(getDefaultDatabase(), excludeSystem);
}
/**
* Returns the collection and loads it into memory.
*
* @param id
* the id of the collection.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity loadCollection(long id) throws ArangoException {
return collectionDriver.loadCollection(getDefaultDatabase(), String.valueOf(id), null);
}
/**
* Returns the collection and loads it into memory.
*
* @param name
* the name of the collection.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity loadCollection(String name) throws ArangoException {
return collectionDriver.loadCollection(getDefaultDatabase(), name, null);
}
/**
* Returns the collection and loads it into memory.
*
* @param id
* the id of the collection.
* @param count
* if set to true the documents count is returned.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity loadCollection(long id, Boolean count) throws ArangoException {
return collectionDriver.loadCollection(getDefaultDatabase(), String.valueOf(id), count);
}
/**
* Returns the collection and loads it into memory.
*
* @param name
* the name of the collection.
* @param count
* if set to true the documents count is returned.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity loadCollection(String name, Boolean count) throws ArangoException {
return collectionDriver.loadCollection(getDefaultDatabase(), name, count);
}
/**
* Returns the collection and deletes it from memory.
*
* @param id
* the id of the collection.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity unloadCollection(long id) throws ArangoException {
return unloadCollection(String.valueOf(id));
}
/**
* Returns the collection and deletes it from memory.
*
* @param name
* the name of the collection.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity unloadCollection(String name) throws ArangoException {
return collectionDriver.unloadCollection(getDefaultDatabase(), name);
}
/**
* Returns the collection and deletes all documents.
*
* @param id
* the id of the collection.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity truncateCollection(long id) throws ArangoException {
return truncateCollection(String.valueOf(id));
}
/**
* Returns the collection and deletes all documents.
*
* @param name
* the name of the collection.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity truncateCollection(String name) throws ArangoException {
return collectionDriver.truncateCollection(getDefaultDatabase(), name);
}
/**
* Returns the collection and changes it's journalSize and waitForSync.
*
* @param id
* the id of the collection.
* @param newWaitForSync
* a new value for the waitForSyncProperty
* @param journalSize
* a new value for the collections journalSize
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity setCollectionProperties(long id, Boolean newWaitForSync, Long journalSize)
throws ArangoException {
return collectionDriver.setCollectionProperties(getDefaultDatabase(), String.valueOf(id), newWaitForSync,
journalSize);
}
/**
* Returns the collection and changes it's journalSize and waitForSync.
*
* @param name
* the name of the collection.
* @param newWaitForSync
* a new value for the waitForSyncProperty
* @param journalSize
* a new value for the collections journalSize
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity setCollectionProperties(String name, Boolean newWaitForSync, Long journalSize)
throws ArangoException {
return collectionDriver.setCollectionProperties(getDefaultDatabase(), name, newWaitForSync, journalSize);
}
/**
* Returns the collection and changes it's name.
*
* @param id
* the id of the collection.
* @param newName
* the new name for the collection
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity renameCollection(long id, String newName) throws ArangoException {
return renameCollection(String.valueOf(id), newName);
}
/**
* Returns the collection and changes it's name.
*
* @param name
* the name of the collection.
* @param newName
* the new name for the collection
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity renameCollection(String name, String newName) throws ArangoException {
return collectionDriver.renameCollection(getDefaultDatabase(), name, newName);
}
/**
* Deletes a collection by id.
*
* @param id
* the id of the collection.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity deleteCollection(long id) throws ArangoException {
return deleteCollection(String.valueOf(id));
}
/**
* Deletes a collection by name.
*
* @param name
* the name of the collection.
* @return CollectionEntity - the collectionEntity.
* @throws ArangoException
*/
public CollectionEntity deleteCollection(String name) throws ArangoException {
return collectionDriver.deleteCollection(getDefaultDatabase(), name);
}
/**
* Creates a document in the collection defined by The collection id
*
* @param collectionId
* The id of the collection
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> createDocument(long collectionId, Object value) throws ArangoException {
return createDocument(String.valueOf(collectionId), value, null, null);
}
/**
* Creates a document in the collection defined by the collection's name
*
* @param collectionName
* The name of the collection
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity createDocument(String collectionName, T value) throws ArangoException {
return documentDriver.createDocument(getDefaultDatabase(), collectionName, null, value, null, null);
}
/**
* Creates a document in the collection defined by the collection's name.
* This method allows to define to documents key. Note that the collection's
* property CollectionKeyOption.allowUserKeys has to be set accordingly.
*
* @param collectionId
* The id of the collection
* @param documentKey
* the desired document key
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
* @see CollectionKeyOption#allowUserKeys
*/
public DocumentEntity> createDocument(long collectionId, String documentKey, Object value)
throws ArangoException {
return createDocument(String.valueOf(collectionId), documentKey, value, null, null);
}
/**
* Creates a document in the collection defined by the collection's name.
* This method allows to define to documents key. Note that the collection's
* property CollectionKeyOption.allowUserKeys has to be set accordingly.
*
* @param collectionName
* The name of the collection
* @param documentKey
* the desired document key
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
* @see CollectionKeyOption#allowUserKeys
*/
public DocumentEntity createDocument(String collectionName, String documentKey, T value)
throws ArangoException {
return documentDriver.createDocument(getDefaultDatabase(), collectionName, documentKey, value, null, null);
}
/**
* Creates a document in the collection defined by The collection id.
*
* @param collectionId
* The id of the collection
* @param value
* An object containing the documents attributes
* @param createCollection
* if set to true the collection is created if it does not exist
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @return DocumentEntity>
* @throws ArangoException
* @see CollectionKeyOption#allowUserKeys
*/
public DocumentEntity createDocument(
long collectionId,
T value,
Boolean createCollection,
Boolean waitForSync) throws ArangoException {
return createDocument(String.valueOf(collectionId), value, createCollection, waitForSync);
}
/**
* Creates a document in the collection defined by the collection's name.
*
* @param collectionName
* The name of the collection
* @param value
* An object containing the documents attributes
* @param createCollection
* if set to true the collection is created if it does not exist
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @return DocumentEntity>
* @throws ArangoException
* @see CollectionKeyOption#allowUserKeys
*/
public DocumentEntity createDocument(
String collectionName,
T value,
Boolean createCollection,
Boolean waitForSync) throws ArangoException {
return documentDriver.createDocument(getDefaultDatabase(), collectionName, null, value, createCollection,
waitForSync);
}
/**
* Creates a document in the collection defined by the collection's id. This
* method allows to define to documents key. Note that the collection's
* property CollectionKeyOption.allowUserKeys has to be set accordingly.
*
* @param collectionId
* The id of the collection
* @param documentKey
* the desired document key
* @param value
* An object containing the documents attributes
* @param createCollection
* if set to true the collection is created if it does not exist
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @return DocumentEntity>
* @throws ArangoException
* @see CollectionKeyOption#allowUserKeys
*/
public DocumentEntity> createDocument(
long collectionId,
String documentKey,
Object value,
Boolean createCollection,
Boolean waitForSync) throws ArangoException {
return createDocument(String.valueOf(collectionId), documentKey, value, createCollection, waitForSync);
}
/**
* Creates a document in the collection defined by the collection's name.
* This method allows to define to documents key. Note that the collection's
* property CollectionKeyOption.allowUserKeys has to be set accordingly.
*
* @param collectionName
* The name of the collection
* @param documentKey
* the desired document key
* @param value
* An object containing the documents attributes
* @param createCollection
* if set to true the collection is created if it does not exist
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @return DocumentEntity>
* @throws ArangoException
* @see CollectionKeyOption#allowUserKeys
*/
public DocumentEntity createDocument(
String collectionName,
String documentKey,
T value,
Boolean createCollection,
Boolean waitForSync) throws ArangoException {
return documentDriver.createDocument(getDefaultDatabase(), collectionName, documentKey, value, createCollection,
waitForSync);
}
/**
* This method replaces the content of the document defined by documentId.
*
* @param collectionId
* The collection's id.
* @param documentId
* The document's id.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> replaceDocument(long collectionId, long documentId, Object value) throws ArangoException {
return replaceDocument(createDocumentHandle(collectionId, String.valueOf(documentId)), value, null, null, null);
}
/**
* This method replaces the content of the document defined by documentId.
*
* @param collectionName
* The collection's name.
* @param documentId
* The document's id.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity replaceDocument(String collectionName, long documentId, T value)
throws ArangoException {
return replaceDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, null, null,
null);
}
/**
* This method replaces the content of the document defined by documentKey.
*
* @param collectionId
* The collection's id.
* @param documentKey
* The document's key.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity replaceDocument(long collectionId, String documentKey, T value)
throws ArangoException {
return replaceDocument(createDocumentHandle(collectionId, documentKey), value, null, null, null);
}
/**
* This method replaces the content of the document defined by documentKey.
*
* @param collectionName
* The collection's name.
* @param documentKey
* The document's key.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity replaceDocument(String collectionName, String documentKey, T value)
throws ArangoException {
return replaceDocument(createDocumentHandle(collectionName, documentKey), value, null, null, null);
}
/**
* This method replaces the content of the document defined by
* documentHandle.
*
* @param documentHandle
* The document handle.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity replaceDocument(String documentHandle, T value) throws ArangoException {
return documentDriver.replaceDocument(getDefaultDatabase(), documentHandle, value, null, null, null);
}
/**
* This method replaces the content of the document defined by documentId.
* This method offers a parameter rev (revision). If the revision of the
* document on the server does not match the given revision the policy
* parameter is used. If it is set to *last* the operation is performed
* anyway. if it is set to *error* an error is thrown.
*
* @param collectionId
* The collection's id.
* @param documentId
* The document's id.
* @param value
* An object containing the new attributes of the document.
* @param rev
* the desired revision.
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @return DocumentEntity a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity replaceDocument(
long collectionId,
long documentId,
T value,
Long rev,
Policy policy,
Boolean waitForSync) throws ArangoException {
return replaceDocument(createDocumentHandle(collectionId, String.valueOf(documentId)), value, rev, policy,
waitForSync);
}
/**
* This method replaces the content of the document defined by documentId.
* This method offers a parameter rev (revision). If the revision of the
* document on the server does not match the given revision the policy
* parameter is used. If it is set to *last* the operation is performed
* anyway. if it is set to *error* an error is thrown.
*
* @param collectionName
* The collection's name.
* @param documentId
* The document's id.
* @param value
* An object containing the new attributes of the document.
* @param rev
* the desired revision.
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> replaceDocument(
String collectionName,
long documentId,
Object value,
Long rev,
Policy policy,
Boolean waitForSync) throws ArangoException {
return replaceDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, rev, policy,
waitForSync);
}
/**
* This method replaces the content of the document defined by documentKey.
* This method offers a parameter rev (revision). If the revision of the
* document on the server does not match the given revision the policy
* parameter is used. If it is set to *last* the operation is performed
* anyway. if it is set to *error* an error is thrown.
*
* @param collectionId
* The collection's id.
* @param documentKey
* The document's key.
* @param value
* An object containing the new attributes of the document.
* @param rev
* the desired revision.
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> replaceDocument(
long collectionId,
String documentKey,
Object value,
Long rev,
Policy policy,
Boolean waitForSync) throws ArangoException {
return replaceDocument(createDocumentHandle(collectionId, documentKey), value, rev, policy, waitForSync);
}
/**
* This method replaces the content of the document defined by documentKey.
* This method offers a parameter rev (revision). If the revision of the
* document on the server does not match the given revision the policy
* parameter is used. If it is set to *last* the operation is performed
* anyway. if it is set to *error* an error is thrown.
*
* @param collectionName
* The collection's name.
* @param documentKey
* The document's key.
* @param value
* An object containing the new attributes of the document.
* @param rev
* the desired revision.
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> replaceDocument(
String collectionName,
String documentKey,
Object value,
Long rev,
Policy policy,
Boolean waitForSync) throws ArangoException {
return replaceDocument(createDocumentHandle(collectionName, documentKey), value, rev, policy, waitForSync);
}
/**
* This method replaces the content of the document defined by
* documentHandle. This method offers a parameter rev (revision). If the
* revision of the document on the server does not match the given revision
* the policy parameter is used. If it is set to *last* the operation is
* performed anyway. if it is set to *error* an error is thrown.
*
* @param documentHandle
* The document's handle.
* @param value
* An object containing the new attributes of the document.
* @param rev
* the desired revision.
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity replaceDocument(
String documentHandle,
T value,
Long rev,
Policy policy,
Boolean waitForSync) throws ArangoException {
return documentDriver.replaceDocument(getDefaultDatabase(), documentHandle, value, rev, policy, waitForSync);
}
/**
* This method updates a document defined by documentId.
*
* @param collectionId
* The collection's id.
* @param documentId
* The document's id.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> updateDocument(long collectionId, long documentId, Object value) throws ArangoException {
return updateDocument(createDocumentHandle(collectionId, String.valueOf(documentId)), value, null, null, null,
null);
}
/**
* This method updates a document defined by documentId.
*
* @param collectionName
* The collection's name.
* @param documentId
* The document's id.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> updateDocument(String collectionName, long documentId, Object value)
throws ArangoException {
return updateDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, null, null, null,
null);
}
/**
* This method updates a document defined by documentKey.
*
* @param collectionId
* The collection's id.
* @param documentKey
* The document's key.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> updateDocument(long collectionId, String documentKey, Object value)
throws ArangoException {
return updateDocument(createDocumentHandle(collectionId, documentKey), value, null, null, null, null);
}
/**
* This method updates a document defined by documentKey.
*
* @param collectionName
* The collection's name.
* @param documentKey
* The document's key.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> updateDocument(String collectionName, String documentKey, Object value)
throws ArangoException {
return updateDocument(createDocumentHandle(collectionName, documentKey), value, null, null, null, null);
}
/**
* This method updates a document defined by documentHandle.
*
* @param documentHandle
* The document's handle.
* @param value
* An object containing the documents attributes
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity updateDocument(String documentHandle, T value) throws ArangoException {
return documentDriver.updateDocument(getDefaultDatabase(), documentHandle, value, null, null, null, null);
}
/**
* This method updates a document defined by documentId.
*
* @param collectionId
* The collection id.
* @param documentId
* The document id.
* @param value
* An object containing the documents attributes
* @param keepNull
* If true null values are kept.
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> updateDocument(long collectionId, long documentId, Object value, Boolean keepNull)
throws ArangoException {
return updateDocument(createDocumentHandle(collectionId, String.valueOf(documentId)), value, null, null, null,
keepNull);
}
/**
* This method updates a document defined by documentId.
*
* @param collectionName
* The collection name.
* @param documentId
* The document id.
* @param value
* An object containing the documents attributes
* @param keepNull
* If true null values are kept.
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> updateDocument(String collectionName, long documentId, Object value, Boolean keepNull)
throws ArangoException {
return updateDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, null, null, null,
keepNull);
}
/**
* This method updates a document defined by documentKey.
*
* @param collectionId
* The collection id.
* @param documentKey
* The document key.
* @param value
* An object containing the documents attributes
* @param keepNull
* If true null values are kept.
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> updateDocument(long collectionId, String documentKey, Object value, Boolean keepNull)
throws ArangoException {
return updateDocument(createDocumentHandle(collectionId, documentKey), value, null, null, null, keepNull);
}
/**
* This method updates a document defined by documentKey.
*
* @param collectionName
* The collection name.
* @param documentKey
* The document key.
* @param value
* An object containing the documents attributes
* @param keepNull
* If true null values are kept.
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> updateDocument(String collectionName, String documentKey, Object value, Boolean keepNull)
throws ArangoException {
return updateDocument(createDocumentHandle(collectionName, documentKey), value, null, null, null, keepNull);
}
/**
* This method updates a document defined by documentKey.
*
* @param documentHandle
* The document handle.
* @param value
* An object containing the documents attributes
* @param keepNull
* If true null values are kept.
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity updateDocument(String documentHandle, T value, Boolean keepNull)
throws ArangoException {
return documentDriver.updateDocument(getDefaultDatabase(), documentHandle, value, null, null, null, keepNull);
}
/**
* This method updates a document defined by documentId. This method offers
* a parameter rev (revision). If the revision of the document on the server
* does not match the given revision the policy parameter is used. If it is
* set to *last* the operation is performed anyway. if it is set to *error*
* an error is thrown.
*
* @param collectionId
* The collection id.
* @param documentId
* The document id.
* @param value
* An object containing the documents attributes
* @param rev
* The desired revision
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @param keepNull
* If true null values are kept.
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity> updateDocument(
long collectionId,
long documentId,
Object value,
Long rev,
Policy policy,
Boolean waitForSync,
Boolean keepNull) throws ArangoException {
return updateDocument(createDocumentHandle(collectionId, String.valueOf(documentId)), value, rev, policy,
waitForSync, keepNull);
}
/**
* This method updates a document defined by documentId. This method offers
* a parameter rev (revision). If the revision of the document on the server
* does not match the given revision the policy parameter is used. If it is
* set to *last* the operation is performed anyway. if it is set to *error*
* an error is thrown.
*
* @param collectionName
* The collection name.
* @param documentId
* The document id.
* @param value
* An object containing the documents attributes
* @param rev
* The desired revision
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @param keepNull
* If true null values are kept.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> updateDocument(
String collectionName,
long documentId,
Object value,
Long rev,
Policy policy,
Boolean waitForSync,
Boolean keepNull) throws ArangoException {
return updateDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, rev, policy,
waitForSync, keepNull);
}
/**
* This method updates a document defined by documentKey. This method offers
* a parameter rev (revision). If the revision of the document on the server
* does not match the given revision the policy parameter is used. If it is
* set to *last* the operation is performed anyway. if it is set to *error*
* an error is thrown.
*
* @param collectionId
* The collection id.
* @param documentKey
* The document key.
* @param value
* An object containing the documents attributes
* @param rev
* The desired revision
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @param keepNull
* If true null values are kept.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> updateDocument(
long collectionId,
String documentKey,
Object value,
Long rev,
Policy policy,
Boolean waitForSync,
Boolean keepNull) throws ArangoException {
return updateDocument(createDocumentHandle(collectionId, documentKey), value, rev, policy, waitForSync,
keepNull);
}
/**
* This method updates a document defined by documentKey. This method offers
* a parameter rev (revision). If the revision of the document on the server
* does not match the given revision the policy parameter is used. If it is
* set to *last* the operation is performed anyway. if it is set to *error*
* an error is thrown.
*
* @param collectionName
* The collection name.
* @param documentKey
* The document key.
* @param value
* An object containing the documents attributes
* @param rev
* The desired revision
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @param keepNull
* If true null values are kept.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> updateDocument(
String collectionName,
String documentKey,
Object value,
Long rev,
Policy policy,
Boolean waitForSync,
Boolean keepNull) throws ArangoException {
return updateDocument(createDocumentHandle(collectionName, documentKey), value, rev, policy, waitForSync,
keepNull);
}
/**
* This method updates a document defined by documentHandle. This method
* offers a parameter rev (revision). If the revision of the document on the
* server does not match the given revision the policy parameter is used. If
* it is set to *last* the operation is performed anyway. if it is set to
* *error* an error is thrown.
*
* @param documentHandle
* The document handle.
* @param value
* An object containing the documents attributes
* @param rev
* The desired revision
* @param policy
* The update policy
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @param keepNull
* If true null values are kept.
* @return DocumentEntity>
* @throws ArangoException
*/
public DocumentEntity updateDocument(
String documentHandle,
T value,
Long rev,
Policy policy,
Boolean waitForSync,
Boolean keepNull) throws ArangoException {
return documentDriver.updateDocument(getDefaultDatabase(), documentHandle, value, rev, policy, waitForSync,
keepNull);
}
/**
* This method returns all document handles from a collection.
*
* @param collectionId
* The collection id.
* @return List - The list of document handles
* @throws ArangoException
*/
public List getDocuments(long collectionId) throws ArangoException {
return getDocuments(String.valueOf(collectionId), false);
}
/**
* This method returns all document handles from a collection.
*
* @param collectionName
* The collection name.
* @return List - The list of document handles
* @throws ArangoException
*/
public List getDocuments(String collectionName) throws ArangoException {
return documentDriver.getDocuments(getDefaultDatabase(), collectionName, false);
}
/**
* This method returns all document handles from a collection.
*
* @param collectionId
* The collection id.
* @param handleConvert
* if set to true only the document identifiers are returned
* @return List - The list of document handles
* @throws ArangoException
*/
public List getDocuments(long collectionId, boolean handleConvert) throws ArangoException {
return getDocuments(String.valueOf(collectionId), handleConvert);
}
/**
* This method returns all document handles from a collection.
*
* @param collectionName
* The collection name.
* @param handleConvert
* if set to true only the document identifiers are returned
* @return List - The list of document handles
* @throws ArangoException
*/
public List getDocuments(String collectionName, boolean handleConvert) throws ArangoException {
return documentDriver.getDocuments(getDefaultDatabase(), collectionName, handleConvert);
}
/**
* The exists method determines whether a document exists given its
* identifier. Instead of returning the found document or an error, this
* method will return either true or false. It can thus be used for easy
* existence checks.
*
* @param collectionId
* The collection id.
* @param documentId
* The document id
* @return true, if the document exists
* @throws ArangoException
*/
public boolean exists(long collectionId, long documentId) throws ArangoException {
return exists(createDocumentHandle(collectionId, String.valueOf(documentId)));
}
/**
* The exists method determines whether a document exists given its
* identifier. Instead of returning the found document or an error, this
* method will return either true or false. It can thus be used for easy
* existence checks.
*
* @param collectionName
* The collection name.
* @param documentId
* The document id
* @return true, if the document exists
* @throws ArangoException
*/
public boolean exists(String collectionName, long documentId) throws ArangoException {
return exists(createDocumentHandle(collectionName, String.valueOf(documentId)));
}
/**
* The exists method determines whether a document exists given its
* identifier. Instead of returning the found document or an error, this
* method will return either true or false. It can thus be used for easy
* existence checks.
*
* @param collectionId
* The collection id.
* @param documentKey
* The document key
* @return true, if the document exists
* @throws ArangoException
*/
public boolean exists(long collectionId, String documentKey) throws ArangoException {
return exists(createDocumentHandle(collectionId, documentKey));
}
/**
* The exists method determines whether a document exists given its
* identifier. Instead of returning the found document or an error, this
* method will return either true or false. It can thus be used for easy
* existence checks.
*
* @param collectionName
* The collection name.
* @param documentKey
* The document key
* @return true, if the document exists
* @throws ArangoException
*/
public boolean exists(String collectionName, String documentKey) throws ArangoException {
return exists(createDocumentHandle(collectionName, documentKey));
}
/**
* The exists method determines whether a document exists given its
* identifier. Instead of returning the found document or an error, this
* method will return either true or false. It can thus be used for easy
* existence checks.
*
* @param documentHandle
* The document handle
* @return true, if the document exists
* @throws ArangoException
*/
public boolean exists(String documentHandle) throws ArangoException {
try {
documentDriver.checkDocument(getDefaultDatabase(), documentHandle);
} catch (ArangoException e) {
if (e.getCode() == ErrorNums.ERROR_HTTP_NOT_FOUND) {
return false;
}
throw e;
}
return true;
}
/**
* This method returns the current revision of a document.
*
* @param collectionId
* The collection id.
* @param documentId
* The document id
* @return the document revision number
* @throws ArangoException
*/
public long checkDocument(long collectionId, long documentId) throws ArangoException {
return checkDocument(createDocumentHandle(collectionId, String.valueOf(documentId)));
}
/**
* This method returns the current revision of a document.
*
* @param collectionName
* The collection name.
* @param documentId
* The document id
* @return the document revision number
* @throws ArangoException
*/
public long checkDocument(String collectionName, long documentId) throws ArangoException {
return checkDocument(createDocumentHandle(collectionName, String.valueOf(documentId)));
}
/**
* This method returns the current revision of a document.
*
* @param collectionId
* The collection id.
* @param documentKey
* The document key
* @return the document revision number
* @throws ArangoException
*/
public long checkDocument(long collectionId, String documentKey) throws ArangoException {
return checkDocument(createDocumentHandle(collectionId, documentKey));
}
/**
* This method returns the current revision of a document.
*
* @param collectionName
* The collection name.
* @param documentKey
* The document key
* @return the document revision number
* @throws ArangoException
*/
public long checkDocument(String collectionName, String documentKey) throws ArangoException {
return checkDocument(createDocumentHandle(collectionName, documentKey));
}
/**
* This method returns the current revision of a document.
*
* @param documentHandle
* The document handle
* @return the document revision number
* @throws ArangoException
*/
public long checkDocument(String documentHandle) throws ArangoException {
return documentDriver.checkDocument(getDefaultDatabase(), documentHandle);
}
/**
* Returns a document entity.
*
* @param collectionId
* The collection id.
* @param documentId
* The document id
* @param clazz
* The expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity getDocument(long collectionId, long documentId, Class clazz)
throws ArangoException {
return getDocument(createDocumentHandle(collectionId, String.valueOf(documentId)), clazz);
}
/**
* Returns a document entity.
*
* @param collectionName
* The collection name.
* @param documentId
* The document id
* @param clazz
* The expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity getDocument(String collectionName, long documentId, Class clazz)
throws ArangoException {
return getDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), clazz);
}
/**
* Returns a document entity.
*
* @param collectionId
* The collection id.
* @param documentKey
* The document key
* @param clazz
* The expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity getDocument(long collectionId, String documentKey, Class clazz)
throws ArangoException {
return getDocument(createDocumentHandle(collectionId, documentKey), clazz);
}
/**
* Returns a document entity.
*
* @param collectionName
* The collection name.
* @param documentKey
* The document key
* @param clazz
* The expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity getDocument(String collectionName, String documentKey, Class clazz)
throws ArangoException {
return getDocument(createDocumentHandle(collectionName, documentKey), clazz);
}
/**
* Returns a document entity.
*
* @param documentHandle
* The document handle
* @param clazz
* The expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity getDocument(String documentHandle, Class clazz) throws ArangoException {
return documentDriver.getDocument(getDefaultDatabase(), documentHandle, clazz, null, null);
}
/**
* Returns a document entity. Note that the *ifNoneMatchRevision* and
* *ifMatchRevision* can not be used at the same time, one of these two has
* to be null.
*
* @param documentHandle
* The document handle
* @param clazz
* The expected class, the result from the server request is
* deserialized to an instance of this class.
* @param ifNoneMatchRevision
* if set the document is only returned id it has a different
* revision.
* @param ifMatchRevision
* if set the document is only returned id it has the same
* revision.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity getDocument(
String documentHandle,
Class clazz,
Long ifNoneMatchRevision,
Long ifMatchRevision) throws ArangoException {
return documentDriver.getDocument(getDefaultDatabase(), documentHandle, clazz, ifNoneMatchRevision,
ifMatchRevision);
}
/**
* Deletes a document from the database.
*
* @param collectionId
* The collection id.
* @param documentId
* The document id.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(long collectionId, long documentId) throws ArangoException {
return deleteDocument(createDocumentHandle(collectionId, String.valueOf(documentId)), null, null);
}
/**
* Deletes a document from the database.
*
* @param collectionName
* The collection name.
* @param documentId
* The document id.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(String collectionName, long documentId) throws ArangoException {
return deleteDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), null, null);
}
/**
* Deletes a document from the database.
*
* @param collectionId
* The collection id.
* @param documentKey
* The document key.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(long collectionId, String documentKey) throws ArangoException {
return deleteDocument(createDocumentHandle(collectionId, documentKey), null, null);
}
/**
* Deletes a document from the database.
*
* @param collectionName
* The collection name.
* @param documentKey
* The document key.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(String collectionName, String documentKey) throws ArangoException {
return deleteDocument(createDocumentHandle(collectionName, documentKey), null, null);
}
/**
* Deletes a document from the database.
*
* @param documentHandle
* The document handle.
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(String documentHandle) throws ArangoException {
return documentDriver.deleteDocument(getDefaultDatabase(), documentHandle, null, null);
}
/**
* Deletes a document from the database. This method offers a parameter rev
* (revision). If the revision of the document on the server does not match
* the given revision the policy parameter is used. If it is set to *last*
* the operation is performed anyway. if it is set to *error* an error is
* thrown.
*
* @param collectionId
* The collection id.
* @param documentId
* The document id.
* @param rev
* The desired revision
* @param policy
* The update policy
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(long collectionId, long documentId, Long rev, Policy policy)
throws ArangoException {
return deleteDocument(createDocumentHandle(collectionId, String.valueOf(documentId)), rev, policy);
}
/**
* Deletes a document from the database. This method offers a parameter rev
* (revision). If the revision of the document on the server does not match
* the given revision the policy parameter is used. If it is set to *last*
* the operation is performed anyway. if it is set to *error* an error is
* thrown.
*
* @param collectionName
* The collection name.
* @param documentId
* The document id.
* @param rev
* The desired revision
* @param policy
* The update policy
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(String collectionName, long documentId, Long rev, Policy policy)
throws ArangoException {
return deleteDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), rev, policy);
}
/**
* Deletes a document from the database. This method offers a parameter rev
* (revision). If the revision of the document on the server does not match
* the given revision the policy parameter is used. If it is set to *last*
* the operation is performed anyway. if it is set to *error* an error is
* thrown.
*
* @param collectionId
* The collection id.
* @param documentKey
* The document key.
* @param rev
* The desired revision
* @param policy
* The update policy
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(long collectionId, String documentKey, Long rev, Policy policy)
throws ArangoException {
return deleteDocument(createDocumentHandle(collectionId, documentKey), rev, policy);
}
/**
* Deletes a document from the database. This method offers a parameter rev
* (revision). If the revision of the document on the server does not match
* the given revision the policy parameter is used. If it is set to *last*
* the operation is performed anyway. if it is set to *error* an error is
* thrown.
*
* @param collectionName
* The collection name.
* @param documentKey
* The document key.
* @param rev
* The desired revision
* @param policy
* The update policy
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(String collectionName, String documentKey, Long rev, Policy policy)
throws ArangoException {
return deleteDocument(createDocumentHandle(collectionName, documentKey), rev, policy);
}
/**
* Deletes a document from the database. This method offers a parameter rev
* (revision). If the revision of the document on the server does not match
* the given revision the policy parameter is used. If it is set to *last*
* the operation is performed anyway. if it is set to *error* an error is
* thrown.
*
* @param documentHandle
* The document handle.
* @param rev
* The desired revision
* @param policy
* The update policy
* @return a DocumentEntity object
* @throws ArangoException
*/
public DocumentEntity> deleteDocument(String documentHandle, Long rev, Policy policy) throws ArangoException {
return documentDriver.deleteDocument(getDefaultDatabase(), documentHandle, rev, policy);
}
/**
* This method validates a given AQL query string and returns a CursorEntity
*
* @param query
* an AQL query as string
* @return a CursorEntity object
* @throws ArangoException
*/
public CursorEntity> validateQuery(String query) throws ArangoException {
return cursorDriver.validateQuery(getDefaultDatabase(), query);
}
/**
* This method executes an AQL query and returns a CursorEntity
*
* @param query
* an AQL query as string
* @param bindVars
* a map containing all bind variables,
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @param calcCount
* if set to true the result count is returned
* @param batchSize
* the batch size of the result cursor (The batch size has to be
* greater than 0)
* @param fullCount
* if set to true, then all results before the final LIMIT will
* be counted
* @return a CursorEntity object
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeDocumentQuery(String, Map, AqlQueryOptions, Class)}
*/
@Deprecated
public CursorEntity executeQuery(
String query,
Map bindVars,
Class clazz,
Boolean calcCount,
Integer batchSize,
Boolean fullCount) throws ArangoException {
return cursorDriver.executeQuery(getDefaultDatabase(), query, bindVars, clazz, calcCount, batchSize, fullCount);
}
/**
* This method executes an AQL query and returns a CursorEntity
*
* @param query
* an AQL query as string
* @param bindVars
* a map containing all bind variables,
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @param calcCount
* if set to true the result count is returned
* @param batchSize
* the batch size of the result cursor (The batch size has to be
* greater than 0)
* @return a CursorEntity object
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeDocumentQuery(String, Map, AqlQueryOptions, Class)}
*/
@Deprecated
public CursorEntity executeQuery(
String query,
Map bindVars,
Class clazz,
Boolean calcCount,
Integer batchSize) throws ArangoException {
return cursorDriver.executeQuery(getDefaultDatabase(), query, bindVars, clazz, calcCount, batchSize, false);
}
/**
* Continues data retrieval for an existing cursor
*
* @param cursorId
* The id of a cursor.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a CursorEntity object
* @throws ArangoException
*/
public CursorEntity continueQuery(long cursorId, Class>... clazz) throws ArangoException {
return cursorDriver.continueQuery(getDefaultDatabase(), cursorId, clazz);
}
/**
* Deletes a cursor from the database.
*
* @param cursorId
* The id of a cursor.
* @return a DefaultEntity object
* @throws ArangoException
*/
public DefaultEntity finishQuery(long cursorId) throws ArangoException {
return cursorDriver.finishQuery(getDefaultDatabase(), cursorId);
}
/**
* This method executes an AQL query and returns a CursorResultSet
*
* @param query
* an AQL query as string
* @param bindVars
* a map containing all bind variables,
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @param calcCount
* if set to true the result count is returned
* @param batchSize
* the batch size of the result cursor (The batch size has to be
* greater than 0)
* @param fullCount
* if set to true, then all results before the final LIMIT will
* be counted
*
* @return a CursorResultSet object
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeDocumentQuery(String, Map, AqlQueryOptions, Class)}
*/
@Deprecated
public CursorResultSet executeQueryWithResultSet(
String query,
Map bindVars,
Class clazz,
Boolean calcCount,
Integer batchSize,
Boolean fullCount) throws ArangoException {
return cursorDriver.executeQueryWithResultSet(getDefaultDatabase(), query, bindVars, clazz, calcCount,
batchSize, fullCount);
}
/**
* This method executes an AQL query and returns a CursorResultSet
*
* @param query
* an AQL query as string
* @param bindVars
* a map containing all bind variables,
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @param calcCount
* if set to true the result count is returned
* @param batchSize
* the batch size of the result cursor (The batch size has to be
* greater than 0)
* @return CursorResultSet
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeDocumentQuery(String, Map, AqlQueryOptions, Class)}
*/
@Deprecated
public CursorResultSet executeQueryWithResultSet(
String query,
Map bindVars,
Class clazz,
Boolean calcCount,
Integer batchSize) throws ArangoException {
return cursorDriver.executeQueryWithResultSet(getDefaultDatabase(), query, bindVars, clazz, calcCount,
batchSize, false);
}
/**
* This method executes an AQL query and returns a CursorEntity.
*
* @param query
* an AQL query as string
* @param bindVars
* a map containing all bind variables,
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @param calcCount
* if set to true the result count is returned
* @param batchSize
* the batch size of the result cursor (The batch size has to be
* greater than 0)
* @param fullCount
* if set to true, then all results before the final LIMIT will
* be counted
* @return a CursorEntity object
* @throws ArangoException
*/
public CursorEntity executeCursorEntityQuery(
String query,
Map bindVars,
Boolean calcCount,
Integer batchSize,
Boolean fullCount,
Class>... clazz) throws ArangoException {
AqlQueryOptions aqlQueryOptions = new AqlQueryOptions().setCount(calcCount).setBatchSize(batchSize)
.setFullCount(fullCount);
return cursorDriver.executeCursorEntityQuery(getDefaultDatabase(), query, bindVars, aqlQueryOptions, clazz);
}
/**
* Creates a default AqlQueryOptions object
*
* @return default AqlQueryOptions object
*/
public AqlQueryOptions getDefaultAqlQueryOptions() {
return new AqlQueryOptions().setBatchSize(configure.getBatchSize()).setCount(false).setFullCount(false);
}
/**
* This method executes an AQL query and returns a DocumentCursor
*
* @param query
* an AQL query as string
* @param bindVars
* a map containing all bind variables,
* @param aqlQueryOptions
* AQL query options (null for default values)
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return DocumentCursor
* @throws ArangoException
*/
public DocumentCursor executeDocumentQuery(
String query,
Map bindVars,
AqlQueryOptions aqlQueryOptions,
Class clazz) throws ArangoException {
@SuppressWarnings("unchecked")
DocumentCursorResult> baseCursor = cursorDriver.executeBaseCursorQuery(
getDefaultDatabase(), query, bindVars, getAqlQueryOptions(aqlQueryOptions), DocumentEntity.class, clazz);
return new DocumentCursor(baseCursor);
}
/**
* This method executes an AQL query and returns a CursorResult
*
* @param query
* an AQL query as string
* @param bindVars
* a map containing all bind variables,
* @param aqlQueryOptions
* AQL query options
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorResult
* @throws ArangoException
*/
public CursorResult executeAqlQuery(
String query,
Map bindVars,
AqlQueryOptions aqlQueryOptions,
Class clazz) throws ArangoException {
return cursorDriver.executeAqlQuery(getDefaultDatabase(), query, bindVars, getAqlQueryOptions(aqlQueryOptions),
clazz);
}
/**
* Executes an AQL query and returns the raw JSON response
*
* @param query
* an AQL query as string
* @param bindVars
* a map containing all bind variables,
* @param aqlQueryOptions
* AQL query options
* @return A JSON string with the results from server
* @throws ArangoException
*/
public String executeAqlQueryJSON(String query, Map bindVars, AqlQueryOptions aqlQueryOptions)
throws ArangoException {
return cursorDriver.executeAqlQueryJSON(getDefaultDatabase(), query, bindVars,
getAqlQueryOptions(aqlQueryOptions));
}
/**
* This method executes an AQL query and returns a DocumentCursorResult
*
* @param query
* an AQL query as string
* @param bindVars
* a map containing all bind variables,
* @param aqlQueryOptions
* AQL query options
* @param classDocumentEntity
* the class the expected class is wrapped in (the class has to
* extend DocumentEntity)
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return DocumentCursorResult
* @throws ArangoException
*/
public > DocumentCursorResult executeAqlQueryWithDocumentCursorResult(
String query,
Map bindVars,
AqlQueryOptions aqlQueryOptions,
Class classDocumentEntity,
Class clazz) throws ArangoException {
return cursorDriver.executeBaseCursorQuery(getDefaultDatabase(), query, bindVars,
getAqlQueryOptions(aqlQueryOptions), classDocumentEntity, clazz);
}
/**
* This method creates an index for a collection.
*
* @param collectionId
* The collection id.
* @param type
* the index type.
* @param unique
* if set to true the index will be a unique index
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createIndex(long collectionId, IndexType type, boolean unique, String... fields)
throws ArangoException {
return createIndex(String.valueOf(collectionId), type, unique, fields);
}
/**
* This method creates an index for a collection.
*
* @param collectionId
* The collection id.
* @param type
* the index type.
* @param unique
* if set to true the index will be a unique index
* @param sparse
* if set to true the index will be sparse
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createIndex(long collectionId, IndexType type, boolean unique, boolean sparse, String... fields)
throws ArangoException {
return createIndex(String.valueOf(collectionId), type, unique, sparse, fields);
}
/**
* This method creates an index for a collection.
*
* @param collectionName
* The collection name.
* @param type
* the index type.
* @param unique
* if set to true the index will be a unique index
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createIndex(String collectionName, IndexType type, boolean unique, String... fields)
throws ArangoException {
return indexDriver.createIndex(getDefaultDatabase(), collectionName, type, unique, fields);
}
/**
* This method creates an index for a collection.
*
* @param collectionName
* The collection name.
* @param type
* the index type.
* @param unique
* if set to true the index will be a unique index
* @param sparse
* if set to true the index will be sparse
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createIndex(
String collectionName,
IndexType type,
boolean unique,
boolean sparse,
String... fields) throws ArangoException {
return indexDriver.createIndex(getDefaultDatabase(), collectionName, type, unique, sparse, fields);
}
/**
* This method creates a hash index for a collection.
*
* @param collectionName
* The collection name.
* @param unique
* if set to true the index will be a unique index
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createHashIndex(String collectionName, boolean unique, String... fields) throws ArangoException {
return indexDriver.createIndex(getDefaultDatabase(), collectionName, IndexType.HASH, unique, fields);
}
/**
* This method creates a hash index for a collection.
*
* @param collectionName
* The collection name.
* @param unique
* if set to true the index will be a unique index
* @param sparse
* if set to true the index will be sparse
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createHashIndex(String collectionName, boolean unique, boolean sparse, String... fields)
throws ArangoException {
return indexDriver.createIndex(getDefaultDatabase(), collectionName, IndexType.HASH, unique, sparse, fields);
}
/**
* This method creates a geo index for a collection.
*
* @param collectionName
* The collection name.
* @param unique
* if set to true the index will be a unique index
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createGeoIndex(String collectionName, boolean unique, String... fields) throws ArangoException {
return indexDriver.createIndex(getDefaultDatabase(), collectionName, IndexType.GEO, unique, fields);
}
/**
* This method creates a skip list index for a collection.
*
* @param collectionName
* The collection name.
* @param unique
* if set to true the index will be a unique index
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createSkipListIndex(String collectionName, boolean unique, String... fields)
throws ArangoException {
return indexDriver.createIndex(getDefaultDatabase(), collectionName, IndexType.SKIPLIST, unique, fields);
}
/**
* This method creates a skip list index for a collection.
*
* @param collectionName
* The collection name.
* @param unique
* if set to true the index will be a unique index
* @param sparse
* if set to true the index will be sparse
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createSkipListIndex(String collectionName, boolean unique, boolean sparse, String... fields)
throws ArangoException {
return indexDriver.createIndex(getDefaultDatabase(), collectionName, IndexType.SKIPLIST, unique, sparse,
fields);
}
/**
* This method creates a capped index for a collection.
*
* @param collectionId
* The collection id.
* @param size
* the maximum amount of documents
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createCappedIndex(long collectionId, int size) throws ArangoException {
return createCappedIndex(String.valueOf(collectionId), size);
}
/**
* This method creates a capped index for a collection.
*
* @param collectionName
* The collection name.
* @param size
* the maximum amount of documents
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createCappedIndex(String collectionName, int size) throws ArangoException {
return indexDriver.createCappedIndex(getDefaultDatabase(), collectionName, size);
}
/**
* This method creates a capped index for a collection.
*
* @param collectionId
* The collection id.
* @param byteSize
* the maximum size of the document data in bytes
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createCappedByDocumentSizeIndex(long collectionId, int byteSize) throws ArangoException {
return createCappedByDocumentSizeIndex(String.valueOf(collectionId), byteSize);
}
/**
* This method creates a capped index for a collection.
*
* @param collectionName
* The collection name.
* @param byteSize
* the maximum size of the document data in bytes
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createCappedByDocumentSizeIndex(String collectionName, int byteSize) throws ArangoException {
return indexDriver.createCappedByDocumentSizeIndex(getDefaultDatabase(), collectionName, byteSize);
}
/**
* This method creates a full text index for a collection.
*
* @param collectionId
* The collection id.
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createFulltextIndex(long collectionId, String... fields) throws ArangoException {
return createFulltextIndex(String.valueOf(collectionId), null, fields);
}
/**
* This method creates a full text index for a collection.
*
* @param collectionName
* The collection name.
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createFulltextIndex(String collectionName, String... fields) throws ArangoException {
return createFulltextIndex(collectionName, null, fields);
}
/**
* This method creates a full text index for a collection.
*
* @param collectionId
* The collection id.
* @param minLength
* Minimum character length of words to index.
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createFulltextIndex(long collectionId, Integer minLength, String... fields)
throws ArangoException {
return createFulltextIndex(String.valueOf(collectionId), minLength, fields);
}
/**
* This method creates a full text index for a collection.
*
* @param collectionName
* The collection name.
* @param minLength
* Minimum character length of words to index.
* @param fields
* the fields (document attributes) the index is created on
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity createFulltextIndex(String collectionName, Integer minLength, String... fields)
throws ArangoException {
return indexDriver.createFulltextIndex(getDefaultDatabase(), collectionName, minLength, fields);
}
/**
* Deletes an index from a collection
*
* @param indexHandle
* the index handle
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity deleteIndex(String indexHandle) throws ArangoException {
return indexDriver.deleteIndex(getDefaultDatabase(), indexHandle);
}
/**
* Returns an index from a collection.
*
* @param indexHandle
* the index handle
* @return IndexEntity
* @throws ArangoException
*/
public IndexEntity getIndex(String indexHandle) throws ArangoException {
return indexDriver.getIndex(getDefaultDatabase(), indexHandle);
}
/**
* Returns all indices from a collection.
*
* @param collectionId
* The collection id.
* @return IndexesEntity
* @throws ArangoException
*/
public IndexesEntity getIndexes(long collectionId) throws ArangoException {
return getIndexes(String.valueOf(collectionId));
}
/**
* Returns all indices from a collection.
*
* @param collectionName
* The collection name.
* @return IndexesEntity
* @throws ArangoException
*/
public IndexesEntity getIndexes(String collectionName) throws ArangoException {
return indexDriver.getIndexes(getDefaultDatabase(), collectionName);
}
/**
* Returns the server log, for the parameters *logLevel* and *logLevelUpTo*
* please note the following: fatal or 0 error or 1 warning or 2 info or 3
* debug or 4 The default value is info.
*
* @param logLevel
* if set only logs with this *logLevel* are returned
* @param logLevelUpTo
* if set all logs up to the *logLevelUpTo* are returned
* @param start
* Returns all log entries such that their log entry identifier
* (lid value) is greater or equal to start.
* @param size
* Restricts the result to at most size log entries.
* @param offset
* Starts to return log entries skipping the first offset log
* entries.
* @param sortAsc
* if set to true the default sort order (descending) is reverted
* to ascending
* @param text
* Only return the log entries containing the text specified in
* text.
* @return a AdminLogEntity object
* @throws ArangoException
*/
public AdminLogEntity getServerLog(
Integer logLevel,
Boolean logLevelUpTo,
Integer start,
Integer size,
Integer offset,
Boolean sortAsc,
String text) throws ArangoException {
return adminDriver.getServerLog(logLevel, logLevelUpTo, start, size, offset, sortAsc, text);
}
/**
* Returns the current statistics
*
* @return StatisticsEntity
* @throws ArangoException
*/
public StatisticsEntity getStatistics() throws ArangoException {
return adminDriver.getStatistics();
}
/**
* Returns the statistics description
*
* @return StatisticsDescriptionEntity
* @throws ArangoException
*/
public StatisticsDescriptionEntity getStatisticsDescription() throws ArangoException {
return adminDriver.getStatisticsDescription();
}
/**
* Returns the database version
*
* @return ArangoVersion
* @throws ArangoException
*/
public ArangoVersion getVersion() throws ArangoException {
return adminDriver.getVersion();
}
/**
* Returns the current server time
*
* @return ArangoUnixTime
* @throws ArangoException
*/
public ArangoUnixTime getTime() throws ArangoException {
return adminDriver.getTime();
}
/**
* Triggers the routes reloading in ArangoDB
*
* @return DefaultEntity
* @throws ArangoException
*/
public DefaultEntity reloadRouting() throws ArangoException {
return adminDriver.reloadRouting(getDefaultDatabase());
}
/**
* Executes a javascript code.
*
* @param jsCode
* a javascript function as string
* @return DefaultEntity
* @throws ArangoException
*/
public DefaultEntity executeScript(String jsCode) throws ArangoException {
return adminDriver.executeScript(getDefaultDatabase(), jsCode);
}
/**
* This will find all documents matching a given example.
*
* @param collectionName
* The collection name.
* @param example
* The example as a map.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
*
* @return CursorEntity
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleByExampleDocuments(String, Map, int, int, Class)}
*/
@Deprecated
public CursorEntity executeSimpleByExample(
String collectionName,
Map example,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleByExample(getDefaultDatabase(), collectionName, example, skip, limit, clazz);
}
/**
* This will find all documents matching a given example.
*
* @param collectionName
* The collection name.
* @param example
* The example as a map.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorResultSet
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleByExampleDocuments(String, Map, int, int, Class)}
*/
@Deprecated
public CursorResultSet executeSimpleByExampleWithResusltSet(
String collectionName,
Map example,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleByExampleWithResultSet(getDefaultDatabase(), collectionName, example, skip,
limit, clazz);
}
/**
* This will find all documents matching a given example.
*
* @param collectionName
* - The collection name.
* @param example
* The example as a map.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorEntity>
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleByExampleDocuments(String, Map, int, int, Class)}
*/
@Deprecated
public CursorEntity> executeSimpleByExampleWithDocument(
String collectionName,
Map example,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleByExampleWithDocument(getDefaultDatabase(), collectionName, example, skip,
limit, clazz);
}
/**
* This will find all documents matching a given example.
*
* @param collectionName
* - The collection name.
* @param example
* The example as a map.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorResultSet>
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleByExampleDocuments(String, Map, int, int, Class)}
*/
@Deprecated
public CursorResultSet> executeSimpleByExampleWithDocumentResusltSet(
String collectionName,
Map example,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleByExampleWithDocumentResultSet(getDefaultDatabase(), collectionName, example,
skip, limit, clazz);
}
/**
* This will find all documents matching a given example.
*
* @param collectionName
* - The collection name.
* @param example
* The example as a map.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return DocumentCursor
* @throws ArangoException
*/
public DocumentCursor executeSimpleByExampleDocuments(
String collectionName,
Map example,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleByExampleDocuments(getDefaultDatabase(), collectionName, example, skip, limit,
clazz);
}
/**
* Returns all documents of a collections.
*
* @param collectionName
* - The collection name.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a CursorEntity object
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleAllDocuments(String, int, int, Class)}
*/
@Deprecated
public CursorEntity executeSimpleAll(String collectionName, int skip, int limit, Class clazz)
throws ArangoException {
return simpleDriver.executeSimpleAll(getDefaultDatabase(), collectionName, skip, limit, clazz);
}
/**
* Returns all documents of a collections.
*
* @param collectionName
* - The collection name.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorResultSet
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleAllDocuments(String, int, int, Class)}
*/
@Deprecated
public CursorResultSet executeSimpleAllWithResultSet(
String collectionName,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleAllWithResultSet(getDefaultDatabase(), collectionName, skip, limit, clazz);
}
/**
* Returns all documents of a collections.
*
* @param collectionName
* - The collection name.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorEntity>
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleAllDocuments(String, int, int, Class)}
*/
@Deprecated
public CursorEntity> executeSimpleAllWithDocument(
String collectionName,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleAllWithDocument(getDefaultDatabase(), collectionName, skip, limit, clazz);
}
/**
* Returns all documents of a collections.
*
* @param collectionName
* The collection name.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorResultSet>
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleAllDocuments(String, int, int, Class)}
*/
@Deprecated
public CursorResultSet> executeSimpleAllWithDocumentResultSet(
String collectionName,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleAllWithDocumentResultSet(getDefaultDatabase(), collectionName, skip, limit,
clazz);
}
/**
* Returns all documents of a collections.
*
* @param collectionName
* The collection name.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return DocumentCursor
* @throws ArangoException
*/
public DocumentCursor executeSimpleAllDocuments(String collectionName, int skip, int limit, Class clazz)
throws ArangoException {
return simpleDriver.executeSimpleAllDocuments(getDefaultDatabase(), collectionName, skip, limit, clazz);
}
/**
* Returns the first document matching the example
*
* @param collectionName
* The collection name.
* @param example
* The example as a map.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a ScalarExampleEntity object
* @throws ArangoException
*/
public ScalarExampleEntity executeSimpleFirstExample(
String collectionName,
Map example,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleFirstExample(getDefaultDatabase(), collectionName, example, clazz);
}
/**
* Returns a random document from the collection
*
* @param collectionName
* The collection name.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a ScalarExampleEntity object
* @throws ArangoException
*/
public ScalarExampleEntity executeSimpleAny(String collectionName, Class clazz) throws ArangoException {
return simpleDriver.executeSimpleAny(getDefaultDatabase(), collectionName, clazz);
}
/**
* This will find all documents within a given range. In order to execute a
* range query, a skip-list index on the queried attribute must be present.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param left
* The lower bound
* @param right
* The upper bound
* @param closed
* If true, use interval including left and right, otherwise
* exclude right, but include left.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a CursorEntity object
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleRangeWithDocuments(String, String, Object, Object, Boolean, int, int, Class)}
*/
@Deprecated
public CursorEntity executeSimpleRange(
String collectionName,
String attribute,
Object left,
Object right,
Boolean closed,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleRange(getDefaultDatabase(), collectionName, attribute, left, right, closed,
skip, limit, clazz);
}
/**
* This will find all documents within a given range. In order to execute a
* range query, a skip-list index on the queried attribute must be present.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param left
* The lower bound
* @param right
* The upper bound
* @param closed
* If true, use interval including left and right, otherwise
* exclude right, but include left.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return DocumentCursor
* @throws ArangoException
*/
public DocumentCursor executeSimpleRangeWithDocuments(
String collectionName,
String attribute,
Object left,
Object right,
Boolean closed,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleRangeWithDocuments(getDefaultDatabase(), collectionName, attribute, left,
right, closed, skip, limit, clazz);
}
/**
* This will find all documents within a given range. In order to execute a
* range query, a skip-list index on the queried attribute must be present.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param left
* The lower bound
* @param right
* The upper bound
* @param closed
* If true, use interval including left and right, otherwise
* exclude right, but include left.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorResultSet
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleRangeWithDocuments(String, String, Object, Object, Boolean, int, int, Class)}
*/
@Deprecated
public CursorResultSet executeSimpleRangeWithResultSet(
String collectionName,
String attribute,
Object left,
Object right,
Boolean closed,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleRangeWithResultSet(getDefaultDatabase(), collectionName, attribute, left,
right, closed, skip, limit, clazz);
}
/**
* This will find all documents within a given range. In order to execute a
* range query, a skip-list index on the queried attribute must be present.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param left
* The lower bound
* @param right
* The upper bound
* @param closed
* If true, use interval including left and right, otherwise
* exclude right, but include left.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorEntity>
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleRangeWithDocuments(String, String, Object, Object, Boolean, int, int, Class)}
*/
@Deprecated
public CursorEntity> executeSimpleRangeWithDocument(
String collectionName,
String attribute,
Object left,
Object right,
Boolean closed,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleRangeWithDocument(getDefaultDatabase(), collectionName, attribute, left, right,
closed, skip, limit, clazz);
}
/**
* This will find all documents within a given range. In order to execute a
* range query, a skip-list index on the queried attribute must be present.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param left
* The lower bound
* @param right
* The upper bound
* @param closed
* If true, use interval including left and right, otherwise
* exclude right, but include left.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorResultSet>
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleRangeWithDocuments(String, String, Object, Object, Boolean, int, int, Class)}
*/
@Deprecated
public CursorResultSet> executeSimpleRangeWithDocumentResultSet(
String collectionName,
String attribute,
Object left,
Object right,
Boolean closed,
int skip,
int limit,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleRangeWithDocumentResultSet(getDefaultDatabase(), collectionName, attribute,
left, right, closed, skip, limit, clazz);
}
/**
* This will find all documents from the collection that match the fulltext
* query specified in query. In order to use the fulltext operator, a
* fulltext index must be defined for the collection and the specified
* attribute.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param query
* The fulltext query as string.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return a CursorEntity object
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleFulltextWithDocuments(String, String, String, int, int, String, Class)}
*/
@Deprecated
public CursorEntity executeSimpleFulltext(
String collectionName,
String attribute,
String query,
int skip,
int limit,
String index,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleFulltext(getDefaultDatabase(), collectionName, attribute, query, skip, limit,
index, clazz);
}
/**
* This will find all documents from the collection that match the fulltext
* query specified in query. In order to use the fulltext operator, a
* fulltext index must be defined for the collection and the specified
* attribute.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param query
* The fulltext query as string.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return DocumentCursor
* @throws ArangoException
*/
public DocumentCursor executeSimpleFulltextWithDocuments(
String collectionName,
String attribute,
String query,
int skip,
int limit,
String index,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleFulltextWithDocuments(getDefaultDatabase(), collectionName, attribute, query,
skip, limit, index, clazz);
}
/**
* This will find all documents from the collection that match the fulltext
* query specified in query. In order to use the fulltext operator, a
* fulltext index must be defined for the collection and the specified
* attribute.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param query
* The fulltext query as string.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorResultSet
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleFulltextWithDocuments(String, String, String, int, int, String, Class)}
*/
@Deprecated
public CursorResultSet executeSimpleFulltextWithResultSet(
String collectionName,
String attribute,
String query,
int skip,
int limit,
String index,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleFulltextWithResultSet(getDefaultDatabase(), collectionName, attribute, query,
skip, limit, index, clazz);
}
/**
* This will find all documents from the collection that match the fulltext
* query specified in query. In order to use the fulltext operator, a
* fulltext index must be defined for the collection and the specified
* attribute.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param query
* The fulltext query as string.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorEntity>
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleFulltextWithDocuments(String, String, String, int, int, String, Class)}
*/
@Deprecated
public CursorEntity> executeSimpleFulltextWithDocument(
String collectionName,
String attribute,
String query,
int skip,
int limit,
String index,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleFulltextWithDocument(getDefaultDatabase(), collectionName, attribute, query,
skip, limit, index, clazz);
}
/**
* This will find all documents from the collection that match the fulltext
* query specified in query. In order to use the fulltext operator, a
* fulltext index must be defined for the collection and the specified
* attribute.
*
* @param collectionName
* The collection name.
* @param attribute
* The attribute path to check.
* @param query
* The fulltext query as string.
* @param skip
* The number of documents to skip in the query.
* @param limit
* The maximal amount of documents to return. The skip is applied
* before the limit restriction.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return CursorResultSet>
* @throws ArangoException
* @deprecated As of release 2.5.4, replaced by
* {@link #executeSimpleFulltextWithDocuments(String, String, String, int, int, String, Class)}
*/
@Deprecated
public CursorResultSet> executeSimpleFulltextWithDocumentResultSet(
String collectionName,
String attribute,
String query,
int skip,
int limit,
String index,
Class clazz) throws ArangoException {
return simpleDriver.executeSimpleFulltextWithDocumentResultSet(getDefaultDatabase(), collectionName, attribute,
query, skip, limit, index, clazz);
}
/**
* This will remove all documents in the collection that match the specified
* example object.
*
* @param collectionName
* The collection name.
* @param example
* The example as a map.
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @param limit
* limits the amount of documents which will be deleted.
* @return SimpleByResultEntity
* @throws ArangoException
*/
public SimpleByResultEntity executeSimpleRemoveByExample(
String collectionName,
Map example,
Boolean waitForSync,
Integer limit) throws ArangoException {
return simpleDriver.executeSimpleRemoveByExample(getDefaultDatabase(), collectionName, example, waitForSync,
limit);
}
/**
* This will replace all documents in the collection that match the
* specified example object.
*
* @param collectionName
* The collection name.
* @param example
* The example as a map.
* @param newValue
* The new values.
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @param limit
* limits the amount of documents which will be replaced.
* @return SimpleByResultEntity
* @throws ArangoException
*/
public SimpleByResultEntity executeSimpleReplaceByExample(
String collectionName,
Map example,
Map newValue,
Boolean waitForSync,
Integer limit) throws ArangoException {
return simpleDriver.executeSimpleReplaceByExample(getDefaultDatabase(), collectionName, example, newValue,
waitForSync, limit);
}
/**
* This will update all documents in the collection that match the specified
* example object.
*
* @param collectionName
* The collection name.
* @param example
* The example as a map.
* @param newValue
* The new values.
* @param keepNull
* - If true null values are kept.
* @param waitForSync
* if set to true the response is returned when the server has
* finished.
* @param limit
* limits the amount of documents which will be updated.
* @return SimpleByResultEntity
* @throws ArangoException
*/
public SimpleByResultEntity executeSimpleUpdateByExample(
String collectionName,
Map example,
Map newValue,
Boolean keepNull,
Boolean waitForSync,
Integer limit) throws ArangoException {
return simpleDriver.executeSimpleUpdateByExample(getDefaultDatabase(), collectionName, example, newValue,
keepNull, waitForSync, limit);
}
/**
* This will return the first document(s) from the collection, in the order
* of insertion/update time.
*
* @param collectionName
* The collection name.
* @param count
* the number of documents to return at most. Specifiying count
* is optional. If it is not specified, it defaults to 1.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return DocumentResultEntity
* @throws ArangoException
*/
public DocumentResultEntity executeSimpleFirst(String collectionName, Integer count, Class clazz)
throws ArangoException {
return simpleDriver.executeSimpleFirst(getDefaultDatabase(), collectionName, count, clazz);
}
/**
* This will return the last document(s) from the collection, in the order
* of insertion/update time.
*
* @param collectionName
* The collection name.
* @param count
* the number of documents to return at most. Specifiying count
* is optional. If it is not specified, it defaults to 1.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @return DocumentResultEntity
* @throws ArangoException
*/
public DocumentResultEntity executeSimpleLast(String collectionName, Integer count, Class clazz)
throws ArangoException {
return simpleDriver.executeSimpleLast(getDefaultDatabase(), collectionName, count, clazz);
}
/**
* Creates a database user.
*
* @param username
* the username as string
* @param passwd
* the username as string
* @param active
* if true the user is active
* @param extra
* additional user data
* @return DefaultEntity
* @throws ArangoException
*/
public DefaultEntity createUser(String username, String passwd, Boolean active, Map extra)
throws ArangoException {
return usersDriver.createUser(getDefaultDatabase(), username, passwd, active, extra);
}
/**
* Replaces the data of a database user.
*
* @param username
* the username as string
* @param passwd
* the username as string
* @param active
* if true the user is active
* @param extra
* additional user data
* @return DefaultEntity
* @throws ArangoException
*/
public DefaultEntity replaceUser(String username, String passwd, Boolean active, Map extra)
throws ArangoException {
return usersDriver.replaceUser(getDefaultDatabase(), username, passwd, active, extra);
}
/**
* Updates the data of a database user.
*
* @param username
* the username as string
* @param passwd
* the username as string
* @param active
* if true the user is active
* @param extra
* additional user data
* @return DefaultEntity
* @throws ArangoException
*/
public DefaultEntity updateUser(String username, String passwd, Boolean active, Map extra)
throws ArangoException {
return usersDriver.updateUser(getDefaultDatabase(), username, passwd, active, extra);
}
/**
* Deletes a database user.
*
* @param username
* the username as string
* @return DefaultEntity
* @throws ArangoException
*/
public DefaultEntity deleteUser(String username) throws ArangoException {
return usersDriver.deleteUser(getDefaultDatabase(), username);
}
/**
* Returns a database user.
*
* @param username
* the username as string
* @return UserEntity
* @throws ArangoException
*/
public UserEntity getUser(String username) throws ArangoException {
return usersDriver.getUser(getDefaultDatabase(), username);
}
/**
* Returns all database user as document.
*
* @return List>
* @throws ArangoException
*/
public List> getUsersDocument() throws ArangoException {
DocumentCursor documentCursor = executeSimpleAllDocuments("_users", 0, 0, UserEntity.class);
return documentCursor.asList();
}
/**
* Returns all database user.
*
* @return List
* @throws ArangoException
*/
public List getUsers() throws ArangoException {
DocumentCursor documentCursor = executeSimpleAllDocuments("_users", 0, 0, UserEntity.class);
return documentCursor.asEntityList();
}
/**
* Creates documents in the collection.
*
* @param collection
* the collection as a string
* @param createCollection
* if set to true the collection is created if it does not exist
* @param values
* a list of Objects that will be stored as documents
* @return ImportResultEntity
* @throws ArangoException
*/
public ImportResultEntity importDocuments(String collection, Boolean createCollection, Collection> values)
throws ArangoException {
return importDriver.importDocuments(getDefaultDatabase(), collection, createCollection, values);
}
/**
* Creates documents in the collection.
*
* @param collection
* the collection as a string
* @param createCollection
* if set to true the collection is created if it does not exist
* @param headerValues
* a list of lists that will be stored as documents
* @return ImportResultEntity
* @throws ArangoException
*/
public ImportResultEntity importDocumentsByHeaderValues(
String collection,
Boolean createCollection,
Collection extends Collection>> headerValues) throws ArangoException {
return importDriver.importDocumentsByHeaderValues(getDefaultDatabase(), collection, createCollection,
headerValues);
}
/**
* Returns the current database
*
* @return DatabaseEntity
* @throws ArangoException
*/
public DatabaseEntity getCurrentDatabase() throws ArangoException {
return databaseDriver.getCurrentDatabase(getDefaultDatabase());
}
/**
* Returns all databases
*
* @return StringsResultEntity
* @throws ArangoException
*/
public StringsResultEntity getDatabases() throws ArangoException {
return getDatabases(false);
}
/**
* Returns all databases
*
* @param currentUserAccessableOnly
* If true only the databases are returned that the current user
* can access
* @return StringsResultEntity
* @throws ArangoException
*/
public StringsResultEntity getDatabases(boolean currentUserAccessableOnly) throws ArangoException {
return databaseDriver.getDatabases(currentUserAccessableOnly, null, null);
}
/**
* Returns all databases the user identified by his credentials can access
*
* @param username
* the username as string
* @param password
* the password as string
* @return StringsResultEntity
* @throws ArangoException
*/
public StringsResultEntity getDatabases(String username, String password) throws ArangoException {
return databaseDriver.getDatabases(true, username, password);
}
/**
* This method creates a database
*
* @param database
* the database name as a string
* @param users
* a list of users which are supposed to have access to the
* database
* @return BooleanResultEntity
* @throws ArangoException
*/
public BooleanResultEntity createDatabase(String database, UserEntity... users) throws ArangoException {
return databaseDriver.createDatabase(database, users);
}
/**
* This method deletes a database
*
* @param database
* the database name as a string
* @return BooleanResultEntity
* @throws ArangoException
*/
public BooleanResultEntity deleteDatabase(String database) throws ArangoException {
return databaseDriver.deleteDatabase(database);
}
/**
* This method creates an endpoint.
*
* @param endpoint
* the endpoint as string
* @param databases
* a list of databases that are allowed on this endpoint
* @return BooleanResultEntity
*/
public BooleanResultEntity createEndpoint(String endpoint, String... databases) throws ArangoException {
return endpointDriver.createEndpoint(endpoint, databases);
}
/**
* This method returns all endpoints.
*
* @return List
*/
public List getEndpoints() throws ArangoException {
return endpointDriver.getEndpoints();
}
/**
* This method deletes an endpoint
*
* @param endpoint
* the endpoint as string
* @return BooleanResultEntity
*/
public BooleanResultEntity deleteEndpoint(String endpoint) throws ArangoException {
return endpointDriver.deleteEndpoint(endpoint);
}
/**
* Returns the list of collections and indexes available on the server. This
* list can be used by replication clients to initiate an initial sync with
* the server.
*
* @return ReplicationInventoryEntity
* @throws ArangoException
*/
public ReplicationInventoryEntity getReplicationInventory() throws ArangoException {
return replicationDriver.getReplicationInventory(getDefaultDatabase(), null);
}
/**
* Returns the list of collections and indexes available on the server. This
* list can be used by replication clients to initiate an initial sync with
* the server.
*
* @param includeSystem
* if true the system collections are included into the result
* @return ReplicationInventoryEntity
* @throws ArangoException
*/
public ReplicationInventoryEntity getReplicationInventory(boolean includeSystem) throws ArangoException {
return replicationDriver.getReplicationInventory(getDefaultDatabase(), includeSystem);
}
/**
* Returns the data from the collection for the requested range.
*
* @param collectionName
* the collection name
* @param from
* Lower bound tick value for results.
* @param to
* Upper bound tick value for results.
* @param chunkSize
* Approximate maximum size of the returned result.
* @param ticks
* Whether or not to include tick values in the dump. Default
* value is true.
* @param clazz
* the expected class, the result from the server request is
* deserialized to an instance of this class.
* @param handler
* a handler object that processes the dump
* @throws ArangoException
*/
public void getReplicationDump(
String collectionName,
Long from,
Long to,
Integer chunkSize,
Boolean ticks,
Class clazz,
DumpHandler handler) throws ArangoException {
replicationDriver.getReplicationDump(getDefaultDatabase(), collectionName, from, to, chunkSize, ticks, clazz,
handler);
}
/**
* Starts a full data synchronization from a remote endpoint into the local
* ArangoDB database.
*
* @param endpoint
* the endpoint as string
* @param database
* the database name as a string
* @param username
* the username as string
* @param password
* the password as string
* @param restrictType
* collection filtering. When specified, the allowed values are
* include or exclude.
* @param restrictCollections
* If restrictType is include, only the specified collections
* will be sychronised. If restrictType is exclude, all but the
* specified collections will be synchronized.
* @return ReplicationSyncEntity
* @throws ArangoException
*/
public ReplicationSyncEntity syncReplication(
String endpoint,
String database,
String username,
String password,
RestrictType restrictType,
String... restrictCollections) throws ArangoException {
return replicationDriver.syncReplication(getDefaultDatabase(), endpoint, database, username, password,
restrictType, restrictCollections);
}
/**
* Returns the servers id. The id is also returned by other replication API
* methods, and this method is an easy means of determining a server's id.
*
* @return String
* @throws ArangoException
*/
public String getReplicationServerId() throws ArangoException {
return replicationDriver.getReplicationServerId();
}
/**
* Starts the replication logger
*
* @return boolean
* @throws ArangoException
*/
public boolean startReplicationLogger() throws ArangoException {
return replicationDriver.startReplicationLogger(getDefaultDatabase());
}
/**
* Stops the replication logger
*
* @return boolean
* @throws ArangoException
*/
public boolean stopReplicationLogger() throws ArangoException {
return replicationDriver.stopReplicationLogger(getDefaultDatabase());
}
/**
* Returns the current state of the server's replication logger. The state
* will include information about whether the logger is running and about
* the last logged tick value.
*
* @return ReplicationLoggerStateEntity
* @throws ArangoException
* @since 1.4.0
*/
public ReplicationLoggerStateEntity getReplicationLoggerState() throws ArangoException {
return replicationDriver.getReplicationLoggerState(getDefaultDatabase());
}
/**
* Returns the configuration of the replication logger
*
* @return ReplicationLoggerConfigEntity
* @throws ArangoException
*/
public ReplicationLoggerConfigEntity getReplicationLoggerConfig() throws ArangoException {
return replicationDriver.getReplicationLoggerConfig(getDefaultDatabase());
}
/**
* Sets the replication logger configuration
*
* @param autoStart
* if true autoStart is activated
* @param logRemoteChanges
* if true remote changes are logged
* @param maxEvents
* the maximum amount of events to log
* @param maxEventsSize
* the maximum size of events
* @return ReplicationLoggerConfigEntity
* @throws ArangoException
*/
public ReplicationLoggerConfigEntity setReplicationLoggerConfig(
Boolean autoStart,
Boolean logRemoteChanges,
Long maxEvents,
Long maxEventsSize) throws ArangoException {
return replicationDriver.setReplicationLoggerConfig(getDefaultDatabase(), autoStart, logRemoteChanges,
maxEvents, maxEventsSize);
}
/**
* Returns the configuration of the replication applier.
*
* @return ReplicationApplierConfigEntity
* @throws ArangoException
* @since 1.4.0
*/
public ReplicationApplierConfigEntity getReplicationApplierConfig() throws ArangoException {
return replicationDriver.getReplicationApplierConfig(getDefaultDatabase());
}
/**
* Sets the configuration of the replication applier.
*
* @param endpoint
* the logger server to connect to (e.g.
* "tcp://192.168.173.13:8529").
* @param database
* the name of the database on the endpoint.
* @param username
* an optional ArangoDB username to use when connecting to the
* endpoint
* @param password
* the password to use when connecting to the endpoint.
* @param maxConnectRetries
* the maximum number of connection attempts the applier will
* make in a row. If the applier cannot establish a connection to
* the endpoint in this number of attempts, it will stop itself.
* @param connectTimeout
* the timeout (in seconds) when attempting to connect to the
* endpoint. This value is used for each connection attempt.
* @param requestTimeout
* the timeout (in seconds) for individual requests to the
* endpoint.
* @param chunkSize
* the requested maximum size for log transfer packets that is
* used when the endpoint is contacted.
* @param autoStart
* whether or not to auto-start the replication applier on (next
* and following) server starts
* @param adaptivePolling
* if set to true, the replication applier will fall to sleep for
* an increasingly long period in case the logger server at the
* endpoint does not have any more replication events to apply.
* @return ReplicationApplierConfigEntity
* @throws ArangoException
*/
public ReplicationApplierConfigEntity setReplicationApplierConfig(
String endpoint,
String database,
String username,
String password,
Integer maxConnectRetries,
Integer connectTimeout,
Integer requestTimeout,
Integer chunkSize,
Boolean autoStart,
Boolean adaptivePolling) throws ArangoException {
return replicationDriver.setReplicationApplierConfig(getDefaultDatabase(), endpoint, database, username,
password, maxConnectRetries, connectTimeout, requestTimeout, chunkSize, autoStart, adaptivePolling);
}
/**
* Sets the configuration of the replication applier.
*
* @param replicationApplierConfigEntity
* an instance of ReplicationApplierConfigEntity containing the
* complete config
* @return ReplicationApplierConfigEntity
* @throws ArangoException
*/
public ReplicationApplierConfigEntity setReplicationApplierConfig(
ReplicationApplierConfigEntity replicationApplierConfigEntity) throws ArangoException {
return replicationDriver.setReplicationApplierConfig(getDefaultDatabase(), replicationApplierConfigEntity);
}
/**
* Starts the replication applier. This will return immediately if the
* replication applier is already running.
*
* @param from
* The remote lastLogTick value from which to start applying.
* @return ReplicationApplierStateEntity
* @throws ArangoException
*/
public ReplicationApplierStateEntity startReplicationApplier(Long from) throws ArangoException {
return replicationDriver.startReplicationApplier(getDefaultDatabase(), from);
}
/**
* Stops the replication applier. This will return immediately if the
* replication applier is not running.
*
* @return ReplicationApplierStateEntity
* @throws ArangoException
*/
public ReplicationApplierStateEntity stopReplicationApplier() throws ArangoException {
return replicationDriver.stopReplicationApplier(getDefaultDatabase());
}
/**
* Returns the state of the replication applier, regardless of whether the
* applier is currently running or not.
*
* @return ReplicationApplierStateEntity
* @throws ArangoException
*/
public ReplicationApplierStateEntity getReplicationApplierState() throws ArangoException {
return replicationDriver.getReplicationApplierState(getDefaultDatabase());
}
/**
* Returns a GraphsEntity containing all graph as GraphEntity object of the
* default database.
*
* @return GraphsEntity Object containing all graphs of the database.
* @throws ArangoException
*/
public GraphsEntity getGraphs() throws ArangoException {
return graphDriver.getGraphs(getDefaultDatabase());
}
/**
* Creates a list of the names of all available graphs of the default
* database.
*
* @return List All graph names of the database.
* @throws ArangoException
*/
public List getGraphList() throws ArangoException {
return graphDriver.getGraphList(getDefaultDatabase());
}
/**
* Creates a graph.
*
* @param graphName
* The name of the graph to be created.
* @param edgeDefinitions
* List of the graphs edge definitions.
* @param orphanCollections
* List of the graphs orphan collections.
* @param waitForSync
* Wait for sync.
* @return GraphEntity The new graph.
* @throws ArangoException
*/
public GraphEntity createGraph(
String graphName,
List edgeDefinitions,
List orphanCollections,
Boolean waitForSync) throws ArangoException {
return graphDriver.createGraph(getDefaultDatabase(), graphName, edgeDefinitions, orphanCollections,
waitForSync);
}
/**
* Creates a graph.
*
* @param graph
* The graph objet to be persistet.
* @param waitForSync
* Wait for sync.
* @return GraphEntity The new graph.
* @throws ArangoException
*/
public GraphEntity createGraph(GraphEntity graph, Boolean waitForSync) throws ArangoException {
String graphName = graph.getName();
List edgeDefinitions = graph.getEdgeDefinitions();
List orphanCollections = graph.getOrphanCollections();
return graphDriver.createGraph(getDefaultDatabase(), graphName, edgeDefinitions, orphanCollections,
waitForSync);
}
/**
* Creates an empty graph.
*
* @param graphName
* The name of the graph to be created.
* @param waitForSync
* Wait for sync.
* @return GraphEntity The new graph.
* @throws ArangoException
*/
public GraphEntity createGraph(String graphName, Boolean waitForSync) throws ArangoException {
return graphDriver.createGraph(getDefaultDatabase(), graphName, waitForSync);
}
/**
* Get graph object by name, including its edge definitions and vertex
* collections.
*
* @param graphName
* The name of the graph.
* @return GraphEntity The graph.
* @throws ArangoException
*/
public GraphEntity getGraph(String graphName) throws ArangoException {
return graphDriver.getGraph(getDefaultDatabase(), graphName);
}
/**
* Delete a graph by its name. The collections of the graph will not be
* dropped.
*
* @param graphName
* Name of the graph to be deleted.
* @return DeletedEntity
* @throws ArangoException
*/
public DeletedEntity deleteGraph(String graphName) throws ArangoException {
return graphDriver.deleteGraph(getDefaultDatabase(), graphName, false);
}
/**
* Delete a graph by its name. If dropCollections is true, all collections
* of the graph will be dropped, if they are not used in another graph.
*
* @param graphName
* Name of the graph to be deleted.
* @param dropCollections
* Indicates if the collections of the graph will be dropped
* @throws ArangoException
*/
public void deleteGraph(String graphName, Boolean dropCollections) throws ArangoException {
graphDriver.deleteGraph(getDefaultDatabase(), graphName, dropCollections);
}
/**
* Returns a list of all vertex collection of a graph that are defined in
* the graphs edgeDefinitions (in "from", "to", and "orphanCollections")
*
* @param graphName
* The graph name.
* @return List List of the names of the vertex collections
* @throws ArangoException
*/
public List graphGetVertexCollections(String graphName) throws ArangoException {
return graphDriver.getVertexCollections(getDefaultDatabase(), graphName);
}
/**
* Removes a vertex collection from the graph and optionally deletes the
* collection, if it is not used in any other graph.
*
* @param graphName
* The graph name.
* @param collectionName
* The name of the vertex collection to be removed from the
* graph.
* @param dropCollection
* Indicates if the collection will be dropped
* @throws ArangoException
*/
public DeletedEntity graphDeleteVertexCollection(String graphName, String collectionName, Boolean dropCollection)
throws ArangoException {
return graphDriver.deleteVertexCollection(getDefaultDatabase(), graphName, collectionName, dropCollection);
}
/**
* Creates a vertex collection
*
* @param graphName
* The graph name.
* @param collectionName
* The name of the collection to be created.
* @return GraphEntity The graph, including the new collection.
* @throws ArangoException
*/
public GraphEntity graphCreateVertexCollection(String graphName, String collectionName) throws ArangoException {
return graphDriver.createVertexCollection(getDefaultDatabase(), graphName, collectionName);
}
/**
* Returns a list of all edge collection of a graph that are defined in the
* graphs edgeDefinitions
*
* @param graphName
* The graph name.
* @return List List of the names of all edge collections of the
* graph.
* @throws ArangoException
*/
public List graphGetEdgeCollections(String graphName) throws ArangoException {
return graphDriver.getEdgeCollections(getDefaultDatabase(), graphName);
}
/**
* Adds a new edge definition to an existing graph
*
* @param graphName
* The graph name.
* @param edgeDefinition
* The edge definition to be added.
* @return GraphEntity The graph, including the new edge definition.
* @throws ArangoException
*/
public GraphEntity graphCreateEdgeDefinition(String graphName, EdgeDefinitionEntity edgeDefinition)
throws ArangoException {
return graphDriver.createEdgeDefinition(getDefaultDatabase(), graphName, edgeDefinition);
}
/**
* Replaces an existing edge definition to an existing graph. This will also
* change the edge definitions of all other graphs using this definition as
* well.
*
* @param graphName
* The name of the graph.
* @param edgeCollectionName
* The name of the edge collection of the edge definition that
* has to be replaced.
* @param edgeDefinition
* The new edge definition.
* @return GraphEntity The graph, including the changed edge definition.
* @throws ArangoException
*/
public GraphEntity graphReplaceEdgeDefinition(
String graphName,
String edgeCollectionName,
EdgeDefinitionEntity edgeDefinition) throws ArangoException {
return graphDriver.replaceEdgeDefinition(getDefaultDatabase(), graphName, edgeCollectionName, edgeDefinition);
}
/**
* Removes an existing edge definition from this graph. All data stored in
* the collections is dropped as well as long as it is not used in other
* graphs.
*
* @param graphName
* The name of the graph.
* @param edgeCollectionName
* The name of edge collection of the edge definition which has
* to be deleted.
* @return The graph, excluding the deleted edge definition.
*/
public GraphEntity graphDeleteEdgeDefinition(String graphName, String edgeCollectionName, Boolean dropCollection)
throws ArangoException {
return graphDriver.deleteEdgeDefinition(getDefaultDatabase(), graphName, edgeCollectionName, dropCollection);
}
/**
* Stores a new vertex with the information contained within the document
* into the given collection.
*
* @param graphName
* The name of the graph.
* @param collectionName
* The name of the collection, where the vertex will be created.
* @param vertex
* The vertex object to be stored
* @param waitForSync
* Wait for sync.
* @return DocumentEntity The resulting DocumentEntity containing the
* vertex document.
* @throws ArangoException
*/
public VertexEntity graphCreateVertex(String graphName, String collectionName, T vertex, Boolean waitForSync)
throws ArangoException {
return graphDriver.createVertex(getDefaultDatabase(), graphName, collectionName, vertex, waitForSync);
}
/**
* Stores a new vertex with the information contained within the document
* into the given collection.
*
* @param graphName
* The name of the graph.
* @param collectionName
* The name of the collection, where the vertex will be created.
* @param key
* The vertex key.
* @param vertex
* The vertex object to be stored
* @param waitForSync
* Wait for sync.
* @return DocumentEntity The resulting DocumentEntity containing the
* vertex document.
* @throws ArangoException
*/
public VertexEntity graphCreateVertex(
String graphName,
String collectionName,
String key,
T vertex,
Boolean waitForSync) throws ArangoException {
return graphDriver.createVertex(getDefaultDatabase(), graphName, collectionName, key, vertex, waitForSync);
}
/**
* Gets a vertex with the given key if it is contained within your graph.
*
* @param graphName
* The name of the graph.
* @param collectionName
* The collection, containing the vertex to get.
* @param key
* The key (document handle) of the vertex to get.
* @param clazz
* The class of the vertex to get.
* @return DocumentEntity The resulting DocumentEntity containing the
* vertex document.
* @throws ArangoException
*/
public VertexEntity graphGetVertex(String graphName, String collectionName, String key, Class clazz)
throws ArangoException {
return graphDriver.getVertex(getDefaultDatabase(), graphName, collectionName, key, clazz, null, null);
}
/**
* Gets a vertex with the given key if it is contained within your graph.
*
* @param graphName
* The name of the graph.
* @param collectionName
* The collection, containing the vertex to get.
* @param key
* The key (document handle) of the vertex to get.
* @param clazz
* The class of the vertex to get.
* @param ifMatchRevision
* If not null the revision of the vertex in the database has to
* be equal to return a document.
* @param ifNoneMatchRevision
* If not null the revision of the vertex in the database has to
* be different to return a document.
* @return DocumentEntity