public class DBSTransactionState extends Object
Until save()
is called, data lives in the transient map.
Upon save, data is written to the repository, even though it has not yet been committed (this means that other sessions can read uncommitted data). It's also kept in an undo log in order for rollback to be possible.
On commit, the undo log is forgotten. On rollback, the undo log is replayed.
Constructor and Description |
---|
DBSTransactionState(DBSRepository repository,
DBSSession session) |
Modifier and Type | Method and Description |
---|---|
void |
commit()
Saves and flushes to database.
|
DBSDocumentState |
copy(String id)
Copies the document into a newly-created object.
|
DBSDocumentState |
createChild(String id,
String parentId,
String name,
Long pos,
String typeName) |
List<String> |
getChildrenIds(String parentId) |
List<DBSDocumentState> |
getChildrenStates(String parentId) |
DBSDocumentState |
getChildState(String parentId,
String name) |
List<DBSDocumentState> |
getKeyValuedStates(String key,
String value) |
State |
getStateForRead(String id)
Returns a state which won't be modified.
|
DBSDocumentState |
getStateForUpdate(String id)
Returns a state and marks it as transient, because it's about to be
modified or returned to user code (where it may be modified).
|
List<DBSDocumentState> |
getStatesForUpdate(List<String> ids)
Returns states and marks them transient, because they're about to be
returned to user code (where they may be modified).
|
boolean |
hasChild(String parentId,
String name) |
boolean |
hasChildren(String parentId) |
void |
removeStates(Set<String> ids)
Removes a list of documents.
|
void |
rollback()
Rolls back the save state by applying the undo log.
|
void |
save()
Writes transient state to database.
|
void |
updateAncestors(String id,
int ndel,
Object[] ancestorIds)
Updates ancestors recursively after a move.
|
void |
updateReadAcls(String id)
Updates the Read ACLs recursively on a document.
|
public DBSTransactionState(DBSRepository repository, DBSSession session)
public DBSDocumentState getStateForUpdate(String id)
public List<DBSDocumentState> getStatesForUpdate(List<String> ids)
public DBSDocumentState getChildState(String parentId, String name)
public List<DBSDocumentState> getChildrenStates(String parentId)
public boolean hasChildren(String parentId)
public DBSDocumentState createChild(String id, String parentId, String name, Long pos, String typeName)
public DBSDocumentState copy(String id)
The copy is automatically saved.
public void updateAncestors(String id, int ndel, Object[] ancestorIds)
Recursing from given doc, replace the first ndel ancestors with those passed.
Doesn't check transient (assumes save is done). The modifications are automatically saved.
public void updateReadAcls(String id)
public List<DBSDocumentState> getKeyValuedStates(String key, String value)
public void removeStates(Set<String> ids) throws DocumentException
Called after a save()
has been done.
DocumentException
public void save() throws DocumentException
An undo log is kept in order to rollback the transaction later if needed.
DocumentException
public void commit() throws DocumentException
DocumentException
public void rollback()
Copyright © 2014 Nuxeo SA. All rights reserved.