Interface EntitySnapshotManager

All Known Implementing Classes:
EntitySnapshotManagerImpl

public interface EntitySnapshotManager
Creates and analyzes entity snapshots.
  • Method Details

    • getSnapshots

      List<EntitySnapshotModel> getSnapshots(MetaClass metaClass, Object id)
      Load snapshots for entity
      Parameters:
      metaClass - Entity metaclass
      id - Entity Id
      Returns:
      Snapshot list sorted by snapshotDate desc
    • getSnapshots

      List<EntitySnapshotModel> getSnapshots(Object entity)
      Get snapshots for entity
      Parameters:
      entity - Entity object
      Returns:
      Snapshot list
    • migrateSnapshots

      void migrateSnapshots(MetaClass metaClass, Object id, Map<Class,Class> classMapping)
      Translate snapshots for archival classes
      Parameters:
      metaClass - Metaclass
      id - Entity Id
      classMapping - Map of [OldClass -> NewClass] for migration
    • createSnapshot

      EntitySnapshotModel createSnapshot(Object entity, FetchPlan fetchPlan)
      Create snapshot for Entity and store it to database
      Parameters:
      entity - Entity
      fetchPlan - FetchPlan
      Returns:
      Snapshot
    • createSnapshot

      EntitySnapshotModel createSnapshot(Object entity, FetchPlan fetchPlan, Date snapshotDate)
      Create snapshot for Entity with specific date and store it to database
      Parameters:
      entity - Entity
      fetchPlan - FetchPlan
      snapshotDate - Date
      Returns:
      Snapshot
    • createSnapshot

      EntitySnapshotModel createSnapshot(Object entity, FetchPlan fetchPlan, Date snapshotDate, String authorUsername)
      Create snapshot for Entity with specific date and author and store it to database
      Parameters:
      entity - Entity
      fetchPlan - FetchPlan
      snapshotDate - Date
      authorUsername - Author
      Returns:
      Snapshot
    • extractEntity

      Object extractEntity(EntitySnapshotModel snapshot)
      Restore entity by snapshot
      Parameters:
      snapshot - Snapshot
      Returns:
      Entity instance
    • extractFetchPlan

      FetchPlan extractFetchPlan(EntitySnapshotModel snapshot)
      Restore fetch plan from snapshot
      Parameters:
      snapshot - Snapshot
      Returns:
      FetchPlan instance
    • getLastEntitySnapshot

      @Nullable EntitySnapshotModel getLastEntitySnapshot(Object entity)
      Get the last snapshot for the given entity. This method always starts a new transaction. It can be used for entities with composite key if they have UUID.
      Parameters:
      entity - entity
      Returns:
      snapshot or null if there is no snapshots in database for the given entity
    • getLastEntitySnapshot

      @Nullable EntitySnapshotModel getLastEntitySnapshot(MetaClass metaClass, Object referenceId)
      Get the last snapshot for the given entity by id. This method always starts a new transaction.
      Parameters:
      metaClass - entity meta class
      referenceId - reference id for which snapshot refers
      Returns:
      snapshot or null if there is no snapshots in database for the given entity
    • createTempSnapshot

      EntitySnapshotModel createTempSnapshot(Object entity, FetchPlan fetchPlan)
      Creates non-persistent snapshot for entity. It can be used for entities with composite key if they have UUID.
      Parameters:
      entity - entity
      fetchPlan - fetchPlan
      Returns:
      not persistence snapshot
    • createTempSnapshot

      EntitySnapshotModel createTempSnapshot(Object entity, FetchPlan fetchPlan, Date snapshotDate)
      Creates non-persistent snapshot for entity with a specific date. It can be used for entities with composite key if they have UUID.
      Parameters:
      entity - entity
      fetchPlan - entity fetch plan
      snapshotDate - date
      Returns:
      not persistence snapshot
    • createTempSnapshot

      EntitySnapshotModel createTempSnapshot(Object entity, FetchPlan fetchPlan, Date snapshotDate, String authorUsername)
      Creates non-persistent snapshot for entity with a specific date and author. It can be used for entities with composite key if they have UUID.
      Parameters:
      entity - entity
      fetchPlan - entity fetch plan
      snapshotDate - date
      authorUsername - author
      Returns:
      not persistence snapshot