@Service public class VersioningService extends Object
Modifier and Type | Field and Description |
---|---|
static String |
COMMIT_MESSAGE_KEY |
Constructor and Description |
---|
VersioningService(org.javers.core.Javers javers) |
Modifier and Type | Method and Description |
---|---|
protected VersionDTO |
convertToVersionDTO(org.javers.shadow.Shadow shadow) |
long |
createVersion(@NonNull String author,
@NonNull Object obj,
String commitMessage)
Persists a current state of a given domain object, creating so a
createVersion of this object.
|
long |
createVersion(@NonNull String author,
@NonNull Object obj,
String commitMessage,
@NonNull Map<String,String> commitProperties)
Persists a current state of a given domain object, creating so a
createVersion of this object.
|
List<VersionDTO> |
findVersions(@NonNull Object object)
Queries for an object's versions.
|
<T> T |
retrieveLatestVersion(T object)
Returns the latest version of the requested object.
|
<T> T |
retrieveVersion(T object,
long version)
Returns a specific version of the requested object.
|
public static final String COMMIT_MESSAGE_KEY
@Autowired public VersioningService(org.javers.core.Javers javers)
public long createVersion(@NonNull @NonNull String author, @NonNull @NonNull Object obj, String commitMessage)
author
- the author who commits the changesobj
- the object to be committedcommitMessage
- a message regarding the commitpublic long createVersion(@NonNull @NonNull String author, @NonNull @NonNull Object obj, String commitMessage, @NonNull @NonNull Map<String,String> commitProperties)
author
- the author who commits the changesobj
- the object to be committedcommitMessage
- a message regarding the commitcommitProperties
- additional commit propertiespublic List<VersionDTO> findVersions(@NonNull @NonNull Object object)
object
- the object to retrieve versions forpublic <T> T retrieveVersion(T object, long version)
T
- the class of the object to retrieve the version forobject
- the object to retrieve the specific versions forversion
- the version to retrievepublic <T> T retrieveLatestVersion(T object)
T
- the class of the object to retrieve the latest version forobject
- the object to retrieve the latest version forprotected VersionDTO convertToVersionDTO(org.javers.shadow.Shadow shadow)
Copyright © 2020. All rights reserved.