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

box / box-java-sdk / #6714

22 Apr 2026 11:25AM UTC coverage: 12.66%. Remained the same
#6714

push

github

web-flow
feat(boxsdkgen): Add `max_extension_length` field to Retention Policies (box/box-openapi#593) (#1798)

0 of 127 new or added lines in 9 files covered. (0.0%)

199 existing lines in 6 files now uncovered.

8374 of 66147 relevant lines covered (12.66%)

0.13 hits per line

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

0.0
/src/main/java/com/box/sdkgen/schemas/retentionpolicy/RetentionPolicy.java
1
package com.box.sdkgen.schemas.retentionpolicy;
2

3
import com.box.sdkgen.internal.utils.DateTimeUtils;
4
import com.box.sdkgen.schemas.retentionpolicybase.RetentionPolicyBaseTypeField;
5
import com.box.sdkgen.schemas.retentionpolicymaxextensionlengthresponse.RetentionPolicyMaxExtensionLengthResponse;
6
import com.box.sdkgen.schemas.retentionpolicymaxextensionlengthresponse.RetentionPolicyMaxExtensionLengthResponseEnum;
7
import com.box.sdkgen.schemas.retentionpolicymini.RetentionPolicyMini;
8
import com.box.sdkgen.schemas.retentionpolicymini.RetentionPolicyMiniDispositionActionField;
9
import com.box.sdkgen.schemas.usermini.UserMini;
10
import com.box.sdkgen.serialization.json.EnumWrapper;
11
import com.fasterxml.jackson.annotation.JsonFilter;
12
import com.fasterxml.jackson.annotation.JsonProperty;
13
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
14
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
15
import java.time.OffsetDateTime;
16
import java.util.List;
17
import java.util.Objects;
18

19
/**
20
 * A retention policy blocks permanent deletion of content for a specified amount of time. Admins
21
 * can create retention policies and then later assign them to specific folders, metadata templates,
22
 * or their entire enterprise. To use this feature, you must have the manage retention policies
23
 * scope enabled for your API key via your application management console.
24
 */
25
@JsonFilter("nullablePropertyFilter")
26
public class RetentionPolicy extends RetentionPolicyMini {
27

28
  /** The additional text description of the retention policy. */
29
  protected String description;
30

31
  /**
32
   * The type of the retention policy. A retention policy type can either be `finite`, where a
33
   * specific amount of time to retain the content is known upfront, or `indefinite`, where the
34
   * amount of time to retain the content is still unknown.
35
   */
36
  @JsonDeserialize(
37
      using = RetentionPolicyPolicyTypeField.RetentionPolicyPolicyTypeFieldDeserializer.class)
38
  @JsonSerialize(
39
      using = RetentionPolicyPolicyTypeField.RetentionPolicyPolicyTypeFieldSerializer.class)
40
  @JsonProperty("policy_type")
41
  protected EnumWrapper<RetentionPolicyPolicyTypeField> policyType;
42

43
  /**
44
   * Specifies the retention type:
45
   *
46
   * <p>* `modifiable`: You can modify the retention policy. For example, you can add or remove
47
   * folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if
48
   * your retention policy is not related to any regulatory purposes.
49
   *
50
   * <p>* `non-modifiable`: You can modify the retention policy only in a limited way: add a folder,
51
   * lengthen the duration, retire the policy, change the disposition action or notification
52
   * settings. You cannot perform other actions, such as deleting the assignment or shortening the
53
   * policy duration. Use this type to ensure compliance with regulatory retention policies.
54
   */
55
  @JsonDeserialize(
56
      using = RetentionPolicyRetentionTypeField.RetentionPolicyRetentionTypeFieldDeserializer.class)
57
  @JsonSerialize(
58
      using = RetentionPolicyRetentionTypeField.RetentionPolicyRetentionTypeFieldSerializer.class)
59
  @JsonProperty("retention_type")
60
  protected EnumWrapper<RetentionPolicyRetentionTypeField> retentionType;
61

62
  /**
63
   * The status of the retention policy. The status of a policy will be `active`, unless explicitly
64
   * retired by an administrator, in which case the status will be `retired`. Once a policy has been
65
   * retired, it cannot become active again.
66
   */
67
  @JsonDeserialize(using = RetentionPolicyStatusField.RetentionPolicyStatusFieldDeserializer.class)
68
  @JsonSerialize(using = RetentionPolicyStatusField.RetentionPolicyStatusFieldSerializer.class)
69
  protected EnumWrapper<RetentionPolicyStatusField> status;
70

71
  @JsonProperty("created_by")
72
  protected UserMini createdBy;
73

74
  /** When the retention policy object was created. */
75
  @JsonProperty("created_at")
76
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
77
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
78
  protected OffsetDateTime createdAt;
79

80
  /** When the retention policy object was last modified. */
81
  @JsonProperty("modified_at")
82
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
83
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
84
  protected OffsetDateTime modifiedAt;
85

86
  /**
87
   * Determines if the owner of items under the policy can extend the retention when the original
88
   * retention duration is about to end.
89
   */
90
  @JsonProperty("can_owner_extend_retention")
91
  protected Boolean canOwnerExtendRetention;
92

93
  /**
94
   * Determines if owners and co-owners of items under the policy are notified when the retention
95
   * duration is about to end.
96
   */
97
  @JsonProperty("are_owners_notified")
98
  protected Boolean areOwnersNotified;
99

100
  /** A list of users notified when the retention policy duration is about to end. */
101
  @JsonProperty("custom_notification_recipients")
102
  protected List<UserMini> customNotificationRecipients;
103

104
  /** Counts the retention policy assignments for each item type. */
105
  @JsonProperty("assignment_counts")
106
  protected RetentionPolicyAssignmentCountsField assignmentCounts;
107

108
  public RetentionPolicy(@JsonProperty("id") String id) {
UNCOV
109
    super(id);
×
UNCOV
110
  }
×
111

112
  protected RetentionPolicy(Builder builder) {
UNCOV
113
    super(builder);
×
UNCOV
114
    this.description = builder.description;
×
115
    this.policyType = builder.policyType;
×
116
    this.retentionType = builder.retentionType;
×
117
    this.status = builder.status;
×
118
    this.createdBy = builder.createdBy;
×
119
    this.createdAt = builder.createdAt;
×
120
    this.modifiedAt = builder.modifiedAt;
×
121
    this.canOwnerExtendRetention = builder.canOwnerExtendRetention;
×
122
    this.areOwnersNotified = builder.areOwnersNotified;
×
123
    this.customNotificationRecipients = builder.customNotificationRecipients;
×
124
    this.assignmentCounts = builder.assignmentCounts;
×
125
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
×
126
  }
×
127

128
  public String getDescription() {
UNCOV
129
    return description;
×
130
  }
131

132
  public EnumWrapper<RetentionPolicyPolicyTypeField> getPolicyType() {
UNCOV
133
    return policyType;
×
134
  }
135

136
  public EnumWrapper<RetentionPolicyRetentionTypeField> getRetentionType() {
UNCOV
137
    return retentionType;
×
138
  }
139

140
  public EnumWrapper<RetentionPolicyStatusField> getStatus() {
UNCOV
141
    return status;
×
142
  }
143

144
  public UserMini getCreatedBy() {
UNCOV
145
    return createdBy;
×
146
  }
147

148
  public OffsetDateTime getCreatedAt() {
UNCOV
149
    return createdAt;
×
150
  }
151

152
  public OffsetDateTime getModifiedAt() {
UNCOV
153
    return modifiedAt;
×
154
  }
155

156
  public Boolean getCanOwnerExtendRetention() {
UNCOV
157
    return canOwnerExtendRetention;
×
158
  }
159

160
  public Boolean getAreOwnersNotified() {
UNCOV
161
    return areOwnersNotified;
×
162
  }
163

164
  public List<UserMini> getCustomNotificationRecipients() {
UNCOV
165
    return customNotificationRecipients;
×
166
  }
167

168
  public RetentionPolicyAssignmentCountsField getAssignmentCounts() {
UNCOV
169
    return assignmentCounts;
×
170
  }
171

172
  @Override
173
  public boolean equals(Object o) {
UNCOV
174
    if (this == o) {
×
UNCOV
175
      return true;
×
176
    }
177
    if (o == null || getClass() != o.getClass()) {
×
UNCOV
178
      return false;
×
179
    }
180
    RetentionPolicy casted = (RetentionPolicy) o;
×
UNCOV
181
    return Objects.equals(id, casted.id)
×
182
        && Objects.equals(type, casted.type)
×
183
        && Objects.equals(policyName, casted.policyName)
×
184
        && Objects.equals(retentionLength, casted.retentionLength)
×
185
        && Objects.equals(dispositionAction, casted.dispositionAction)
×
NEW
186
        && Objects.equals(maxExtensionLength, casted.maxExtensionLength)
×
187
        && Objects.equals(description, casted.description)
×
188
        && Objects.equals(policyType, casted.policyType)
×
189
        && Objects.equals(retentionType, casted.retentionType)
×
190
        && Objects.equals(status, casted.status)
×
191
        && Objects.equals(createdBy, casted.createdBy)
×
192
        && Objects.equals(createdAt, casted.createdAt)
×
193
        && Objects.equals(modifiedAt, casted.modifiedAt)
×
194
        && Objects.equals(canOwnerExtendRetention, casted.canOwnerExtendRetention)
×
195
        && Objects.equals(areOwnersNotified, casted.areOwnersNotified)
×
196
        && Objects.equals(customNotificationRecipients, casted.customNotificationRecipients)
×
197
        && Objects.equals(assignmentCounts, casted.assignmentCounts);
×
198
  }
199

200
  @Override
201
  public int hashCode() {
UNCOV
202
    return Objects.hash(
×
203
        id,
204
        type,
205
        policyName,
206
        retentionLength,
207
        dispositionAction,
208
        maxExtensionLength,
209
        description,
210
        policyType,
211
        retentionType,
212
        status,
213
        createdBy,
214
        createdAt,
215
        modifiedAt,
216
        canOwnerExtendRetention,
217
        areOwnersNotified,
218
        customNotificationRecipients,
219
        assignmentCounts);
220
  }
221

222
  @Override
223
  public String toString() {
UNCOV
224
    return "RetentionPolicy{"
×
225
        + "id='"
226
        + id
227
        + '\''
228
        + ", "
229
        + "type='"
230
        + type
231
        + '\''
232
        + ", "
233
        + "policyName='"
234
        + policyName
235
        + '\''
236
        + ", "
237
        + "retentionLength='"
238
        + retentionLength
239
        + '\''
240
        + ", "
241
        + "dispositionAction='"
242
        + dispositionAction
243
        + '\''
244
        + ", "
245
        + "maxExtensionLength='"
246
        + maxExtensionLength
247
        + '\''
248
        + ", "
249
        + "description='"
250
        + description
251
        + '\''
252
        + ", "
253
        + "policyType='"
254
        + policyType
255
        + '\''
256
        + ", "
257
        + "retentionType='"
258
        + retentionType
259
        + '\''
260
        + ", "
261
        + "status='"
262
        + status
263
        + '\''
264
        + ", "
265
        + "createdBy='"
266
        + createdBy
267
        + '\''
268
        + ", "
269
        + "createdAt='"
270
        + createdAt
271
        + '\''
272
        + ", "
273
        + "modifiedAt='"
274
        + modifiedAt
275
        + '\''
276
        + ", "
277
        + "canOwnerExtendRetention='"
278
        + canOwnerExtendRetention
279
        + '\''
280
        + ", "
281
        + "areOwnersNotified='"
282
        + areOwnersNotified
283
        + '\''
284
        + ", "
285
        + "customNotificationRecipients='"
286
        + customNotificationRecipients
287
        + '\''
288
        + ", "
289
        + "assignmentCounts='"
290
        + assignmentCounts
291
        + '\''
292
        + "}";
293
  }
294

295
  public static class Builder extends RetentionPolicyMini.Builder {
296

297
    protected String description;
298

299
    protected EnumWrapper<RetentionPolicyPolicyTypeField> policyType;
300

301
    protected EnumWrapper<RetentionPolicyRetentionTypeField> retentionType;
302

303
    protected EnumWrapper<RetentionPolicyStatusField> status;
304

305
    protected UserMini createdBy;
306

307
    protected OffsetDateTime createdAt;
308

309
    protected OffsetDateTime modifiedAt;
310

311
    protected Boolean canOwnerExtendRetention;
312

313
    protected Boolean areOwnersNotified;
314

315
    protected List<UserMini> customNotificationRecipients;
316

317
    protected RetentionPolicyAssignmentCountsField assignmentCounts;
318

319
    public Builder(String id) {
UNCOV
320
      super(id);
×
UNCOV
321
    }
×
322

323
    public Builder description(String description) {
UNCOV
324
      this.description = description;
×
UNCOV
325
      return this;
×
326
    }
327

328
    public Builder policyType(RetentionPolicyPolicyTypeField policyType) {
329
      this.policyType = new EnumWrapper<RetentionPolicyPolicyTypeField>(policyType);
×
UNCOV
330
      return this;
×
331
    }
332

333
    public Builder policyType(EnumWrapper<RetentionPolicyPolicyTypeField> policyType) {
UNCOV
334
      this.policyType = policyType;
×
UNCOV
335
      return this;
×
336
    }
337

338
    public Builder retentionType(RetentionPolicyRetentionTypeField retentionType) {
UNCOV
339
      this.retentionType = new EnumWrapper<RetentionPolicyRetentionTypeField>(retentionType);
×
UNCOV
340
      return this;
×
341
    }
342

343
    public Builder retentionType(EnumWrapper<RetentionPolicyRetentionTypeField> retentionType) {
UNCOV
344
      this.retentionType = retentionType;
×
UNCOV
345
      return this;
×
346
    }
347

348
    public Builder status(RetentionPolicyStatusField status) {
UNCOV
349
      this.status = new EnumWrapper<RetentionPolicyStatusField>(status);
×
UNCOV
350
      return this;
×
351
    }
352

353
    public Builder status(EnumWrapper<RetentionPolicyStatusField> status) {
UNCOV
354
      this.status = status;
×
UNCOV
355
      return this;
×
356
    }
357

358
    public Builder createdBy(UserMini createdBy) {
UNCOV
359
      this.createdBy = createdBy;
×
UNCOV
360
      return this;
×
361
    }
362

363
    public Builder createdAt(OffsetDateTime createdAt) {
UNCOV
364
      this.createdAt = createdAt;
×
UNCOV
365
      return this;
×
366
    }
367

368
    public Builder modifiedAt(OffsetDateTime modifiedAt) {
UNCOV
369
      this.modifiedAt = modifiedAt;
×
UNCOV
370
      return this;
×
371
    }
372

373
    public Builder canOwnerExtendRetention(Boolean canOwnerExtendRetention) {
UNCOV
374
      this.canOwnerExtendRetention = canOwnerExtendRetention;
×
UNCOV
375
      return this;
×
376
    }
377

378
    public Builder areOwnersNotified(Boolean areOwnersNotified) {
UNCOV
379
      this.areOwnersNotified = areOwnersNotified;
×
UNCOV
380
      return this;
×
381
    }
382

383
    public Builder customNotificationRecipients(List<UserMini> customNotificationRecipients) {
UNCOV
384
      this.customNotificationRecipients = customNotificationRecipients;
×
UNCOV
385
      return this;
×
386
    }
387

388
    public Builder assignmentCounts(RetentionPolicyAssignmentCountsField assignmentCounts) {
UNCOV
389
      this.assignmentCounts = assignmentCounts;
×
UNCOV
390
      return this;
×
391
    }
392

393
    @Override
394
    public Builder type(RetentionPolicyBaseTypeField type) {
UNCOV
395
      this.type = new EnumWrapper<RetentionPolicyBaseTypeField>(type);
×
UNCOV
396
      return this;
×
397
    }
398

399
    @Override
400
    public Builder type(EnumWrapper<RetentionPolicyBaseTypeField> type) {
UNCOV
401
      this.type = type;
×
UNCOV
402
      return this;
×
403
    }
404

405
    @Override
406
    public Builder policyName(String policyName) {
UNCOV
407
      this.policyName = policyName;
×
UNCOV
408
      return this;
×
409
    }
410

411
    @Override
412
    public Builder retentionLength(String retentionLength) {
UNCOV
413
      this.retentionLength = retentionLength;
×
UNCOV
414
      return this;
×
415
    }
416

417
    @Override
418
    public Builder dispositionAction(RetentionPolicyMiniDispositionActionField dispositionAction) {
UNCOV
419
      this.dispositionAction =
×
420
          new EnumWrapper<RetentionPolicyMiniDispositionActionField>(dispositionAction);
421
      return this;
×
422
    }
423

424
    @Override
425
    public Builder dispositionAction(
426
        EnumWrapper<RetentionPolicyMiniDispositionActionField> dispositionAction) {
427
      this.dispositionAction = dispositionAction;
×
UNCOV
428
      return this;
×
429
    }
430

431
    @Override
432
    public Builder maxExtensionLength(
433
        RetentionPolicyMaxExtensionLengthResponseEnum maxExtensionLength) {
NEW
434
      this.maxExtensionLength = new RetentionPolicyMaxExtensionLengthResponse(maxExtensionLength);
×
NEW
435
      return this;
×
436
    }
437

438
    @Override
439
    public Builder maxExtensionLength(String maxExtensionLength) {
NEW
440
      this.maxExtensionLength = new RetentionPolicyMaxExtensionLengthResponse(maxExtensionLength);
×
NEW
441
      return this;
×
442
    }
443

444
    @Override
445
    public Builder maxExtensionLength(
446
        RetentionPolicyMaxExtensionLengthResponse maxExtensionLength) {
NEW
447
      this.maxExtensionLength = maxExtensionLength;
×
NEW
448
      return this;
×
449
    }
450

451
    public RetentionPolicy build() {
UNCOV
452
      if (this.type == null) {
×
UNCOV
453
        this.type =
×
454
            new EnumWrapper<RetentionPolicyBaseTypeField>(
455
                RetentionPolicyBaseTypeField.RETENTION_POLICY);
456
      }
UNCOV
457
      return new RetentionPolicy(this);
×
458
    }
459
  }
460
}
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