Class DocumentRepository.FirstVersionManager

  • Enclosing class:
    DocumentRepository

    public static class DocumentRepository.FirstVersionManager
    extends Object
    In charge of registering the first version to apply for HistorisedDocument.

    When a first version will be registered (document copy as an example), using this manager permits to apply the right first version.

    BE CAREFUL: the repository of this manager is the thread memory, so it MUST be used into a try finally statement:

       try {
         ...
         FirstVersionManager.set(new Version(...));
         ...
       } finally {
         FirstVersionManager.clear();
       }
     
    or
       try {
         ...
         FirstVersionManager.computeIfAbsent(new Version(...));
         ...
       } finally {
         FirstVersionManager.clear();
       }
     

    • Method Detail

      • set

        public static void set​(DocumentRepository.DocumentVersion version)
        Registers the given version, even if another one is already registered.

        The previous one registered if any is lost.

        Parameters:
        version - a version to register.
      • clear

        public static void clear()
        Clears the registered version as a first one.