Class DocumentRepository.FirstVersionManager
- java.lang.Object
-
- org.silverpeas.core.contribution.attachment.repository.DocumentRepository.FirstVersionManager
-
- Enclosing class:
- DocumentRepository
public static class DocumentRepository.FirstVersionManager extends Object
In charge of registering the first version to apply forHistorisedDocument
.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(); }
ortry { ... FirstVersionManager.computeIfAbsent(new Version(...)); ... } finally { FirstVersionManager.clear(); }
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clear()
Clears the registered version as a first one.static DocumentRepository.DocumentVersion
computeIfAbsent(DocumentRepository.DocumentVersion version)
Gets first version and computes it if it does not yet exist.static void
set(DocumentRepository.DocumentVersion version)
Registers the given version, even if another one is already registered.
-
-
-
Method Detail
-
computeIfAbsent
public static DocumentRepository.DocumentVersion computeIfAbsent(DocumentRepository.DocumentVersion version)
Gets first version and computes it if it does not yet exist.- Parameters:
version
- a version to register if none yet registered.- Returns:
- the already registered version if any, the given version otherwise.
-
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.
-
-