1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.linecorp.centraldogma.server.internal.admin.dto;
18
19 import static java.util.Objects.requireNonNull;
20
21 import java.util.ArrayList;
22 import java.util.List;
23 import java.util.stream.Collectors;
24
25 import com.google.common.base.MoreObjects;
26
27 import com.linecorp.centraldogma.internal.thrift.Commit;
28
29 public class CommitDto {
30 private RevisionDto revision;
31 private AuthorDto author;
32 private String timestamp;
33 private String summary;
34 private CommentDto detail;
35 private List<ChangeDto> diffs = new ArrayList<>();
36
37 public CommitDto() {}
38
39 public CommitDto(Commit commit) {
40 requireNonNull(commit, "commit");
41
42 revision = new RevisionDto(commit.getRevision());
43 author = new AuthorDto(commit.getAuthor());
44 timestamp = commit.getTimestamp();
45 summary = commit.getSummary();
46 detail = new CommentDto(commit.getDetail());
47 diffs = commit.getDiffs().stream().map(ChangeDto::new).collect(Collectors.toList());
48 }
49
50 public RevisionDto getRevision() {
51 return revision;
52 }
53
54 public void setRevision(RevisionDto revision) {
55 this.revision = revision;
56 }
57
58 public AuthorDto getAuthor() {
59 return author;
60 }
61
62 public void setAuthor(AuthorDto author) {
63 this.author = author;
64 }
65
66 public String getTimestamp() {
67 return timestamp;
68 }
69
70 public void setTimestamp(String timestamp) {
71 this.timestamp = timestamp;
72 }
73
74 public String getSummary() {
75 return summary;
76 }
77
78 public void setSummary(String summary) {
79 this.summary = summary;
80 }
81
82 public CommentDto getDetail() {
83 return detail;
84 }
85
86 public void setDetail(CommentDto detail) {
87 this.detail = detail;
88 }
89
90 public List<ChangeDto> getDiffs() {
91 return diffs;
92 }
93
94 public void setDiffs(List<ChangeDto> diffs) {
95 this.diffs = diffs;
96 }
97
98 @Override
99 public String toString() {
100 return MoreObjects.toStringHelper(this)
101 .add("revision", revision)
102 .add("author", author)
103 .add("timestamp", timestamp)
104 .add("summary", summary)
105 .add("detail", detail)
106 .add("diffs", diffs)
107 .toString();
108 }
109 }