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.

DevOpsPlatformSettingNewValue.java 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 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.audit.model;
  21. import java.util.Objects;
  22. import javax.annotation.CheckForNull;
  23. import javax.annotation.Nullable;
  24. import org.sonar.db.alm.setting.AlmSettingDto;
  25. import org.sonar.db.alm.setting.ProjectAlmSettingDto;
  26. import org.sonar.db.project.ProjectDto;
  27. public class DevOpsPlatformSettingNewValue extends NewValue {
  28. /**
  29. * @deprecated The uuids in the audit logs are not product requirement anymore and will be removed in 11.x
  30. */
  31. @Deprecated(since = "10.2")
  32. @Nullable
  33. private String devOpsPlatformSettingUuid;
  34. @Nullable
  35. private String key;
  36. @Nullable
  37. private String devOpsPlatformName;
  38. @Nullable
  39. private String url;
  40. @Nullable
  41. private String appId;
  42. @Nullable
  43. private String clientId;
  44. /**
  45. * @deprecated The uuids in the audit logs are not product requirement anymore and will be removed in 11.x
  46. */
  47. @Deprecated(since = "10.2")
  48. @Nullable
  49. private String projectUuid;
  50. @Nullable
  51. private String projectKey;
  52. @Nullable
  53. private String projectName;
  54. @Nullable
  55. private String almRepo;
  56. @Nullable
  57. private String almSlug;
  58. @Nullable
  59. private Boolean isSummaryCommentEnabled;
  60. @Nullable
  61. private Boolean isMonorepo;
  62. public DevOpsPlatformSettingNewValue(String devOpsPlatformSettingUuid, String key) {
  63. this.devOpsPlatformSettingUuid = devOpsPlatformSettingUuid;
  64. this.key = key;
  65. }
  66. public DevOpsPlatformSettingNewValue(AlmSettingDto dto) {
  67. this.devOpsPlatformSettingUuid = dto.getUuid();
  68. this.key = dto.getKey();
  69. this.devOpsPlatformName = dto.getAppId();
  70. this.url = dto.getUrl();
  71. this.appId = dto.getAppId();
  72. this.clientId = dto.getClientId();
  73. }
  74. public DevOpsPlatformSettingNewValue(ProjectAlmSettingDto dto, String key, String projectName, String projectKey) {
  75. this.devOpsPlatformSettingUuid = dto.getAlmSettingUuid();
  76. this.key = key;
  77. this.projectUuid = dto.getProjectUuid();
  78. this.projectKey = projectKey;
  79. this.projectName = projectName;
  80. this.almRepo = dto.getAlmRepo();
  81. this.almSlug = dto.getAlmSlug();
  82. this.isSummaryCommentEnabled = dto.getSummaryCommentEnabled();
  83. this.isMonorepo = dto.getMonorepo();
  84. }
  85. public DevOpsPlatformSettingNewValue(ProjectDto projectDto) {
  86. this.projectUuid = projectDto.getUuid();
  87. this.projectKey = projectDto.getKey();
  88. this.projectName = projectDto.getName();
  89. }
  90. /**
  91. * @deprecated The uuids in the audit logs are not product requirement anymore and will be removed in 11.x
  92. */
  93. @Deprecated(since = "10.2")
  94. @CheckForNull
  95. public String getDevOpsPlatformSettingUuid() {
  96. return this.devOpsPlatformSettingUuid;
  97. }
  98. @CheckForNull
  99. public String getKey() {
  100. return this.key;
  101. }
  102. @CheckForNull
  103. public String getDevOpsPlatformName() {
  104. return this.devOpsPlatformName;
  105. }
  106. @CheckForNull
  107. public String getUrl() {
  108. return this.url;
  109. }
  110. @CheckForNull
  111. public String getAppId() {
  112. return this.appId;
  113. }
  114. @CheckForNull
  115. public String getClientId() {
  116. return this.clientId;
  117. }
  118. /**
  119. * @deprecated The uuids in the audit logs are not product requirement anymore and will be removed in 11.x
  120. */
  121. @Deprecated(since = "10.2")
  122. @CheckForNull
  123. public String getProjectUuid() {
  124. return this.projectUuid;
  125. }
  126. @CheckForNull
  127. public String getProjectKey() {
  128. return this.projectKey;
  129. }
  130. @CheckForNull
  131. public String getProjectName() {
  132. return this.projectName;
  133. }
  134. @CheckForNull
  135. public String getAlmRepo() {
  136. return this.almRepo;
  137. }
  138. @CheckForNull
  139. public String getAlmSlug() {
  140. return this.almSlug;
  141. }
  142. @CheckForNull
  143. public Boolean isSummaryCommentEnabled() {
  144. return this.isSummaryCommentEnabled;
  145. }
  146. @CheckForNull
  147. public Boolean isMonorepo() {
  148. return this.isMonorepo;
  149. }
  150. @Override
  151. public String toString() {
  152. StringBuilder sb = new StringBuilder("{");
  153. addField(sb, "\"devOpsPlatformSettingUuid\": ", this.devOpsPlatformSettingUuid, true);
  154. addField(sb, "\"key\": ", this.key, true);
  155. addField(sb, "\"devOpsPlatformName\": ", this.devOpsPlatformName, true);
  156. addField(sb, "\"url\": ", this.url, true);
  157. addField(sb, "\"appId\": ", this.appId, true);
  158. addField(sb, "\"clientId\": ", this.clientId, true);
  159. addField(sb, "\"projectUuid\": ", this.projectUuid, true);
  160. addField(sb, "\"projectKey\": ", this.projectKey, true);
  161. addField(sb, "\"projectName\": ", this.projectName, true);
  162. addField(sb, "\"almRepo\": ", this.almRepo, true);
  163. addField(sb, "\"almSlug\": ", this.almSlug, true);
  164. addField(sb, "\"isSummaryCommentEnabled\": ", Objects.toString(this.isSummaryCommentEnabled, ""), false);
  165. addField(sb, "\"isMonorepo\": ", Objects.toString(this.isMonorepo, ""), false);
  166. endString(sb);
  167. return sb.toString();
  168. }
  169. }