public interface Session
Modifier and Type | Method and Description |
---|---|
void |
addSessionListener(de.espirit.or.SessionListener listener)
Add the
listener to this session. |
void |
close()
Close the session and release all used resources.
|
void |
commit()
Make all changes since the last commit or rollback persistent.
|
void |
commit(String comment)
Make all changes since the last commit or rollback persistent with the given
comment
as revision comment. |
Entity |
createEntity(String type)
Create a new entity of the given
type |
Select |
createSelect(String name)
Create a select for the entity type
name with the actual session time as query time. |
void |
delete(Entity entity)
Mark the
entity as deleted. |
EntityList |
executeQuery(Select select) |
de.espirit.or.DumpData |
exportData(String name,
long from,
long to) |
Schema |
extractSchemaFromDB(String schemaName)
Update the assigned schema with the structure of DB schema
schemaName . |
de.espirit.common.util.IdentifierList<UUID,Entity> |
fetchEntities(String entityTypeName,
Collection<UUID> entityGids)
Fetches all entities specified by given
gids . |
List<KeyValue> |
fetchKeys(Select select)
Return a list of key values of all entities which fullfill the criterion defined by
select . |
Entity |
find(EntityType type,
String uuid)
Returns the entity specififed by given EntityType and uuid string
|
Entity |
find(EntityType type,
UUID uuid)
Returns the entity specififed by given EntityType and uuid
|
Entity |
find(Identifier identifier)
Return the entity with the given
identifier . |
Entity |
find(KeyValue keyValue)
Return the entity with the given
keyValue . |
Entity |
find(String entityTypeName,
Object... key)
Return the entity of type
entityTypeName with the id key . |
Entity |
findNotNull(KeyValue keyValue)
Returns an entity with the given
keyValue even if it doesn't exist. |
Entity |
findNotNull(String entityTypeName,
Object... key)
Returns an entity of type
entityTypeName with the id key even if it doesn't exists. |
Set<Entity> |
getChanged()
Return the set of modified but not committed entities in this session.
|
List<Entity> |
getDeletedEntities(String entityTypeName)
Get all deleted entities from type
entityTypeName . |
List<Entity> |
getHistory(KeyValue keyValue)
Return the history of the entity with the given
keyValue . |
List<Entity> |
getInvalidEntities(KeyValue keyValue)
Return a list of invalid entities of the given
keyValue .. |
long |
getLastChangeTime(Select select)
Get the timestamp of the last change of the result set of the specified select.
|
long |
getLastChangeTime(Select select,
long after)
Get the timestamp of the last change of the result set of the specified select after the specified
timestamp.
|
Set<KeyValue> |
getReleasedDeleted(String entityTypeName)
Get the key values of all entities of the given entity type which are deleted but still released.
|
Schema |
getSchema()
Return the schema assigned with this session.
|
boolean |
hasChangedAfter(Select select,
long time)
Return true if the result of the query with the given
select is not empty. |
boolean |
hasChanges()
|
void |
importData(de.espirit.or.DumpData data)
Import the
data into the database connected by this session. |
void |
importUpdateData(de.espirit.or.DumpData data)
Import or update the
data into the database connected by this session. |
boolean |
isReadOnly()
If the session is "read only" no modifications are permitted.
|
boolean |
isRelease()
Return true if this session is a release session else false.
|
void |
release(Entity entity)
Release the given
entity . |
void |
removeSessionListener(de.espirit.or.SessionListener listener)
Remove the
listener from this session. |
void |
restore(Identifier identifier)
Restore the deleted entity with the
identifier . |
void |
rollback()
Undo all changes since the last commit or rollback.
|
Schema |
syncSchemaWithDB(Schema schema,
boolean importMode)
Update the DB structure with the given
schema . |
void |
updateWorkflowData(Entity entity,
Color wfColor,
long taskId)
Set the workflow color and the task id of
entity to wfColor
and taskId . |
Select |
xml2Select(String queryXml)
Construct a select from the xml document
queryXml . |
@NotNull Entity createEntity(@NotNull String type) throws de.espirit.or.ORException
type
de.espirit.or.ORException
@Nullable Entity find(@NotNull KeyValue keyValue)
keyValue
.@NotNull Entity findNotNull(@NotNull KeyValue keyValue)
keyValue
even if it doesn't exist. In that case the
entity's state
is NOT_EXISTS
.@Nullable Entity find(@NotNull String entityTypeName, @NotNull Object... key)
entityTypeName
with the id key
.Entity find(@NotNull EntityType type, String uuid)
Entity find(@NotNull EntityType type, UUID uuid)
@NotNull Entity findNotNull(@NotNull String entityTypeName, @NotNull Object... key)
entityTypeName
with the id key
even if it doesn't exists.
In that case the entity's state
is NOT_EXISTS
.@NotNull Entity find(@NotNull Identifier identifier)
identifier
.
Important: Keep in mind the difference between an Identifier
and KeyValue
, use find(KeyValue)
if possible!@NotNull Select createSelect(@NotNull String name) throws de.espirit.or.SchemaException
name
with the actual session time as query time.de.espirit.or.SchemaException
@NotNull Select xml2Select(@NotNull String queryXml) throws de.espirit.or.ORException
queryXml
.de.espirit.or.ORException
void delete(@NotNull Entity entity) throws de.espirit.or.ORException
entity
as deleted.
The change is persistent by the next commit()
.de.espirit.or.ORException
@NotNull EntityList executeQuery(@NotNull Select select) throws de.espirit.or.ORException
de.espirit.or.ORException
de.espirit.common.util.IdentifierList<UUID,Entity> fetchEntities(@NotNull String entityTypeName, @NotNull Collection<UUID> entityGids)
gids
.null
entries for gids not entity could be found for.@NotNull List<Entity> getDeletedEntities(@NotNull String entityTypeName) throws de.espirit.or.ORException
entityTypeName
.de.espirit.or.ORException
@NotNull Set<KeyValue> getReleasedDeleted(@NotNull String entityTypeName) throws de.espirit.or.ORException
de.espirit.or.ORException
@NotNull List<Entity> getInvalidEntities(@NotNull KeyValue keyValue) throws de.espirit.or.ORException
keyValue
.. For
non-temporal
schemas this method delivers an empty list.de.espirit.or.ORException
getHistory(de.espirit.or.schema.KeyValue)
@NotNull List<Entity> getHistory(@NotNull KeyValue keyValue) throws de.espirit.or.ORException
keyValue
. For
non-temporal
schemas this method delivers an empty list. In
contrast to getInvalidEntities(de.espirit.or.schema.KeyValue)
the returned list includes the also the
most actual value of the entity.keyValue
- the key of the entityORException
- in case of database problemsgetInvalidEntities(de.espirit.or.schema.KeyValue)
void restore(@NotNull Identifier identifier) throws de.espirit.or.ORException
identifier
.de.espirit.or.ORException
@NotNull List<KeyValue> fetchKeys(@NotNull Select select) throws de.espirit.or.ORException
select
.de.espirit.or.ORException
void importData(@NotNull de.espirit.or.DumpData data) throws de.espirit.or.ORException
data
into the database connected by this session.de.espirit.or.ORException
void importUpdateData(@NotNull de.espirit.or.DumpData data) throws de.espirit.or.ORException
data
into the database connected by this session.de.espirit.or.ORException
@NotNull de.espirit.or.DumpData exportData(@NotNull String name, long from, long to) throws de.espirit.or.ORException
de.espirit.or.ORException
void rollback()
void commit() throws de.espirit.or.ORException
de.espirit.or.ORException
void commit(String comment) throws de.espirit.or.ORException
comment
as revision comment.de.espirit.or.ORException
void close() throws de.espirit.or.ORException
de.espirit.or.ORException
void release(@NotNull Entity entity) throws de.espirit.or.ORException
entity
.de.espirit.or.ORException
boolean isRelease()
delete(Entity)
executeQuery(Select)
,
find an entity by key #find(String,Object)
the returned entities are all in the release state
createEntity(String)
,
import data importData(DumpData)
, create a new schema form the database extractSchemaFromDB(String)
and
update the database structure syncSchemaWithDB(Schema,boolean)
are not supported.
An UnsupportedOperationException
will be thrown if these methods is called in a release session.Schema extractSchemaFromDB(String schemaName)
schemaName
.Schema syncSchemaWithDB(@NotNull Schema schema, boolean importMode)
schema
. If importMode
is true then no foreign key and primary key is created in the DB in other case all
primary and foreign keys will be createdboolean isReadOnly()
Set<Entity> getChanged()
boolean hasChangedAfter(@NotNull Select select, long time) throws de.espirit.or.ORException
select
is not empty.de.espirit.or.ORException
long getLastChangeTime(@NotNull Select select) throws de.espirit.or.ORException
result table
are considered.
Only supported for temporal schema.
de.espirit.or.ORException
getLastChangeTime(de.espirit.or.query.Select,long)
long getLastChangeTime(@NotNull Select select, long after) throws de.espirit.or.ORException
result table
are
considered.
Only supported for temporal schema.
de.espirit.or.ORException
getLastChangeTime(de.espirit.or.query.Select)
void addSessionListener(@NotNull de.espirit.or.SessionListener listener)
listener
to this session.void removeSessionListener(@NotNull de.espirit.or.SessionListener listener)
listener
from this session.void updateWorkflowData(@NotNull Entity entity, Color wfColor, long taskId) throws de.espirit.or.ORException
entity
to wfColor
and taskId
. This update doesn't create a new version of entity
in the
database and is executed immediately.de.espirit.or.ORException
Copyright © 2014 e-Spirit AG. All Rights Reserved. Build 5.0_BETA.500