Class MergeToSmallestIdDedupeStrategy
- java.lang.Object
-
- com.atlassian.confluence.internal.upgrade.constraint.dedup.KeepOneDedupeStrategy
-
- com.atlassian.confluence.internal.upgrade.constraint.dedup.KeepSmallestIdDedupeStrategy
-
- com.atlassian.confluence.internal.upgrade.constraint.dedup.MergeToSmallestIdDedupeStrategy
-
- All Implemented Interfaces:
DedupeStrategy
public class MergeToSmallestIdDedupeStrategy extends KeepSmallestIdDedupeStrategy
2 steps: 1. Move all child records from referencing others to referencing the record with smallest Id 2. Delete others- Since:
- 7.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MergeToSmallestIdDedupeStrategy.ReferencedTable
Hold information about a table having a foreign key referencing current table This implementation only support simple foreign keys i.e.
-
Constructor Summary
Constructors Constructor Description MergeToSmallestIdDedupeStrategy(String table, String idColumn, Collection<MergeToSmallestIdDedupeStrategy.ReferencedTable> referencedTables)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
perform(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, SortedSet<Object> ids)
Remove duplicates so a unique constraint can be added-
Methods inherited from class com.atlassian.confluence.internal.upgrade.constraint.dedup.KeepSmallestIdDedupeStrategy
getIdToKeep
-
-
-
-
Constructor Detail
-
MergeToSmallestIdDedupeStrategy
public MergeToSmallestIdDedupeStrategy(String table, String idColumn, Collection<MergeToSmallestIdDedupeStrategy.ReferencedTable> referencedTables)
-
-
Method Detail
-
perform
public void perform(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, SortedSet<Object> ids) throws UpgradeException
Description copied from interface:DedupeStrategy
Remove duplicates so a unique constraint can be added- Specified by:
perform
in interfaceDedupeStrategy
- Overrides:
perform
in classKeepOneDedupeStrategy
- Parameters:
jdbcTemplate
- AJdbcTemplate
to be usedids
- Set of Ids of duplicate rows in DB. Upon invocation of this method, only one of them can remain in the DB. All Confluence primary keys are of type Long or String so they can be used inSortedSet
.- Throws:
UpgradeException
- Thrown if there is any error removing duplicates, will cancel the constraint adding process
-
-