public class JsonDBTemplate extends java.lang.Object implements JsonDBOperations
| Constructor and Description |
|---|
JsonDBTemplate(java.lang.String dbFilesLocationString,
java.lang.String baseScanPackage) |
JsonDBTemplate(java.lang.String dbFilesLocationString,
java.lang.String baseScanPackage,
boolean compatibilityMode,
java.util.Comparator<java.lang.String> schemaComparator) |
JsonDBTemplate(java.lang.String dbFilesLocationString,
java.lang.String baseScanPackage,
ICipher cipher) |
JsonDBTemplate(java.lang.String dbFilesLocationString,
java.lang.String baseScanPackage,
ICipher cipher,
boolean compatibilityMode,
java.util.Comparator<java.lang.String> schemaComparator) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCollectionFileChangeListener(CollectionFileChangeListener listener)
adds a CollectionFileChangeListener to db.
|
void |
backup(java.lang.String backupPath)
This method backs up JSONDB collections to specified backup path
|
<T> void |
changeEncryption(ICipher newCipher)
A method that allows changing the encryption algorithm and or encryption key used.
|
<T> boolean |
collectionExists(java.lang.Class<T> entityClass)
Check to see if a collection with a name indicated by the entity class exists.
|
boolean |
collectionExists(java.lang.String collectionName)
Check to see if a collection with a given name exists.
|
<T> void |
createCollection(java.lang.Class<T> entityClass)
Create an uncapped collection with a name based on the provided entity class.
|
<T> void |
createCollection(java.lang.String collectionName)
Create an uncapped collection with the provided name.
|
<T> void |
dropCollection(java.lang.Class<T> entityClass)
Drop the collection with the name indicated by the entity class.
|
void |
dropCollection(java.lang.String collectionName)
Drop the collection with the given name.
|
<T> java.util.List<T> |
find(java.lang.String jxQuery,
java.lang.Class<T> entityClass)
Map the results of an ad-hoc query on the collection for the entity class to a List of the specified type.
|
<T> java.util.List<T> |
find(java.lang.String jxQuery,
java.lang.Class<T> entityClass,
java.util.Comparator<? super T> comparator)
Map the results of an ad-hoc query on the collection for the entity class to a List of the specified type.
|
<T> java.util.List<T> |
find(java.lang.String jxQuery,
java.lang.Class<T> entityClass,
java.util.Comparator<? super T> comparator,
java.lang.String slice)
Map the results of an ad-hoc query on the specified collection to a List of the specified type.
|
<T> java.util.List<T> |
find(java.lang.String jxQuery,
java.lang.String collectionName)
Map the results of an ad-hoc query on the specified collection to a List of the specified type.
|
<T> java.util.List<T> |
find(java.lang.String jxQuery,
java.lang.String collectionName,
java.util.Comparator<? super T> comparator)
Map the results of an ad-hoc query on the specified collection to a List of the specified type.
|
<T> java.util.List<T> |
find(java.lang.String jxQuery,
java.lang.String collectionName,
java.util.Comparator<? super T> comparator,
java.lang.String slice)
Map the results of an ad-hoc query on the specified collection to a List of the specified type.
|
<T> java.util.List<T> |
findAll(java.lang.Class<T> entityClass)
Query for a list of objects of type T from the specified collection.
|
<T> java.util.List<T> |
findAll(java.lang.Class<T> entityClass,
java.util.Comparator<? super T> comparator)
Query for a list of objects of type T from the specified collection.
|
<T> java.util.List<T> |
findAll(java.lang.Class<T> entityClass,
java.util.Comparator<? super T> comparator,
java.lang.String slice)
Query for a list of objects of type T from the specified collection.
|
<T> java.util.List<T> |
findAll(java.lang.String collectionName)
Query for a list of objects of type T from the specified collection.
|
<T> java.util.List<T> |
findAll(java.lang.String collectionName,
java.util.Comparator<? super T> comparator)
Query for a list of objects of type T from the specified collection.
|
<T> java.util.List<T> |
findAll(java.lang.String collectionName,
java.util.Comparator<? super T> comparator,
java.lang.String slice)
Query for a list of objects of type T from the specified collection.
|
<T> java.util.List<T> |
findAllAndModify(java.lang.String jxQuery,
Update update,
java.lang.Class<T> entityClass) |
<T> java.util.List<T> |
findAllAndModify(java.lang.String jxQuery,
Update update,
java.lang.String collectionName) |
<T> java.util.List<T> |
findAllAndRemove(java.lang.String jxQuery,
java.lang.Class<T> entityClass)
Returns and removes all documents matching the given query form the collection used to store the entityClass.
|
<T> java.util.List<T> |
findAllAndRemove(java.lang.String jxQuery,
java.lang.String collectionName)
Returns and removes all documents matching the given query form the collection used to store the entityClass.
|
<T> T |
findAndModify(java.lang.String jxQuery,
Update update,
java.lang.Class<T> entityClass)
Triggers findAndModify to apply provided Update on the first document matching Criteria of given Query.
|
<T> T |
findAndModify(java.lang.String jxQuery,
Update update,
java.lang.String collectionName)
Triggers findAndModify to apply provided Update on the first document matching Criteria of given Query.
|
<T> T |
findAndRemove(java.lang.String jxQuery,
java.lang.Class<T> entityClass)
Map the results of the jxQuery on the collection for the entity type to a single
instance of an object of the specified type.
|
<T> T |
findAndRemove(java.lang.String jxQuery,
java.lang.String collectionName)
Map the results of the jxQuery on the collection for the entity type to a single
instance of an object of the specified type.
|
<T> T |
findById(java.lang.Object id,
java.lang.Class<T> entityClass)
Returns a document with the given id mapped onto the given class.
|
<T> T |
findById(java.lang.Object id,
java.lang.String collectionName)
Returns the document with the given id from the given collection mapped onto the given target class.
|
<T> T |
findOne(java.lang.String jxQuery,
java.lang.Class<T> entityClass) |
<T> T |
findOne(java.lang.String jxQuery,
java.lang.String collectionName) |
<T> java.util.List<T> |
getCollection(java.lang.Class<T> entityClass)
Get a collection by name, creating it if it doesn't exist.
|
java.lang.String |
getCollectionName(java.lang.Class<?> entityClass)
The collection name used for the specified class by this template.
|
java.util.Set<java.lang.String> |
getCollectionNames()
A set of collection names.
|
boolean |
hasCollectionFileChangeListener()
a method to check if there are any registered CollectionFileChangeListener
|
<T> void |
insert(java.util.Collection<? extends T> batchToSave,
java.lang.Class<T> entityClass)
Insert a Collection of objects into a collection in a single batch write to the database.
|
<T> void |
insert(java.util.Collection<? extends T> batchToSave,
java.lang.String collectionName)
Insert a Collection of objects into a collection in a single batch write to the database.
|
<T> void |
insert(java.lang.Object objectToSave)
Insert the object into correct collection.
|
<T> void |
insert(java.lang.Object objectToSave,
java.lang.String collectionName)
Insert the object into the specified collection.
|
<T> boolean |
isCollectionReadonly(java.lang.Class<T> entityClass)
is a collection readonly,
A collection can be readonly if its schema version does not match the actualSchema version
|
<T> boolean |
isCollectionReadonly(java.lang.String collectionName) |
void |
reloadCollection(java.lang.String collectionName)
Reloads a particular collection from dblocation directory
|
void |
reLoadDB()
Re-load the collections from dblocation folder.
|
<T> java.util.List<T> |
remove(java.util.Collection<? extends T> batchToRemove,
java.lang.Class<T> entityClass)
Remove a Collection of objects from a collection in a single batch write to the database.
|
<T> java.util.List<T> |
remove(java.util.Collection<? extends T> batchToRemove,
java.lang.String collectionName)
Remove a Collection of objects from a collection in a single batch write to the database.
|
<T> T |
remove(java.lang.Object objectToRemove,
java.lang.Class<T> entityClass)
Remove the given object from the collection by id.
|
<T> T |
remove(java.lang.Object objectToRemove,
java.lang.String collectionName)
Remove the given object from the collection by id.
|
void |
removeCollectionFileChangeListener(CollectionFileChangeListener listener)
removes a previously added CollectionFileChangeListener
|
void |
restore(java.lang.String restorePath,
boolean merge)
This method restores JSONDB collections from specified restore path.
|
<T> void |
save(java.lang.Object objectToSave,
java.lang.Class<T> entityClass)
Save the object to the collection for the entity type of the object to save.
|
<T> void |
save(java.lang.Object objectToSave,
java.lang.String collectionName)
Save the object to the collection for the entity type of the object to save.
|
<T> void |
updateCollectionSchema(CollectionSchemaUpdate update,
java.lang.Class<T> entityClass) |
<T> void |
updateCollectionSchema(CollectionSchemaUpdate update,
java.lang.String collectionName)
Update a collection as per the specified CollectionUpdate param.
|
<T> void |
upsert(java.util.Collection<? extends T> batchToSave,
java.lang.Class<T> entityClass)
Performs an upsert.
|
<T> void |
upsert(java.util.Collection<? extends T> batchToSave,
java.lang.String collectionName)
Performs an upsert.
|
<T> void |
upsert(java.lang.Object objectToSave)
Performs an upsert.
|
<T> void |
upsert(java.lang.Object objectToSave,
java.lang.String collectionName)
Performs an upsert.
|
public JsonDBTemplate(java.lang.String dbFilesLocationString,
java.lang.String baseScanPackage)
public JsonDBTemplate(java.lang.String dbFilesLocationString,
java.lang.String baseScanPackage,
boolean compatibilityMode,
java.util.Comparator<java.lang.String> schemaComparator)
public JsonDBTemplate(java.lang.String dbFilesLocationString,
java.lang.String baseScanPackage,
ICipher cipher)
public JsonDBTemplate(java.lang.String dbFilesLocationString,
java.lang.String baseScanPackage,
ICipher cipher,
boolean compatibilityMode,
java.util.Comparator<java.lang.String> schemaComparator)
public void reLoadDB()
JsonDBOperationsreLoadDB in interface JsonDBOperationspublic void reloadCollection(java.lang.String collectionName)
JsonDBOperationsreloadCollection in interface JsonDBOperationscollectionName - name of the collection to reloadpublic void addCollectionFileChangeListener(CollectionFileChangeListener listener)
JsonDBOperationsaddCollectionFileChangeListener in interface JsonDBOperationslistener - actual listener to addpublic void removeCollectionFileChangeListener(CollectionFileChangeListener listener)
JsonDBOperationsremoveCollectionFileChangeListener in interface JsonDBOperationslistener - actual listener to removepublic boolean hasCollectionFileChangeListener()
JsonDBOperationshasCollectionFileChangeListener in interface JsonDBOperationspublic <T> void createCollection(java.lang.Class<T> entityClass)
JsonDBOperationscreateCollection in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageentityClass - class that determines the collection to createpublic <T> void createCollection(java.lang.String collectionName)
JsonDBOperationscreateCollection in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagecollectionName - name of the collectionpublic <T> void dropCollection(java.lang.Class<T> entityClass)
JsonDBOperationsdropCollection in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageentityClass - class that determines the collection to drop/delete.public void dropCollection(java.lang.String collectionName)
JsonDBOperationsdropCollection in interface JsonDBOperationscollectionName - name of the collection to drop/delete.public <T> void updateCollectionSchema(CollectionSchemaUpdate update, java.lang.Class<T> entityClass)
updateCollectionSchema in interface JsonDBOperationspublic <T> void updateCollectionSchema(CollectionSchemaUpdate update, java.lang.String collectionName)
JsonDBOperationsupdateCollectionSchema in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageupdate - how to update the CollectioncollectionName - name of the collection to update schema forpublic java.util.Set<java.lang.String> getCollectionNames()
JsonDBOperationsgetCollectionNames in interface JsonDBOperationspublic java.lang.String getCollectionName(java.lang.Class<?> entityClass)
JsonDBOperationsgetCollectionName in interface JsonDBOperationsentityClass - must not be null.public <T> java.util.List<T> getCollection(java.lang.Class<T> entityClass)
JsonDBOperationsgetCollection in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageentityClass - class that determines the name of the collectionpublic <T> boolean collectionExists(java.lang.Class<T> entityClass)
JsonDBOperationscollectionExists in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageentityClass - class that determines the name of the collectionpublic boolean collectionExists(java.lang.String collectionName)
JsonDBOperationscollectionExists in interface JsonDBOperationscollectionName - name of the collectionpublic <T> boolean isCollectionReadonly(java.lang.Class<T> entityClass)
JsonDBOperationsisCollectionReadonly in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageentityClass - class that determines the collectionpublic <T> boolean isCollectionReadonly(java.lang.String collectionName)
isCollectionReadonly in interface JsonDBOperationspublic <T> java.util.List<T> find(java.lang.String jxQuery,
java.lang.Class<T> entityClass)
JsonDBOperationsfind in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - a XPATH query expressionentityClass - the parameterized type of the returned list.public <T> java.util.List<T> find(java.lang.String jxQuery,
java.lang.String collectionName)
JsonDBOperationsfind in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - a XPATH query expressioncollectionName - name of the collection to retrieve the objects frompublic <T> java.util.List<T> find(java.lang.String jxQuery,
java.lang.Class<T> entityClass,
java.util.Comparator<? super T> comparator)
JsonDBOperationsfind in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - a XPATH query expressionentityClass - the parameterized type of the returned list.comparator - Comparator to use for sorting the objectspublic <T> java.util.List<T> find(java.lang.String jxQuery,
java.lang.String collectionName,
java.util.Comparator<? super T> comparator)
JsonDBOperationsfind in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - a XPATH query expressioncollectionName - name of the collection to retrieve the objects fromcomparator - Comparator to use for sorting the objectspublic <T> java.util.List<T> find(java.lang.String jxQuery,
java.lang.Class<T> entityClass,
java.util.Comparator<? super T> comparator,
java.lang.String slice)
JsonDBOperationsfind in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - a XPATH query expressionentityClass - the parameterized type of the returned list.comparator - Comparator to use for sorting the objects
Note: If sorting along with slicing is used then sorting over fields with the 'secret' anotation
will actually sort the raw encrypted field value, which will be undesirable and probably useless,
this limitation is for efficiency reasons, when slicing is enabled we defer the deep copy and
decryption of secret fields until a later stage (which happens after sorting), assuming quite
some objects may not be selected due to slicing
However if slicing is not used then the sorting will sort over unencrypted field value.slice - select the indices to return from the find_result. The behaviour of this slicing feature is similar to
the slicing feature in python or numpy, as much as possible
https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html
A slice is a string notation and the basic slice syntax is i:j:k, where i is the starting index,
j is the stopping index, and k is the step (k != 0). In other words it is start:stop:step
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "1:7:2" returns [T1, T3, T5]
i is inclusive, j is exclusive
Negative i and j are interpreted as n + i and n + j where n is the number of elements found. Negative
k makes stepping go towards smaller indices.
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "-2:10" returns [T8, T9]
slice = "-3:3:-1" returns [T7, T6, T5, T4]
Assume n is the number of elements in find_result. Then, if i is not given it defaults to 0
for k>0 and n - 1 for k<0 . If j is not given it defaults to n for k>0 and -n-1 for k<0
If k is not given it defaults to 1. Note that :: is the same as : and means select all indices
from find_result.
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "5:" returns [T5, T6, T7, T8, T9]
Assume n is the number of elements in find_result. Then, if j>n then it is considered as n, in case
of negative j it is considered -n.public <T> java.util.List<T> find(java.lang.String jxQuery,
java.lang.String collectionName,
java.util.Comparator<? super T> comparator,
java.lang.String slice)
JsonDBOperationsfind in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - a XPATH query expressioncollectionName - name of the collection to retrieve the objects fromcomparator - Comparator to use for sorting the objects
Note: If sorting along with slicing is used then sorting over fields with the 'secret' anotation
will actually sort the raw encrypted field value, which will be undesirable and probably useless,
this limitation is for efficiency reasons, when slicing is enabled we defer the deep copy and
decryption of secret fields until a later stage (which happens after sorting), assuming quite
some objects may not be selected due to slicing
However if slicing is not used then the sorting will sort over unencrypted field value.slice - select the indices to return from the find_result. The behaviour of this slicing feature is similar to
the slicing feature in python or numpy, as much as possible
https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html
A slice is a string notation and the basic slice syntax is i:j:k, where i is the starting index,
j is the stopping index, and k is the step (k != 0). In other words it is start:stop:step
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "1:7:2" returns [T1, T3, T5]
i is inclusive, j is exclusive
Negative i and j are interpreted as n + i and n + j where n is the number of elements found. Negative
k makes stepping go towards smaller indices.
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "-2:10" returns [T8, T9]
slice = "-3:3:-1" returns [T7, T6, T5, T4]
Assume n is the number of elements in find_result. Then, if i is not given it defaults to 0
for k>0 and n - 1 for k<0 . If j is not given it defaults to n for k>0 and -n-1 for k<0
If k is not given it defaults to 1. Note that :: is the same as : and means select all indices
from find_result.
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "5:" returns [T5, T6, T7, T8, T9]
Assume n is the number of elements in find_result. Then, if j>n then it is considered as n, in case
of negative j it is considered -n.public <T> java.util.List<T> findAll(java.lang.Class<T> entityClass)
JsonDBOperationsfindAll in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageentityClass - the parameterized type of the returned list.public <T> java.util.List<T> findAll(java.lang.String collectionName)
JsonDBOperationsfindAll in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagecollectionName - name of the collection to retrieve the objects frompublic <T> java.util.List<T> findAll(java.lang.Class<T> entityClass,
java.util.Comparator<? super T> comparator)
JsonDBOperationsfindAll in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageentityClass - the parameterized type of the returned list.comparator - Comparator to use for sorting the objectspublic <T> java.util.List<T> findAll(java.lang.String collectionName,
java.util.Comparator<? super T> comparator)
JsonDBOperationsfindAll in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagecollectionName - name of the collection to retrieve the objects fromcomparator - Comparator to use for sorting the objectspublic <T> java.util.List<T> findAll(java.lang.Class<T> entityClass,
java.util.Comparator<? super T> comparator,
java.lang.String slice)
JsonDBOperationsfindAll in interface JsonDBOperationsT - Type annotated with Document annotation and member of the baseScanPackageentityClass - the parameterized type of the returned list.comparator - Comparator to use for sorting the objects
Note: If sorting along with slicing is used then sorting over fields with the 'secret' anotation
will actually sort the raw encrypted field value, which will be undesirable and probably useless,
this limitation is for efficiency reasons, when slicing is enabled we defer the deep copy and
decryption of secret fields until a later stage (which happens after sorting), assuming quite
some objects may not be selected due to slicing
However if slicing is not used then the sorting will sort over unencrypted field value.slice - select the indices to return from the find_result. The behaviour of this slicing feature is similar to
the slicing feature in python or numpy, as much as possible
https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html
A slice is a string notation and the basic slice syntax is i:j:k, where i is the starting index,
j is the stopping index, and k is the step (k != 0). In other words it is start:stop:step
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "1:7:2" returns [T1, T3, T5]
i is inclusive, j is exclusive
Negative i and j are interpreted as n + i and n + j where n is the number of elements found. Negative
k makes stepping go towards smaller indices.
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "-2:10" returns [T8, T9]
slice = "-3:3:-1" returns [T7, T6, T5, T4]
Assume n is the number of elements in find_result. Then, if i is not given it defaults to 0
for k>0 and n - 1 for k<0 . If j is not given it defaults to n for k>0 and -n-1 for k<0
If k is not given it defaults to 1. Note that :: is the same as : and means select all indices
from find_result.
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "5:" returns [T5, T6, T7, T8, T9]
Assume n is the number of elements in find_result. Then, if j>n then it is considered as n, in case
of negative j it is considered -n.public <T> java.util.List<T> findAll(java.lang.String collectionName,
java.util.Comparator<? super T> comparator,
java.lang.String slice)
JsonDBOperationsfindAll in interface JsonDBOperationsT - Type annotated with Document annotation and member of the baseScanPackagecollectionName - name of the collection to retrieve the objects fromcomparator - Comparator to use for sorting the objects
Note: If sorting along with slicing is used then sorting over fields with the 'secret' anotation
will actually sort the raw encrypted field value, which will be undesirable and probably useless,
this limitation is for efficiency reasons, when slicing is enabled we defer the deep copy and
decryption of secret fields until a later stage (which happens after sorting), assuming quite
some objects may not be selected due to slicing
However if slicing is not used then the sorting will sort over unencrypted field value.slice - select the indices to return from the find_result. The behaviour of this slicing feature is similar to
the slicing feature in python or numpy, as much as possible
https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html
A slice is a string notation and the basic slice syntax is i:j:k, where i is the starting index,
j is the stopping index, and k is the step (k != 0). In other words it is start:stop:step
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "1:7:2" returns [T1, T3, T5]
i is inclusive, j is exclusive
Negative i and j are interpreted as n + i and n + j where n is the number of elements found. Negative
k makes stepping go towards smaller indices.
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "-2:10" returns [T8, T9]
slice = "-3:3:-1" returns [T7, T6, T5, T4]
Assume n is the number of elements in find_result. Then, if i is not given it defaults to 0
for k>0 and n - 1 for k<0 . If j is not given it defaults to n for k>0 and -n-1 for k<0
If k is not given it defaults to 1. Note that :: is the same as : and means select all indices
from find_result.
Example find_result = [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
slice = "5:" returns [T5, T6, T7, T8, T9]
Assume n is the number of elements in find_result. Then, if j>n then it is considered as n, in case
of negative j it is considered -n.public <T> T findById(java.lang.Object id,
java.lang.Class<T> entityClass)
JsonDBOperationsfindById in interface JsonDBOperationsT - Type annotated with Document annotation and member of the baseScanPackageid - the id of the document to return.entityClass - the type the document shall be converted into.public <T> T findById(java.lang.Object id,
java.lang.String collectionName)
JsonDBOperationsfindById in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageid - the id of the document to returncollectionName - the collection to query for the documentpublic <T> T findOne(java.lang.String jxQuery,
java.lang.Class<T> entityClass)
findOne in interface JsonDBOperationspublic <T> T findOne(java.lang.String jxQuery,
java.lang.String collectionName)
findOne in interface JsonDBOperationspublic <T> void insert(java.lang.Object objectToSave)
JsonDBOperationsinsert in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageobjectToSave - the object to store in the collectionpublic <T> void insert(java.lang.Object objectToSave,
java.lang.String collectionName)
JsonDBOperationsinsert in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageobjectToSave - the object to store in the collectioncollectionName - name of the collection to store the object inpublic <T> void insert(java.util.Collection<? extends T> batchToSave,
java.lang.Class<T> entityClass)
JsonDBOperationsinsert in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagebatchToSave - the list of objects to save.entityClass - class that determines the collection to usepublic <T> void insert(java.util.Collection<? extends T> batchToSave,
java.lang.String collectionName)
JsonDBOperationsinsert in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagebatchToSave - the list of objects to save.collectionName - name of the collection to store the object inpublic <T> void save(java.lang.Object objectToSave,
java.lang.Class<T> entityClass)
JsonDBOperationssave in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageobjectToSave - the object to store in the collectionentityClass - class that determines the collection to usepublic <T> void save(java.lang.Object objectToSave,
java.lang.String collectionName)
JsonDBOperationssave in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageobjectToSave - the object to store in the collectioncollectionName - name of the collection to store the object inpublic <T> T remove(java.lang.Object objectToRemove,
java.lang.Class<T> entityClass)
JsonDBOperationsremove in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageobjectToRemove - the object to remove from the collectionentityClass - class that determines the collection to usepublic <T> T remove(java.lang.Object objectToRemove,
java.lang.String collectionName)
JsonDBOperationsremove in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageobjectToRemove - the object to remove from the collectioncollectionName - name of the collection to remove the object frompublic <T> java.util.List<T> remove(java.util.Collection<? extends T> batchToRemove,
java.lang.Class<T> entityClass)
JsonDBOperationsremove in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagebatchToRemove - the list of objects to remove.entityClass - class that determines the collection to usepublic <T> java.util.List<T> remove(java.util.Collection<? extends T> batchToRemove,
java.lang.String collectionName)
JsonDBOperationsremove in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagebatchToRemove - the list of objects to remove.collectionName - name of the collection to remove the objects frompublic <T> void upsert(java.lang.Object objectToSave)
JsonDBOperationsupsert in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageobjectToSave - the object to update.public <T> void upsert(java.lang.Object objectToSave,
java.lang.String collectionName)
JsonDBOperationsupsert in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackageobjectToSave - the object to update.collectionName - name of the collection to update the objects frompublic <T> void upsert(java.util.Collection<? extends T> batchToSave,
java.lang.Class<T> entityClass)
JsonDBOperationsupsert in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagebatchToSave - the list of objects to update.entityClass - class that determines the collection to usepublic <T> void upsert(java.util.Collection<? extends T> batchToSave,
java.lang.String collectionName)
JsonDBOperationsupsert in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagebatchToSave - the list of objects to update.collectionName - name of the collection to update the objects frompublic <T> T findAndRemove(java.lang.String jxQuery,
java.lang.Class<T> entityClass)
JsonDBOperationsfindAndRemove in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - JxPath query stringentityClass - class that determines the collection to usepublic <T> T findAndRemove(java.lang.String jxQuery,
java.lang.String collectionName)
JsonDBOperationsfindAndRemove in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - JxPath query stringcollectionName - name of the collection to update the objects frompublic <T> java.util.List<T> findAllAndRemove(java.lang.String jxQuery,
java.lang.Class<T> entityClass)
JsonDBOperationsfindAllAndRemove in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - JxPath query stringentityClass - class that determines the collection to usepublic <T> java.util.List<T> findAllAndRemove(java.lang.String jxQuery,
java.lang.String collectionName)
JsonDBOperationsfindAllAndRemove in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - JxPath query stringcollectionName - name of the collection to update the objects frompublic <T> T findAndModify(java.lang.String jxQuery,
Update update,
java.lang.Class<T> entityClass)
JsonDBOperationsfindAndModify in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - JxPath query stringupdate - The Update operation to performentityClass - class that determines the collection to usepublic <T> T findAndModify(java.lang.String jxQuery,
Update update,
java.lang.String collectionName)
JsonDBOperationsfindAndModify in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagejxQuery - JxPath query stringupdate - The Update operation to performcollectionName - name of the collection to update the objects frompublic <T> java.util.List<T> findAllAndModify(java.lang.String jxQuery,
Update update,
java.lang.Class<T> entityClass)
findAllAndModify in interface JsonDBOperationspublic <T> java.util.List<T> findAllAndModify(java.lang.String jxQuery,
Update update,
java.lang.String collectionName)
findAllAndModify in interface JsonDBOperationspublic <T> void changeEncryption(ICipher newCipher)
JsonDBOperationschangeEncryption in interface JsonDBOperationsT - Type annotated with Document annotation
and member of the baseScanPackagenewCipher - a new cipher to use, the algorithm may be same and just the key may be newpublic void backup(java.lang.String backupPath)
JsonDBOperationsbackup in interface JsonDBOperationsbackupPath - location at which to backup the database contentspublic void restore(java.lang.String restorePath,
boolean merge)
JsonDBOperationsrestore in interface JsonDBOperationsrestorePath - path were backup jsondb files are presentmerge - whether to merge data from restore location