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
JasDBStorageException
public EntityBagImpl(String instanceId, String name) throws JasDBStorageException
JasDBStorageException
public String getName()
EntityBag
public long getSize() throws JasDBStorageException
EntityBag
getSize
in interface EntityBag
JasDBStorageException
public long getDiskSize() throws JasDBStorageException
EntityBag
getDiskSize
in interface EntityBag
JasDBStorageException
public void flush() throws JasDBStorageException
EntityBag
flush
in interface EntityBag
JasDBStorageException
- If unable to flush the bagpublic SimpleEntity addEntity(SimpleEntity entity) throws JasDBStorageException
EntityBag
addEntity
in interface EntityBag
entity
- The entity to add to the bagJasDBStorageException
- If unable to persist the entity into the bagpublic SimpleEntity updateEntity(SimpleEntity entity) throws JasDBStorageException
EntityBag
updateEntity
in interface EntityBag
entity
- The entity to update in the bagJasDBStorageException
- If unable to update the entity in the bagpublic void removeEntity(SimpleEntity entity) throws JasDBStorageException
EntityBag
removeEntity
in interface EntityBag
entity
- The entity to be removedJasDBStorageException
- If unable to remove the entity from the bagpublic void removeEntity(String entityId) throws JasDBStorageException
EntityBag
removeEntity
in interface EntityBag
entityId
- The id of the entity to deleteJasDBStorageException
- If unable to remove the entity from the bagpublic QueryExecutor find(QueryField queryField, SortParameter... params) throws JasDBStorageException
EntityBag
find
in interface EntityBag
queryField
- The field to queryparams
- The sorting parametersJasDBStorageException
- If unable to build a document querypublic QueryExecutor find(CompositeQueryField queryFields, SortParameter... params) throws JasDBStorageException
EntityBag
find
in interface EntityBag
queryFields
- The fields to queryparams
- The sorting parametersJasDBStorageException
- If unable to build a document querypublic QueryExecutor find(QueryBuilder queryBuilder) throws JasDBStorageException
EntityBag
find
in interface EntityBag
queryBuilder
- The querybuilder to use for building the queryJasDBStorageException
- If unable to build a document querypublic QueryResult getEntities() throws JasDBStorageException
EntityBag
getEntities
in interface EntityBag
JasDBStorageException
- If unable to return a all records iterator for this bagpublic QueryResult getEntities(int max) throws JasDBStorageException
EntityBag
getEntities
in interface EntityBag
max
- The maximum amount of records to returnJasDBStorageException
- If unable to return a all records iterator for this bagpublic SimpleEntity getEntity(String entityId) throws JasDBStorageException
EntityBag
getEntity
in interface EntityBag
entityId
- 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
EntityBag
ensureIndex
in interface EntityBag
indexField
- 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
EntityBag
ensureIndex
in interface EntityBag
indexField
- 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
EntityBag
removeIndex
in interface EntityBag
indexKeyName
- The name of the indexJasDBStorageException
- If unable to cleanly remove the indexpublic List<String> getIndexNames() throws JasDBStorageException
EntityBag
getIndexNames
in interface EntityBag
JasDBStorageException
- If unable to retrieve the indexesCopyright © 2015. All rights reserved.