public class ArangoTemplate extends Object implements ArangoOperations, DefaultUserOperation.CollectionCallback, ApplicationContextAware
ArangoOperations.UpsertStrategy
Constructor and Description |
---|
ArangoTemplate(com.arangodb.ArangoDB arango,
String database,
ArangoConverter converter,
ResolverFactory resolverFactory) |
ArangoTemplate(com.arangodb.ArangoDB arango,
String database,
ArangoConverter converter,
ResolverFactory resolverFactory,
PersistenceExceptionTranslator exceptionTranslator) |
Modifier and Type | Method and Description |
---|---|
CollectionOperations |
collection(Class<?> entityClass)
Returns the operations interface for a collection.
|
CollectionOperations |
collection(String name)
Returns the operations interface for a collection.
|
CollectionOperations |
collection(String name,
com.arangodb.model.CollectionCreateOptions options)
Returns the operations interface for a collection.
|
com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> |
delete(Iterable<Object> values,
Class<?> entityClass)
Deletes multiple documents from a collection.
|
com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> |
delete(Iterable<Object> values,
Class<?> entityClass,
com.arangodb.model.DocumentDeleteOptions options)
Deletes multiple documents from a collection.
|
com.arangodb.entity.DocumentEntity |
delete(Object id,
Class<?> entityClass)
Deletes the document with the given
id from a collection. |
com.arangodb.entity.DocumentEntity |
delete(Object id,
Class<?> entityClass,
com.arangodb.model.DocumentDeleteOptions options)
Deletes the document with the given
id from a collection. |
com.arangodb.ArangoDB |
driver()
Give direct access to the underlying driver
|
void |
dropDatabase()
Drop an existing database
|
boolean |
exists(Object id,
Class<?> entityClass)
Checks whether the document exists by reading a single document head
|
<T> Iterable<T> |
find(Iterable<? extends Object> ids,
Class<T> entityClass)
Retrieves multiple documents with the given
ids from a collection. |
<T> Optional<T> |
find(Object id,
Class<T> entityClass)
Retrieves the document with the given
id from a collection. |
<T> Optional<T> |
find(Object id,
Class<T> entityClass,
com.arangodb.model.DocumentReadOptions options)
Retrieves the document with the given
id from a collection. |
<T> Iterable<T> |
findAll(Class<T> entityClass)
Retrieves all documents from a collection.
|
ArangoConverter |
getConverter() |
ResolverFactory |
getResolverFactory() |
Iterable<com.arangodb.entity.UserEntity> |
getUsers()
Fetches data about all users.
|
com.arangodb.entity.ArangoDBVersion |
getVersion()
Returns the server name and version number.
|
<T> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> |
insert(Iterable<T> values,
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<? extends com.arangodb.entity.DocumentEntity> |
insert(Iterable<T> values,
Class<T> entityClass,
com.arangodb.model.DocumentCreateOptions options)
Creates new documents from the given documents, unless there is already a document with the _key given.
|
com.arangodb.entity.DocumentEntity |
insert(Object value)
Creates a new document from the given document, unless there is already a document with the _key given.
|
com.arangodb.entity.DocumentEntity |
insert(Object value,
com.arangodb.model.DocumentCreateOptions options)
Creates a new document from the given document, unless there is already a document with the _key given.
|
com.arangodb.entity.DocumentEntity |
insert(String collectionName,
Object value)
Creates a new document from the given document, unless there is already a document with the _key given.
|
com.arangodb.entity.DocumentEntity |
insert(String collectionName,
Object 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.ArangoCursor<T> |
query(String query,
com.arangodb.model.AqlQueryOptions options,
Class<T> entityClass)
Performs a database query using the given
query , then returns a new ArangoCursor instance for the
result list. |
<T> com.arangodb.ArangoCursor<T> |
query(String query,
Class<T> entityClass)
Performs a database query using the given
query , then returns a new ArangoCursor instance 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 given
query and bindVars , then returns a new
ArangoCursor instance for the result list. |
<T> com.arangodb.ArangoCursor<T> |
query(String query,
Map<String,Object> bindVars,
Class<T> entityClass)
Performs a database query using the given
query and bindVars , then returns a new
ArangoCursor instance for the result list. |
<T> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> |
replace(Iterable<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> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> |
replace(Iterable<T> values,
Class<T> entityClass,
com.arangodb.model.DocumentReplaceOptions options)
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.
|
com.arangodb.entity.DocumentEntity |
replace(Object id,
Object value)
Replaces the document with
id with the one in the body, provided there is such a document and no
precondition is violated |
com.arangodb.entity.DocumentEntity |
replace(Object id,
Object value,
com.arangodb.model.DocumentReplaceOptions options)
Replaces the document with
id with the one in the body, provided there is such a document and no
precondition is violated |
<T> void |
repsert(Iterable<? extends T> values,
Class<T> entityClass)
Creates new documents from the given documents, unless there already exists.
|
<T> void |
repsert(T value)
Creates a new document from the given document, unless there is already a document with the id given.
|
void |
setApplicationContext(ApplicationContext applicationContext) |
<T> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> |
update(Iterable<T> values,
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<? extends com.arangodb.entity.DocumentEntity> |
update(Iterable<T> values,
Class<T> entityClass,
com.arangodb.model.DocumentUpdateOptions options)
Partially updates documents, the documents to update are specified by the _key attributes in the objects on
values.
|
com.arangodb.entity.DocumentEntity |
update(Object id,
Object value)
Partially updates the document identified by document id or key.
|
com.arangodb.entity.DocumentEntity |
update(Object id,
Object value,
com.arangodb.model.DocumentUpdateOptions options)
Partially updates the document identified by document id or key.
|
<T> void |
upsert(Iterable<T> value,
ArangoOperations.UpsertStrategy strategy)
Creates new documents from the given documents, unless there already exists.
|
<T> void |
upsert(T value,
ArangoOperations.UpsertStrategy strategy)
Creates a new document from the given document, unless there is already a document with the id given.
|
UserOperations |
user(String username)
Return the operations interface for a user.
|
public ArangoTemplate(com.arangodb.ArangoDB arango, String database, ArangoConverter converter, ResolverFactory resolverFactory)
public ArangoTemplate(com.arangodb.ArangoDB arango, String database, ArangoConverter converter, ResolverFactory resolverFactory, PersistenceExceptionTranslator exceptionTranslator)
public com.arangodb.ArangoDB driver()
ArangoOperations
driver
in interface ArangoOperations
public com.arangodb.entity.ArangoDBVersion getVersion() throws DataAccessException
ArangoOperations
getVersion
in interface ArangoOperations
DataAccessException
public <T> com.arangodb.ArangoCursor<T> query(String query, Class<T> entityClass) throws DataAccessException
ArangoOperations
query
, then returns a new ArangoCursor
instance for the
result list.query
in interface ArangoOperations
query
- An AQL query stringentityClass
- The entity type of the resultDataAccessException
public <T> com.arangodb.ArangoCursor<T> query(String query, Map<String,Object> bindVars, Class<T> entityClass) throws DataAccessException
ArangoOperations
query
and bindVars
, then returns a new
ArangoCursor
instance for the result list.query
in interface ArangoOperations
query
- An AQL query stringbindVars
- key/value pairs defining the variables to bind the query toentityClass
- The entity type of the resultDataAccessException
public <T> com.arangodb.ArangoCursor<T> query(String query, com.arangodb.model.AqlQueryOptions options, Class<T> entityClass) throws DataAccessException
ArangoOperations
query
, then returns a new ArangoCursor
instance for the
result list.query
in interface ArangoOperations
query
- An AQL query stringoptions
- Additional options that will be passed to the query API, can be nullentityClass
- The entity type of the resultDataAccessException
public <T> com.arangodb.ArangoCursor<T> query(String query, Map<String,Object> bindVars, com.arangodb.model.AqlQueryOptions options, Class<T> entityClass) throws DataAccessException
ArangoOperations
query
and bindVars
, then returns a new
ArangoCursor
instance for the result list.query
in interface ArangoOperations
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 resultDataAccessException
public com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> delete(Iterable<Object> values, Class<?> entityClass, com.arangodb.model.DocumentDeleteOptions options) throws DataAccessException
ArangoOperations
delete
in interface ArangoOperations
values
- The keys of the documents or the documents themselvesentityClass
- The entity class which represents the collectionoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> delete(Iterable<Object> values, Class<?> entityClass) throws DataAccessException
ArangoOperations
delete
in interface ArangoOperations
values
- The keys of the documents or the documents themselvesentityClass
- The entity class which represents the collectionDataAccessException
public com.arangodb.entity.DocumentEntity delete(Object id, Class<?> entityClass, com.arangodb.model.DocumentDeleteOptions options) throws DataAccessException
ArangoOperations
id
from a collection.delete
in interface ArangoOperations
id
- The id or key of the documententityClass
- The entity class which represents the collectionoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.DocumentEntity delete(Object id, Class<?> entityClass) throws DataAccessException
ArangoOperations
id
from a collection.delete
in interface ArangoOperations
id
- The id or key of the documententityClass
- The entity class which represents the collectionDataAccessException
public <T> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> update(Iterable<T> values, Class<T> entityClass, com.arangodb.model.DocumentUpdateOptions options) throws DataAccessException
ArangoOperations
update
in interface ArangoOperations
values
- A list of documentsentityClass
- The entity class which represents the collectionoptions
- Additional options, can be nullDataAccessException
public <T> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> update(Iterable<T> values, Class<T> entityClass) throws DataAccessException
ArangoOperations
update
in interface ArangoOperations
values
- A list of documentsentityClass
- The entity class which represents the collectionDataAccessException
public com.arangodb.entity.DocumentEntity update(Object id, Object value, com.arangodb.model.DocumentUpdateOptions options) throws DataAccessException
ArangoOperations
update
in interface ArangoOperations
id
- The id or key of the documentvalue
- A representation of a single documentoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.DocumentEntity update(Object id, Object value) throws DataAccessException
ArangoOperations
update
in interface ArangoOperations
id
- The id or key of the documentvalue
- A representation of a single documentDataAccessException
public <T> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> replace(Iterable<T> values, Class<T> entityClass, com.arangodb.model.DocumentReplaceOptions options) throws DataAccessException
ArangoOperations
replace
in interface ArangoOperations
values
- A List of documentsentityClass
- The entity class which represents the collectionoptions
- Additional options, can be nullDataAccessException
public <T> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> replace(Iterable<T> values, Class<T> entityClass) throws DataAccessException
ArangoOperations
replace
in interface ArangoOperations
values
- A List of documentsentityClass
- The entity class which represents the collectionDataAccessException
public com.arangodb.entity.DocumentEntity replace(Object id, Object value, com.arangodb.model.DocumentReplaceOptions options) throws DataAccessException
ArangoOperations
id
with the one in the body, provided there is such a document and no
precondition is violatedreplace
in interface ArangoOperations
id
- The id or key of the documentvalue
- A representation of a single documentoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.DocumentEntity replace(Object id, Object value) throws DataAccessException
ArangoOperations
id
with the one in the body, provided there is such a document and no
precondition is violatedreplace
in interface ArangoOperations
id
- The id or key of the documentvalue
- A representation of a single documentDataAccessException
public <T> Optional<T> find(Object id, Class<T> entityClass, com.arangodb.model.DocumentReadOptions options) throws DataAccessException
ArangoOperations
id
from a collection.find
in interface ArangoOperations
id
- The id or key of the documententityClass
- The entity class which represents the collectionoptions
- Additional options, can be nullDataAccessException
public <T> Optional<T> find(Object id, Class<T> entityClass) throws DataAccessException
ArangoOperations
id
from a collection.find
in interface ArangoOperations
id
- The id or key of the documententityClass
- The entity class which represents the collectionDataAccessException
public <T> Iterable<T> findAll(Class<T> entityClass) throws DataAccessException
ArangoOperations
findAll
in interface ArangoOperations
entityClass
- The entity class which represents the collectionDataAccessException
public <T> Iterable<T> find(Iterable<? extends Object> ids, Class<T> entityClass) throws DataAccessException
ArangoOperations
ids
from a collection.find
in interface ArangoOperations
ids
- The ids or keys of the documentsentityClass
- The entity class which represents the collectionDataAccessException
public <T> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> insert(Iterable<T> values, Class<T> entityClass, com.arangodb.model.DocumentCreateOptions options) throws DataAccessException
ArangoOperations
insert
in interface ArangoOperations
values
- A List of documentsentityClass
- The entity class which represents the collectionoptions
- Additional options, can be nullDataAccessException
public <T> com.arangodb.entity.MultiDocumentEntity<? extends com.arangodb.entity.DocumentEntity> insert(Iterable<T> values, Class<T> entityClass) throws DataAccessException
ArangoOperations
insert
in interface ArangoOperations
values
- A List of documentsentityClass
- The entity class which represents the collectionDataAccessException
public com.arangodb.entity.DocumentEntity insert(Object value, com.arangodb.model.DocumentCreateOptions options) throws DataAccessException
ArangoOperations
insert
in interface ArangoOperations
value
- A representation of a single documentoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.DocumentEntity insert(Object value) throws DataAccessException
ArangoOperations
insert
in interface ArangoOperations
value
- A representation of a single documentDataAccessException
public com.arangodb.entity.DocumentEntity insert(String collectionName, Object value, com.arangodb.model.DocumentCreateOptions options) throws DataAccessException
ArangoOperations
insert
in interface ArangoOperations
collectionName
- Name of the collection in which the new document should be insertedvalue
- A representation of a single documentoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.DocumentEntity insert(String collectionName, Object value) throws DataAccessException
ArangoOperations
insert
in interface ArangoOperations
collectionName
- Name of the collection in which the new document should be insertedvalue
- A representation of a single documentDataAccessException
public <T> void upsert(T value, ArangoOperations.UpsertStrategy strategy) throws DataAccessException
ArangoOperations
upsert
in interface ArangoOperations
value
- A representation of a single documentstrategy
- The strategy to use when not inserting the documentDataAccessException
public <T> void upsert(Iterable<T> value, ArangoOperations.UpsertStrategy strategy) throws DataAccessException
ArangoOperations
upsert
in interface ArangoOperations
value
- A List of documentsstrategy
- The strategy to use when not inserting the documentDataAccessException
public <T> void repsert(T value) throws DataAccessException
ArangoOperations
repsert
in interface ArangoOperations
value
- A representation of a single documentDataAccessException
public <T> void repsert(Iterable<? extends T> values, Class<T> entityClass) throws DataAccessException
ArangoOperations
repsert
in interface ArangoOperations
values
- A List of documentsentityClass
- The entity class which represents the collectionDataAccessException
public boolean exists(Object id, Class<?> entityClass) throws DataAccessException
ArangoOperations
exists
in interface ArangoOperations
id
- The id or key of the documententityClass
- The entity type representing the collectionDataAccessException
public void dropDatabase() throws DataAccessException
ArangoOperations
dropDatabase
in interface ArangoOperations
DataAccessException
public CollectionOperations collection(Class<?> entityClass) throws DataAccessException
ArangoOperations
collection
in interface ArangoOperations
collection
in interface DefaultUserOperation.CollectionCallback
entityClass
- The entity type representing the collectionCollectionOperations
DataAccessException
public CollectionOperations collection(String name) throws DataAccessException
ArangoOperations
collection
in interface ArangoOperations
collection
in interface DefaultUserOperation.CollectionCallback
name
- The name of the collectionCollectionOperations
DataAccessException
public CollectionOperations collection(String name, com.arangodb.model.CollectionCreateOptions options) throws DataAccessException
ArangoOperations
collection
in interface ArangoOperations
name
- The name of the collectionoptions
- Additional options for collection creation, can be nullCollectionOperations
DataAccessException
public UserOperations user(String username)
ArangoOperations
user
in interface ArangoOperations
username
- The name of the userUserOperations
public Iterable<com.arangodb.entity.UserEntity> getUsers() throws DataAccessException
ArangoOperations
getUsers
in interface ArangoOperations
DataAccessException
public ArangoConverter getConverter()
getConverter
in interface ArangoOperations
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
public ResolverFactory getResolverFactory()
getResolverFactory
in interface ArangoOperations
Copyright © 2017–2020 ArangoDB GmbH. All rights reserved.