@Component(value="cuba_EntitySnapshotManager") public class EntitySnapshotManager extends java.lang.Object implements EntitySnapshotAPI
NAME
Constructor and Description |
---|
EntitySnapshotManager() |
Modifier and Type | Method and Description |
---|---|
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
|
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(MetaClass metaClass,
java.lang.Object referenceId)
Get the last snapshot for the given entity by id.
|
java.util.List<EntitySnapshot> |
getSnapshots(MetaClass metaClass,
java.lang.Object id)
Load snapshots for entity
|
void |
migrateSnapshots(MetaClass metaClass,
java.lang.Object id,
java.util.Map<java.lang.Class,java.lang.Class> classMapping)
Translate snapshots for archival classes
|
public java.util.List<EntitySnapshot> getSnapshots(MetaClass metaClass, java.lang.Object id)
EntitySnapshotAPI
getSnapshots
in interface EntitySnapshotAPI
metaClass
- Entity metaclassid
- Entity Idpublic void migrateSnapshots(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 versionpublic EntitySnapshot getLastEntitySnapshot(Entity entity)
EntitySnapshotAPI
HasUuid
interface.getLastEntitySnapshot
in interface EntitySnapshotAPI
entity
- entitypublic EntitySnapshot getLastEntitySnapshot(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
- author