001package com.box.sdkgen.managers.retentionpolicies; 002 003import com.box.sdkgen.internal.Nullable; 004import com.box.sdkgen.internal.NullableFieldTracker; 005import com.box.sdkgen.internal.SerializableObject; 006import com.box.sdkgen.schemas.retentionpolicymaxextensionlengthrequest.RetentionPolicyMaxExtensionLengthRequest; 007import com.box.sdkgen.schemas.retentionpolicymaxextensionlengthrequest.RetentionPolicyMaxExtensionLengthRequestEnum; 008import com.box.sdkgen.schemas.userbase.UserBase; 009import com.fasterxml.jackson.annotation.JsonFilter; 010import com.fasterxml.jackson.annotation.JsonProperty; 011import java.util.List; 012import java.util.Objects; 013 014@JsonFilter("nullablePropertyFilter") 015public class UpdateRetentionPolicyByIdRequestBody extends SerializableObject { 016 017 /** The name for the retention policy. */ 018 @JsonProperty("policy_name") 019 @Nullable 020 protected String policyName; 021 022 /** The additional text description of the retention policy. */ 023 @Nullable protected String description; 024 025 /** 026 * The disposition action of the retention policy. This action can be `permanently_delete`, which 027 * will cause the content retained by the policy to be permanently deleted, or `remove_retention`, 028 * which will lift the retention policy from the content, allowing it to be deleted by users, once 029 * the retention policy has expired. You can use `null` if you don't want to change 030 * `disposition_action`. 031 */ 032 @JsonProperty("disposition_action") 033 protected String dispositionAction; 034 035 /** 036 * Specifies the retention type: 037 * 038 * <p>* `modifiable`: You can modify the retention policy. For example, you can add or remove 039 * folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if 040 * your retention policy is not related to any regulatory purposes. * `non-modifiable`: You can 041 * modify the retention policy only in a limited way: add a folder, lengthen the duration, retire 042 * the policy, change the disposition action or notification settings. You cannot perform other 043 * actions, such as deleting the assignment or shortening the policy duration. Use this type to 044 * ensure compliance with regulatory retention policies. 045 * 046 * <p>When updating a retention policy, you can use `non-modifiable` type only. You can convert a 047 * `modifiable` policy to `non-modifiable`, but not the other way around. 048 */ 049 @JsonProperty("retention_type") 050 @Nullable 051 protected String retentionType; 052 053 /** 054 * The length of the retention policy. This value specifies the duration in days that the 055 * retention policy will be active for after being assigned to content. If the policy has a 056 * `policy_type` of `indefinite`, the `retention_length` will also be `indefinite`. 057 */ 058 @JsonProperty("retention_length") 059 protected UpdateRetentionPolicyByIdRequestBodyRetentionLengthField retentionLength; 060 061 /** 062 * Used to retire a retention policy. 063 * 064 * <p>If not retiring a policy, do not include this parameter or set it to `null`. 065 */ 066 @Nullable protected String status; 067 068 /** 069 * Determines if the owner of items under the policy can extend the retention when the original 070 * retention duration is about to end. 071 */ 072 @JsonProperty("can_owner_extend_retention") 073 @Nullable 074 protected Boolean canOwnerExtendRetention; 075 076 @JsonProperty("max_extension_length") 077 protected RetentionPolicyMaxExtensionLengthRequest maxExtensionLength; 078 079 /** 080 * Determines if owners and co-owners of items under the policy are notified when the retention 081 * duration is about to end. 082 */ 083 @JsonProperty("are_owners_notified") 084 @Nullable 085 protected Boolean areOwnersNotified; 086 087 /** A list of users notified when the retention duration is about to end. */ 088 @JsonProperty("custom_notification_recipients") 089 @Nullable 090 protected List<UserBase> customNotificationRecipients; 091 092 public UpdateRetentionPolicyByIdRequestBody() { 093 super(); 094 } 095 096 protected UpdateRetentionPolicyByIdRequestBody(Builder builder) { 097 super(); 098 this.policyName = builder.policyName; 099 this.description = builder.description; 100 this.dispositionAction = builder.dispositionAction; 101 this.retentionType = builder.retentionType; 102 this.retentionLength = builder.retentionLength; 103 this.status = builder.status; 104 this.canOwnerExtendRetention = builder.canOwnerExtendRetention; 105 this.maxExtensionLength = builder.maxExtensionLength; 106 this.areOwnersNotified = builder.areOwnersNotified; 107 this.customNotificationRecipients = builder.customNotificationRecipients; 108 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 109 } 110 111 public String getPolicyName() { 112 return policyName; 113 } 114 115 public String getDescription() { 116 return description; 117 } 118 119 public String getDispositionAction() { 120 return dispositionAction; 121 } 122 123 public String getRetentionType() { 124 return retentionType; 125 } 126 127 public UpdateRetentionPolicyByIdRequestBodyRetentionLengthField getRetentionLength() { 128 return retentionLength; 129 } 130 131 public String getStatus() { 132 return status; 133 } 134 135 public Boolean getCanOwnerExtendRetention() { 136 return canOwnerExtendRetention; 137 } 138 139 public RetentionPolicyMaxExtensionLengthRequest getMaxExtensionLength() { 140 return maxExtensionLength; 141 } 142 143 public Boolean getAreOwnersNotified() { 144 return areOwnersNotified; 145 } 146 147 public List<UserBase> getCustomNotificationRecipients() { 148 return customNotificationRecipients; 149 } 150 151 @Override 152 public boolean equals(Object o) { 153 if (this == o) { 154 return true; 155 } 156 if (o == null || getClass() != o.getClass()) { 157 return false; 158 } 159 UpdateRetentionPolicyByIdRequestBody casted = (UpdateRetentionPolicyByIdRequestBody) o; 160 return Objects.equals(policyName, casted.policyName) 161 && Objects.equals(description, casted.description) 162 && Objects.equals(dispositionAction, casted.dispositionAction) 163 && Objects.equals(retentionType, casted.retentionType) 164 && Objects.equals(retentionLength, casted.retentionLength) 165 && Objects.equals(status, casted.status) 166 && Objects.equals(canOwnerExtendRetention, casted.canOwnerExtendRetention) 167 && Objects.equals(maxExtensionLength, casted.maxExtensionLength) 168 && Objects.equals(areOwnersNotified, casted.areOwnersNotified) 169 && Objects.equals(customNotificationRecipients, casted.customNotificationRecipients); 170 } 171 172 @Override 173 public int hashCode() { 174 return Objects.hash( 175 policyName, 176 description, 177 dispositionAction, 178 retentionType, 179 retentionLength, 180 status, 181 canOwnerExtendRetention, 182 maxExtensionLength, 183 areOwnersNotified, 184 customNotificationRecipients); 185 } 186 187 @Override 188 public String toString() { 189 return "UpdateRetentionPolicyByIdRequestBody{" 190 + "policyName='" 191 + policyName 192 + '\'' 193 + ", " 194 + "description='" 195 + description 196 + '\'' 197 + ", " 198 + "dispositionAction='" 199 + dispositionAction 200 + '\'' 201 + ", " 202 + "retentionType='" 203 + retentionType 204 + '\'' 205 + ", " 206 + "retentionLength='" 207 + retentionLength 208 + '\'' 209 + ", " 210 + "status='" 211 + status 212 + '\'' 213 + ", " 214 + "canOwnerExtendRetention='" 215 + canOwnerExtendRetention 216 + '\'' 217 + ", " 218 + "maxExtensionLength='" 219 + maxExtensionLength 220 + '\'' 221 + ", " 222 + "areOwnersNotified='" 223 + areOwnersNotified 224 + '\'' 225 + ", " 226 + "customNotificationRecipients='" 227 + customNotificationRecipients 228 + '\'' 229 + "}"; 230 } 231 232 public static class Builder extends NullableFieldTracker { 233 234 protected String policyName; 235 236 protected String description; 237 238 protected String dispositionAction; 239 240 protected String retentionType; 241 242 protected UpdateRetentionPolicyByIdRequestBodyRetentionLengthField retentionLength; 243 244 protected String status; 245 246 protected Boolean canOwnerExtendRetention; 247 248 protected RetentionPolicyMaxExtensionLengthRequest maxExtensionLength; 249 250 protected Boolean areOwnersNotified; 251 252 protected List<UserBase> customNotificationRecipients; 253 254 public Builder policyName(String policyName) { 255 this.policyName = policyName; 256 this.markNullableFieldAsSet("policy_name"); 257 return this; 258 } 259 260 public Builder description(String description) { 261 this.description = description; 262 this.markNullableFieldAsSet("description"); 263 return this; 264 } 265 266 public Builder dispositionAction(String dispositionAction) { 267 this.dispositionAction = dispositionAction; 268 return this; 269 } 270 271 public Builder retentionType(String retentionType) { 272 this.retentionType = retentionType; 273 this.markNullableFieldAsSet("retention_type"); 274 return this; 275 } 276 277 public Builder retentionLength(String retentionLength) { 278 this.retentionLength = 279 new UpdateRetentionPolicyByIdRequestBodyRetentionLengthField(retentionLength); 280 return this; 281 } 282 283 public Builder retentionLength(int retentionLength) { 284 this.retentionLength = 285 new UpdateRetentionPolicyByIdRequestBodyRetentionLengthField(retentionLength); 286 return this; 287 } 288 289 public Builder retentionLength( 290 UpdateRetentionPolicyByIdRequestBodyRetentionLengthField retentionLength) { 291 this.retentionLength = retentionLength; 292 return this; 293 } 294 295 public Builder status(String status) { 296 this.status = status; 297 this.markNullableFieldAsSet("status"); 298 return this; 299 } 300 301 public Builder canOwnerExtendRetention(Boolean canOwnerExtendRetention) { 302 this.canOwnerExtendRetention = canOwnerExtendRetention; 303 this.markNullableFieldAsSet("can_owner_extend_retention"); 304 return this; 305 } 306 307 public Builder maxExtensionLength( 308 RetentionPolicyMaxExtensionLengthRequestEnum maxExtensionLength) { 309 this.maxExtensionLength = new RetentionPolicyMaxExtensionLengthRequest(maxExtensionLength); 310 return this; 311 } 312 313 public Builder maxExtensionLength(String maxExtensionLength) { 314 this.maxExtensionLength = new RetentionPolicyMaxExtensionLengthRequest(maxExtensionLength); 315 return this; 316 } 317 318 public Builder maxExtensionLength(int maxExtensionLength) { 319 this.maxExtensionLength = new RetentionPolicyMaxExtensionLengthRequest(maxExtensionLength); 320 return this; 321 } 322 323 public Builder maxExtensionLength(RetentionPolicyMaxExtensionLengthRequest maxExtensionLength) { 324 this.maxExtensionLength = maxExtensionLength; 325 return this; 326 } 327 328 public Builder areOwnersNotified(Boolean areOwnersNotified) { 329 this.areOwnersNotified = areOwnersNotified; 330 this.markNullableFieldAsSet("are_owners_notified"); 331 return this; 332 } 333 334 public Builder customNotificationRecipients(List<UserBase> customNotificationRecipients) { 335 this.customNotificationRecipients = customNotificationRecipients; 336 this.markNullableFieldAsSet("custom_notification_recipients"); 337 return this; 338 } 339 340 public UpdateRetentionPolicyByIdRequestBody build() { 341 return new UpdateRetentionPolicyByIdRequestBody(this); 342 } 343 } 344}