• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

smartsheet / smartsheet-java-sdk / #55

02 Oct 2024 07:40PM UTC coverage: 60.548% (+0.7%) from 59.836%
#55

push

github

web-flow
Release prep for 3.2.1 (#103)

4156 of 6864 relevant lines covered (60.55%)

0.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/main/java/com/smartsheet/api/models/Comment.java
1
/*
2
 * Copyright (C) 2024 Smartsheet
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.smartsheet.api.models;
18

19
import java.util.Date;
20
import java.util.List;
21

22
/**
23
 * Represents the Comment object.
24
 */
25
public class Comment extends IdentifiableModel<Long> {
26

27
    /**
28
     * Represents the text for the comment.
29
     */
30
    private String text;
31

32
    /**
33
     * Represents the user that created the comment.
34
     */
35
    private User createdBy;
36

37
    /**
38
     * Represents the date the comment was modified.
39
     */
40
    private Date modifiedDate;
41

42
    /**
43
     * Represents the attachments for the comment.
44
     */
45
    private List<Attachment> attachments;
46

47
    /**
48
     * Represents the discussion ID.
49
     */
50
    private Long discussionId;
51

52
    /**
53
     * The date the comment was created.
54
     */
55
    private Date createdAt;
56

57
    /**
58
     * The date the comment was last modified.
59
     */
60
    private Date modifiedAt;
61

62
    /**
63
     * Constructors
64
     */
65
    public Comment() {
1✔
66
    }
1✔
67

68
    public Comment(String text) {
×
69
        setText(text);
×
70
    }
×
71

72
    /**
73
     * Gets the text for the comment.
74
     *
75
     * @return the text
76
     */
77
    public String getText() {
78
        return text;
1✔
79
    }
80

81
    /**
82
     * Sets the text for the comment.
83
     *
84
     * @param text the new text
85
     */
86
    public Comment setText(String text) {
87
        this.text = text;
1✔
88
        return this;
1✔
89
    }
90

91
    /**
92
     * Gets user that created the comment.
93
     *
94
     * @return the created by
95
     */
96
    public User getCreatedBy() {
97
        return createdBy;
1✔
98
    }
99

100
    /**
101
     * Sets the user that created the comment.
102
     *
103
     * @param createdBy the new created by
104
     */
105
    public Comment setCreatedBy(User createdBy) {
106
        this.createdBy = createdBy;
1✔
107
        return this;
1✔
108
    }
109

110
    /**
111
     * Gets the date the comment was last modified.
112
     *
113
     * @return the modified date
114
     */
115
    public Date getModifiedDate() {
116
        return modifiedDate;
1✔
117
    }
118

119
    /**
120
     * Sets the date the comment was last modified.
121
     *
122
     * @param modifiedDate the new modified date
123
     */
124
    public Comment setModifiedDate(Date modifiedDate) {
125
        this.modifiedDate = modifiedDate;
1✔
126
        return this;
1✔
127
    }
128

129
    /**
130
     * Gets the comment attachments.
131
     *
132
     * @return the attachments
133
     */
134
    public List<Attachment> getAttachments() {
135
        return attachments;
1✔
136
    }
137

138
    /**
139
     * Sets the comment attachments.
140
     *
141
     * @param attachments the new attachments
142
     */
143
    public Comment setAttachments(List<Attachment> attachments) {
144
        this.attachments = attachments;
1✔
145
        return this;
1✔
146
    }
147

148
    /**
149
     * Gets the discussion id.
150
     *
151
     * @return the discussion id
152
     */
153
    public Long getDiscussionId() {
154
        return discussionId;
1✔
155
    }
156

157
    /**
158
     * Sets the discussion id.
159
     *
160
     * @param discussionId the new discussion id
161
     */
162
    public Comment setDiscussionId(Long discussionId) {
163
        this.discussionId = discussionId;
1✔
164
        return this;
1✔
165
    }
166

167
    /**
168
     * Gets the date the comment was created.
169
     *
170
     * @return the created at
171
     */
172
    public Date getCreatedAt() {
173
        return createdAt;
1✔
174
    }
175

176
    /**
177
     * Sets the date the comment was created.
178
     *
179
     * @param createdAt the new created at
180
     */
181
    public Comment setCreatedAt(Date createdAt) {
182
        this.createdAt = createdAt;
1✔
183
        return this;
1✔
184
    }
185

186
    /**
187
     * Gets the date the comment was modified.
188
     *
189
     * @return the modified at
190
     */
191
    public Date getModifiedAt() {
192
        return modifiedAt;
1✔
193
    }
194

195
    /**
196
     * Sets the date the comment was modified.
197
     *
198
     * @param modifiedAt the new modified at
199
     */
200
    public Comment setModifiedAt(Date modifiedAt) {
201
        this.modifiedAt = modifiedAt;
1✔
202
        return this;
1✔
203
    }
204

205
    /**
206
     * A convenience class to generate a comment with the appropriate fields for adding it to a sheet.
207
     */
208
    public static class AddCommentBuilder {
1✔
209

210
        /**
211
         * The text.
212
         */
213
        private String text;
214

215
        /**
216
         * The text for the comment.
217
         *
218
         * @param text the text
219
         * @return the adds the comment builder
220
         */
221
        public AddCommentBuilder setText(String text) {
222
            this.text = text;
1✔
223
            return this;
1✔
224
        }
225

226
        /**
227
         * Gets the text for the comment.
228
         *
229
         * @return the text
230
         */
231
        public String getText() {
232
            return text;
×
233
        }
234

235
        /**
236
         * Builds the comment.
237
         *
238
         * @return the comment
239
         */
240
        public Comment build() {
241
            if (text == null) {
1✔
242
                throw new InstantiationError("The comment text is required.");
×
243
            }
244

245
            Comment comment = new Comment();
1✔
246
            comment.text = text;
1✔
247
            return comment;
1✔
248
        }
249
    }
250
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc