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.

ProjectDto.java 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.project;
  21. import java.util.List;
  22. import java.util.stream.Collectors;
  23. import javax.annotation.CheckForNull;
  24. import javax.annotation.Nullable;
  25. import org.sonar.db.entity.EntityDto;
  26. import static org.apache.commons.lang.StringUtils.trimToNull;
  27. import static org.sonar.db.component.DbTagsReader.readDbTags;
  28. public class ProjectDto extends EntityDto {
  29. private static final String TAGS_SEPARATOR = ",";
  30. private String tags;
  31. private long createdAt;
  32. private long updatedAt;
  33. private String initialPermSync;
  34. public long getCreatedAt() {
  35. return createdAt;
  36. }
  37. public ProjectDto setCreatedAt(long createdAt) {
  38. this.createdAt = createdAt;
  39. return this;
  40. }
  41. public long getUpdatedAt() {
  42. return updatedAt;
  43. }
  44. public ProjectDto setUpdatedAt(long updatedAt) {
  45. this.updatedAt = updatedAt;
  46. return this;
  47. }
  48. public ProjectDto setUuid(String uuid) {
  49. this.uuid = uuid;
  50. return this;
  51. }
  52. /**
  53. * This is the setter used by MyBatis mapper.
  54. */
  55. public ProjectDto setKee(String kee) {
  56. this.kee = kee;
  57. return this;
  58. }
  59. public ProjectDto setKey(String key) {
  60. return setKee(key);
  61. }
  62. @Override
  63. public ProjectDto setPrivate(boolean aPrivate) {
  64. isPrivate = aPrivate;
  65. return this;
  66. }
  67. public List<String> getTags() {
  68. return readDbTags(tags);
  69. }
  70. public ProjectDto setTags(List<String> tags) {
  71. setTagsString(tags.stream()
  72. .filter(t -> !t.isEmpty())
  73. .collect(Collectors.joining(TAGS_SEPARATOR)));
  74. return this;
  75. }
  76. /**
  77. * Used by MyBatis
  78. */
  79. @CheckForNull
  80. public String getTagsString() {
  81. return tags;
  82. }
  83. public ProjectDto setTagsString(@Nullable String tags) {
  84. this.tags = trimToNull(tags);
  85. return this;
  86. }
  87. public ProjectDto setName(String name) {
  88. this.name = name;
  89. return this;
  90. }
  91. public ProjectDto setDescription(@Nullable String description) {
  92. this.description = description;
  93. return this;
  94. }
  95. public ProjectDto setQualifier(String qualifier) {
  96. this.qualifier = qualifier;
  97. return this;
  98. }
  99. public String getInitialPermSync() {
  100. return initialPermSync;
  101. }
  102. public ProjectDto setInitialPermSync(@Nullable String initialPermSync) {
  103. this.initialPermSync = initialPermSync;
  104. return this;
  105. }
  106. }