Class DuplicateKeyDetector
java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.orientdb.utils.DuplicateKeyDetector
Recognizes the failure of a commit refused by a unique index: a record carrying a key that
another record already holds, reported by the backend with an
ORecordDuplicatedException,
which the layers above may have wrapped.- Author:
- Luca Frosini (ISTI - CNR)
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectduplicatedKey(Throwable throwable) Returns the key the unique index refused.static booleanisDuplicateKey(Throwable throwable) Returns whether the given failure, or one of its causes, is a duplicate key.
-
Method Details
-
isDuplicateKey
Returns whether the given failure, or one of its causes, is a duplicate key.- Parameters:
throwable- the failure- Returns:
trueif a unique index refused the write
-
duplicatedKey
Returns the key the unique index refused.- Parameters:
throwable- the failure- Returns:
- the duplicated key, or
nullif the failure is not a duplicate key
-