@BoxResourceType(value="retention_policy") public class BoxRetentionPolicy extends BoxResource
Unless otherwise noted, the methods in this class can throw an unchecked {@link BoxAPIException} (unchecked meaning that the compiler won't force you to handle it) if an error occurs. If you wish to implement custom error handling for errors related to the Box REST API, you should capture this exception explicitly.
Modifier and Type | Class and Description |
---|---|
static class |
BoxRetentionPolicy.BoxRetentionPolicyAction
The disposition action of the retention policy.
|
class |
BoxRetentionPolicy.Info
Contains information about the retention policy.
|
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_PERMANENTLY_DELETE
Will cause the content retained by the policy to be permanently deleted.
|
static String |
ACTION_REMOVE_RETENTION
Will lift the retention policy from the content, allowing it to be deleted by users.
|
static URLTemplate |
ASSIGNMENTS_URL_TEMPLATE
The URL template used for operation with retention policy assignments.
|
static URLTemplate |
POLICY_URL_TEMPLATE
The URL template used for operation with retention policy with given ID.
|
static URLTemplate |
RETENTION_POLICIES_URL_TEMPLATE
The URL template used for operation with retention policies.
|
static String |
STATUS_ACTIVE
Status corresponding to active retention policy.
|
static String |
STATUS_RETIRED
Status corresponding to retired retention policy.
|
Constructor and Description |
---|
BoxRetentionPolicy(BoxAPIConnection api,
String id)
Constructs a retention policy for a resource with a given ID.
|
Modifier and Type | Method and Description |
---|---|
BoxRetentionPolicyAssignment.Info |
assignTo(BoxFolder folder)
Assigns this retention policy to folder.
|
BoxRetentionPolicyAssignment.Info |
assignToEnterprise()
Assigns this retention policy to the current enterprise.
|
BoxRetentionPolicyAssignment.Info |
assignToMetadataTemplate(String templateID,
MetadataFieldFilter... fieldFilters)
Assigns this retention policy to a metadata template, optionally with certain field values.
|
BoxRetentionPolicyAssignment.Info |
assignToMetadataTemplate(String templateID,
String startDateField,
MetadataFieldFilter... fieldFilters)
Assigns this retention policy to a metadata template, optionally with certain field values.
|
static BoxRetentionPolicy.Info |
createFinitePolicy(BoxAPIConnection api,
String name,
int length,
BoxRetentionPolicy.BoxRetentionPolicyAction action)
Used to create a new finite retention policy.
|
static BoxRetentionPolicy.Info |
createFinitePolicy(BoxAPIConnection api,
String name,
int length,
BoxRetentionPolicy.BoxRetentionPolicyAction action,
RetentionPolicyParams optionalParams)
Used to create a new finite retention policy with optional parameters.
|
static BoxRetentionPolicy.Info |
createIndefinitePolicy(BoxAPIConnection api,
String name)
Used to create a new indefinite retention policy.
|
static BoxRetentionPolicy.Info |
createIndefinitePolicy(BoxAPIConnection api,
String name,
RetentionPolicyParams optionalParams)
Used to create a new indefinite retention policy with optional parameters.
|
static Iterable<BoxRetentionPolicy.Info> |
getAll(BoxAPIConnection api,
String... fields)
Returns all the retention policies.
|
static Iterable<BoxRetentionPolicy.Info> |
getAll(String name,
String type,
String userID,
int limit,
BoxAPIConnection api,
String... fields)
Returns all the retention policies with specified filters.
|
Iterable<BoxRetentionPolicyAssignment.Info> |
getAllAssignments(int limit,
String... fields)
Returns iterable with all assignments of this retention policy.
|
Iterable<BoxRetentionPolicyAssignment.Info> |
getAllAssignments(String... fields)
Returns iterable with all assignments of this retention policy.
|
Iterable<BoxRetentionPolicyAssignment.Info> |
getEnterpriseAssignments(int limit,
String... fields)
Returns iterable with all enterprise assignments of this retention policy.
|
Iterable<BoxRetentionPolicyAssignment.Info> |
getEnterpriseAssignments(String... fields)
Returns iterable with all enterprise assignments of this retention policy.
|
Iterable<BoxRetentionPolicyAssignment.Info> |
getFolderAssignments(int limit,
String... fields)
Returns iterable with all folder assignments of this retention policy.
|
Iterable<BoxRetentionPolicyAssignment.Info> |
getFolderAssignments(String... fields)
Returns iterable with all folder assignments of this retention policy.
|
BoxRetentionPolicy.Info |
getInfo(String... fields)
Returns information about this retention policy.
|
void |
updateInfo(BoxRetentionPolicy.Info info)
Updates the information about this retention policy with any info fields that have been modified locally.
|
equals, getAPI, getID, getResourceType, hashCode
public static final URLTemplate RETENTION_POLICIES_URL_TEMPLATE
public static final URLTemplate POLICY_URL_TEMPLATE
public static final URLTemplate ASSIGNMENTS_URL_TEMPLATE
public static final String ACTION_PERMANENTLY_DELETE
public static final String ACTION_REMOVE_RETENTION
public static final String STATUS_ACTIVE
public static final String STATUS_RETIRED
public BoxRetentionPolicy(BoxAPIConnection api, String id)
api
- the API connection to be used by the resource.id
- the ID of the resource.public static BoxRetentionPolicy.Info createIndefinitePolicy(BoxAPIConnection api, String name)
api
- the API connection to be used by the created user.name
- the name of the retention policy.public static BoxRetentionPolicy.Info createIndefinitePolicy(BoxAPIConnection api, String name, RetentionPolicyParams optionalParams)
api
- the API connection to be used by the created user.name
- the name of the retention policy.optionalParams
- the optional parameters.public static BoxRetentionPolicy.Info createFinitePolicy(BoxAPIConnection api, String name, int length, BoxRetentionPolicy.BoxRetentionPolicyAction action)
api
- the API connection to be used by the created user.name
- the name of the retention policy.length
- the duration in days that the retention policy will be active for after being assigned to content.action
- the disposition action can be "permanently_delete" or "remove_retention".public static BoxRetentionPolicy.Info createFinitePolicy(BoxAPIConnection api, String name, int length, BoxRetentionPolicy.BoxRetentionPolicyAction action, RetentionPolicyParams optionalParams)
api
- the API connection to be used by the created user.name
- the name of the retention policy.length
- the duration in days that the retention policy will be active for after being assigned to content.action
- the disposition action can be "permanently_delete" or "remove_retention".optionalParams
- the optional parameters.public static Iterable<BoxRetentionPolicy.Info> getAll(BoxAPIConnection api, String... fields)
api
- the API connection to be used by the resource.fields
- the fields to retrieve.public static Iterable<BoxRetentionPolicy.Info> getAll(String name, String type, String userID, int limit, BoxAPIConnection api, String... fields)
name
- a name to filter the retention policies by. A trailing partial match search is performed.
Set to null if no name filtering is required.type
- a policy type to filter the retention policies by. Set to null if no type filtering is required.userID
- a user id to filter the retention policies by. Set to null if no type filtering is required.limit
- the limit of items per single response. The default value is 100.api
- the API connection to be used by the resource.fields
- the fields to retrieve.public Iterable<BoxRetentionPolicyAssignment.Info> getFolderAssignments(String... fields)
fields
- the fields to retrieve.public Iterable<BoxRetentionPolicyAssignment.Info> getFolderAssignments(int limit, String... fields)
limit
- the limit of entries per response. The default value is 100.fields
- the fields to retrieve.public Iterable<BoxRetentionPolicyAssignment.Info> getEnterpriseAssignments(String... fields)
fields
- the fields to retrieve.public Iterable<BoxRetentionPolicyAssignment.Info> getEnterpriseAssignments(int limit, String... fields)
limit
- the limit of entries per response. The default value is 100.fields
- the fields to retrieve.public Iterable<BoxRetentionPolicyAssignment.Info> getAllAssignments(String... fields)
fields
- the fields to retrieve.public Iterable<BoxRetentionPolicyAssignment.Info> getAllAssignments(int limit, String... fields)
limit
- the limit of entries per response. The default value is 100.fields
- the fields to retrieve.public BoxRetentionPolicyAssignment.Info assignTo(BoxFolder folder)
folder
- the folder to assign policy to.public BoxRetentionPolicyAssignment.Info assignToEnterprise()
public BoxRetentionPolicyAssignment.Info assignToMetadataTemplate(String templateID, MetadataFieldFilter... fieldFilters)
templateID
- the ID of the metadata template to apply to.fieldFilters
- optional field value filters.public BoxRetentionPolicyAssignment.Info assignToMetadataTemplate(String templateID, String startDateField, MetadataFieldFilter... fieldFilters)
templateID
- the ID of the metadata template to apply to.startDateField
- the date the retention policy assignment begins. This field can be a date field's metadata attribute key id.fieldFilters
- optional field value filters.public void updateInfo(BoxRetentionPolicy.Info info)
info
- the updated info.public BoxRetentionPolicy.Info getInfo(String... fields)
fields
- the fields to retrieve.