• 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

81.1
/src/main/java/com/smartsheet/api/models/AbstractSheet.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 com.fasterxml.jackson.annotation.JsonIgnore;
20
import com.smartsheet.api.models.enums.AccessLevel;
21
import com.smartsheet.api.models.enums.AttachmentType;
22
import com.smartsheet.api.models.enums.ResourceManagementType;
23

24
import java.util.Date;
25
import java.util.EnumSet;
26
import java.util.List;
27

28
public abstract class AbstractSheet<TRow extends AbstractRow<TColumn, TCell>, TColumn extends Column, TCell extends Cell>
1✔
29
        extends NamedModel<Long> {
30

31
    /**
32
     * Represents the ID of the sheet/template from which the sheet was created.
33
     */
34
    private Long fromId;
35

36
    /**
37
     * Represents the owner id of the owner.
38
     */
39
    private Long ownerId;
40

41
    /**
42
     * Represents the access level for the sheet.
43
     */
44
    private AccessLevel accessLevel;
45

46
    /**
47
     * Represents the attachments for the sheet.
48
     */
49
    private List<Attachment> attachments;
50

51
    /**
52
     * Represents the columns for the sheet.
53
     */
54
    private List<TColumn> columns;
55

56
    /**
57
     * Get a list of contact references used by MULTI_CONTACT columns in this sheet
58
     */
59
    private List<ContactObjectValue> contactReferences;
60

61
    /**
62
     * Represents the creation timestamp for the sheet.
63
     */
64
    private Date createdAt;
65

66
    /**
67
     * Get a list of cross sheet references used by this sheet
68
     */
69
    private List<CrossSheetReference> crossSheetReferences;
70

71
    /**
72
     * Represents the dependencies enabled flag.
73
     *
74
     * @see <a href="http://help.smartsheet.com/customer/portal/articles/765727-using-the-dependencies-functionality">
75
     * Dependencies Functionality</a>
76
     */
77
    private Boolean dependenciesEnabled;
78

79
    /**
80
     * Represents the discussions for the sheet.
81
     */
82
    private List<Discussion> discussions;
83

84
    /**
85
     * Represents effective attachment options.
86
     */
87
    private EnumSet<AttachmentType> effectiveAttachmentOptions;
88

89
    /**
90
     * Identifies if the sheet is marked as favorite.
91
     *
92
     * @deprecated As of API 3.2.2. Please use the isFavorite method in FavoritesResources instead.
93
     */
94
    @Deprecated(since = "3.2.2", forRemoval = true)
95
    private Boolean favorite;
96

97
    /**
98
     * List of sheet filters
99
     */
100
    private List<SheetFilter> filters;
101

102
    /**
103
     * Represents the Gantt enabled flag.
104
     */
105
    private Boolean ganttEnabled;
106

107
    /**
108
     * Indicates whether a sheet summary is present
109
     */
110
    private Boolean hasSummaryFields;
111

112
    /**
113
     * Represents the modification timestamp for the sheet.
114
     */
115
    private Date modifiedAt;
116

117
    /**
118
     * Represents the owner of the sheet.
119
     */
120
    private String owner;
121

122
    /**
123
     * Represents the direct URL to the sheet.
124
     */
125
    private String permalink;
126

127
    /**
128
     * Represents projects settings for a dependency-enabled sheet
129
     */
130
    private ProjectSettings projectSettings;
131

132
    /**
133
     * Represents the read only flag for the sheet.
134
     */
135
    private Boolean readOnly;
136

137
    /**
138
     * A flag that indicates if resource management is enabled for a sheet.
139
     */
140
    private Boolean resourceManagementEnabled;
141

142
    /**
143
     * A flag that indicates if resource management is enabled for a sheet.
144
     */
145
    private ResourceManagementType resourceManagementType;
146

147
    /**
148
     * Represents the rows for the sheet.
149
     */
150
    private List<TRow> rows;
151

152
    /**
153
     * Identifies if it is enabled to show parent rows for filters.
154
     */
155
    private Boolean showParentRowsForFilters;
156

157
    /**
158
     * Represents the source of the sheet.
159
     */
160
    private Source source;
161

162
    /**
163
     * A SheetSummary object containing a list of defined fields and values for the sheet.
164
     */
165
    private SheetSummary summary;
166

167
    /**
168
     * Represents the total number of rows in the sheet.
169
     */
170
    private Integer totalRowCount;
171

172
    /**
173
     * A SheetUserPermissions object indicating what summary operations are possible for the current user
174
     */
175
    private SheetUserPermissions userPermissions;
176

177
    /**
178
     * Represents the user settings.
179
     */
180
    private SheetUserSettings userSettings;
181

182
    /**
183
     * Represents the version for the sheet
184
     */
185
    private Integer version;
186

187
    /**
188
     * A Workspace object containing Id and Name (if this sheet is in a Workspace)
189
     */
190
    private Workspace workspace;
191

192
    /**
193
     * Gets the ID of the sheet/template from which the sheet was created.
194
     *
195
     * @return the from id
196
     */
197
    public Long getFromId() {
198
        return fromId;
1✔
199
    }
200

201
    /**
202
     * Sets the ID of the sheet/template from which the sheet was created.
203
     *
204
     * @param fromId the new from id
205
     */
206
    @SuppressWarnings("unchecked")
207
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setFromId(Long fromId) {
208
        this.fromId = fromId;
1✔
209
        return (T) this;
1✔
210
    }
211

212
    /**
213
     * Gets the owner id.
214
     *
215
     * @return the ownerid
216
     */
217
    public Long getOwnerId() {
218
        return ownerId;
1✔
219
    }
220

221
    /**
222
     * Sets the owner id.
223
     *
224
     * @param ownerId the owner id
225
     */
226
    @SuppressWarnings("unchecked")
227
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setOwnerId(long ownerId) {
228
        this.ownerId = ownerId;
1✔
229
        return (T) this;
1✔
230
    }
231

232
    /**
233
     * Gets the access level for the sheet.
234
     *
235
     * @return the access level
236
     */
237
    public AccessLevel getAccessLevel() {
238
        return accessLevel;
1✔
239
    }
240

241
    /**
242
     * Sets the access level for the sheet.
243
     *
244
     * @param accessLevel the new access level
245
     */
246
    @SuppressWarnings("unchecked")
247
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setAccessLevel(AccessLevel accessLevel) {
248
        this.accessLevel = accessLevel;
1✔
249
        return (T) this;
1✔
250
    }
251

252
    /**
253
     * Gets the attachments for the sheet.
254
     *
255
     * @return the attachments
256
     */
257
    public List<Attachment> getAttachments() {
258
        return attachments;
1✔
259
    }
260

261
    /**
262
     * Sets the attachments for the sheet.
263
     *
264
     * @param attachments the new attachments
265
     */
266
    @SuppressWarnings("unchecked")
267
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setAttachments(List<Attachment> attachments) {
268
        this.attachments = attachments;
1✔
269
        return (T) this;
1✔
270
    }
271

272
    /**
273
     * Gets the columns for the sheet.
274
     *
275
     * @return the columns
276
     */
277
    public List<TColumn> getColumns() {
278
        return columns;
1✔
279
    }
280

281
    /**
282
     * Sets the columns for the sheet.
283
     *
284
     * @param columns the new columns
285
     */
286
    @SuppressWarnings("unchecked")
287
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setColumns(List<TColumn> columns) {
288
        this.columns = columns;
1✔
289
        return (T) this;
1✔
290
    }
291

292
    /**
293
     * Sets contact references used by MULTI_CONTACT_LIST columns
294
     *
295
     * @return contact references
296
     */
297
    public List<ContactObjectValue> getContactReferences() {
298
        return contactReferences;
1✔
299
    }
300

301
    /**
302
     * Sets contact references used by MULTI_CONTACT_LIST columns
303
     */
304
    @SuppressWarnings("unchecked")
305
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setContactReferences(List<ContactObjectValue> contactReferences) {
306
        this.contactReferences = contactReferences;
×
307
        return (T) this;
×
308
    }
309

310
    /**
311
     * Gets the date and time the sheet was created.
312
     *
313
     * @return the created at
314
     */
315
    public Date getCreatedAt() {
316
        return createdAt;
1✔
317
    }
318

319
    /**
320
     * Sets the date and time the sheet was created.
321
     *
322
     * @param createdAt the new created at
323
     */
324
    @SuppressWarnings("unchecked")
325
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setCreatedAt(Date createdAt) {
326
        this.createdAt = createdAt;
1✔
327
        return (T) this;
1✔
328
    }
329

330
    /**
331
     * Gets the list of cross sheet references used by this sheet
332
     *
333
     * @return the cross sheet references
334
     */
335
    public List<CrossSheetReference> getCrossSheetReferences() {
336
        return crossSheetReferences;
1✔
337
    }
338

339
    /**
340
     * Sets the list of cross sheet references used by this sheet
341
     *
342
     * @param crossSheetReferences the cross sheet references
343
     */
344
    @SuppressWarnings("unchecked")
345
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setCrossSheetReferences(List<CrossSheetReference> crossSheetReferences) {
346
        this.crossSheetReferences = crossSheetReferences;
×
347
        return (T) this;
×
348
    }
349

350
    /**
351
     * Gets the dependencies enabled flag.
352
     *
353
     * @return the dependencies enabled
354
     */
355
    public Boolean getDependenciesEnabled() {
356
        return dependenciesEnabled;
1✔
357
    }
358

359
    /**
360
     * Sets the dependencies enabled flag.
361
     *
362
     * @param dependenciesEnabled the new dependencies enabled
363
     */
364
    @SuppressWarnings("unchecked")
365
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setDependenciesEnabled(Boolean dependenciesEnabled) {
366
        this.dependenciesEnabled = dependenciesEnabled;
1✔
367
        return (T) this;
1✔
368
    }
369

370
    /**
371
     * Gets the discussions for the sheet.
372
     *
373
     * @return the discussions
374
     */
375
    public List<Discussion> getDiscussions() {
376
        return discussions;
1✔
377
    }
378

379
    /**
380
     * Sets the discussions for the sheet.
381
     *
382
     * @param discussions the new discussions
383
     */
384
    @SuppressWarnings("unchecked")
385
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setDiscussions(List<Discussion> discussions) {
386
        this.discussions = discussions;
1✔
387
        return (T) this;
1✔
388
    }
389

390
    /**
391
     * Gets the effective attachment options.
392
     *
393
     * @return list of attachment types
394
     */
395
    public EnumSet<AttachmentType> getEffectiveAttachmentOptions() {
396
        return effectiveAttachmentOptions;
1✔
397
    }
398

399
    /**
400
     * Sets the effective attachment options.
401
     *
402
     * @param effectiveAttachmentOptions the effective attachment options
403
     */
404
    @SuppressWarnings("unchecked")
405
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setEffectiveAttachmentOptions(
406
            EnumSet<AttachmentType> effectiveAttachmentOptions
407
    ) {
408
        this.effectiveAttachmentOptions = effectiveAttachmentOptions;
×
409
        return (T) this;
×
410
    }
411

412
    /**
413
     * True if the sheet is a favorite sheet.
414
     *
415
     * @return the favorite
416
     *
417
     * @deprecated As of API 3.2.2. Please use the isFavorite method in FavoritesResources instead.
418
     */
419
    @Deprecated(since = "3.2.2", forRemoval = true)
420
    public Boolean isFavorite() {
421
        return favorite;
1✔
422
    }
423

424
    /**
425
     * Sets the favorite sheet
426
     *
427
     * @param favorite the favorite
428
     *
429
     * @deprecated As of API 3.2.2. Please use the isFavorite method in FavoritesResources instead.
430
     */
431
    @Deprecated(since = "3.2.2", forRemoval = true)
432
    @SuppressWarnings("unchecked")
433
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setFavorite(Boolean favorite) {
434
        this.favorite = favorite;
×
435
        return (T) this;
×
436
    }
437

438
    /**
439
     * Get the list of sheet filters for this sheet.
440
     *
441
     * @return the list of SheetFilters
442
     */
443
    public List<SheetFilter> getFilters() {
444
        return filters;
1✔
445
    }
446

447
    /**
448
     * Sets the list of sheet filters for this sheet.
449
     *
450
     * @param filters the list of SheetFilters
451
     */
452
    @SuppressWarnings("unchecked")
453
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setFilters(List<SheetFilter> filters) {
454
        this.filters = filters;
×
455
        return (T) this;
×
456
    }
457

458
    /**
459
     * Gets the gantt enabled flag.
460
     *
461
     * @return the gantt enabled flag
462
     */
463
    public Boolean getGanttEnabled() {
464
        return ganttEnabled;
1✔
465
    }
466

467
    /**
468
     * Sets the gantt enabled flag.
469
     *
470
     * @param ganttEnabled the new gantt enabled flag
471
     */
472
    @SuppressWarnings("unchecked")
473
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setGanttEnabled(Boolean ganttEnabled) {
474
        this.ganttEnabled = ganttEnabled;
1✔
475
        return (T) this;
1✔
476
    }
477

478
    /**
479
     * Gets flag indicating whether a sheet summary is present
480
     *
481
     * @return hasSheetSummary
482
     */
483
    public Boolean getHasSummaryFields() {
484
        return hasSummaryFields;
1✔
485
    }
486

487
    /**
488
     * Sets flag indicating whether a sheet summary is present
489
     */
490
    @SuppressWarnings("unchecked")
491
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setHasSummaryFields(Boolean hasSummaryFields) {
492
        this.hasSummaryFields = hasSummaryFields;
×
493
        return (T) this;
×
494
    }
495

496
    /**
497
     * Gets the date and time the sheet was last modified.
498
     *
499
     * @return the modified at
500
     */
501
    public Date getModifiedAt() {
502
        return modifiedAt;
1✔
503
    }
504

505
    /**
506
     * Sets the date and time the sheet was last modified.
507
     *
508
     * @param modifiedAt the new modified at
509
     */
510
    @SuppressWarnings("unchecked")
511
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setModifiedAt(Date modifiedAt) {
512
        this.modifiedAt = modifiedAt;
1✔
513
        return (T) this;
1✔
514
    }
515

516
    /**
517
     * Provide an 'override' of setName (returns AbstractSheet not NamedModel)
518
     *
519
     * @param name the new name
520
     */
521
    public AbstractSheet<TRow, TColumn, TCell> setName(String name) {
522
        super.setName(name);
1✔
523
        return this;
1✔
524
    }
525

526
    /**
527
     * version of setName that returns this type
528
     *
529
     * @param name the new name
530
     * @return this
531
     */
532
    @SuppressWarnings("unchecked")
533
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setSheetName(String name) {
534
        super.setName(name);
1✔
535
        return (T) this;
1✔
536
    }
537

538
    /**
539
     * version of setId that returns this type
540
     *
541
     * @param id the new sheet ID
542
     * @return this
543
     */
544
    @JsonIgnore(false)
545
    @SuppressWarnings("unchecked")
546
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setSheetId(Long id) {
547
        super.setId(id);
1✔
548
        return (T) this;
1✔
549
    }
550

551
    /**
552
     * Gets the owner email.
553
     *
554
     * @return the owner email
555
     */
556
    public String getOwner() {
557
        return owner;
1✔
558
    }
559

560
    /**
561
     * Sets the owner
562
     *
563
     * @param owner the owner email
564
     */
565
    @SuppressWarnings("unchecked")
566
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setOwner(String owner) {
567
        this.owner = owner;
1✔
568
        return (T) this;
1✔
569
    }
570

571
    /**
572
     * Gets the permalink for the sheet.
573
     *
574
     * @return the permalink
575
     */
576
    public String getPermalink() {
577
        return permalink;
1✔
578
    }
579

580
    /**
581
     * Sets the permalink for the sheet.
582
     *
583
     * @param permalink the new permalink
584
     */
585
    @SuppressWarnings("unchecked")
586
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setPermalink(String permalink) {
587
        this.permalink = permalink;
1✔
588
        return (T) this;
1✔
589
    }
590

591
    /**
592
     * Gets the project settings.
593
     *
594
     * @return the project settings
595
     */
596
    public ProjectSettings getProjectSettings() {
597
        return projectSettings;
1✔
598
    }
599

600
    /**
601
     * Sets the project settings.
602
     *
603
     * @param projectSettings the project settings
604
     */
605
    @SuppressWarnings("unchecked")
606
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setProjectSettings(ProjectSettings projectSettings) {
607
        this.projectSettings = projectSettings;
1✔
608
        return (T) this;
1✔
609
    }
610

611
    /**
612
     * Gets the read only flag for the sheet.
613
     *
614
     * @return the read only
615
     */
616
    public Boolean getReadOnly() {
617
        return readOnly;
1✔
618
    }
619

620
    /**
621
     * Sets the read only flag for the sheet.
622
     *
623
     * @param readOnly the new read only
624
     */
625
    @SuppressWarnings("unchecked")
626
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setReadOnly(Boolean readOnly) {
627
        this.readOnly = readOnly;
1✔
628
        return (T) this;
1✔
629
    }
630

631
    /**
632
     * @return the flag indicating if resource management is enabled.
633
     */
634
    public Boolean getResourceManagementEnabled() {
635
        return resourceManagementEnabled;
1✔
636
    }
637

638
    /**
639
     * @param resourceManagementEnabled the resourceManagementEnabled to set
640
     */
641
    @SuppressWarnings("unchecked")
642
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setResourceManagementEnabled(Boolean resourceManagementEnabled) {
643
        this.resourceManagementEnabled = resourceManagementEnabled;
×
644
        return (T) this;
×
645
    }
646

647
    /**
648
     * Gets the resource management type for the sheet.
649
     *
650
     * @return the resource management type
651
     */
652
    public ResourceManagementType getResourceManagementType() {
653
        return resourceManagementType;
1✔
654
    }
655

656
    /**
657
     * Sets the access level for the sheet.
658
     */
659
    @SuppressWarnings("unchecked")
660
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setResourceManagementType(ResourceManagementType resourceManagementType) {
661
        this.resourceManagementType = resourceManagementType;
×
662
        return (T) this;
×
663
    }
664

665
    /**
666
     * Gets the rows for the sheet.
667
     *
668
     * @return the rows
669
     */
670
    public List<TRow> getRows() {
671
        return rows;
1✔
672
    }
673

674
    /**
675
     * Sets the rows for the sheet.
676
     *
677
     * @param rows the new rows
678
     */
679
    @SuppressWarnings("unchecked")
680
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setRows(List<TRow> rows) {
681
        this.rows = rows;
1✔
682
        return (T) this;
1✔
683
    }
684

685
    /**
686
     * True if show parent rows for filters.
687
     *
688
     * @return the show parent row for filters
689
     */
690
    public Boolean getShowParentRowsForFilters() {
691
        return showParentRowsForFilters;
1✔
692
    }
693

694
    /**
695
     * Sets the show parent rows for filters.
696
     *
697
     * @param showParentRowsForFilters the show parent rows for filters
698
     */
699
    @SuppressWarnings("unchecked")
700
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setShowParentRowsForFilters(Boolean showParentRowsForFilters) {
701
        this.showParentRowsForFilters = showParentRowsForFilters;
×
702
        return (T) this;
×
703
    }
704

705
    /**
706
     * Gets the source.
707
     *
708
     * @return the source
709
     */
710
    public Source getSource() {
711
        return source;
1✔
712
    }
713

714
    /**
715
     * Sets the source.
716
     *
717
     * @param source the source
718
     */
719
    @SuppressWarnings("unchecked")
720
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setSource(Source source) {
721
        this.source = source;
1✔
722
        return (T) this;
1✔
723
    }
724

725
    /**
726
     * Gets the sheet summary if one exists for this sheet
727
     *
728
     * @return sheetSummary
729
     */
730
    public SheetSummary getSummary() {
731
        return summary;
1✔
732
    }
733

734
    /**
735
     * Sets the sheet summary if one exists for this sheet
736
     */
737
    @SuppressWarnings("unchecked")
738
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setSummary(SheetSummary summary) {
739
        this.summary = summary;
×
740
        return (T) this;
×
741
    }
742

743
    /**
744
     * Gets the total row count for the sheet.
745
     *
746
     * @return the total row count
747
     */
748
    public Integer getTotalRowCount() {
749
        return totalRowCount;
1✔
750
    }
751

752
    /**
753
     * Sets the total row count.
754
     *
755
     * @param totalRowCount the total row count
756
     */
757
    @SuppressWarnings("unchecked")
758
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setTotalRowCount(Integer totalRowCount) {
759
        this.totalRowCount = totalRowCount;
1✔
760
        return (T) this;
1✔
761
    }
762

763
    /**
764
     * Gets the sheet user permissions
765
     *
766
     * @return userPermissions
767
     */
768
    public SheetUserPermissions getUserPermissions() {
769
        return userPermissions;
1✔
770
    }
771

772
    /**
773
     * Sets the sheet user permissions
774
     */
775
    @SuppressWarnings("unchecked")
776
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setUserPermissions(SheetUserPermissions userPermissions) {
777
        this.userPermissions = userPermissions;
×
778
        return (T) this;
×
779
    }
780

781
    /**
782
     * Gets the sheet user settings.
783
     *
784
     * @return the user settings
785
     */
786
    public SheetUserSettings getUserSettings() {
787
        return userSettings;
1✔
788
    }
789

790
    /**
791
     * Sets the user settings.
792
     *
793
     * @param userSettings the user settings
794
     */
795
    @SuppressWarnings("unchecked")
796
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setUserSettings(SheetUserSettings userSettings) {
797
        this.userSettings = userSettings;
1✔
798
        return (T) this;
1✔
799
    }
800

801
    /**
802
     * Gets the version for the sheet.
803
     *
804
     * @return the version
805
     */
806
    public Integer getVersion() {
807
        return version;
1✔
808
    }
809

810
    /**
811
     * Sets the version for the sheet.
812
     *
813
     * @param version the new version
814
     */
815
    @SuppressWarnings("unchecked")
816
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setVersion(Integer version) {
817
        this.version = version;
1✔
818
        return (T) this;
1✔
819
    }
820

821
    /**
822
     * Gets a workspace object containing the name and id of the workspace containing this sheet
823
     *
824
     * @return workspace
825
     */
826
    public Workspace getWorkspace() {
827
        return workspace;
1✔
828
    }
829

830
    /**
831
     * Sets a workspace object containing the name and id of the workspace containing this sheet
832
     */
833
    @SuppressWarnings("unchecked")
834
    public <T extends AbstractSheet<TRow, TColumn, TCell>> T setWorkspace(Workspace workspace) {
835
        this.workspace = workspace;
×
836
        return (T) this;
×
837
    }
838

839
    /**
840
     * Get a column by index.
841
     *
842
     * @param index the column index
843
     * @return the column by index
844
     */
845
    public TColumn getColumnByIndex(int index) {
846
        if (columns == null) {
1✔
847
            return null;
1✔
848
        }
849

850
        TColumn result = null;
1✔
851
        for (TColumn column : columns) {
1✔
852
            if (column.getIndex() == index) {
1✔
853
                result = column;
1✔
854
                break;
1✔
855
            }
856
        }
1✔
857
        return result;
1✔
858
    }
859

860
    /**
861
     * Get a {@link Column} by ID.
862
     *
863
     * @param columnId the column id
864
     * @return the column by id
865
     */
866
    public TColumn getColumnById(long columnId) {
867
        if (columns == null) {
1✔
868
            return null;
1✔
869
        }
870

871
        TColumn result = null;
1✔
872
        for (TColumn column : columns) {
1✔
873
            if (column.getId() == columnId) {
1✔
874
                result = column;
1✔
875
                break;
1✔
876
            }
877
        }
1✔
878
        return result;
1✔
879
    }
880

881
    /**
882
     * Get a {@link Row} by row number.
883
     *
884
     * @param rowNumber the row number
885
     * @return the row by row number
886
     */
887
    public TRow getRowByRowNumber(int rowNumber) {
888
        if (rows == null) {
1✔
889
            return null;
1✔
890
        }
891

892
        TRow result = null;
1✔
893
        for (TRow row : rows) {
1✔
894
            if (row.getRowNumber() == rowNumber) {
1✔
895
                result = row;
1✔
896
                break;
1✔
897
            }
898
        }
1✔
899
        return result;
1✔
900
    }
901
}
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