public class EntityBagImpl extends Object implements EntityBag
| Modifier | Constructor and Description |
|---|---|
|
EntityBagImpl(String instanceId,
String name) |
protected |
EntityBagImpl(String instanceId,
String name,
StorageService storageService) |
|
EntityBagImpl(String instanceId,
String name,
UserSession userSession) |
| Modifier and Type | Method and Description |
|---|---|
SimpleEntity |
addEntity(SimpleEntity entity)
Adds an entity to the bag of entities
|
void |
ensureIndex(CompositeIndexField indexField,
boolean isUnique,
IndexField... valueFields)
Ensures there is an index present on a given amount of fields in this bag, will create if not existent, will do nothing
if index already exists.
|
void |
ensureIndex(IndexField indexField,
boolean isUnique,
IndexField... valueFields)
Ensures there is an index present on a given field in this bag, will create if not existent, will do nothing
if index already exists.
|
QueryExecutor |
find(CompositeQueryField queryFields,
SortParameter... params)
Builds a query for document in the storage for multiple queryfields with optional sorting parameters
|
QueryExecutor |
find(QueryBuilder queryBuilder)
Builds a query for document in the storage using the QueryBuilder which has a fluent query building mechanism.
|
QueryExecutor |
find(QueryField queryField,
SortParameter... params)
Builds a query for document in the storage for a specific queryfield with optional sorting parameters
|
void |
flush()
Forcibly flushes all the data in the bag to the storage
|
long |
getDiskSize()
Returns the size on the disk of the entities
|
QueryResult |
getEntities()
Execute a query returning all records in the bag
|
QueryResult |
getEntities(int max)
Execute a query returning all records in the bag with a given max
|
SimpleEntity |
getEntity(String entityId)
Retrieves a specific entity from the bag
|
List<String> |
getIndexNames()
Gets a list of all the index names on this bag
|
String |
getName()
Returns the name of the bag containing all data
|
long |
getSize()
Returns the amount of entities in the bag
|
void |
removeEntity(SimpleEntity entity)
Remove the entity from the bag
|
void |
removeEntity(String entityId)
Removes the entity from the bag using the id
|
void |
removeIndex(String indexKeyName)
Removes the index from the bag
|
SimpleEntity |
updateEntity(SimpleEntity entity)
Updates an entity in the bag of entities
|
protected EntityBagImpl(String instanceId, String name, StorageService storageService)
public EntityBagImpl(String instanceId, String name, UserSession userSession) throws JasDBStorageException
JasDBStorageExceptionpublic EntityBagImpl(String instanceId, String name) throws JasDBStorageException
JasDBStorageExceptionpublic String getName()
EntityBagpublic long getSize()
throws JasDBStorageException
EntityBaggetSize in interface EntityBagJasDBStorageExceptionpublic long getDiskSize()
throws JasDBStorageException
EntityBaggetDiskSize in interface EntityBagJasDBStorageExceptionpublic void flush()
throws JasDBStorageException
EntityBagflush in interface EntityBagJasDBStorageException - If unable to flush the bagpublic SimpleEntity addEntity(SimpleEntity entity) throws JasDBStorageException
EntityBagaddEntity in interface EntityBagentity - The entity to add to the bagJasDBStorageException - If unable to persist the entity into the bagpublic SimpleEntity updateEntity(SimpleEntity entity) throws JasDBStorageException
EntityBagupdateEntity in interface EntityBagentity - The entity to update in the bagJasDBStorageException - If unable to update the entity in the bagpublic void removeEntity(SimpleEntity entity) throws JasDBStorageException
EntityBagremoveEntity in interface EntityBagentity - The entity to be removedJasDBStorageException - If unable to remove the entity from the bagpublic void removeEntity(String entityId) throws JasDBStorageException
EntityBagremoveEntity in interface EntityBagentityId - The id of the entity to deleteJasDBStorageException - If unable to remove the entity from the bagpublic QueryExecutor find(QueryField queryField, SortParameter... params) throws JasDBStorageException
EntityBagfind in interface EntityBagqueryField - The field to queryparams - The sorting parametersJasDBStorageException - If unable to build a document querypublic QueryExecutor find(CompositeQueryField queryFields, SortParameter... params) throws JasDBStorageException
EntityBagfind in interface EntityBagqueryFields - The fields to queryparams - The sorting parametersJasDBStorageException - If unable to build a document querypublic QueryExecutor find(QueryBuilder queryBuilder) throws JasDBStorageException
EntityBagfind in interface EntityBagqueryBuilder - The querybuilder to use for building the queryJasDBStorageException - If unable to build a document querypublic QueryResult getEntities() throws JasDBStorageException
EntityBaggetEntities in interface EntityBagJasDBStorageException - If unable to return a all records iterator for this bagpublic QueryResult getEntities(int max) throws JasDBStorageException
EntityBaggetEntities in interface EntityBagmax - The maximum amount of records to returnJasDBStorageException - If unable to return a all records iterator for this bagpublic SimpleEntity getEntity(String entityId) throws JasDBStorageException
EntityBaggetEntity in interface EntityBagentityId - The entityId to retrieve the document forJasDBStorageException - If unable to find the entity in the bagpublic void ensureIndex(IndexField indexField, boolean isUnique, IndexField... valueFields) throws JasDBStorageException
EntityBagensureIndex in interface EntityBagindexField - The field to indexisUnique - True if the field contains unique values, False if notvalueFields - The valueFields to be stored in the indexJasDBStorageException - If unable to ensure the indexpublic void ensureIndex(CompositeIndexField indexField, boolean isUnique, IndexField... valueFields) throws JasDBStorageException
EntityBagensureIndex in interface EntityBagindexField - The fields to persist in the indexisUnique - True if the field contains unique values, False if notvalueFields - The valueFields to be stored in the indexJasDBStorageException - If unable to ensure the indexpublic void removeIndex(String indexKeyName) throws JasDBStorageException
EntityBagremoveIndex in interface EntityBagindexKeyName - The name of the indexJasDBStorageException - If unable to cleanly remove the indexpublic List<String> getIndexNames() throws JasDBStorageException
EntityBaggetIndexNames in interface EntityBagJasDBStorageException - If unable to retrieve the indexesCopyright © 2015. All rights reserved.