Class VersioningService

java.lang.Object
com.eurodyn.qlack.fuse.acv.service.VersioningService

@Service public class VersioningService extends Object
Provides functionality to persist and retrieve versions of a given entity object.
Author:
European Dynamics SA
  • Field Details

  • Constructor Details

    • VersioningService

      @Autowired public VersioningService(org.javers.core.Javers javers)
  • Method Details

    • createVersion

      public long createVersion(@NonNull @NonNull String author, @NonNull @NonNull Object obj, String commitMessage)
      Persists a current state of a given domain object, creating so a createVersion of this object.
      Parameters:
      author - the author who commits the changes
      obj - the object to be committed
      commitMessage - a message regarding the commit
      Returns:
      the number of the persisted version
    • createVersion

      public long createVersion(@NonNull @NonNull String author, @NonNull @NonNull Object obj, String commitMessage, @NonNull @NonNull Map<String,String> commitProperties)
      Persists a current state of a given domain object, creating so a createVersion of this object.
      Parameters:
      author - the author who commits the changes
      obj - the object to be committed
      commitMessage - a message regarding the commit
      commitProperties - additional commit properties
      Returns:
      the new version number
    • findVersions

      public List<VersionDTO> findVersions(@NonNull @NonNull Object object)
      Queries for an object's versions.
      Parameters:
      object - the object to retrieve versions for
      Returns:
      A list of VersionDTO's, ordered in reverse chronological order
    • retrieveVersion

      public <T> T retrieveVersion(T object, long version)
      Returns a specific version of the requested object.

      Throws a QDoesNotExistException when the requested version does not exist.
      Type Parameters:
      T - the class of the object to retrieve the version for
      Parameters:
      object - the object to retrieve the specific versions for
      version - the version to retrieve
      Returns:
      the object in the requested version
    • retrieveLatestVersion

      public <T> T retrieveLatestVersion(T object)
      Returns the latest version of the requested object.

      Throws a QDoesNotExistException when the requested version does not exist.
      Type Parameters:
      T - the class of the object to retrieve the latest version for
      Parameters:
      object - the object to retrieve the latest version for
      Returns:
      the latest version of the requested object
    • convertToVersionDTO

      protected VersionDTO convertToVersionDTO(org.javers.shadow.Shadow shadow)