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.

GroupWithPermission.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * SonarQube, open source software quality management tool.
  3. * Copyright (C) 2008-2014 SonarSource
  4. * mailto:contact AT sonarsource DOT com
  5. *
  6. * SonarQube 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. * SonarQube 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.permission;
  21. import javax.annotation.CheckForNull;
  22. import javax.annotation.Nullable;
  23. import org.apache.commons.lang.builder.ToStringBuilder;
  24. import org.apache.commons.lang.builder.ToStringStyle;
  25. public class GroupWithPermission {
  26. private long id;
  27. private String name;
  28. private String description;
  29. private boolean hasPermission;
  30. public long id() {
  31. return id;
  32. }
  33. public GroupWithPermission setId(Long id) {
  34. this.id = id;
  35. return this;
  36. }
  37. public String name() {
  38. return name;
  39. }
  40. public GroupWithPermission setName(String name) {
  41. this.name = name;
  42. return this;
  43. }
  44. @CheckForNull
  45. public String description() {
  46. return description;
  47. }
  48. public GroupWithPermission setDescription(@Nullable String description) {
  49. this.description = description;
  50. return this;
  51. }
  52. public boolean hasPermission() {
  53. return hasPermission;
  54. }
  55. public GroupWithPermission hasPermission(boolean hasPermission) {
  56. this.hasPermission = hasPermission;
  57. return this;
  58. }
  59. @Override
  60. public String toString() {
  61. return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
  62. }
  63. @Override
  64. public boolean equals(Object o) {
  65. if (this == o) {
  66. return true;
  67. }
  68. if (o == null || getClass() != o.getClass()) {
  69. return false;
  70. }
  71. GroupWithPermission that = (GroupWithPermission) o;
  72. return name.equals(that.name);
  73. }
  74. @Override
  75. public int hashCode() {
  76. return name.hashCode();
  77. }
  78. }