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

smartsheet / smartsheet-java-sdk / #41

24 Aug 2023 04:59PM UTC coverage: 50.458% (+0.01%) from 50.444%
#41

push

github-actions

web-flow
Fix Checkstyle Violations in "Impl" Classes (#53)

241 of 241 new or added lines in 32 files covered. (100.0%)

3417 of 6772 relevant lines covered (50.46%)

0.5 hits per line

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

82.76
/src/main/java/com/smartsheet/api/models/Group.java
1
package com.smartsheet.api.models;
2

3
import java.util.Date;
4
import java.util.List;
5

6
/*
7
 * #[license]
8
 * Smartsheet SDK for Java
9
 * %%
10
 * Copyright (C) 2023 Smartsheet
11
 * %%
12
 * Licensed under the Apache License, Version 2.0 (the "License");
13
 * you may not use this file except in compliance with the License.
14
 * You may obtain a copy of the License at
15
 *
16
 *      http://www.apache.org/licenses/LICENSE-2.0
17
 *
18
 * Unless required by applicable law or agreed to in writing, software
19
 * distributed under the License is distributed on an "AS IS" BASIS,
20
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
 * See the License for the specific language governing permissions and
22
 * limitations under the License.
23
 * %[license]
24
 */
25

26
/**
27
 * Represents a Group Object.
28
 * @see <a href="http://help.smartsheet.com/customer/portal/articles/1554165-managing-groups-team-enterprise-only-">Managing groups</a>
29
 */
30
public class Group extends NamedModel<Long> {
31

32
    /**
33
     *    The description of the group.
34
     */
35
    private String description;
36

37
    /**
38
     *    The email address of the owner of the group.
39
     */
40
    private String owner;
41

42
    /**
43
     *    The the id of the owner of the group.
44
     */
45
    private Long ownerId;
46

47
    /**
48
     *    The date when the group was created.
49
     */
50
    private Date createdAt;
51

52
    /**
53
     *    The date when the group was last modified.
54
     */
55
    private Date modifiedAt;
56

57
    /**
58
     * The list of members in the group.
59
     */
60
    private List<GroupMember> members;
61

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

67
    public Group(Long id) {
×
68
        setId(id);
×
69
    }
×
70

71
    /**
72
     * Provide an 'override' of setName (returns Group not NamedModel)
73
     *
74
     * @param name the new name
75
     */
76
    public Group setName(String name) {
77
        super.setName(name);
1✔
78
        return this;
1✔
79
    }
80

81
    /**
82
     * @return the description of the group
83
     */
84
    public String getDescription() {
85
        return description;
1✔
86
    }
87

88
    /**
89
     * @param description the description to set
90
     */
91
    public Group setDescription(String description) {
92
        this.description = description;
1✔
93
        return this;
1✔
94
    }
95

96
    /**
97
     * @return the email address of the owner
98
     */
99
    public String getOwner() {
100
        return owner;
1✔
101
    }
102

103
    /**
104
     * @param owner the owner email address to set
105
     */
106
    public Group setOwner(String owner) {
107
        this.owner = owner;
1✔
108
        return this;
1✔
109
    }
110

111
    /**
112
     * @return the id of the owner of the group.
113
     */
114
    public Long getOwnerId() {
115
        return ownerId;
1✔
116
    }
117

118
    /**
119
     * @param ownerId the owner Id to set
120
     */
121
    public Group setOwnerId(Long ownerId) {
122
        this.ownerId = ownerId;
1✔
123
        return this;
1✔
124
    }
125

126
    /**
127
     * @return the createdAt {@link Date}
128
     */
129
    public Date getCreatedAt() {
130
        return createdAt;
1✔
131
    }
132

133
    /**
134
     * @param createdAt the createdAt {@link Date} to set
135
     */
136
    public Group setCreatedAt(Date createdAt) {
137
        this.createdAt = createdAt;
1✔
138
        return this;
1✔
139
    }
140

141
    /**
142
     * @return the modifiedAt {@link Date}
143
     */
144
    public Date getModifiedAt() {
145
        return modifiedAt;
1✔
146
    }
147

148
    /**
149
     * @param modifiedAt the modifiedAt {@link Date} to set
150
     */
151
    public Group setModifiedAt(Date modifiedAt) {
152
        this.modifiedAt = modifiedAt;
1✔
153
        return this;
1✔
154
    }
155

156
    /**
157
     * @return the {@link List} of {@link Group}s
158
     */
159
    public List<GroupMember> getMembers() {
160
        return members;
1✔
161
    }
162

163
    /**
164
     * @param members the {@link List} of {@link User}s to set
165
     */
166
    public Group setMembers(List<GroupMember> members) {
167
        this.members = members;
1✔
168
        return this;
1✔
169
    }
170

171
    /**
172
     * A convenience class to make a {@link Group} object with the necessary fields to create the group by posting it
173
     * to smartsheet.
174
     */
175
    public static class CreateGroupBuilder {
1✔
176
        private List<GroupMember> members;
177
        private String name;
178
        private String description;
179

180
        /**
181
         * Sets the members for the group being created.
182
         *
183
         * @param members The {@link List} of {@link Group}s to add as members of this group.
184
         * @return the creates the builder
185
         */
186
        public CreateGroupBuilder setMembers(List<GroupMember> members) {
187
            this.members = members;
1✔
188
            return this;
1✔
189
        }
190

191
        /**
192
         * Sets the name for the {@link Group} being created.
193
         *
194
         * @param name The name for the {@link Group} being created.
195
         * @return the creates the builder
196
         */
197
        public CreateGroupBuilder setName(String name) {
198
            this.name = name;
1✔
199
            return this;
1✔
200
        }
201

202
        /**
203
         * Returns the list of members.
204
         *
205
         * @return the columns
206
         */
207
        public List<GroupMember> getMembers() {
208
            return members;
1✔
209
        }
210

211
        /**
212
         * Returns the name for the group.
213
         *
214
         * @return the name
215
         */
216
        public String getName() {
217
            return name;
×
218
        }
219

220
        /**
221
         * Creates a user by using the values from setters in this builder.
222
         *
223
         * @return the sheet
224
         */
225
        public Group build() {
226
            Group group = new Group();
1✔
227

228
            if (name == null) {
1✔
229
                throw new InstantiationError();
×
230
            }
231
            group.setName(name);
1✔
232
            group.setMembers(members);
1✔
233
            group.setDescription(description);
1✔
234
            return group;
1✔
235
        }
236

237
        /**
238
         * @return the description of the group
239
         */
240
        public String getDescription() {
241
            return description;
×
242
        }
243

244
        /**
245
         * @param description the description to set
246
         * @return the builder
247
         */
248
        public CreateGroupBuilder setDescription(String description) {
249
            this.description = description;
1✔
250
            return this;
1✔
251
        }
252
    }
253

254
    /**
255
     * A convenience class to update a {@link Group} object with the necessary fields to create the group by putting it
256
     * to smartsheet.
257
     */
258
    public static class UpdateGroupBuilder {
1✔
259
        private String name;
260
        private String description;
261
        private Long id;
262

263
        /**
264
         * Sets the name for the {@link Group} being created.
265
         *
266
         * @param name The name for the {@link Group} being created.
267
         * @return the creates the builder
268
         */
269
        public UpdateGroupBuilder setName(String name) {
270
            this.name = name;
1✔
271
            return this;
1✔
272
        }
273

274
        /**
275
         * Returns the name for the group.
276
         *
277
         * @return the name
278
         */
279
        public String getName() {
280
            return name;
×
281
        }
282

283
        /**
284
         * Creates a user by using the values from setters in this builder.
285
         *
286
         * @return the sheet
287
         */
288
        public Group build() {
289
            Group group = new Group();
1✔
290

291
            if (name == null || id == null) {
1✔
292
                throw new InstantiationError();
×
293
            }
294
            group.setDescription(description);
1✔
295
            group.setName(name);
1✔
296
            group.setId(id);
1✔
297
            return group;
1✔
298
        }
299

300
        /**
301
         * @return the description of the group
302
         */
303
        public String getDescription() {
304
            return description;
×
305
        }
306

307
        /**
308
         * @param description the description to set
309
         * @return the builder
310
         */
311
        public UpdateGroupBuilder setDescription(String description) {
312
            this.description = description;
1✔
313
            return this;
1✔
314
        }
315

316
        /**
317
         * @return the id of the {@link Group}
318
         */
319
        public Long getId() {
320
            return id;
×
321
        }
322

323
        /**
324
         * @param id the id to set
325
         * @return the builder
326
         */
327
        public UpdateGroupBuilder setId(Long id) {
328
            this.id = id;
1✔
329
            return this;
1✔
330
        }
331
    }
332
}
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

© 2026 Coveralls, Inc