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.

PurgeProperties.java 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2021 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.core.config;
  21. import java.util.List;
  22. import org.sonar.api.CoreProperties;
  23. import org.sonar.api.PropertyType;
  24. import org.sonar.api.config.PropertyDefinition;
  25. import org.sonar.api.resources.Qualifiers;
  26. import static java.util.Arrays.asList;
  27. public final class PurgeProperties {
  28. private PurgeProperties() {
  29. }
  30. public static List<PropertyDefinition> all() {
  31. return asList(
  32. PropertyDefinition.builder(PurgeConstants.HOURS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_DAY)
  33. .defaultValue("24")
  34. .name("Keep only one analysis a day after")
  35. .description("After this number of hours, if there are several analyses during the same day, "
  36. + "the DbCleaner keeps the most recent one and fully deletes the other ones.")
  37. .type(PropertyType.INTEGER)
  38. .onQualifiers(Qualifiers.PROJECT)
  39. .category(CoreProperties.CATEGORY_HOUSEKEEPING)
  40. .subCategory(CoreProperties.SUBCATEGORY_GENERAL)
  41. .index(1)
  42. .build(),
  43. PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_WEEK)
  44. .defaultValue("4")
  45. .name("Keep only one analysis a week after")
  46. .description("After this number of weeks, if there are several analyses during the same week, "
  47. + "the DbCleaner keeps the most recent one and fully deletes the other ones")
  48. .type(PropertyType.INTEGER)
  49. .onQualifiers(Qualifiers.PROJECT)
  50. .category(CoreProperties.CATEGORY_HOUSEKEEPING)
  51. .subCategory(CoreProperties.SUBCATEGORY_GENERAL)
  52. .index(2)
  53. .build(),
  54. PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_MONTH)
  55. .defaultValue("52")
  56. .name("Keep only one analysis a month after")
  57. .description("After this number of weeks, if there are several analyses during the same month, "
  58. + "the DbCleaner keeps the most recent one and fully deletes the other ones.")
  59. .type(PropertyType.INTEGER)
  60. .onQualifiers(Qualifiers.PROJECT)
  61. .category(CoreProperties.CATEGORY_HOUSEKEEPING)
  62. .subCategory(CoreProperties.SUBCATEGORY_GENERAL)
  63. .index(3)
  64. .build(),
  65. PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_KEEPING_ONLY_ANALYSES_WITH_VERSION)
  66. .defaultValue("104")
  67. .name("Keep only analyses with a version event after")
  68. .description("After this number of weeks, the DbCleaner keeps only analyses with a version event associated.")
  69. .type(PropertyType.INTEGER)
  70. .onQualifiers(Qualifiers.PROJECT)
  71. .category(CoreProperties.CATEGORY_HOUSEKEEPING)
  72. .subCategory(CoreProperties.SUBCATEGORY_GENERAL)
  73. .index(4)
  74. .build(),
  75. PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_DELETING_ALL_SNAPSHOTS)
  76. .defaultValue("260")
  77. .name("Delete all analyses after")
  78. .description("After this number of weeks, all analyses are fully deleted.")
  79. .type(PropertyType.INTEGER)
  80. .onQualifiers(Qualifiers.PROJECT)
  81. .category(CoreProperties.CATEGORY_HOUSEKEEPING)
  82. .subCategory(CoreProperties.SUBCATEGORY_GENERAL)
  83. .index(5)
  84. .build(),
  85. PropertyDefinition.builder(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES)
  86. .defaultValue("30")
  87. .name("Delete closed issues after")
  88. .description("Issues that have been closed for more than this number of days will be deleted.")
  89. .type(PropertyType.INTEGER)
  90. .onQualifiers(Qualifiers.PROJECT)
  91. .category(CoreProperties.CATEGORY_HOUSEKEEPING)
  92. .subCategory(CoreProperties.SUBCATEGORY_GENERAL)
  93. .index(6)
  94. .build());
  95. }
  96. }