@Component(value="cuba_EntitySnapshotManager") public class EntitySnapshotManager extends java.lang.Object implements EntitySnapshotAPI
| Modifier and Type | Field and Description |
|---|---|
protected DataManager |
dataManager |
protected EntityDiffManager |
diffManager |
protected EntitySerializationAPI |
entitySerializationAPI |
protected ExtendedEntities |
extendedEntities |
protected Metadata |
metadata |
protected Persistence |
persistence |
protected ReferenceToEntitySupport |
referenceToEntitySupport |
protected TimeSource |
timeSource |
protected UserSessionSource |
userSessionSource |
protected ViewSerializationAPI |
viewSerializationAPI |
NAME| Constructor and Description |
|---|
EntitySnapshotManager() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkCompositePrimaryKey(Entity entity) |
protected EntitySnapshot |
createEntitySnapshot(Entity entity,
View view,
java.util.Date snapshotDate,
User author) |
EntitySnapshot |
createSnapshot(Entity entity,
View view)
Create snapshot for Entity and store it to database
|
EntitySnapshot |
createSnapshot(Entity entity,
View view,
java.util.Date snapshotDate)
Create snapshot for Entity with specific date and store it to database
|
EntitySnapshot |
createSnapshot(Entity entity,
View view,
java.util.Date snapshotDate,
User author)
Create snapshot for Entity with specific date and author and store it to database
|
EntitySnapshot |
createTempSnapshot(Entity entity,
View view)
Creates non-persistent snapshot for entity.
|
EntitySnapshot |
createTempSnapshot(Entity entity,
View view,
java.util.Date snapshotDate)
Creates non-persistent snapshot for entity with a specific date.
|
EntitySnapshot |
createTempSnapshot(Entity entity,
View view,
java.util.Date snapshotDate,
User author)
Creates non-persistent snapshot for entity with a specific date and author.
|
Entity |
extractEntity(EntitySnapshot snapshot)
Restore entity by snapshot
|
View |
extractView(EntitySnapshot snapshot)
Restore view from snapshot
|
protected java.lang.Object |
fromXML(java.lang.String xml) |
EntityDiff |
getDifference(EntitySnapshot first,
EntitySnapshot second)
Diff two versions of entity
|
EntitySnapshot |
getLastEntitySnapshot(Entity entity)
Get the last snapshot for the given entity.
|
EntitySnapshot |
getLastEntitySnapshot(com.haulmont.chile.core.model.MetaClass metaClass,
java.lang.Object referenceId)
Get the last snapshot for the given entity by id.
|
java.util.List<EntitySnapshot> |
getSnapshots(com.haulmont.chile.core.model.MetaClass metaClass,
java.lang.Object id)
Load snapshots for entity
|
protected boolean |
isXml(java.lang.String value) |
void |
migrateSnapshots(com.haulmont.chile.core.model.MetaClass metaClass,
java.lang.Object id,
java.util.Map<java.lang.Class,java.lang.Class> classMapping)
Translate snapshots for archival classes
|
protected java.lang.String |
processSnapshotXml(java.lang.String snapshotXml,
java.util.Map<java.lang.Class,java.lang.Class> classMapping) |
protected java.lang.String |
processViewXml(java.lang.String viewXml,
java.util.Map<java.lang.Class,java.lang.Class> classMapping) |
protected void |
replaceClasses(org.dom4j.Element element,
java.util.Map<java.lang.Class,java.lang.Class> classMapping) |
protected void |
replaceInXmlTree(org.dom4j.Element element,
java.util.Map<java.lang.Class,java.lang.Class> classMapping) |
@Inject protected Persistence persistence
@Inject protected Metadata metadata
@Inject protected EntityDiffManager diffManager
@Inject protected ExtendedEntities extendedEntities
@Inject protected UserSessionSource userSessionSource
@Inject protected TimeSource timeSource
@Inject protected EntitySerializationAPI entitySerializationAPI
@Inject protected ViewSerializationAPI viewSerializationAPI
@Inject protected ReferenceToEntitySupport referenceToEntitySupport
@Inject protected DataManager dataManager
public java.util.List<EntitySnapshot> getSnapshots(com.haulmont.chile.core.model.MetaClass metaClass, java.lang.Object id)
EntitySnapshotAPIgetSnapshots in interface EntitySnapshotAPImetaClass - Entity metaclassid - Entity Idpublic void migrateSnapshots(com.haulmont.chile.core.model.MetaClass metaClass,
java.lang.Object id,
java.util.Map<java.lang.Class,java.lang.Class> classMapping)
EntitySnapshotAPImigrateSnapshots in interface EntitySnapshotAPImetaClass - Metaclassid - Entity IdclassMapping - Map of [OldClass -> NewClass] for migrationpublic EntitySnapshot createSnapshot(Entity entity, View view)
EntitySnapshotAPIcreateSnapshot in interface EntitySnapshotAPIentity - Entityview - Viewpublic EntitySnapshot createSnapshot(Entity entity, View view, java.util.Date snapshotDate)
EntitySnapshotAPIcreateSnapshot in interface EntitySnapshotAPIentity - Entityview - ViewsnapshotDate - Datepublic EntitySnapshot createSnapshot(Entity entity, View view, java.util.Date snapshotDate, User author)
EntitySnapshotAPIcreateSnapshot in interface EntitySnapshotAPIentity - Entityview - ViewsnapshotDate - Dateauthor - Authorpublic Entity extractEntity(EntitySnapshot snapshot)
EntitySnapshotAPIextractEntity in interface EntitySnapshotAPIsnapshot - Snapshotpublic View extractView(EntitySnapshot snapshot)
EntitySnapshotAPIextractView in interface EntitySnapshotAPIsnapshot - Snapshotpublic EntityDiff getDifference(@Nullable EntitySnapshot first, EntitySnapshot second)
EntitySnapshotAPIgetDifference in interface EntitySnapshotAPIfirst - First versionsecond - Second versionprotected java.lang.Object fromXML(java.lang.String xml)
protected boolean isXml(java.lang.String value)
protected void checkCompositePrimaryKey(Entity entity)
protected void replaceInXmlTree(org.dom4j.Element element,
java.util.Map<java.lang.Class,java.lang.Class> classMapping)
protected void replaceClasses(org.dom4j.Element element,
java.util.Map<java.lang.Class,java.lang.Class> classMapping)
protected java.lang.String processViewXml(java.lang.String viewXml,
java.util.Map<java.lang.Class,java.lang.Class> classMapping)
protected java.lang.String processSnapshotXml(java.lang.String snapshotXml,
java.util.Map<java.lang.Class,java.lang.Class> classMapping)
public EntitySnapshot getLastEntitySnapshot(Entity entity)
EntitySnapshotAPIHasUuid interface.getLastEntitySnapshot in interface EntitySnapshotAPIentity - entitypublic EntitySnapshot getLastEntitySnapshot(com.haulmont.chile.core.model.MetaClass metaClass, java.lang.Object referenceId)
EntitySnapshotAPIgetLastEntitySnapshot in interface EntitySnapshotAPImetaClass - entity meta classreferenceId - reference id for which snapshot referspublic EntitySnapshot createTempSnapshot(Entity entity, View view)
EntitySnapshotAPIHasUuid interface.createTempSnapshot in interface EntitySnapshotAPIentity - entityview - viewpublic EntitySnapshot createTempSnapshot(Entity entity, View view, java.util.Date snapshotDate)
EntitySnapshotAPIHasUuid interface.createTempSnapshot in interface EntitySnapshotAPIentity - entityview - entity viewsnapshotDate - datepublic EntitySnapshot createTempSnapshot(Entity entity, View view, java.util.Date snapshotDate, User author)
EntitySnapshotAPIHasUuid interface.createTempSnapshot in interface EntitySnapshotAPIentity - entityview - entity viewsnapshotDate - dateauthor - authorprotected EntitySnapshot createEntitySnapshot(Entity entity, View view, java.util.Date snapshotDate, User author)