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

smartsheet / smartsheet-java-sdk / #56

06 Jun 2025 04:28PM UTC coverage: 60.611% (+0.06%) from 60.548%
#56

push

github

web-flow
chore: Added pull request template (#121)

* Initial commit: Added pull request template

* Updated wording and grammar

* Added relevant links and removed style guide requirement

* chore: Updated pull request template and added codeowners file

* chore: Removed redundant checklist point and codeowners file

---------

Co-authored-by: Priyanka Lakhe <priyankalakhe@gmail.com>

4164 of 6870 relevant lines covered (60.61%)

0.61 hits per line

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

64.0
/src/main/java/com/smartsheet/api/models/Folder.java
1
/*
2
 * Copyright (C) 2025 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.List;
20

21
/**
22
 * Represents a folder.
23
 */
24
public class Folder extends NamedModel<Long> {
25

26
    /**
27
     * Represents the sheets contained in the folder.
28
     */
29
    private List<Sheet> sheets;
30

31
    /**
32
     * Represents the child folders contained in the folder.
33
     */
34
    private List<Folder> folders;
35

36
    /**
37
     * Represents the reports.
38
     */
39
    private List<Report> reports;
40

41
    /**
42
     * Represents the templates contained in the folder.
43
     */
44
    private List<Template> templates;
45

46
    /**
47
     * Represents the Sights contained in the folder.
48
     */
49
    private List<Sight> sights;
50

51
    /**
52
     * Returns if the user has marked the Folder as a Favorite in their Home tab.
53
     *
54
     * @deprecated As of API 3.2.2. Please use the isFavorite method in FavoritesResources instead.
55
     */
56
    @Deprecated(since = "3.2.2", forRemoval = true)
57
    private Boolean favorite;
58

59
    /**
60
     * Represents the Direct URL to Folder.
61
     */
62
    private String permalink;
63

64
    /**
65
     * Default constructor
66
     */
67
    public Folder() {
1✔
68
    }
1✔
69

70
    /**
71
     * Construct a Folder with specified id
72
     *
73
     * @param id Folder id
74
     */
75
    public Folder(Long id) {
×
76
        this.setId(id);
×
77
    }
×
78

79
    /**
80
     * Provide an 'override' of setName (returns Folder not NamedModel)
81
     *
82
     * @param name the new name
83
     */
84
    public Folder setName(String name) {
85
        super.setName(name);
1✔
86
        return this;
1✔
87
    }
88

89
    /**
90
     * Gets the Direct URL to Folder.
91
     *
92
     * @return the sheets
93
     */
94
    public String getPermalink() {
95
        return permalink;
1✔
96
    }
97

98
    /**
99
     * Sets the Direct URL to Folder.
100
     *
101
     * @param permalink the new sheets
102
     */
103
    public Folder setPermalink(String permalink) {
104
        this.permalink = permalink;
1✔
105
        return this;
1✔
106
    }
107

108
    /**
109
     * Gets the favorite boolean value of folder in Home.
110
     *
111
     * @return the sheets
112
     *
113
     * @deprecated As of API 3.2.2. Please use the isFavorite method in FavoritesResources instead.
114
     */
115
    @Deprecated(since = "3.2.2", forRemoval = true)
116
    public Boolean getFavorite() {
117
        return favorite;
1✔
118
    }
119

120
    /**
121
     * Sets the favorite boolean value of folder in Home.
122
     *
123
     * @param favorite the new sheets
124
     *
125
     * @deprecated As of API 3.2.2. Please use the isFavorite method in FavoritesResources instead.
126
     */
127
    @Deprecated(since = "3.2.2", forRemoval = true)
128
    public Folder setFavorite(Boolean favorite) {
129
        this.favorite = favorite;
×
130
        return this;
×
131
    }
132

133
    /**
134
     * Gets the sheets in the folder.
135
     *
136
     * @return the sheets
137
     */
138
    public List<Sheet> getSheets() {
139
        return sheets;
1✔
140
    }
141

142
    /**
143
     * Sets the sheets contained in the folder.
144
     *
145
     * @param sheets the new sheets
146
     */
147
    public Folder setSheets(List<Sheet> sheets) {
148
        this.sheets = sheets;
1✔
149
        return this;
1✔
150
    }
151

152
    /**
153
     * Gets the folders contained in this folder.
154
     *
155
     * @return the folders
156
     */
157
    public List<Folder> getFolders() {
158
        return folders;
1✔
159
    }
160

161
    /**
162
     * Sets the folders contained in this folder.
163
     *
164
     * @param folders the new folders
165
     */
166
    public Folder setFolders(List<Folder> folders) {
167
        this.folders = folders;
1✔
168
        return this;
1✔
169
    }
170

171
    /**
172
     * Gets the reports.
173
     *
174
     * @return the reports
175
     */
176
    public List<Report> getReports() {
177
        return reports;
1✔
178
    }
179

180
    /**
181
     * Sets the reports.
182
     *
183
     * @param reports the new reports
184
     */
185
    public Folder setReports(List<Report> reports) {
186
        this.reports = reports;
×
187
        return this;
×
188
    }
189

190
    /**
191
     * Gets the templates contained in this folder.
192
     *
193
     * @return the templates
194
     */
195
    public List<Template> getTemplates() {
196
        return templates;
1✔
197
    }
198

199
    /**
200
     * Sets the templates contained in this folder.
201
     *
202
     * @param templates the new templates
203
     */
204
    public Folder setTemplates(List<Template> templates) {
205
        this.templates = templates;
×
206
        return this;
×
207
    }
208

209
    /**
210
     * Get the sights contained in this folder
211
     *
212
     * @return the sights
213
     */
214
    public List<Sight> getSights() {
215
        return sights;
1✔
216
    }
217

218
    /**
219
     * Sets the sights contained in this folder.
220
     */
221
    public Folder setSights(List<Sight> sights) {
222
        this.sights = sights;
×
223
        return this;
×
224
    }
225

226
    /**
227
     * A convenience class for setting up a folder with the appropriate fields for updating the folder.
228
     */
229
    public static class UpdateFolderBuilder {
1✔
230
        private String folderName;
231
        private Long id;
232

233
        /**
234
         * Name.
235
         *
236
         * @param name the name
237
         * @return the update folder builder
238
         */
239
        public UpdateFolderBuilder setName(String name) {
240
            this.folderName = name;
1✔
241
            return this;
1✔
242
        }
243

244
        /**
245
         * Gets the name.
246
         *
247
         * @return the name
248
         */
249
        public String getName() {
250
            return folderName;
×
251
        }
252

253
        /**
254
         * Gets the folder id.
255
         *
256
         * @return the folder id.
257
         */
258
        public Long getId() {
259
            return id;
×
260
        }
261

262
        /**
263
         * Sets the folder id.
264
         *
265
         * @param id the id of the folder.
266
         * @return the builder
267
         */
268
        public UpdateFolderBuilder setId(Long id) {
269
            this.id = id;
×
270
            return this;
×
271
        }
272

273
        /**
274
         * Builds the folder.
275
         *
276
         * @return the folder
277
         */
278
        public Folder build() {
279
            if (folderName == null) {
1✔
280
                throw new IllegalStateException("A folder name is required.");
×
281
            }
282

283
            Folder folder = new Folder();
1✔
284
            folder.setId(id);
1✔
285
            folder.setName(folderName);
1✔
286
            return folder;
1✔
287
        }
288
    }
289

290
    /**
291
     * A convenience class for setting up a folder with the appropriate fields for updating the folder.
292
     */
293
    public static class CreateFolderBuilder {
1✔
294
        private String folderName;
295

296
        /**
297
         * Name.
298
         *
299
         * @param name the name
300
         * @return the create folder builder
301
         */
302
        public CreateFolderBuilder setName(String name) {
303
            this.folderName = name;
1✔
304
            return this;
1✔
305
        }
306

307
        /**
308
         * Gets the name.
309
         *
310
         * @return the name
311
         */
312
        public String getName() {
313
            return folderName;
×
314
        }
315

316
        /**
317
         * Builds the folder.
318
         *
319
         * @return the folder
320
         */
321
        public Folder build() {
322
            if (folderName == null) {
1✔
323
                throw new IllegalStateException("A folder name is required.");
×
324
            }
325

326
            Folder folder = new Folder();
1✔
327
            folder.setName(folderName);
1✔
328
            return folder;
1✔
329
        }
330
    }
331
}
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