Class CompareService
java.lang.Object
com.eurodyn.qlack.fuse.acv.service.CompareService
Provides functionality to compare two objects of the same class.
- Author:
- European Dynamics SA
-
Constructor Summary
ConstructorsConstructorDescriptionCompareService
(org.javers.core.Javers javers, VersioningService versioningService) -
Method Summary
Modifier and TypeMethodDescriptioncompare
(T obj1, T obj2) Compares two objects and returns the changes.compareObjectWithLatestVersion
(Object object) Compares an object with the latest version and returns the changes.compareObjectWithVersion
(Object object, long version) Compares an object with a specific version and returns the changes.compareVersions
(Object object, long version1, long version2) Compares two object versions and returns the changes.protected ChangeDTO
convertToChangeDTO
(org.javers.core.diff.changetype.ValueChange change) <T> boolean
hasChanges
(T obj1, T obj2) Compares two objects and returns if they have changes or not.
-
Constructor Details
-
CompareService
@Autowired public CompareService(org.javers.core.Javers javers, VersioningService versioningService)
-
-
Method Details
-
hasChanges
public <T> boolean hasChanges(@NonNull T obj1, @NonNull T obj2) Compares two objects and returns if they have changes or not.- Type Parameters:
T
- the type of the objects to compare, so to ensure that the objects are of the same class- Parameters:
obj1
- the first object to compareobj2
- the second object to compare- Returns:
- true if the objects they have changes, else false
-
compare
Compares two objects and returns the changes.- Type Parameters:
T
- the type of the objects to compare, so to ensure that the objects are of the same class- Parameters:
obj1
- the first object to compareobj2
- the second object to compare- Returns:
- a list with the changes between the two comparing objects
-
compareVersions
Compares two object versions and returns the changes.
Throws a QDoesNotExistException when one of the requested versions doesn't exist.- Parameters:
object
- the object to find the requested versions.version1
- number of the first version to compare withversion2
- number of the second version to compare with- Returns:
- a list with the changes between the two comparing objects
-
compareObjectWithVersion
Compares an object with a specific version and returns the changes.
Throws a QDoesNotExistException when the requested version doesn't exist.- Parameters:
object
- the object to compare with the latest version.version
- number of the version to compare with- Returns:
- a list with the changes between the two comparing objects
-
compareObjectWithLatestVersion
Compares an object with the latest version and returns the changes.
Throws a QDoesNotExistException when no committed version exists.- Parameters:
object
- the object to compare with the latest version.- Returns:
- a list with the changes between the two comparing objects
-
convertToChangeDTO
-