Package sonia.scm.store
Interface QueryableStoreFactory
public interface QueryableStoreFactory
Factory to create
Normally, there should be no need to use this factory directly. Instead, for each type annotated with
Implementations probably are backed by a database or a similar storage system instead of the familiar file based storage using XML.
QueryableStore
and QueryableMutableStore
instances.
In comparison to the DataStoreFactory
, this factory is used to create stores which can execute
queries on the stored data. Queryable stores can be used for types which are annotated with QueryableType
.
Normally, there should be no need to use this factory directly. Instead, for each type annotated with
QueryableType
a dedicated store factory is generated which can be injected into other components.
For instance, if your data class is named MyData
and annotated with QueryableType
, a factory
you should find a MyDataStoreFactory
for your needs which is backed by this class.
Implementations probably are backed by a database or a similar storage system instead of the familiar file based storage using XML.
- Since:
- 3.8.0
-
Method Summary
Modifier and TypeMethodDescription<T> QueryableMaintenanceStore<T>
getForMaintenance
(Class<T> clazz, String... parentIds) <T> QueryableMutableStore<T>
getMutable
(Class<T> clazz, String... parentIds) Creates a mutable store for the given class and parent ids.<T> QueryableStore<T>
getReadOnly
(Class<T> clazz, String... parentIds) Creates a read-only store for the given class and optional parent ids.
-
Method Details
-
getReadOnly
Creates a read-only store for the given class and optional parent ids. If parent ids are omitted, queries will not be restricted to a specific parent (for example a repository) but will run on all data of the given type.- Type Parameters:
T
- The type of the data.- Parameters:
clazz
- The class of the data type (must be annotated withQueryableType
).parentIds
- Optional parent ids to restrict the query to a specific parent.- Returns:
- A read-only store for the given class and optional parent ids.
-
getMutable
Creates a mutable store for the given class and parent ids. In contrast to the read-only store, for a mutable store the parent ids are mandatory. For each parent class given in theQueryableType
annotation of the type, a concrete id has to be specified. This is because mutable stores are used to store data, which is done for the concrete parents only. So if data should be stored for different parents, separate mutable stores have to be created.
The mutable store provides methods to store, update and delete data but also all query methods of the read-only store.- Type Parameters:
T
- The type of the data.- Parameters:
clazz
- The class of the data type (must be annotated withQueryableType
).parentIds
- Ids for all parent classes named in theQueryableType
annotation.- Returns:
- A mutable store for the given class scoped to the given parents.
-
getForMaintenance
-