public class CommitContext
extends java.lang.Object
implements java.io.Serializable
DataService
Modifier and Type | Class and Description |
---|---|
static class |
CommitContext.ValidationMode
Validation mode.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
authorizationRequired |
protected java.util.Collection<Entity> |
commitInstances |
protected java.util.Map<java.lang.String,java.lang.Object> |
dbHints |
protected boolean |
discardCommitted |
protected boolean |
joinTransaction |
protected java.util.Collection<Entity> |
removeInstances |
protected boolean |
softDeletion |
protected java.util.List<java.lang.Class> |
validationGroups |
protected CommitContext.ValidationMode |
validationMode |
protected java.util.Map<java.lang.Object,View> |
views |
Constructor and Description |
---|
CommitContext(java.util.Collection commitInstances) |
CommitContext(java.util.Collection commitInstances,
java.util.Collection removeInstances) |
CommitContext(Entity... commitInstances) |
Modifier and Type | Method and Description |
---|---|
CommitContext |
addInstanceToCommit(Entity entity)
Adds an entity to be committed to the database.
|
CommitContext |
addInstanceToCommit(Entity entity,
java.lang.String viewName)
Adds an entity to be committed to the database.
|
CommitContext |
addInstanceToCommit(Entity entity,
View view)
Adds an entity to be committed to the database.
|
CommitContext |
addInstanceToRemove(Entity entity)
Adds an entity to be removed from the database.
|
java.util.Collection<Entity> |
getCommitInstances() |
java.util.Map<java.lang.String,java.lang.Object> |
getDbHints() |
java.util.Collection<Entity> |
getRemoveInstances() |
java.util.List<java.lang.Class> |
getValidationGroups() |
CommitContext.ValidationMode |
getValidationMode() |
java.util.Map<java.lang.Object,View> |
getViews()
Enables defining a view for each committed entity.
|
boolean |
isAuthorizationRequired() |
boolean |
isDiscardCommitted() |
boolean |
isJoinTransaction() |
boolean |
isSoftDeletion() |
CommitContext |
setAuthorizationRequired(boolean authorizationRequired) |
void |
setCommitInstances(java.util.Collection commitInstances) |
void |
setDiscardCommitted(boolean discardCommitted)
Set to true if calling code does not need committed instances, which allows for performance optimization.
|
CommitContext |
setJoinTransaction(boolean joinTransaction) |
void |
setRemoveInstances(java.util.Collection removeInstances) |
void |
setSoftDeletion(boolean softDeletion) |
void |
setValidationGroups(java.util.List<java.lang.Class> validationGroups)
Sets groups targeted for validation.
|
void |
setValidationMode(CommitContext.ValidationMode validationMode)
Sets
CommitContext.ValidationMode for commit context. |
protected java.util.Collection<Entity> commitInstances
protected java.util.Collection<Entity> removeInstances
protected java.util.Map<java.lang.Object,View> views
protected boolean softDeletion
protected boolean discardCommitted
protected boolean authorizationRequired
protected boolean joinTransaction
protected CommitContext.ValidationMode validationMode
protected java.util.Map<java.lang.String,java.lang.Object> dbHints
protected java.util.List<java.lang.Class> validationGroups
public CommitContext(Entity... commitInstances)
commitInstances
- changed entities to be committed to the databasepublic CommitContext(java.util.Collection commitInstances)
commitInstances
- collection of changed entities to be committed to the databasepublic CommitContext(java.util.Collection commitInstances, java.util.Collection removeInstances)
commitInstances
- collection of changed entities to be committed to the databaseremoveInstances
- collection of entities to be removed from the databasepublic CommitContext addInstanceToCommit(Entity entity)
entity
- entity instancepublic CommitContext addInstanceToCommit(Entity entity, @Nullable View view)
entity
- entity instanceview
- view which is used in merge operation to ensure all required attributes are loaded in the returned instancepublic CommitContext addInstanceToCommit(Entity entity, @Nullable java.lang.String viewName)
entity
- entity instanceviewName
- view which is used in merge operation to ensure all required attributes are loaded in the returned instancepublic CommitContext addInstanceToRemove(Entity entity)
entity
- entity instancepublic java.util.Collection<Entity> getCommitInstances()
public void setCommitInstances(java.util.Collection commitInstances)
commitInstances
- collection of changed entities that will be committed to the databasepublic java.util.Collection<Entity> getRemoveInstances()
public void setRemoveInstances(java.util.Collection removeInstances)
removeInstances
- collection of entities to be removed from the databasepublic java.util.Map<java.lang.Object,View> getViews()
public java.util.Map<java.lang.String,java.lang.Object> getDbHints()
public boolean isSoftDeletion()
public void setSoftDeletion(boolean softDeletion)
softDeletion
- whether to use soft deletion for this commitpublic boolean isDiscardCommitted()
public void setDiscardCommitted(boolean discardCommitted)
public CommitContext.ValidationMode getValidationMode()
CommitContext.ValidationMode
of commit context.public void setValidationMode(CommitContext.ValidationMode validationMode)
CommitContext.ValidationMode
for commit context.
Validation type is responsible for whether entity bean validation will be applied on DataManager
level.validationMode
- validation typeBeanValidation
public boolean isAuthorizationRequired()
public CommitContext setAuthorizationRequired(boolean authorizationRequired)
public boolean isJoinTransaction()
public CommitContext setJoinTransaction(boolean joinTransaction)
public java.util.List<java.lang.Class> getValidationGroups()
Validator.validate(Object, Class[])
public void setValidationGroups(java.util.List<java.lang.Class> validationGroups)
validationGroups
- Set
of groupsValidator.validate(Object, Class[])