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.

ExportRuleDto.java 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2019 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.qualityprofile;
  21. import java.util.LinkedList;
  22. import java.util.List;
  23. import org.sonar.api.rule.RuleKey;
  24. import org.sonar.api.rules.RuleType;
  25. import org.sonar.db.rule.SeverityUtil;
  26. public class ExportRuleDto {
  27. private Integer activeRuleId = null;
  28. private String repository = null;
  29. private String rule = null;
  30. private String name = null;
  31. private String description = null;
  32. private String extendedDescription = null;
  33. private String template = null;
  34. private Integer severity = null;
  35. private Integer type = null;
  36. private String tags = null;
  37. private List<ExportRuleParamDto> params;
  38. public boolean isCustomRule() {
  39. return template != null;
  40. }
  41. public Integer getActiveRuleId() {
  42. return activeRuleId;
  43. }
  44. public RuleKey getRuleKey() {
  45. return RuleKey.of(repository, rule);
  46. }
  47. public RuleKey getTemplateRuleKey() {
  48. return RuleKey.of(repository, template);
  49. }
  50. public String getSeverityString() {
  51. return SeverityUtil.getSeverityFromOrdinal(severity);
  52. }
  53. public String getExtendedDescription() {
  54. return extendedDescription;
  55. }
  56. public RuleType getRuleType() {
  57. return RuleType.valueOf(type);
  58. }
  59. public String getTags() {
  60. return tags;
  61. }
  62. public String getDescription() {
  63. return description;
  64. }
  65. public String getName() {
  66. return name;
  67. }
  68. public List<ExportRuleParamDto> getParams() {
  69. if (params == null) {
  70. params = new LinkedList<>();
  71. }
  72. return params;
  73. }
  74. void setParams(List<ExportRuleParamDto> params) {
  75. this.params = params;
  76. }
  77. }