@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)
EntitySnapshotAPI
getSnapshots
in interface EntitySnapshotAPI
metaClass
- 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)
EntitySnapshotAPI
migrateSnapshots
in interface EntitySnapshotAPI
metaClass
- Metaclassid
- Entity IdclassMapping
- Map of [OldClass -> NewClass] for migrationpublic EntitySnapshot createSnapshot(Entity entity, View view)
EntitySnapshotAPI
createSnapshot
in interface EntitySnapshotAPI
entity
- Entityview
- Viewpublic EntitySnapshot createSnapshot(Entity entity, View view, java.util.Date snapshotDate)
EntitySnapshotAPI
createSnapshot
in interface EntitySnapshotAPI
entity
- Entityview
- ViewsnapshotDate
- Datepublic EntitySnapshot createSnapshot(Entity entity, View view, java.util.Date snapshotDate, User author)
EntitySnapshotAPI
createSnapshot
in interface EntitySnapshotAPI
entity
- Entityview
- ViewsnapshotDate
- Dateauthor
- Authorpublic Entity extractEntity(EntitySnapshot snapshot)
EntitySnapshotAPI
extractEntity
in interface EntitySnapshotAPI
snapshot
- Snapshotpublic View extractView(EntitySnapshot snapshot)
EntitySnapshotAPI
extractView
in interface EntitySnapshotAPI
snapshot
- Snapshotpublic EntityDiff getDifference(@Nullable EntitySnapshot first, EntitySnapshot second)
EntitySnapshotAPI
getDifference
in interface EntitySnapshotAPI
first
- 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)
EntitySnapshotAPI
HasUuid
interface.getLastEntitySnapshot
in interface EntitySnapshotAPI
entity
- entitypublic EntitySnapshot getLastEntitySnapshot(com.haulmont.chile.core.model.MetaClass metaClass, java.lang.Object referenceId)
EntitySnapshotAPI
getLastEntitySnapshot
in interface EntitySnapshotAPI
metaClass
- entity meta classreferenceId
- reference id for which snapshot referspublic EntitySnapshot createTempSnapshot(Entity entity, View view)
EntitySnapshotAPI
HasUuid
interface.createTempSnapshot
in interface EntitySnapshotAPI
entity
- entityview
- viewpublic EntitySnapshot createTempSnapshot(Entity entity, View view, java.util.Date snapshotDate)
EntitySnapshotAPI
HasUuid
interface.createTempSnapshot
in interface EntitySnapshotAPI
entity
- entityview
- entity viewsnapshotDate
- datepublic EntitySnapshot createTempSnapshot(Entity entity, View view, java.util.Date snapshotDate, User author)
EntitySnapshotAPI
HasUuid
interface.createTempSnapshot
in interface EntitySnapshotAPI
entity
- entityview
- entity viewsnapshotDate
- dateauthor
- authorprotected EntitySnapshot createEntitySnapshot(Entity entity, View view, java.util.Date snapshotDate, User author)