Legal Hold Policy information describes the basic characteristics of the Policy, such as name, description, and filter dates.
- Get Legal Hold Policy
- Get List of Legal Hold Policies
- Create New Legal Hold Policy
- Update Existing Legal Hold Policy
- Delete Legal Hold Policy
- Get Assignment
- Get List of Assignments
- Create New Assignment
- Delete Assignment
- Get File Version Legal Hold
- Get List of File Version Legal Holds
Calling getInfo(String...)
will return a BoxLegalHoldPolicy.Info object
containing information about the legal hold policy. If necessary to retrieve
limited set of fields, it is possible to specify them using param.
BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, id);
BoxLegalHoldPolicy.Info policyInfo = policy.getInfo();
Calling the static getAll(BoxAPIConnection)
will return an iterable that will page through all of the legal hold policies.
It is possible to specify name of legal hold policy, maximum number of items per
response and fields to retrieve by calling the static
getAll(BoxAPIConnection, String, int, String...)
method.
Iterable<BoxLegalHoldPolicy.Info> policies = BoxLegalHoldPolicy.getAll(api);
for (BoxLegalHoldPolicy.Info policyInfo : policies) {
// Do something with the legal hold policy.
}
The static create(BoxAPIConnection api, String name, String description, Date startDate, Date endDate)
method will let you create a new legal hold policy with a specified name, description, start and end dates.
BoxLegalHoldPolicy.Info policyInfo = BoxLegalHoldPolicy.create(api, name, description, startedAt, endedAt);
If you wish to create an ongoing Legal Hold Policy with no end date and a description, call createOngoing(BoxAPIConnection api, String name, String description)
.
BoxLegalHoldPolicy.Info policyInfo = BoxLegalHoldPolicy.createOngoing(api, name, description);
Updating a legal hold policy's information is done by calling
updateInfo(BoxLegalHoldPolicy.Info fieldsToUpdate)
.
BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, id);
BoxLegalHoldPolicy.Info policyInfo = policy.new Info();
info.addPendingChange("description", "new description");
policy.updateInfo(info);
A legal hold policy can be deleted by calling the delete()
method.
BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, id);
policy.delete();
Calling getInfo(String... fields)
will return a BoxLegalHoldAssignment.Info
object containing information about the legal hold policy assignment.
BoxLegalHoldAssignment assignment = new BoxLegalHoldAssignment(api, id);
BoxLegalHoldAssignment.Info info = assignment.getInfo("assigned_by");
Calling the static getAssignments(String... fields)
will return
an iterable that will page through all of the assignments of the legal hold policy.
It is possible to specify filters for type and id, maximum number of items per single
response and fields to retrieve by calling
getAssignments(String type, String id, int limit, String... fields)
.
BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, id);
Iterable<BoxLegalHoldAssignment.Info> assignments = policy.getAssignments(BoxResource.getResourceType(BoxFolder.class), null, 50, "assigned_at");
for (BoxLegalHoldAssignment.Info assignmentInfo : assignments) {
// Do something with the legal hold policy assignment.
}
To create new legal hold policy assignment call assignTo(BoxResource target)
method.
Currently only BoxFile, BoxFileVersion, BoxFolder and BoxUser objects are supported as a parameter.
BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, policyID);
BoxFolder folder = new BoxFolder(api, folderID);
policy.assignTo(folder);
A legal hold policy assignment can be deleted by calling the delete()
method
of BoxLegalHoldAssignment object.
BoxLegalHoldAssignment assignment = new BoxLegalHoldAssignment(api, id);
assignment.delete();
Calling getInfo(String... fields)
will return
a BoxFileVersionLegalHold.Info object containing information about the file version legal hold policy.
BoxFileVersionLegalHold hold = new BoxFileVersionLegalHold(api, id);
hold.getInfo("file");
To get an iterable with all non-deleted file version legal holds for current
legal hold policy, call getFileVersionHolds(String... fields)
.
It is possible to specify maximum number of items per single response by calling
getFileVersionHolds(int limit, String... fields)
.
BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, id);
Iterable<BoxFileVersionLegalHold.Info> fileVersionHolds = policy.getFileVersionHolds();
for (BoxFileVersionLegalHold.Info fileVersionHold : fileVersionHolds) {
// Do something with the file version legal hold.
}