|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Session
Method Summary | |
---|---|
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. |
de.espirit.or.EntityList |
executeQuery(Select select)
|
de.espirit.or.DumpData |
exportData(String name,
long from,
long to)
|
de.espirit.or.schema.Schema |
extractSchemaFromDB(String schemaName)
Update the assigned schema with the structure of DB schema schemaName . |
List<KeyValue> |
fetchKeys(Select select)
Return a list of key values of all entities which fullfill the criterion defined by select . |
Entity |
find(de.espirit.or.schema.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. |
de.espirit.or.schema.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()
Returns true if there are uncommitted changes, see commit and rollback . |
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(de.espirit.or.schema.Identifier identifier)
Restore the deleted entity with the identifier . |
void |
rollback()
Undo all changes since the last commit or rollback. |
de.espirit.or.schema.Schema |
syncSchemaWithDB(de.espirit.or.schema.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 . |
Method Detail |
---|
@NotNull de.espirit.or.schema.Schema getSchema()
@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
.
@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 de.espirit.or.schema.Identifier identifier)
identifier
.
Important: Keep in mind the difference between an Identifier
and KeyValue
, use Session.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 Session.commit()
.
de.espirit.or.ORException
@NotNull de.espirit.or.EntityList executeQuery(@NotNull Select select) throws de.espirit.or.ORException
de.espirit.or.ORException
@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
Session.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 Session.getInvalidEntities(de.espirit.or.schema.KeyValue)
the returned list includes the also the
most actual value of the entity.
keyValue
- the key of the entity
ORException
- in case of database problemsSession.getInvalidEntities(de.espirit.or.schema.KeyValue)
void restore(@NotNull de.espirit.or.schema.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()
Session.delete(Entity)
Session.executeQuery(Select)
,
find an entity by key Session.find(String, Object...)
the returned entities are all in the release state
Session.createEntity(String)
,
import data Session.importData(DumpData)
, create a new schema form the database Session.extractSchemaFromDB(String)
and
update the database structure Session.syncSchemaWithDB(Schema, boolean)
are not supported.
An UnsupportedOperationException
will be thrown if these methods is called in a release session.
de.espirit.or.schema.Schema extractSchemaFromDB(String schemaName)
schemaName
.
de.espirit.or.schema.Schema syncSchemaWithDB(@NotNull de.espirit.or.schema.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 created
boolean isReadOnly()
boolean hasChanges()
true
if there are uncommitted changes, see commit
and rollback
.
commit
,
rollback
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
Session.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
Session.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
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |