public class SaveWorkState
extends java.lang.Object
Constructor and Description |
---|
SaveWorkState(java.util.Map saveBundle)
Constructs an instance of this class with the deserialized result of
an Http save request.
|
Modifier and Type | Method and Description |
---|---|
EntityInfo |
addEntity(java.lang.Object entity,
EntityState entityState)
Schedule an additional entity to be saved.
|
protected void |
afterSave() |
void |
afterSaveEntities()
Allow subclasses to process the saveMap after entities are saved (and temporary keys replaced)
|
void |
beforeCommit(java.lang.Object context)
Allow subclasses to process the entities just before they are ready to be committed
|
protected void |
beforeSave()
Build the saveMap, and call context.beforeSaveEntity/ies
|
void |
beforeSaveEntities()
Allow subclasses to process the entities after they have been hooked up to one another
but before they have been added to the session.
|
protected boolean |
beforeSaveEntity(EntityInfo entityInfo)
Allow subclasses to process each entity before it gets included in the saveMap.
|
java.util.Set<java.util.Map.Entry<java.lang.Class,java.util.List<EntityInfo>>> |
entrySet() |
EntityInfo |
findEntityInfo(java.lang.Object entity)
Return the EntityInfo associated with a specific entity.
|
EntityInfo |
findEntityInfoById(java.lang.Class clazz,
java.lang.Object id) |
java.util.List<java.lang.Object> |
getEntities() |
java.util.List<java.lang.Object> |
getEntities(java.lang.Class clazz) |
java.util.List<EntityInfo> |
getEntityInfos(java.lang.Class clazz) |
java.lang.Object |
getIdentifier(java.lang.Object entity) |
Metadata |
getMetadata() |
SaveOptions |
getSaveOptions() |
boolean |
handleException(java.lang.Exception e)
Allows subclasses to plug in their own exception handling.
|
boolean |
removeEntity(java.lang.Object entity)
Remove an entity from being scheduled to be saved.
|
void |
setEntityErrors(EntityErrorsException exception) |
protected void |
setSaveProcessor(SaveProcessor saveProcessor) |
SaveResult |
toSaveResult()
Populate a new SaveResult with the entities and keyMappings.
|
public SaveWorkState(java.util.Map saveBundle)
saveBundle
- public SaveOptions getSaveOptions()
protected void setSaveProcessor(SaveProcessor saveProcessor)
public java.lang.Object getIdentifier(java.lang.Object entity)
entity
- public Metadata getMetadata()
public void setEntityErrors(EntityErrorsException exception)
protected void beforeSave()
protected void afterSave()
protected boolean beforeSaveEntity(EntityInfo entityInfo)
entityInfo
- public void beforeSaveEntities()
public void beforeCommit(java.lang.Object context)
public void afterSaveEntities()
saveMap
- all entities which have been savedkeyMappings
- mapping of temporary keys to real keyspublic boolean handleException(java.lang.Exception e)
e
- Exception that was thrown by saveChangesCorepublic java.util.List<EntityInfo> getEntityInfos(java.lang.Class clazz)
clazz
- public java.util.List<java.lang.Object> getEntities(java.lang.Class clazz)
clazz
- public java.util.List<java.lang.Object> getEntities()
public EntityInfo addEntity(java.lang.Object entity, EntityState entityState)
entity
- The entity to be saved.entityState
- The EntityState of the newly added entity.public boolean removeEntity(java.lang.Object entity)
entity
- The entity to be removed.public EntityInfo findEntityInfo(java.lang.Object entity)
entity
- public EntityInfo findEntityInfoById(java.lang.Class clazz, java.lang.Object id)
public java.util.Set<java.util.Map.Entry<java.lang.Class,java.util.List<EntityInfo>>> entrySet()
public SaveResult toSaveResult()