Package com.atlassian.jira.bc.dataimport
Class DowngradeUtil
java.lang.Object
com.atlassian.jira.bc.dataimport.DowngradeUtil
Static utility methods for running a database downgrade.
This is used in two separate places:
- First we get Upgrade History items from the import XML file and use this class to calculate if a downgrade is even possible (else we don't write to the DB).
- Second we use it after the import data is in the DB and we want to run the actual downgrade.
- Since:
- v6.4.6
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canDowngrade
(List<UpgradeHistoryDTO> upgradeHistoryItems, int targetBuildNumber) Given a list of all upgrade History items, determine if a Downgrade should be successful.findDowngradeTasksToRun
(List<UpgradeHistoryDTO> upgradeHistoryItems, int targetBuildNumber) Finds downgrade tasks that are needed to be run in order to downgrade version of JIRA to targetBuildNumber.static ReindexRequirement
getReindexRequirement
(ApplicationProperties applicationProperties) static Map
<Integer, DowngradeTask> Reads a downgrade XML file to get a list of all the downgrades specified in this file.static void
setReindexRequirement
(ApplicationProperties applicationProperties, ReindexRequirement reindexRequirement) static void
verifyTasksExist
(List<Integer> downgradeTaskNumbers, Map<Integer, DowngradeTask> downgradeTaskMap) Given a list of all downgrade tasks to run, and a Map of Tasks we have, verify that all required tasks are known.
-
Constructor Details
-
DowngradeUtil
public DowngradeUtil()
-
-
Method Details
-
canDowngrade
public static boolean canDowngrade(List<UpgradeHistoryDTO> upgradeHistoryItems, int targetBuildNumber) Given a list of all upgrade History items, determine if a Downgrade should be successful.- Parameters:
upgradeHistoryItems
- History of upgrades that have already run (usually comes from an import file)targetBuildNumber
- target build number- Returns:
- true if a Downgrade should be successful.
-
findDowngradeTasksToRun
@Nonnull public static List<Integer> findDowngradeTasksToRun(List<UpgradeHistoryDTO> upgradeHistoryItems, int targetBuildNumber) throws DowngradeException Finds downgrade tasks that are needed to be run in order to downgrade version of JIRA to targetBuildNumber.- Parameters:
upgradeHistoryItems
- History of upgrades that have already run (usually comes from an import file)targetBuildNumber
- build number to downgrade to- Returns:
- List of downgrade task numbers
- Throws:
DowngradeException
-
loadDowngradeTasks
Reads a downgrade XML file to get a list of all the downgrades specified in this file.- Throws:
DowngradeException
-
verifyTasksExist
public static void verifyTasksExist(List<Integer> downgradeTaskNumbers, Map<Integer, DowngradeTask> downgradeTaskMap) throws MissingDowngradeTaskExceptionGiven a list of all downgrade tasks to run, and a Map of Tasks we have, verify that all required tasks are known.- Parameters:
downgradeTaskNumbers
- the upgrade task build numbers that we need to revert with an explicit downgrade taskdowngradeTaskMap
- map of known Downgrade tasks by build number- Throws:
MissingDowngradeTaskException
- if there are upgrade tasks that we can't revert
-
getReindexRequirement
@Nonnull public static ReindexRequirement getReindexRequirement(ApplicationProperties applicationProperties) -
setReindexRequirement
public static void setReindexRequirement(ApplicationProperties applicationProperties, ReindexRequirement reindexRequirement)
-