T - the object instance being queried from the underlying persistence layerpublic interface StrolchDao<T extends StrolchRootElement>
This data access object is used to access StrolchRootElement from the underlying persistence layer. Objects
in Strolch are always referenced by a type and an ID. The type is a categorisation/grouping of the objects, while the
ID is a unique identifier of the object. The ID must be unique, even for multiple groups.
The DAO must support versioning. i.e. if versioning is enabled, then if an object is updated or removed, the existing version is not modified, but a new version is persisted so that rollbacks can be done
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Causes the DAO to flush any actions which have not yet been sent to the underlying persistence layer
|
boolean |
hasElement(String type,
String id)
Returns true if an element exists with the given type and id in the underlying persistence layer
|
List<T> |
queryAll()
Queries and returns all elements regardless of type
|
List<T> |
queryAll(String type)
Queries and returns all elements of the given type
|
T |
queryBy(String type,
String id)
Queries the latest version of the element with the given type and ID
|
T |
queryBy(String type,
String id,
int version)
Queries a specific version of the element with the given type and ID.
|
Set<String> |
queryKeySet()
Queries the set of IDs for all elements, regardless of types from the underlying persistence layer.
|
Set<String> |
queryKeySet(String type)
Queries the set of IDs for the elements with the given type
|
long |
querySize()
Returns the number of elements in the underlying persistence layer, regardless of type
|
long |
querySize(String type)
Returns the number of elements in the underlying persistence layer for the given type
|
Set<String> |
queryTypes()
Queries the current list of types from the underlying persistence layer
|
List<T> |
queryVersionsFor(String type,
String id)
Queries and returns all the versions of the element with the given type and ID
|
long |
queryVersionsSizeFor(String type,
String id)
Queries and returns the number of versions for the element with the given type and ID
|
void |
remove(T element)
Removes the given element from the underlying persistence layer
|
long |
removeAll()
Removes all elements regardless of type from the underlying persistence layer
|
void |
removeAll(List<T> elements)
Removes the given elements from the underlying persistence layer
|
long |
removeAllBy(String type)
Removes all elements of the given type from the underlying persistence layer
|
void |
removeVersion(T element)
Removes the given version of the given element from the underlying persistence layer.
|
void |
save(T element)
Persists the given element.
|
void |
saveAll(List<T> elements)
Persists the given list of elements.
|
void |
update(T element)
Updates the given element.
|
void |
updateAll(List<T> elements)
Updates the given list of elements.
|
Set<String> queryKeySet()
boolean hasElement(String type, String id)
type - the type of elementsid - the id of the element to returnlong querySize()
long querySize(String type)
Set<String> queryKeySet(String type)
Set<String> queryTypes()
T queryBy(String type, String id)
type - the type of the element to be queriedid - the id of the element to be queriedT queryBy(String type, String id, int version)
Queries a specific version of the element with the given type and ID.
Note: If you want to query the latest version, then use the method with out the version parameter
type - the type of the element to be queriedid - the id of the element to be queriedversion - the version of the element to be returnedList<T> queryVersionsFor(String type, String id)
type - the type of the element to be queriedid - the id of the element to be queriedlong queryVersionsSizeFor(String type, String id)
type - the type of the element to be queriedid - the id of the element to be queriedList<T> queryAll()
List<T> queryAll(String type)
type - the type of element to returnvoid save(T element) throws StrolchPersistenceException
element - the element to be persistedStrolchPersistenceException - if the element already existsvoid saveAll(List<T> elements) throws StrolchPersistenceException
elements - the list of elements to be persistedStrolchPersistenceException - if any of the elements already existvoid update(T element) throws StrolchPersistenceException
element - the element to be updatedStrolchPersistenceException - if the element does not existvoid updateAll(List<T> elements) throws StrolchPersistenceException
elements - the elements to be updatedStrolchPersistenceException - if any of the elements do not existvoid remove(T element) throws StrolchPersistenceException
Removes the given element from the underlying persistence layer
Note: This method deletes the given object including its versions! Do not call this method if you want to use versioning!
element - the element to be removedStrolchPersistenceException - if the element does not existvoid removeAll(List<T> elements) throws StrolchPersistenceException
Removes the given elements from the underlying persistence layer
Note: This method deletes the given objects including their versions! Do not call this method if you want to use versioning!
elements - the elements to be removedStrolchPersistenceException - if any of the elements do not existlong removeAll()
Removes all elements regardless of type from the underlying persistence layer
Note: This method does not support versioning. This method completely removes all objects regardless of type and their versions!
StrolchPersistenceExceptionlong removeAllBy(String type)
Removes all elements of the given type from the underlying persistence layer
Note: This method does not support versioning. This method completely removes all objects of the given type and their versions!
type - the type of element to removevoid removeVersion(T element) throws StrolchPersistenceException
Removes the given version of the given element from the underlying persistence layer. The version must be the
latest version and thus always deletes the newest version. To delete multiple versions call this method multiple
times. To remove it completely, call the remove(StrolchRootElement) method.
Note: This element given must be the current latest version!
element - the latest version of the element to be removedStrolchPersistenceException - if the element/version does not existvoid flush()
Copyright © 2011–2016 Strolch. All rights reserved.