@Repository public class SimpleArangoRepository<T,ID> extends Object implements ArangoRepository<T,ID>
Constructor and Description |
---|
SimpleArangoRepository(ArangoOperations arangoOperations,
Class<T> domainClass) |
Modifier and Type | Method and Description |
---|---|
long |
count()
Counts the number of documents in the collection for the type of this
repository
|
<S extends T> |
count(Example<S> example)
Counts the number of documents in the collection which match with the given
example
|
void |
delete(T entity)
Deletes document in the database representing the given object, by getting
it's id
|
void |
deleteAll()
Deletes all documents in the collection for this repository
|
void |
deleteAll(Iterable<? extends T> entities)
Deletes all the given documents from the database
|
void |
deleteById(ID id)
Deletes the document with the given id or key
|
<S extends T> |
exists(Example<S> example)
Checks if any documents match with the given example
|
boolean |
existsById(ID id)
Checks if a document exists or not based on the given id or key
|
Iterable<T> |
findAll()
Gets all documents in the collection for the class type of this repository
|
<S extends T> |
findAll(Example<S> example)
Finds all documents which match with the given example
|
<S extends T> |
findAll(Example<S> example,
Pageable pageable)
Finds all documents which match with the given example, with pagination
|
<S extends T> |
findAll(Example<S> example,
Sort sort)
Finds all documents which match with the given example, then apply the given
sort to results
|
Page<T> |
findAll(Pageable pageable)
Gets all documents in the collection for the class type of this repository,
with pagination
|
Iterable<T> |
findAll(Sort sort)
Gets all documents in the collection for the class type of this repository,
with the given sort applied
|
Iterable<T> |
findAllById(Iterable<ID> ids)
Finds all documents with the an id or key in the argument
|
Optional<T> |
findById(ID id)
Finds if a document with the given id exists in the database
|
<S extends T> |
findOne(Example<S> example)
Finds one document which matches the given example object
|
<S extends T> |
save(S entity)
Saves the passed entity to the database using repsert from the template
|
<S extends T> |
saveAll(Iterable<S> entities)
Saves the given iterable of entities to the database using repsert from the template
|
public SimpleArangoRepository(ArangoOperations arangoOperations, Class<T> domainClass)
arangoOperations
- The template used to execute much of the
functionality of this classdomainClass
- the class type of this repositorypublic <S extends T> S save(S entity)
save
in interface CrudRepository<T,ID>
entity
- the entity to be saved to the databasepublic <S extends T> Iterable<S> saveAll(Iterable<S> entities)
saveAll
in interface CrudRepository<T,ID>
entities
- the iterable of entities to be saved to the databasepublic Optional<T> findById(ID id)
findById
in interface CrudRepository<T,ID>
id
- the id of the document to search forpublic boolean existsById(ID id)
existsById
in interface CrudRepository<T,ID>
id
- represents either the key or id of a document to check forpublic Iterable<T> findAll()
findAll
in interface CrudRepository<T,ID>
public Iterable<T> findAllById(Iterable<ID> ids)
findAllById
in interface CrudRepository<T,ID>
ids
- an iterable with ids/keys of documents to getpublic long count()
count
in interface CrudRepository<T,ID>
public void deleteById(ID id)
deleteById
in interface CrudRepository<T,ID>
id
- id or key of document to be deletedpublic void delete(T entity)
delete
in interface CrudRepository<T,ID>
entity
- the entity to be deleted from the databasepublic void deleteAll(Iterable<? extends T> entities)
deleteAll
in interface CrudRepository<T,ID>
entities
- iterable of entities to be deleted from the databasepublic void deleteAll()
deleteAll
in interface CrudRepository<T,ID>
public Iterable<T> findAll(Sort sort)
findAll
in interface PagingAndSortingRepository<T,ID>
sort
- the sort object to use for sortingpublic Page<T> findAll(Pageable pageable)
findAll
in interface PagingAndSortingRepository<T,ID>
pageable
- the pageable object to use for pagination of the resultspublic <S extends T> Optional<S> findOne(Example<S> example)
findOne
in interface QueryByExampleExecutor<T>
S
- example
- example object to construct query withpublic <S extends T> Iterable<S> findAll(Example<S> example)
findAll
in interface QueryByExampleExecutor<T>
S
- example
- example object to construct query withpublic <S extends T> Iterable<S> findAll(Example<S> example, Sort sort)
findAll
in interface QueryByExampleExecutor<T>
S
- example
- example object to construct query withsort
- sort object to sort resultspublic <S extends T> Page<S> findAll(Example<S> example, Pageable pageable)
findAll
in interface QueryByExampleExecutor<T>
S
- example
- example object to construct query withpageable
- pageable object to apply pagination withpublic <S extends T> long count(Example<S> example)
count
in interface QueryByExampleExecutor<T>
S
- example
- example object to construct query withpublic <S extends T> boolean exists(Example<S> example)
exists
in interface QueryByExampleExecutor<T>
S
- example
- Copyright © 2017–2020 ArangoDB GmbH. All rights reserved.