Post.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. package rocks.zipcode.io.domain;
  2. import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  3. import org.hibernate.annotations.Cache;
  4. import org.hibernate.annotations.CacheConcurrencyStrategy;
  5. import javax.persistence.*;
  6. import java.io.Serializable;
  7. import java.time.LocalDate;
  8. import java.util.Objects;
  9. /**
  10. * A Post.
  11. */
  12. @Entity
  13. @Table(name = "post")
  14. @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
  15. public class Post implements Serializable {
  16. private static final long serialVersionUID = 1L;
  17. @Id
  18. @GeneratedValue(strategy = GenerationType.IDENTITY)
  19. private Long id;
  20. @Column(name = "jhi_timestamp")
  21. private LocalDate timestamp;
  22. @Column(name = "content")
  23. private String content;
  24. @Column(name = "likes")
  25. private String likes;
  26. @ManyToOne
  27. @JsonIgnoreProperties("")
  28. private UserProfile poster;
  29. @ManyToOne
  30. @JsonIgnoreProperties("")
  31. private Privacy privacySetting;
  32. // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
  33. public Long getId() {
  34. return id;
  35. }
  36. public void setId(Long id) {
  37. this.id = id;
  38. }
  39. public LocalDate getTimestamp() {
  40. return timestamp;
  41. }
  42. public Post timestamp(LocalDate timestamp) {
  43. this.timestamp = timestamp;
  44. return this;
  45. }
  46. public void setTimestamp(LocalDate timestamp) {
  47. this.timestamp = timestamp;
  48. }
  49. public String getContent() {
  50. return content;
  51. }
  52. public Post content(String content) {
  53. this.content = content;
  54. return this;
  55. }
  56. public void setContent(String content) {
  57. this.content = content;
  58. }
  59. public String getLikes() {
  60. return likes;
  61. }
  62. public Post likes(String likes) {
  63. this.likes = likes;
  64. return this;
  65. }
  66. public void setLikes(String likes) {
  67. this.likes = likes;
  68. }
  69. public UserProfile getPoster() {
  70. return poster;
  71. }
  72. public Post poster(UserProfile userProfile) {
  73. this.poster = userProfile;
  74. return this;
  75. }
  76. public void setPoster(UserProfile userProfile) {
  77. this.poster = userProfile;
  78. }
  79. public Privacy getPrivacySetting() {
  80. return privacySetting;
  81. }
  82. public Post privacySetting(Privacy privacy) {
  83. this.privacySetting = privacy;
  84. return this;
  85. }
  86. public void setPrivacySetting(Privacy privacy) {
  87. this.privacySetting = privacy;
  88. }
  89. // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
  90. @Override
  91. public boolean equals(Object o) {
  92. if (this == o) {
  93. return true;
  94. }
  95. if (o == null || getClass() != o.getClass()) {
  96. return false;
  97. }
  98. Post post = (Post) o;
  99. if (post.getId() == null || getId() == null) {
  100. return false;
  101. }
  102. return Objects.equals(getId(), post.getId());
  103. }
  104. @Override
  105. public int hashCode() {
  106. return Objects.hashCode(getId());
  107. }
  108. @Override
  109. public String toString() {
  110. return "Post{" +
  111. "id=" + getId() +
  112. ", timestamp='" + getTimestamp() + "'" +
  113. ", content='" + getContent() + "'" +
  114. ", likes='" + getLikes() + "'" +
  115. "}";
  116. }
  117. }