1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.jira.rest.client.domain;
18
19 import com.google.common.base.Objects;
20 import org.joda.time.DateTime;
21
22 import javax.annotation.Nullable;
23 import java.net.URI;
24
25
26
27
28
29
30 public class Worklog {
31 private final URI self;
32 private final URI issueUri;
33 private final BasicUser author;
34 private final BasicUser updateAuthor;
35 private final String comment;
36 private final DateTime creationDate;
37 private final DateTime updateDate;
38 private final DateTime startDate;
39 private final int minutesSpent;
40 @Nullable
41 private final Visibility visibility;
42
43 public Worklog(URI self, URI issueUri, BasicUser author, BasicUser updateAuthor, String comment, DateTime creationDate,
44 DateTime updateDate, DateTime startDate, int minutesSpent, Visibility visibility) {
45 this.self = self;
46 this.issueUri = issueUri;
47 this.author = author;
48 this.updateAuthor = updateAuthor;
49 this.comment = comment;
50 this.creationDate = creationDate;
51 this.updateDate = updateDate;
52 this.startDate = startDate;
53 this.minutesSpent = minutesSpent;
54 this.visibility = visibility;
55 }
56
57 public URI getSelf() {
58 return self;
59 }
60
61 public URI getIssueUri() {
62 return issueUri;
63 }
64
65 public BasicUser getAuthor() {
66 return author;
67 }
68
69 public BasicUser getUpdateAuthor() {
70 return updateAuthor;
71 }
72
73 public String getComment() {
74 return comment;
75 }
76
77 public DateTime getCreationDate() {
78 return creationDate;
79 }
80
81 public DateTime getUpdateDate() {
82 return updateDate;
83 }
84
85 public DateTime getStartDate() {
86 return startDate;
87 }
88
89 public int getMinutesSpent() {
90 return minutesSpent;
91 }
92
93 public Visibility getVisibility() {
94 return visibility;
95 }
96
97 @Override
98 public String toString() {
99 return Objects.toStringHelper(this).
100 add("self", self).
101 add("issueUri", issueUri).
102 add("author", author).
103 add("updateAuthor", updateAuthor).
104 add("comment", comment).
105 add("creationDate", creationDate).
106 add("updateDate", updateDate).
107 add("startDate", startDate).
108 add("minutesSpent", minutesSpent).
109 add("visibility", visibility).
110 toString();
111 }
112
113 @Override
114 public boolean equals(Object obj) {
115 if (obj instanceof Worklog) {
116 Worklog that = (Worklog) obj;
117 return Objects.equal(this.self, that.self)
118 && Objects.equal(this.issueUri, that.issueUri)
119 && Objects.equal(this.author, that.author)
120 && Objects.equal(this.updateAuthor, that.updateAuthor)
121 && Objects.equal(this.comment, that.comment)
122 && Objects.equal(this.visibility, that.visibility)
123 && this.creationDate.isEqual(that.creationDate)
124 && this.updateDate.isEqual(that.updateDate)
125 && this.startDate.isEqual(that.startDate)
126 && Objects.equal(this.minutesSpent, that.minutesSpent);
127 }
128 return false;
129 }
130
131 @Override
132 public int hashCode() {
133 return Objects.hashCode(self, issueUri, author, updateAuthor, comment, creationDate, updateDate, startDate, minutesSpent);
134 }
135
136
137 }