PageRenderTime 27ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/jira-testkit-common/src/main/java/com/atlassian/jira/testkit/client/restclient/UserBean.java

https://bitbucket.org/atlassian/jira-testkit
Java | 173 lines | 135 code | 26 blank | 12 comment | 0 complexity | 02f4ca39a50c0276476c1a3860d88b6e MD5 | raw file
Possible License(s): Apache-2.0
  1. /*
  2. * Copyright © 2012 - 2013 Atlassian Corporation Pty Ltd.
  3. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
  4. * except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
  5. * Unless required by applicable law or agreed to in writing, software distributed under the License is
  6. * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  7. * or implied. See the License for the specific language governing permissions and limitations under the License.
  8. */
  9. package com.atlassian.jira.testkit.client.restclient;
  10. import com.atlassian.jira.testkit.beans.ApplicationRole;
  11. import org.codehaus.jackson.annotate.JsonIgnore;
  12. import org.codehaus.jackson.annotate.JsonIgnoreProperties;
  13. import org.codehaus.jackson.map.annotate.JsonSerialize;
  14. import java.util.List;
  15. /**
  16. *
  17. * @since v5.0
  18. */
  19. @JsonIgnoreProperties( ignoreUnknown = true )
  20. @JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
  21. public class UserBean
  22. {
  23. public String self;
  24. public String name;
  25. public String displayName;
  26. public String key;
  27. public String password;
  28. public String emailAddress;
  29. public String notification;
  30. private List<String> applicationKeys;
  31. public UserBean() {}
  32. public UserBean(final String name, final String displayName, final String key, final String password, final String emailAddress, final String notification, List<String> applicationKeys) {
  33. this.name = name;
  34. this.displayName = displayName;
  35. this.key = key;
  36. this.password = password;
  37. this.emailAddress = emailAddress;
  38. this.notification = notification;
  39. this.applicationKeys = applicationKeys;
  40. }
  41. public UserBean(final String name, final String displayName, final String key, final String password, final String emailAddress, final String notification)
  42. {
  43. this.name = name;
  44. this.displayName = displayName;
  45. this.key = key;
  46. this.password = password;
  47. this.emailAddress = emailAddress;
  48. this.notification = notification;
  49. }
  50. @JsonIgnore
  51. public Builder but()
  52. {
  53. return builder()
  54. .setDisplayName(displayName)
  55. .setEmailAddress(emailAddress)
  56. .setKey(key)
  57. .setName(name)
  58. .setNotification(notification)
  59. .setPassword(password)
  60. .setApplicationKeys(applicationKeys);
  61. }
  62. public static Builder builder()
  63. {
  64. return new Builder();
  65. }
  66. public static class Builder
  67. {
  68. private String name;
  69. private String displayName;
  70. private String key;
  71. private String password;
  72. private String emailAddress;
  73. private String notification;
  74. private List<String> applicationKeys;
  75. public Builder setName(final String name)
  76. {
  77. this.name = name;
  78. return this;
  79. }
  80. public Builder setDisplayName(final String displayName)
  81. {
  82. this.displayName = displayName;
  83. return this;
  84. }
  85. public Builder setKey(final String key)
  86. {
  87. this.key = key;
  88. return this;
  89. }
  90. public Builder setPassword(final String password)
  91. {
  92. this.password = password;
  93. return this;
  94. }
  95. public Builder setEmailAddress(final String emailAddress)
  96. {
  97. this.emailAddress = emailAddress;
  98. return this;
  99. }
  100. public Builder setNotification(final String notification)
  101. {
  102. this.notification = notification;
  103. return this;
  104. }
  105. public Builder setApplicationKeys(final List<String> roles)
  106. {
  107. this.applicationKeys = roles;
  108. return this;
  109. }
  110. public UserBean build()
  111. {
  112. return new UserBean(name, displayName, key, password, emailAddress, notification, applicationKeys);
  113. }
  114. }
  115. public String getName()
  116. {
  117. return name;
  118. }
  119. public String getDisplayName()
  120. {
  121. return displayName;
  122. }
  123. public String getKey()
  124. {
  125. return key;
  126. }
  127. public String getPassword()
  128. {
  129. return password;
  130. }
  131. public String getEmailAddress()
  132. {
  133. return emailAddress;
  134. }
  135. public String getNotification()
  136. {
  137. return notification;
  138. }
  139. public String getSelf()
  140. {
  141. return self;
  142. }
  143. public List<String> getApplicationKeys()
  144. {
  145. return applicationKeys;
  146. }
  147. }