/static/node_modules/generator-jhipster/app/templates/src/main/java/package/domain/_SocialUserConnection.java

https://gitlab.com/augurpl/gitlab-ci-hipster-image · Java · 253 lines · 212 code · 39 blank · 2 comment · 73 complexity · 98c7e2234e341d9617485908284ac9fe MD5 · raw file

  1. package <%=packageName%>.domain;
  2. import org.hibernate.annotations.Cache;
  3. import org.hibernate.annotations.CacheConcurrencyStrategy;
  4. <% if (databaseType == 'mongodb') { %>
  5. import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
  6. import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  7. import org.springframework.data.annotation.Id;
  8. import org.springframework.data.mongodb.core.mapping.Document;
  9. import org.springframework.data.mongodb.core.mapping.Field;
  10. <% } %><% if (databaseType == 'sql') { %>
  11. import javax.persistence.*;<% } %>
  12. import javax.validation.constraints.NotNull;
  13. <% if (databaseType == 'mongodb') { -%>
  14. import javax.validation.constraints.Size;
  15. <% } -%>
  16. import java.io.Serializable;
  17. import java.util.Objects;
  18. /**
  19. * A Social user.
  20. */<% if (databaseType == 'sql') { %>
  21. @Entity
  22. @Table(name = "jhi_social_user_connection")
  23. @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)<% } %><% if (databaseType == 'mongodb') { %>
  24. @Document(collection = "jhi_social_user_connection")<% } %>
  25. public class SocialUserConnection implements Serializable {
  26. <% if (databaseType == 'sql') { %>
  27. @Id
  28. @GeneratedValue(strategy = GenerationType.AUTO)
  29. private Long id;<% } %><% if (databaseType == 'mongodb') { %>
  30. @Id
  31. private String id;<% } %>
  32. @NotNull<% if (databaseType == 'sql') { %>
  33. @Column(name = "user_id", length = 255, nullable = false)<% } %><% if (databaseType == 'mongodb') { %>
  34. @Size(max = 255)
  35. @Field("user_id")<% } %>
  36. private String userId;
  37. @NotNull<% if (databaseType == 'sql') { %>
  38. @Column(name = "provider_id", length = 255, nullable = false)<% } %><% if (databaseType == 'mongodb') { %>
  39. @Size(max = 255)
  40. @Field("provider_id")<% } %>
  41. private String providerId;
  42. @NotNull<% if (databaseType == 'sql') { %>
  43. @Column(name = "provider_user_id", length = 255, nullable = false)<% } %><% if (databaseType == 'mongodb') { %>
  44. @Size(max = 255)
  45. @Field("provider_user_id")<% } %>
  46. private String providerUserId;
  47. @NotNull<% if (databaseType == 'sql') { %>
  48. @Column(nullable = false)<% } %>
  49. private Long rank;
  50. <% if (databaseType == 'sql') { %>
  51. @Column(name = "display_name", length = 255)<% } %><% if (databaseType == 'mongodb') { %>
  52. @Size(max = 255)
  53. @Field("display_name")<% } %>
  54. private String displayName;
  55. <% if (databaseType == 'sql') { %>
  56. @Column(name = "profile_url", length = 255)<% } %><% if (databaseType == 'mongodb') { %>
  57. @Size(max = 255)
  58. @Field("profile_url")<% } %>
  59. private String profileURL;
  60. <% if (databaseType == 'sql') { %>
  61. @Column(name = "image_url", length = 255)<% } %><% if (databaseType == 'mongodb') { %>
  62. @Size(max = 255)
  63. @Field("image_url")<% } %>
  64. private String imageURL;
  65. @NotNull<% if (databaseType == 'sql') { %>
  66. @Column(name = "access_token", length = 255, nullable = false)<% } %><% if (databaseType == 'mongodb') { %>
  67. @Size(max = 255)
  68. @Field("access_token")<% } %>
  69. private String accessToken;
  70. <% if (databaseType == 'sql') { %>
  71. @Column(length = 255)<% } %><% if (databaseType == 'mongodb') { %>
  72. @Size(max = 255)<% } %>
  73. private String secret;
  74. <% if (databaseType == 'sql') { %>
  75. @Column(name = "refresh_token", length = 255)<% } %><% if (databaseType == 'mongodb') { %>
  76. @Size(max = 255)
  77. @Field("refresh_token")<% } %>
  78. private String refreshToken;
  79. <% if (databaseType == 'sql') { %>
  80. @Column(name = "expire_time")<% } %><% if (databaseType == 'mongodb') { %>
  81. @Field("expire_time")<% } %>
  82. private Long expireTime;
  83. public SocialUserConnection() {}
  84. public SocialUserConnection(String userId,
  85. String providerId,
  86. String providerUserId,
  87. Long rank,
  88. String displayName,
  89. String profileURL,
  90. String imageURL,
  91. String accessToken,
  92. String secret,
  93. String refreshToken,
  94. Long expireTime) {
  95. this.userId = userId;
  96. this.providerId = providerId;
  97. this.providerUserId = providerUserId;
  98. this.rank = rank;
  99. this.displayName = displayName;
  100. this.profileURL = profileURL;
  101. this.imageURL = imageURL;
  102. this.accessToken = accessToken;
  103. this.secret = secret;
  104. this.refreshToken = refreshToken;
  105. this.expireTime = expireTime;
  106. }
  107. public <% if (databaseType == 'sql') { %>Long<% } else if (databaseType == 'mongodb') { %>String<% } %> getId() {
  108. return id;
  109. }
  110. public void setId(<% if (databaseType == 'sql') { %>Long<% } else if (databaseType == 'mongodb') { %>String<% } %> id) {
  111. this.id = id;
  112. }
  113. public String getUserId() {
  114. return userId;
  115. }
  116. public void setUserId(String userId) {
  117. this.userId = userId;
  118. }
  119. public String getProviderId() {
  120. return providerId;
  121. }
  122. public void setProviderId(String providerId) {
  123. this.providerId = providerId;
  124. }
  125. public String getProviderUserId() {
  126. return providerUserId;
  127. }
  128. public void setProviderUserId(String providerUserId) {
  129. this.providerUserId = providerUserId;
  130. }
  131. public Long getRank() {
  132. return rank;
  133. }
  134. public void setRank(Long rank) {
  135. this.rank = rank;
  136. }
  137. public String getDisplayName() {
  138. return displayName;
  139. }
  140. public void setDisplayName(String displayName) {
  141. this.displayName = displayName;
  142. }
  143. public String getProfileURL() {
  144. return profileURL;
  145. }
  146. public void setProfileURL(String profileURL) {
  147. this.profileURL = profileURL;
  148. }
  149. public String getImageURL() {
  150. return imageURL;
  151. }
  152. public void setImageURL(String imageURL) {
  153. this.imageURL = imageURL;
  154. }
  155. public String getAccessToken() {
  156. return accessToken;
  157. }
  158. public void setAccessToken(String accessToken) {
  159. this.accessToken = accessToken;
  160. }
  161. public String getSecret() {
  162. return secret;
  163. }
  164. public void setSecret(String secret) {
  165. this.secret = secret;
  166. }
  167. public String getRefreshToken() {
  168. return refreshToken;
  169. }
  170. public void setRefreshToken(String refreshToken) {
  171. this.refreshToken = refreshToken;
  172. }
  173. public Long getExpireTime() {
  174. return expireTime;
  175. }
  176. public void setExpireTime(Long expireTime) {
  177. this.expireTime = expireTime;
  178. }
  179. @Override
  180. public boolean equals(Object o) {
  181. if (this == o) {
  182. return true;
  183. }
  184. if (o == null || getClass() != o.getClass()) {
  185. return false;
  186. }
  187. SocialUserConnection user = (SocialUserConnection) o;
  188. if (!id.equals(user.id)) {
  189. return false;
  190. }
  191. return true;
  192. }
  193. @Override
  194. public int hashCode() {
  195. return Objects.hashCode(id);
  196. }
  197. @Override
  198. public String toString() {
  199. return "SocialUserConnection{" +
  200. "id=" + id +
  201. ", userId=" + userId +
  202. ", providerId='" + providerId + '\'' +
  203. ", providerUserId='" + providerUserId + '\'' +
  204. ", rank=" + rank +
  205. ", displayName='" + displayName + '\'' +
  206. ", profileURL='" + profileURL + '\'' +
  207. ", imageURL='" + imageURL + '\'' +
  208. ", accessToken='" + accessToken + '\'' +
  209. ", secret='" + secret + '\'' +
  210. ", refreshToken='" + refreshToken + '\'' +
  211. ", expireTime=" + expireTime +
  212. '}';
  213. }
  214. }