Class ArangoTemplate
java.lang.Object
com.arangodb.springframework.core.template.ArangoTemplate
- All Implemented Interfaces:
ArangoOperations,DefaultUserOperation.CollectionCallback,Aware,ApplicationContextAware
public class ArangoTemplate
extends Object
implements ArangoOperations, DefaultUserOperation.CollectionCallback, ApplicationContextAware
- Author:
- Mark Vollmary, Christian Lechner, Reşat SABIQ
-
Constructor Summary
ConstructorsConstructorDescriptionArangoTemplate(com.arangodb.ArangoDB arango, String database, ArangoConverter converter, ResolverFactory resolverFactory) ArangoTemplate(com.arangodb.ArangoDB arango, String database, ArangoConverter converter, ResolverFactory resolverFactory, PersistenceExceptionTranslator exceptionTranslator) -
Method Summary
Modifier and TypeMethodDescriptioncollection(Class<?> entityClass) Returns the operations interface for a collection.collection(String name) Returns the operations interface for a collection.collection(String name, com.arangodb.model.CollectionCreateOptions options) Returns the operations interface for a collection.<T> com.arangodb.entity.DocumentDeleteEntity<T>Deletes the document with the givenidfrom a collection.com.arangodb.entity.DocumentDeleteEntity<?>Deletes the document with the givenidfrom a collection.<T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentDeleteEntity<T>>deleteAll(Iterable<?> values, com.arangodb.model.DocumentDeleteOptions options, Class<T> entityClass) Deletes multiple documents from a collection.com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentDeleteEntity<?>>Deletes multiple documents from a collection.com.arangodb.ArangoDBdriver()Give direct access to the underlying drivervoidDrop an existing databasebooleanChecks whether the document exists by reading a single document head<T> Optional<T>Retrieves the document with the givenidfrom a collection.<T> Optional<T>Retrieves the document with the givenidfrom a collection.<T> Iterable<T>Retrieves all documents from a collection.<T> Iterable<T>Retrieves multiple documents with the givenidsfrom a collection.Iterable<com.arangodb.entity.UserEntity>getUsers()Fetches data about all users.com.arangodb.entity.ArangoDBVersionReturns the server name and version number.com.arangodb.entity.DocumentCreateEntity<?>Creates a new document from the given document, unless there is already a document with the _key given.<T> com.arangodb.entity.DocumentCreateEntity<T>insert(T value, com.arangodb.model.DocumentCreateOptions options) Creates a new document from the given document, unless there is already a document with the _key given.<T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentCreateEntity<T>>insertAll(Iterable<? extends T> values, com.arangodb.model.DocumentCreateOptions options, Class<T> entityClass) Creates new documents from the given documents, unless there is already a document with the _key given.<T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentCreateEntity<?>>Creates new documents from the given documents, unless there is already a document with the _key given.<T> com.arangodb.ArangoCursor<T>Performs a database query using the givenquery, then returns a newArangoCursorinstance for the result list.<T> com.arangodb.ArangoCursor<T>Performs a database query using the givenquery, then returns a newArangoCursorinstance for the result list.<T> com.arangodb.ArangoCursor<T>query(String query, Map<String, Object> bindVars, com.arangodb.model.AqlQueryOptions options, Class<T> entityClass) Performs a database query using the givenqueryandbindVars, then returns a newArangoCursorinstance for the result list.<T> com.arangodb.ArangoCursor<T>Performs a database query using the givenqueryandbindVars, then returns a newArangoCursorinstance for the result list.com.arangodb.entity.DocumentUpdateEntity<?>Replaces the document withidwith the one in the body, provided there is such a document and no precondition is violated<T> com.arangodb.entity.DocumentUpdateEntity<T>Replaces the document withidwith the one in the body, provided there is such a document and no precondition is violated<T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentUpdateEntity<T>>replaceAll(Iterable<? extends T> values, com.arangodb.model.DocumentReplaceOptions options, Class<T> entityClass) Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are specified by the _key attributes in the documents in values.<T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentUpdateEntity<?>>replaceAll(Iterable<? extends T> values, Class<T> entityClass) Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are specified by the _key attributes in the documents in values.<T> Trepsert(T value) Creates a new document from the given document, unless there is already a document with the id given.<T> Iterable<T>repsertAll(Iterable<T> values, Class<? super T> entityClass) Creates new documents from the given documents, unless there already exists.voidsetApplicationContext(ApplicationContext applicationContext) com.arangodb.entity.DocumentUpdateEntity<?>Partially updates the document identified by document id or key.<T> com.arangodb.entity.DocumentUpdateEntity<T>Partially updates the document identified by document id or key.<T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentUpdateEntity<T>>updateAll(Iterable<? extends T> values, com.arangodb.model.DocumentUpdateOptions options, Class<T> entityClass) Partially updates documents, the documents to update are specified by the _key attributes in the objects on values.<T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentUpdateEntity<?>>Partially updates documents, the documents to update are specified by the _key attributes in the objects on values.Return the operations interface for a user.
-
Constructor Details
-
ArangoTemplate
public ArangoTemplate(com.arangodb.ArangoDB arango, String database, ArangoConverter converter, ResolverFactory resolverFactory) -
ArangoTemplate
public ArangoTemplate(com.arangodb.ArangoDB arango, String database, ArangoConverter converter, ResolverFactory resolverFactory, PersistenceExceptionTranslator exceptionTranslator)
-
-
Method Details
-
driver
public com.arangodb.ArangoDB driver()Description copied from interface:ArangoOperationsGive direct access to the underlying driver- Specified by:
driverin interfaceArangoOperations- Returns:
- main access object of the driver
-
getVersion
Description copied from interface:ArangoOperationsReturns the server name and version number.- Specified by:
getVersionin interfaceArangoOperations- Returns:
- the server version, number
- Throws:
DataAccessException
-
query
public <T> com.arangodb.ArangoCursor<T> query(String query, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsPerforms a database query using the givenquery, then returns a newArangoCursorinstance for the result list.- Specified by:
queryin interfaceArangoOperations- Parameters:
query- An AQL query stringentityClass- The entity type of the result- Returns:
- cursor of the results
- Throws:
DataAccessException
-
query
public <T> com.arangodb.ArangoCursor<T> query(String query, Map<String, Object> bindVars, Class<T> entityClass) throws DataAccessExceptionDescription copied from interface:ArangoOperationsPerforms a database query using the givenqueryandbindVars, then returns a newArangoCursorinstance for the result list.- Specified by:
queryin interfaceArangoOperations- Parameters:
query- An AQL query stringbindVars- key/value pairs defining the variables to bind the query toentityClass- The entity type of the result- Returns:
- cursor of the results
- Throws:
DataAccessException
-
query
public <T> com.arangodb.ArangoCursor<T> query(String query, com.arangodb.model.AqlQueryOptions options, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsPerforms a database query using the givenquery, then returns a newArangoCursorinstance for the result list.- Specified by:
queryin interfaceArangoOperations- Parameters:
query- An AQL query stringoptions- Additional options that will be passed to the query API, can be nullentityClass- The entity type of the result- Returns:
- cursor of the results
- Throws:
DataAccessException
-
query
public <T> com.arangodb.ArangoCursor<T> query(String query, Map<String, Object> bindVars, com.arangodb.model.AqlQueryOptions options, Class<T> entityClass) throws DataAccessExceptionDescription copied from interface:ArangoOperationsPerforms a database query using the givenqueryandbindVars, then returns a newArangoCursorinstance for the result list.- Specified by:
queryin interfaceArangoOperations- Parameters:
query- An AQL query stringbindVars- key/value pairs defining the variables to bind the query tooptions- Additional options that will be passed to the query API, can be nullentityClass- The entity type of the result- Returns:
- cursor of the results
- Throws:
DataAccessException
-
deleteAll
public <T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentDeleteEntity<T>> deleteAll(Iterable<?> values, com.arangodb.model.DocumentDeleteOptions options, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsDeletes multiple documents from a collection.- Specified by:
deleteAllin interfaceArangoOperations- Parameters:
values- The keys of the documents or the documents themselvesoptions- Additional options, can be nullentityClass- The entity class which represents the collection- Returns:
- information about the documents
- Throws:
DataAccessException
-
deleteAll
public com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentDeleteEntity<?>> deleteAll(Iterable<?> values, Class<?> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsDeletes multiple documents from a collection.- Specified by:
deleteAllin interfaceArangoOperations- Parameters:
values- The keys of the documents or the documents themselvesentityClass- The entity class which represents the collection- Returns:
- information about the documents
- Throws:
DataAccessException
-
delete
public <T> com.arangodb.entity.DocumentDeleteEntity<T> delete(Object id, com.arangodb.model.DocumentDeleteOptions options, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsDeletes the document with the givenidfrom a collection.- Specified by:
deletein interfaceArangoOperations- Parameters:
id- The id or key of the documentoptions- Additional options, can be nullentityClass- The entity class which represents the collection- Returns:
- information about the document
- Throws:
DataAccessException
-
delete
public com.arangodb.entity.DocumentDeleteEntity<?> delete(Object id, Class<?> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsDeletes the document with the givenidfrom a collection.- Specified by:
deletein interfaceArangoOperations- Parameters:
id- The id or key of the documententityClass- The entity class which represents the collection- Returns:
- information about the document
- Throws:
DataAccessException
-
updateAll
public <T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentUpdateEntity<T>> updateAll(Iterable<? extends T> values, com.arangodb.model.DocumentUpdateOptions options, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsPartially updates documents, the documents to update are specified by the _key attributes in the objects on values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All attributes from the patch documents will be added to the existing documents if they do not yet exist, and overwritten in the existing documents if they do exist there.- Specified by:
updateAllin interfaceArangoOperations- Parameters:
values- A list of documentsoptions- Additional options, can be nullentityClass- The entity class which represents the collection- Returns:
- information about the documents
- Throws:
DataAccessException
-
updateAll
public <T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentUpdateEntity<?>> updateAll(Iterable<? extends T> values, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsPartially updates documents, the documents to update are specified by the _key attributes in the objects on values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All attributes from the patch documents will be added to the existing documents if they do not yet exist, and overwritten in the existing documents if they do exist there.- Specified by:
updateAllin interfaceArangoOperations- Parameters:
values- A list of documentsentityClass- The entity class which represents the collection- Returns:
- information about the documents
- Throws:
DataAccessException
-
update
public <T> com.arangodb.entity.DocumentUpdateEntity<T> update(Object id, T value, com.arangodb.model.DocumentUpdateOptions options) throws DataAccessException Description copied from interface:ArangoOperationsPartially updates the document identified by document id or key. The value must contain a document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not yet exist, and overwritten in the existing document if they do exist there.- Specified by:
updatein interfaceArangoOperations- Parameters:
id- The id or key of the documentvalue- A representation of a single documentoptions- Additional options, can be null- Returns:
- information about the document
- Throws:
DataAccessException
-
update
public com.arangodb.entity.DocumentUpdateEntity<?> update(Object id, Object value) throws DataAccessException Description copied from interface:ArangoOperationsPartially updates the document identified by document id or key. The value must contain a document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not yet exist, and overwritten in the existing document if they do exist there.- Specified by:
updatein interfaceArangoOperations- Parameters:
id- The id or key of the documentvalue- A representation of a single document- Returns:
- information about the document
- Throws:
DataAccessException
-
replaceAll
public <T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentUpdateEntity<T>> replaceAll(Iterable<? extends T> values, com.arangodb.model.DocumentReplaceOptions options, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsReplaces multiple documents in the specified collection with the ones in the values, the replaced documents are specified by the _key attributes in the documents in values.- Specified by:
replaceAllin interfaceArangoOperations- Parameters:
values- A List of documentsoptions- Additional options, can be nullentityClass- The entity class which represents the collection- Returns:
- information about the documents
- Throws:
DataAccessException
-
replaceAll
public <T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentUpdateEntity<?>> replaceAll(Iterable<? extends T> values, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsReplaces multiple documents in the specified collection with the ones in the values, the replaced documents are specified by the _key attributes in the documents in values.- Specified by:
replaceAllin interfaceArangoOperations- Parameters:
values- A List of documentsentityClass- The entity class which represents the collection- Returns:
- information about the documents
- Throws:
DataAccessException
-
replace
public <T> com.arangodb.entity.DocumentUpdateEntity<T> replace(Object id, T value, com.arangodb.model.DocumentReplaceOptions options) throws DataAccessException Description copied from interface:ArangoOperationsReplaces the document withidwith the one in the body, provided there is such a document and no precondition is violated- Specified by:
replacein interfaceArangoOperations- Parameters:
id- The id or key of the documentvalue- A representation of a single documentoptions- Additional options, can be null- Returns:
- information about the document
- Throws:
DataAccessException
-
replace
public com.arangodb.entity.DocumentUpdateEntity<?> replace(Object id, Object value) throws DataAccessException Description copied from interface:ArangoOperationsReplaces the document withidwith the one in the body, provided there is such a document and no precondition is violated- Specified by:
replacein interfaceArangoOperations- Parameters:
id- The id or key of the documentvalue- A representation of a single document- Returns:
- information about the document
- Throws:
DataAccessException
-
find
public <T> Optional<T> find(Object id, Class<T> entityClass, com.arangodb.model.DocumentReadOptions options) throws DataAccessException Description copied from interface:ArangoOperationsRetrieves the document with the givenidfrom a collection.- Specified by:
findin interfaceArangoOperations- Parameters:
id- The id or key of the documententityClass- The entity class which represents the collectionoptions- Additional options, can be null- Returns:
- the document identified by the id
- Throws:
DataAccessException
-
find
Description copied from interface:ArangoOperationsRetrieves the document with the givenidfrom a collection.- Specified by:
findin interfaceArangoOperations- Parameters:
id- The id or key of the documententityClass- The entity class which represents the collection- Returns:
- the document identified by the id
- Throws:
DataAccessException
-
findAll
Description copied from interface:ArangoOperationsRetrieves all documents from a collection.- Specified by:
findAllin interfaceArangoOperations- Parameters:
entityClass- The entity class which represents the collection- Returns:
- the documents
- Throws:
DataAccessException
-
findAll
Description copied from interface:ArangoOperationsRetrieves multiple documents with the givenidsfrom a collection.- Specified by:
findAllin interfaceArangoOperations- Parameters:
ids- The ids or keys of the documentsentityClass- The entity class which represents the collection- Returns:
- the documents
- Throws:
DataAccessException
-
insertAll
public <T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentCreateEntity<T>> insertAll(Iterable<? extends T> values, com.arangodb.model.DocumentCreateOptions options, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsCreates new documents from the given documents, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.- Specified by:
insertAllin interfaceArangoOperations- Parameters:
values- A List of documentsoptions- Additional options, can be nullentityClass- The entity class which represents the collection- Returns:
- information about the documents
- Throws:
DataAccessException
-
insertAll
public <T> com.arangodb.entity.MultiDocumentEntity<com.arangodb.entity.DocumentCreateEntity<?>> insertAll(Iterable<? extends T> values, Class<T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsCreates new documents from the given documents, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.- Specified by:
insertAllin interfaceArangoOperations- Parameters:
values- A List of documentsentityClass- The entity class which represents the collection- Returns:
- information about the documents
- Throws:
DataAccessException
-
insert
public <T> com.arangodb.entity.DocumentCreateEntity<T> insert(T value, com.arangodb.model.DocumentCreateOptions options) throws DataAccessException Description copied from interface:ArangoOperationsCreates a new document from the given document, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.- Specified by:
insertin interfaceArangoOperations- Parameters:
value- A representation of a single documentoptions- Additional options, can be null- Returns:
- information about the document
- Throws:
DataAccessException
-
insert
Description copied from interface:ArangoOperationsCreates a new document from the given document, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.- Specified by:
insertin interfaceArangoOperations- Parameters:
value- A representation of a single document- Returns:
- information about the document
- Throws:
DataAccessException
-
repsert
Description copied from interface:ArangoOperationsCreates a new document from the given document, unless there is already a document with the id given. In that case it replaces the document.- Specified by:
repsertin interfaceArangoOperations- Parameters:
value- A representation of a single document- Throws:
DataAccessException
-
repsertAll
public <T> Iterable<T> repsertAll(Iterable<T> values, Class<? super T> entityClass) throws DataAccessException Description copied from interface:ArangoOperationsCreates new documents from the given documents, unless there already exists. In that case it replaces the documents.- Specified by:
repsertAllin interfaceArangoOperations- Parameters:
values- A List of documentsentityClass- The entity class which represents the collection- Throws:
DataAccessException
-
exists
Description copied from interface:ArangoOperationsChecks whether the document exists by reading a single document head- Specified by:
existsin interfaceArangoOperations- Parameters:
id- The id or key of the documententityClass- The entity type representing the collection- Returns:
- true if the document exists, false if not
- Throws:
DataAccessException
-
dropDatabase
Description copied from interface:ArangoOperationsDrop an existing database- Specified by:
dropDatabasein interfaceArangoOperations- Throws:
DataAccessException
-
collection
Description copied from interface:ArangoOperationsReturns the operations interface for a collection. If the collection does not exists, it is created automatically.- Specified by:
collectionin interfaceArangoOperations- Specified by:
collectionin interfaceDefaultUserOperation.CollectionCallback- Parameters:
entityClass- The entity type representing the collection- Returns:
CollectionOperations- Throws:
DataAccessException
-
collection
Description copied from interface:ArangoOperationsReturns the operations interface for a collection. If the collection does not exists, it is created automatically.- Specified by:
collectionin interfaceArangoOperations- Specified by:
collectionin interfaceDefaultUserOperation.CollectionCallback- Parameters:
name- The name of the collection- Returns:
CollectionOperations- Throws:
DataAccessException
-
collection
public CollectionOperations collection(String name, com.arangodb.model.CollectionCreateOptions options) throws DataAccessException Description copied from interface:ArangoOperationsReturns the operations interface for a collection. If the collection does not exists, it is created automatically.- Specified by:
collectionin interfaceArangoOperations- Parameters:
name- The name of the collectionoptions- Additional options for collection creation, can be null- Returns:
CollectionOperations- Throws:
DataAccessException
-
user
Description copied from interface:ArangoOperationsReturn the operations interface for a user. The user is not created automatically if it does not exists.- Specified by:
userin interfaceArangoOperations- Parameters:
username- The name of the user- Returns:
UserOperations
-
getUsers
Description copied from interface:ArangoOperationsFetches data about all users. You can only execute this call if you have access to the _system database.- Specified by:
getUsersin interfaceArangoOperations- Returns:
- information about all users
- Throws:
DataAccessException
-
getConverter
- Specified by:
getConverterin interfaceArangoOperations
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
getResolverFactory
- Specified by:
getResolverFactoryin interfaceArangoOperations
-