• 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

84.95
/src/main/java/com/smartsheet/api/models/AbstractRow.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 com.fasterxml.jackson.annotation.JsonIgnore;
20
import com.smartsheet.api.models.enums.AccessLevel;
21
import com.smartsheet.api.models.format.Format;
22

23
import java.util.Date;
24
import java.util.List;
25

26
public abstract class AbstractRow<TColumn extends Column, TCell extends Cell> extends IdentifiableModel<Long> {
1✔
27
    @Override
28
    @JsonIgnore(false)
29
    public Long getId() {
30
        return super.getId();
1✔
31
    }
32

33
    @Override
34
    @JsonIgnore(false)
35
    public IdentifiableModel<Long> setId(Long id) {
36
        super.setId(id);
1✔
37
        return this;
1✔
38
    }
39

40
    @JsonIgnore
41
    public Long getRowId() {
42
        return super.getId();
1✔
43
    }
44

45
    /**
46
     * Set the Row ID
47
     */
48
    @JsonIgnore
49
    @SuppressWarnings("unchecked")
50
    public <T extends AbstractRow<TColumn, TCell>> T setRowId(Long id) {
51
        super.setId(id);
1✔
52
        return (T) this;
1✔
53
    }
54

55
    /**
56
     * Represents the Sheet ID.
57
     */
58
    private Long sheetId;
59

60
    /**
61
     * Represents the row number.
62
     */
63
    private Integer rowNumber;
64

65
    /**
66
     * Represents the parent row number.
67
     */
68
    private Integer parentRowNumber;
69

70
    /**
71
     * Represents the cells for this row.
72
     */
73
    private List<TCell> cells;
74

75
    /**
76
     * Represents the discussions for this row.
77
     */
78
    private List<Discussion> discussions;
79

80
    /**
81
     * Represents the attachments for this row.
82
     */
83
    private List<Attachment> attachments;
84

85
    /**
86
     * Represents the columns for this row.
87
     */
88
    private List<TColumn> columns;
89

90
    /**
91
     * Represents the date and time the row was created.
92
     */
93
    private Date createdAt;
94

95
    /**
96
     * Represents the date and time the row was modified.
97
     */
98
    private Date modifiedAt;
99

100
    /**
101
     * A read-only flag to indicate if the row is expanded or collapsed.
102
     */
103
    private Boolean expanded;
104

105
    /**
106
     * The version number that is incremented every time a sheet is modified.
107
     */
108
    private Integer version;
109

110
    /**
111
     * The user's permissions on the sheet.
112
     */
113
    private AccessLevel accessLevel;
114

115
    /**
116
     * Indicates if the row is locked. Defaults to false
117
     **/
118
    private Boolean locked;
119

120
    /**
121
     * Indicates if the row is locked for the current user. Defaults to false.
122
     **/
123
    private Boolean lockedForUser;
124

125
    /**
126
     * Represents the {@link Format} for this cell.
127
     */
128
    private Format format;
129

130
    /**
131
     * Represents the parent row ID.
132
     */
133
    private Long parentId;
134

135
    /**
136
     * Represents the sibling row ID
137
     */
138
    private Long siblingId;
139

140
    /**
141
     * Represents the URL to the row of the sheet
142
     */
143
    private String permalink;
144

145
    /**
146
     * Indicates if the row is filtered out by a column filter
147
     */
148
    private Boolean filteredOut;
149

150
    /**
151
     * Indicates if the sheet is a project sheet with dependencies enabled and this row is in the critical path
152
     */
153
    private Boolean inCriticalPath;
154

155
    /**
156
     * Represents the conditional {@link Format} for this row.
157
     */
158
    private Format conditionalFormat;
159

160
    /**
161
     * Indicates if the row should be put at the top of the sheet
162
     */
163
    private Boolean toTop;
164

165
    /**
166
     * Indicates if the row should be put at the bottom of the sheet
167
     */
168
    private Boolean toBottom;
169

170
    /**
171
     * Indicates if the row should be put above the specified sibling row
172
     */
173
    private Boolean above;
174

175
    /**
176
     * Indent a row (applicable for update only)
177
     */
178
    private Integer indent;
179

180
    /**
181
     * Outdent a row (applicable for update only)
182
     */
183
    private Integer outdent;
184

185
    /**
186
     * User object containing name and email of the creator of this row
187
     */
188
    private User createdBy;
189

190
    /**
191
     * User object containing name and email of the last person to modify this row
192
     */
193
    private User modifiedBy;
194

195
    /**
196
     * Gets the user's permissions on the sheet.
197
     *
198
     * @return the access level
199
     */
200
    public AccessLevel getAccessLevel() {
201
        return accessLevel;
1✔
202
    }
203

204
    /**
205
     * Sets the user's permissions on the sheet.
206
     *
207
     * @param accessLevel the new access level
208
     */
209
    @SuppressWarnings("unchecked")
210
    public <T extends AbstractRow<TColumn, TCell>> T setAccessLevel(AccessLevel accessLevel) {
211
        this.accessLevel = accessLevel;
1✔
212
        return (T) this;
1✔
213
    }
214

215
    /**
216
     * Gets the version number that is incremented every time a sheet is modified.
217
     *
218
     * @return the version
219
     */
220
    public Integer getVersion() {
221
        return version;
1✔
222
    }
223

224
    /**
225
     * Sets the version number that is incremented every time a sheet is modified..
226
     *
227
     * @param version the new version
228
     */
229
    @SuppressWarnings("unchecked")
230
    public <T extends AbstractRow<TColumn, TCell>> T setVersion(Integer version) {
231
        this.version = version;
×
232
        return (T) this;
×
233
    }
234

235
    /**
236
     * Checks if the row is expanded.
237
     *
238
     * @return true, if is expanded
239
     */
240
    public Boolean isExpanded() {
241
        return expanded;
1✔
242
    }
243

244
    /**
245
     * Sets the row to be expanded.
246
     *
247
     * @param expanded the new expanded
248
     */
249
    @SuppressWarnings("unchecked")
250
    public <T extends AbstractRow<TColumn, TCell>> T setExpanded(Boolean expanded) {
251
        this.expanded = expanded;
1✔
252
        return (T) this;
1✔
253
    }
254

255
    /**
256
     * Get a column by it's index.
257
     *
258
     * @param index the column index
259
     * @return the column by index
260
     */
261
    public TColumn getColumnByIndex(int index) {
262
        if (columns == null) {
1✔
263
            return null;
1✔
264
        }
265
        return columns.stream().filter(column -> column.getIndex() == index).findFirst().orElse(null);
1✔
266
    }
267

268
    /**
269
     * Get a column by it's ID.
270
     *
271
     * @param columnId the column id
272
     * @return the column by id
273
     */
274
    public TColumn getColumnById(long columnId) {
275
        if (columns == null) {
1✔
276
            return null;
1✔
277
        }
278
        return columns.stream().filter(column -> column.getId() == columnId).findFirst().orElse(null);
1✔
279
    }
280

281
    /**
282
     * Gets the id of the sheet.
283
     *
284
     * @return the sheet id
285
     */
286
    public Long getSheetId() {
287
        return sheetId;
1✔
288
    }
289

290
    /**
291
     * Sets the sheet id.
292
     *
293
     * @param sheetId the new sheet id
294
     */
295
    @SuppressWarnings("unchecked")
296
    public <T extends AbstractRow<TColumn, TCell>> T setSheetId(Long sheetId) {
297
        this.sheetId = sheetId;
1✔
298
        return (T) this;
1✔
299
    }
300

301
    /**
302
     * Gets the row number.
303
     *
304
     * @return the row number
305
     */
306
    public Integer getRowNumber() {
307
        return rowNumber;
1✔
308
    }
309

310
    /**
311
     * Sets the row number.
312
     *
313
     * @param rowNumber the new row number
314
     */
315
    @SuppressWarnings("unchecked")
316
    public <T extends AbstractRow<TColumn, TCell>> T setRowNumber(Integer rowNumber) {
317
        this.rowNumber = rowNumber;
1✔
318
        return (T) this;
1✔
319
    }
320

321
    /**
322
     * Gets the parent row number.
323
     *
324
     * @return the parent row number
325
     */
326
    public Integer getParentRowNumber() {
327
        return parentRowNumber;
1✔
328
    }
329

330
    /**
331
     * Sets the parent row number.
332
     *
333
     * @param parentRowNumber the new parent row number
334
     */
335
    @SuppressWarnings("unchecked")
336
    public <T extends AbstractRow<TColumn, TCell>> T setParentRowNumber(Integer parentRowNumber) {
337
        this.parentRowNumber = parentRowNumber;
×
338
        return (T) this;
×
339
    }
340

341
    /**
342
     * Gets the cells.
343
     *
344
     * @return the cells
345
     */
346
    public List<TCell> getCells() {
347
        return cells;
1✔
348
    }
349

350
    /**
351
     * Sets the cells.
352
     *
353
     * @param cells the new cells
354
     */
355
    @SuppressWarnings("unchecked")
356
    public <T extends AbstractRow<TColumn, TCell>> T setCells(List<TCell> cells) {
357
        this.cells = cells;
1✔
358
        return (T) this;
1✔
359
    }
360

361
    /**
362
     * Gets the discussions.
363
     *
364
     * @return the discussions
365
     */
366
    public List<Discussion> getDiscussions() {
367
        return discussions;
1✔
368
    }
369

370
    /**
371
     * Sets the discussions.
372
     *
373
     * @param discussions the new discussions
374
     */
375
    @SuppressWarnings("unchecked")
376
    public <T extends AbstractRow<TColumn, TCell>> T setDiscussions(List<Discussion> discussions) {
377
        this.discussions = discussions;
1✔
378
        return (T) this;
1✔
379
    }
380

381
    /**
382
     * Gets the attachments.
383
     *
384
     * @return the attachments
385
     */
386
    public List<Attachment> getAttachments() {
387
        return attachments;
1✔
388
    }
389

390
    /**
391
     * Sets the attachments.
392
     *
393
     * @param attachments the new attachments
394
     */
395
    @SuppressWarnings("unchecked")
396
    public <T extends AbstractRow<TColumn, TCell>> T setAttachments(List<Attachment> attachments) {
397
        this.attachments = attachments;
1✔
398
        return (T) this;
1✔
399
    }
400

401
    /**
402
     * Gets the columns.
403
     *
404
     * @return the columns
405
     */
406
    public List<TColumn> getColumns() {
407
        return columns;
1✔
408
    }
409

410
    /**
411
     * Sets the columns.
412
     *
413
     * @param columns the new columns
414
     */
415
    @SuppressWarnings("unchecked")
416
    public <T extends AbstractRow<TColumn, TCell>> T setColumns(List<TColumn> columns) {
417
        this.columns = columns;
1✔
418
        return (T) this;
1✔
419
    }
420

421
    /**
422
     * Gets the date and time a row was created.
423
     *
424
     * @return the created at
425
     */
426
    public Date getCreatedAt() {
427
        return createdAt;
1✔
428
    }
429

430
    /**
431
     * Sets the date and time a row was created.
432
     *
433
     * @param createdAt the new created at
434
     */
435
    @SuppressWarnings("unchecked")
436
    public <T extends AbstractRow<TColumn, TCell>> T setCreatedAt(Date createdAt) {
437
        this.createdAt = createdAt;
1✔
438
        return (T) this;
1✔
439
    }
440

441
    /**
442
     * Gets the date and time a row was modified.
443
     *
444
     * @return the modified at
445
     */
446
    public Date getModifiedAt() {
447
        return modifiedAt;
1✔
448
    }
449

450
    /**
451
     * Sets the date and time a row was modified.
452
     *
453
     * @param modifiedAt the new modified at
454
     */
455
    @SuppressWarnings("unchecked")
456
    public <T extends AbstractRow<TColumn, TCell>> T setModifiedAt(Date modifiedAt) {
457
        this.modifiedAt = modifiedAt;
1✔
458
        return (T) this;
1✔
459
    }
460

461
    /**
462
     * Indicates whether a row is locked or not.
463
     *
464
     * @return the locked status
465
     */
466
    public Boolean isLocked() {
467
        return locked;
1✔
468
    }
469

470
    /**
471
     * @param locked the locked status
472
     */
473
    @SuppressWarnings("unchecked")
474
    public <T extends AbstractRow<TColumn, TCell>> T setLocked(Boolean locked) {
475
        this.locked = locked;
1✔
476
        return (T) this;
1✔
477
    }
478

479
    /**
480
     * Indicates whether a row is locked for the user. Users cannot modify rows that are locked for them.
481
     *
482
     * @return the lock status for the user
483
     */
484
    public Boolean isLockedForUser() {
485
        return lockedForUser;
1✔
486
    }
487

488
    /**
489
     * Set locked For User
490
     */
491
    @SuppressWarnings("unchecked")
492
    public <T extends AbstractRow<TColumn, TCell>> T setLockedForUser(Boolean lockedForUser) {
493
        this.lockedForUser = lockedForUser;
×
494
        return (T) this;
×
495
    }
496

497
    /**
498
     * @return the {@link Format}
499
     */
500
    public Format getFormat() {
501
        return format;
1✔
502
    }
503

504
    /**
505
     * @param format the {@link Format} to set
506
     */
507
    @SuppressWarnings("unchecked")
508
    public <T extends AbstractRow<TColumn, TCell>> T setFormat(Format format) {
509
        this.format = format;
1✔
510
        return (T) this;
1✔
511
    }
512

513
    /**
514
     * Gets the row's parent ID.
515
     *
516
     * @return the ID of the parent
517
     */
518
    public Long getParentId() {
519
        return parentId;
1✔
520
    }
521

522
    /**
523
     * Sets the parent row id.
524
     *
525
     * @param parentId the parent row id
526
     */
527
    @SuppressWarnings("unchecked")
528
    public <T extends AbstractRow<TColumn, TCell>> T setParentId(Long parentId) {
529
        this.parentId = parentId;
1✔
530
        return (T) this;
1✔
531
    }
532

533
    /**
534
     * Gets the row's sibling ID.
535
     *
536
     * @return the ID of the sibling
537
     */
538
    public Long getSiblingId() {
539
        return siblingId;
1✔
540
    }
541

542
    /**
543
     * Sets the sibling row id.
544
     *
545
     * @param siblingId the sibling row id
546
     */
547
    @SuppressWarnings("unchecked")
548
    public <T extends AbstractRow<TColumn, TCell>> T setSiblingId(Long siblingId) {
549
        this.siblingId = siblingId;
1✔
550
        return (T) this;
1✔
551
    }
552

553
    /**
554
     * Gets the row's permalink URL.
555
     *
556
     * @return the permalink URL of the row
557
     */
558
    public String getPermalink() {
559
        return permalink;
1✔
560
    }
561

562
    /**
563
     * Sets the parmalink URL.
564
     *
565
     * @param permalink the URL to the row
566
     */
567
    @SuppressWarnings("unchecked")
568
    public <T extends AbstractRow<TColumn, TCell>> T setPermalink(String permalink) {
569
        this.permalink = permalink;
×
570
        return (T) this;
×
571
    }
572

573
    /**
574
     * Check if the row is filtered out
575
     *
576
     * @return true, if it is filtered out
577
     */
578
    public Boolean isFilteredOut() {
579
        return filteredOut;
1✔
580
    }
581

582
    /**
583
     * Sets the row to be filtered out.
584
     *
585
     * @param filteredOut if the row is filtered out
586
     */
587
    @SuppressWarnings("unchecked")
588
    public <T extends AbstractRow<TColumn, TCell>> T setFilteredOut(Boolean filteredOut) {
589
        this.filteredOut = filteredOut;
×
590
        return (T) this;
×
591
    }
592

593
    /**
594
     * Check if the row is in critical path
595
     *
596
     * @return true, if it is in critical path
597
     */
598
    public Boolean isInCriticalPath() {
599
        return inCriticalPath;
1✔
600
    }
601

602
    /**
603
     * Sets the row to be in critical path.
604
     *
605
     * @param inCriticalPath if the row is in critical path
606
     */
607
    @SuppressWarnings("unchecked")
608
    public <T extends AbstractRow<TColumn, TCell>> T setInCriticalPath(Boolean inCriticalPath) {
609
        this.inCriticalPath = inCriticalPath;
×
610
        return (T) this;
×
611
    }
612

613
    /**
614
     * @return the conditional {@link Format}
615
     */
616
    public Format getConditionalFormat() {
617
        return conditionalFormat;
1✔
618
    }
619

620
    /**
621
     * Sets the conditional format of the row.
622
     *
623
     * @param conditionalFormat the conditional format
624
     */
625
    @SuppressWarnings("unchecked")
626
    public <T extends AbstractRow<TColumn, TCell>> T setConditionalFormat(Format conditionalFormat) {
627
        this.conditionalFormat = conditionalFormat;
×
628
        return (T) this;
×
629
    }
630

631
    /**
632
     * Gets the to top.
633
     *
634
     * @return true, if row should be at the top
635
     */
636
    public Boolean getToTop() {
637
        return toTop;
1✔
638
    }
639

640
    /**
641
     * Sets the to top
642
     *
643
     * @param toTop if the row is to the top
644
     */
645
    @SuppressWarnings("unchecked")
646
    public <T extends AbstractRow<TColumn, TCell>> T setToTop(Boolean toTop) {
647
        this.toTop = toTop;
1✔
648
        return (T) this;
1✔
649
    }
650

651
    /**
652
     * Gets the to bottom.
653
     *
654
     * @return true, if row should be at the bottom
655
     */
656
    public Boolean getToBottom() {
657
        return toBottom;
1✔
658
    }
659

660
    /**
661
     * Sets the to bottom
662
     *
663
     * @param toBottom if the row is to the bottom
664
     */
665
    @SuppressWarnings("unchecked")
666
    public <T extends AbstractRow<TColumn, TCell>> T setToBottom(Boolean toBottom) {
667
        this.toBottom = toBottom;
1✔
668
        return (T) this;
1✔
669
    }
670

671
    /**
672
     * Gets the above.
673
     *
674
     * @return true, if row should be above the specified sibling ID
675
     */
676
    public Boolean getAbove() {
677
        return above;
1✔
678
    }
679

680
    /**
681
     * Sets the above
682
     *
683
     * @param above if the row is above a specified row
684
     */
685
    @SuppressWarnings("unchecked")
686
    public <T extends AbstractRow<TColumn, TCell>> T setAbove(Boolean above) {
687
        this.above = above;
1✔
688
        return (T) this;
1✔
689
    }
690

691
    /**
692
     * Get integer value specifying the number of levels to indent this row (update only).
693
     *
694
     * @return value specifying the number of levels to indent this row
695
     */
696
    public Integer getIndent() {
697
        return indent;
1✔
698
    }
699

700
    /**
701
     * Sets integer value specifying the number of levels to indent this row (update only).
702
     *
703
     * @param indent integer value specifying the number of levels to indent
704
     */
705
    @SuppressWarnings("unchecked")
706
    public <T extends AbstractRow<TColumn, TCell>> T setIndent(Integer indent) {
707
        this.indent = indent;
1✔
708
        return (T) this;
1✔
709
    }
710

711
    /**
712
     * Get integer value specifying the number of levels to outdent this row (update only).
713
     *
714
     * @return value specifying the number of levels to outdent this row
715
     */
716
    public Integer getOutdent() {
717
        return outdent;
1✔
718
    }
719

720
    /**
721
     * Sets integer value specifying the number of levels to outdent this row (update only).
722
     *
723
     * @param outdent integer value specifying number of levels to outdent
724
     */
725
    @SuppressWarnings("unchecked")
726
    public <T extends AbstractRow<TColumn, TCell>> T setOutdent(Integer outdent) {
727
        this.outdent = outdent;
1✔
728
        return (T) this;
1✔
729
    }
730

731
    /**
732
     * Gets the User object containing name and email of the creator of this row.
733
     *
734
     * @return User object
735
     */
736
    public User getCreatedBy() {
737
        return createdBy;
1✔
738
    }
739

740
    /**
741
     * Gets the User object containing name and email of the last person to modify this row.
742
     *
743
     * @return User object
744
     */
745
    public User getModifiedBy() {
746
        return modifiedBy;
1✔
747
    }
748
}
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