| Constructor and Description |
|---|
DB()
create new instance.
|
| Modifier and Type | Method and Description |
|---|---|
<TEntity extends IEntity> |
createEntitySchema(Class<TEntity> aType)
create necessary structures inside DB for specified entity type.
|
<TEntity extends IEntity> |
getAllEntitiesOfType(Class<TEntity> aType,
String sNextToken,
List<TEntity> lResults)
return all entities matching to the given type.
|
<TEntity extends IEntity> |
getEntitiesById(Class<TEntity> aType,
String sNextToken,
List<TEntity> lResults,
String... lIds)
return a list of entities matching to the given list of primary keys.
|
<TEntity extends IEntity> |
getEntityById(Class<TEntity> aType,
String sId)
direct access to ONE entity which specified ID.
|
<TEntity extends IEntity> |
prepareQuery(Class<TEntity> aType,
String sQueryId)
provide a query object which we can use later at the interface method
IDB.query ().
|
<TEntity extends IEntity> |
query(Class<TEntity> aType,
String sNextToken,
List<TEntity> lResults,
IDBQuery<TEntity> iQuery)
query for entities where it's attributes match the given set of
query parameters/values.
|
<TEntity extends IEntity> |
queryOne(Class<TEntity> aType,
IDBQuery<TEntity> iQuery)
Does the same then query () ... but instead of be usable for big sets of
results these method can be used if one result will be expected.
|
<TEntity extends IEntity> |
removeAllEntitiesOfType(Class<TEntity> aType)
remove all entities of given type from these DB.
|
<TEntity extends IEntity> |
removeEntities(TEntity... lEntities)
remove the given set of entities from the DB.
|
<TEntity extends IEntity> |
removeEntitiesById(Class<TEntity> aType,
String... lIds)
remove all entities of specified type from the DB where it's
Id's match to given Id set.
|
<TEntity extends IEntity> |
removeEntitySchema(Class<TEntity> aType)
remove all data within DB back end related to the specified entity.
|
void |
setPersistenceUnit(IPersistenceUnit iUnit)
same as setPersistenceUnit(java.lang.String) ...
|
void |
setPersistenceUnit(String sUnit)
bind these DB instance to a persistence unit configuration.
|
<TEntity extends IEntity> |
storeEntities(TEntity... lEntities)
make all given entities persistent inside DB.
|
public void setPersistenceUnit(String sUnit) throws Exception
IDBsetPersistenceUnit in interface IDBsUnit - [IN]
name of the persistence unit.IllegalArgumentException - in case given persistence unit does not exists.Exception - in case an internal (runtime) error occur.public void setPersistenceUnit(IPersistenceUnit iUnit) throws Exception
IDBsetPersistenceUnit in interface IDBiUnit - [IN]
the persistence unit to be used here.IllegalArgumentException - in case given persistence unit does not exists.Exception - in case an internal (runtime) error occur.public <TEntity extends IEntity> void storeEntities(TEntity... lEntities) throws Exception
IDBstoreEntities in interface IDBlEntities - [IN]
the list of entities to be made persistent.
If list will be empty or null - nothing will happen.Exception - in case an internal (runtime) error occured.public <TEntity extends IEntity> void removeEntities(TEntity... lEntities) throws Exception
IDBremoveEntities in interface IDBlEntities - [IN]
the list of entities to be removed.
If list will be empty or null - nothing will happen.Exceptionpublic <TEntity extends IEntity> void removeEntitiesById(Class<TEntity> aType, String... lIds) throws Exception
IDBremoveEntitiesById in interface IDBaType - [IN]
the type of those entities to be removed here.lIds - [IN]
the list of Id's where the matching entities must be removed.
If list will be empty or null - nothing will happen.Exceptionpublic <TEntity extends IEntity> void removeAllEntitiesOfType(Class<TEntity> aType) throws Exception
IDBremoveAllEntitiesOfType in interface IDBaType - [IN]
describe the type where all corresponding entities
has to be removed.Exception - in case an internal (runtime) error occur.public <TEntity extends IEntity> TEntity getEntityById(Class<TEntity> aType, String sId) throws Exception
IDBgetEntityById in interface IDBaType - [IN]
the type of entity asked here.sId - [IN]
the unique ID (primary key) of those entity.Exception - in case an internal (runtime) error occur.public <TEntity extends IEntity> String getEntitiesById(Class<TEntity> aType, String sNextToken, List<TEntity> lResults, String... lIds) throws Exception
IDBgetEntitiesById in interface IDBaType - [IN]
the type of entities where we must search for.sNextToken - [IN]
the next token where further results might be available for.
Can be null or an empty string if this the 'first query'.lResults - [OUT]
the list of matching entities for this request.
Will be empty if no (further) results exists.lIds - [IN]
the list of Id's.
If list will be empty (or even null) - nothing will happen.Exception - in case an internal (runtime) error occur.public <TEntity extends IEntity> String getAllEntitiesOfType(Class<TEntity> aType, String sNextToken, List<TEntity> lResults) throws Exception
IDBgetAllEntitiesOfType in interface IDBaType - [IN]
the type of entities where we must search for.sNextToken - [IN]
the next token where further results might be available for.
Can be null or an empty string if this the 'first query'.lResults - [OUT]
the list of matching entities for this request.
Will be empty if no (further) results exists.Exception - in case an internal (runtime) error occur.public <TEntity extends IEntity> String query(Class<TEntity> aType, String sNextToken, List<TEntity> lResults, IDBQuery<TEntity> iQuery) throws Exception
IDBquery in interface IDBaType - [IN]
the entity type where this query is for.sNextToken - [IN]
the next token where further results might be available for.
Can be null or an empty string if this the 'first query'.lResults - [OUT]
the list of matching entities for this query.
Will be empty if no (further) results exists.iQuery - [IN]
the query itself.Exceptionpublic <TEntity extends IEntity> TEntity queryOne(Class<TEntity> aType, IDBQuery<TEntity> iQuery) throws Exception
IDBpublic <TEntity extends IEntity> IDBQuery<TEntity> prepareQuery(Class<TEntity> aType, String sQueryId) throws Exception
IDBprepareQuery in interface IDBaType - [IN]
the type of entities where the query must be suitable for.sQueryId - [ID]
an unique ID for this query.
Will be might used for internal caching of pre-compiled queries.Exceptionpublic <TEntity extends IEntity> void createEntitySchema(Class<TEntity> aType) throws Exception
IDBSchemacreateEntitySchema in interface IDBSchemaaType - [IN]
describe the entity type.Exception - is creating the schema was not successfully.public <TEntity extends IEntity> void removeEntitySchema(Class<TEntity> aType) throws Exception
IDBSchemaremoveEntitySchema in interface IDBSchemaaType - [IN]
describe the entity type.Exception - if operation failed and entity data couldn't be removed.
Note It throws NO exception in case entity is unknown within these DB.Copyright © 2016 as-development.net. All rights reserved.