You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PurgeMapper.java 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2023 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.db.purge;
  21. import java.util.List;
  22. import java.util.Set;
  23. import javax.annotation.CheckForNull;
  24. import javax.annotation.Nullable;
  25. import org.apache.ibatis.annotations.Param;
  26. public interface PurgeMapper {
  27. List<String> selectAnalysisUuids(PurgeSnapshotQuery query);
  28. /**
  29. * Returns the list of subviews and the application/view/project for the specified project_uuid.
  30. */
  31. List<String> selectRootAndSubviewsByProjectUuid(@Param("rootUuid") String rootUuid);
  32. Set<String> selectDisabledComponentsWithFileSource(@Param("branchUuid") String branchUuid);
  33. Set<String> selectDisabledComponentsWithUnresolvedIssues(@Param("branchUuid") String branchUuid);
  34. Set<String> selectDisabledComponentsWithLiveMeasures(@Param("branchUuid") String branchUuid);
  35. void deleteAnalyses(@Param("analysisUuids") List<String> analysisUuids);
  36. void deleteAnalysisProperties(@Param("analysisUuids") List<String> analysisUuids);
  37. void deleteAnalysisDuplications(@Param("analysisUuids") List<String> analysisUuids);
  38. void deleteAnalysisEvents(@Param("analysisUuids") List<String> analysisUuids);
  39. void deleteAnalysisEventComponentChanges(@Param("analysisUuids") List<String> analysisUuids);
  40. void deleteAnalysisMeasures(@Param("analysisUuids") List<String> analysisUuids);
  41. void fullDeleteComponentMeasures(@Param("componentUuids") List<String> componentUuids);
  42. /**
  43. * Purge status flag is used to not attempt to remove duplications & historical data of analyses
  44. * for which we already removed them.
  45. */
  46. void updatePurgeStatusToOne(@Param("analysisUuids") List<String> analysisUuid);
  47. void resolveComponentIssuesNotAlreadyResolved(@Param("componentUuids") List<String> componentUuids, @Param("dateAsLong") Long dateAsLong);
  48. void deleteProjectLinksByProjectUuid(@Param("rootUuid") String rootUuid);
  49. void deletePropertiesByEntityUuids(@Param("entityUuids") List<String> entityUuids);
  50. void deleteComponentsByBranchUuid(@Param("rootUuid") String rootUuid);
  51. void deleteNonMainBranchComponentsByProjectUuid(@Param("uuid") String uuid);
  52. void deleteProjectsByProjectUuid(@Param("projectUuid") String projectUuid);
  53. void deleteComponentsByUuids(@Param("componentUuids") List<String> componentUuids);
  54. void deleteGroupRolesByEntityUuid(@Param("entityUuid") String entityUuid);
  55. void deleteUserRolesByEntityUuid(@Param("entityUuid") String entityUuid);
  56. void deleteEventsByComponentUuid(@Param("componentUuid") String componentUuid);
  57. void deleteEventComponentChangesByComponentUuid(@Param("componentUuid") String componentUuid);
  58. List<PurgeableAnalysisDto> selectPurgeableAnalyses(@Param("componentUuid") String componentUuid);
  59. void deleteIssuesByProjectUuid(@Param("projectUuid") String projectUuid);
  60. void deleteIssueChangesByProjectUuid(@Param("projectUuid") String projectUuid);
  61. List<String> selectBranchOrphanIssues(@Param("branchUuid") String branchUuid);
  62. void deleteNewCodeReferenceIssuesByProjectUuid(@Param("projectUuid") String projectUuid);
  63. void deleteIssuesImpactsByProjectUuid(@Param("projectUuid") String projectUuid);
  64. List<String> selectOldClosedIssueKeys(@Param("projectUuid") String projectUuid, @Nullable @Param("toDate") Long toDate);
  65. List<String> selectStaleBranchesAndPullRequests(@Param("projectUuid") String projectUuid, @Param("toDate") Long toDate);
  66. @CheckForNull
  67. String selectSpecificAnalysisNewCodePeriod(@Param("projectUuid") String projectUuid);
  68. List<String> selectDisabledComponentsWithoutIssues(@Param("branchUuid") String branchUuid);
  69. void deleteIssuesFromKeys(@Param("keys") List<String> keys);
  70. void deleteIssueChangesFromIssueKeys(@Param("issueKeys") List<String> issueKeys);
  71. void deleteNewCodeReferenceIssuesFromKeys(@Param("issueKeys") List<String> keys);
  72. void deleteIssuesImpactsFromKeys(@Param("issueKeys") List<String> keys);
  73. void deleteFileSourcesByProjectUuid(String rootProjectUuid);
  74. void deleteFileSourcesByFileUuid(@Param("fileUuids") List<String> fileUuids);
  75. void deleteCeTaskCharacteristicsOfCeActivityByRootUuidOrBefore(@Nullable @Param("rootUuid") String rootUuid,
  76. @Nullable @Param("entityUuidToPurge") String entityUuidToPurge, @Nullable @Param("createdAtBefore") Long createdAtBefore);
  77. void deleteCeTaskInputOfCeActivityByRootUuidOrBefore(@Nullable @Param("rootUuid") String rootUuid,
  78. @Nullable @Param("entityUuidToPurge") String entityUuidToPurge, @Nullable @Param("createdAtBefore") Long createdAtBefore);
  79. void deleteCeScannerContextOfCeActivityByRootUuidOrBefore(@Nullable @Param("rootUuid") String rootUuid,
  80. @Nullable @Param("entityUuidToPurge") String entityUuidToPurge, @Nullable @Param("createdAtBefore") Long createdAtBefore);
  81. void deleteCeTaskMessageOfCeActivityByRootUuidOrBefore(@Nullable @Param("rootUuid") String rootUuid,
  82. @Nullable @Param("entityUuidToPurge") String entityUuidToPurge, @Nullable @Param("createdAtBefore") Long createdAtBefore);
  83. /**
  84. * Delete rows in CE_ACTIVITY of tasks of the specified component and/or created before specified date.
  85. */
  86. void deleteCeActivityByRootUuidOrBefore(@Nullable @Param("rootUuid") String rootUuid,
  87. @Nullable @Param("entityUuidToPurge") String entityUuidToPurge, @Nullable @Param("createdAtBefore") Long createdAtBefore);
  88. void deleteCeScannerContextOfCeQueueByRootUuid(@Param("rootUuid") String rootUuid);
  89. void deleteCeTaskCharacteristicsOfCeQueueByRootUuid(@Param("rootUuid") String rootUuid);
  90. void deleteCeTaskInputOfCeQueueByRootUuid(@Param("rootUuid") String rootUuid);
  91. void deleteCeTaskMessageOfCeQueueByRootUuid(@Param("rootUuid") String rootUuid);
  92. void deleteCeQueueByRootUuid(@Param("rootUuid") String rootUuid);
  93. void deleteWebhooksByProjectUuid(@Param("projectUuid") String projectUuid);
  94. void deleteWebhookDeliveriesByProjectUuid(@Param("projectUuid") String projectUuid);
  95. void deleteAppProjectsByAppUuid(@Param("applicationUuid") String applicationUuid);
  96. void deleteAppProjectsByProjectUuid(@Param("projectUuid") String projectUuid);
  97. void deleteAppBranchProjectBranchesByAppUuid(@Param("applicationUuid") String applicationUuid);
  98. void deleteAppBranchProjectBranchesByProjectUuid(@Param("projectUuid") String projectUuid);
  99. void deleteAppBranchProjectsByAppBranchUuid(@Param("branchUuid") String applicationBranchUuid);
  100. void deleteAppBranchProjectBranchesByProjectBranchUuid(@Param("projectBranchUuid") String projectBranchUuid);
  101. void deletePortfolioProjectsByBranchUuid(@Param("branchUuid") String branchUuid);
  102. void deletePortfolioProjectsByProjectUuid(@Param("projectUuid") String projectUuid);
  103. void deletePortfolioProjectBranchesByBranchUuid(@Param("branchUuid") String branchUuid);
  104. void deleteBranchByUuid(@Param("uuid") String uuid);
  105. void deleteLiveMeasuresByProjectUuid(@Param("projectUuid") String projectUuid);
  106. void deleteLiveMeasuresByComponentUuids(@Param("componentUuids") List<String> componentUuids);
  107. void deleteNewCodePeriodsByProjectUuid(String projectUuid);
  108. void deleteNewCodePeriodsByBranchUuid(String branchUuid);
  109. void deleteProjectAlmSettingsByProjectUuid(@Param("projectUuid") String projectUuid);
  110. void deleteProjectBadgeTokenByProjectUuid(@Param("projectUuid") String rootUuid);
  111. void deleteUserDismissedMessagesByProjectUuid(@Param("projectUuid") String projectUuid);
  112. void deleteScannerAnalysisCacheByBranchUuid(@Param("branchUuid") String branchUuid);
  113. void deleteReportSchedulesByBranchUuid(@Param("branchUuid") String branchUuid);
  114. void deleteReportSubscriptionsByBranchUuid(@Param("branchUuid") String branchUuid);
  115. void deleteReportSchedulesByPortfolioUuids(@Param("portfolioUuids") List<String> portfolioUuids);
  116. void deleteReportSubscriptionsByPortfolioUuids(@Param("portfolioUuids") List<String> portfolioUuids);
  117. void deleteAnticipatedTransitionsByProjectUuidAndCreationDate(@Param("projectUuid") String projectUuid, @Param("createdAtBefore") Long createdAtBefore);
  118. }