A disposal policy defines criteria for objects of a specified class to be automatically deleted by a Content Engine background task. The background task repeatedly sweeps over the database table that stores objects of the specified class and removes the objects that satisfy the policy criteria. A disposal policy keeps count of sweep results, including completed iterations and objects examined, processed, and failed. For server installations configured for retention, a disposal policy can identify objects with a retention date in the past and remove them from the database.
A disposal policy is represented by a CmDisposalPolicy object. You create a CmDisposalPolicy object with a factory method, set the disposal critera with the FilterExpression property, and set the class instances to be disposed with the SweepTarget property. You can also set the start and end times for the disposal policy to be in effect.
When you create a CmDisposalPolicy object, the server automatically creates, if necessary, the following objects required for policy-based processing:
The same CmPolicyControlledSweep object is used for multiple sweep policies that target the same database table. The CmPolicyControlledSweep object evaluates and applies the multiple policies when sweeping the database table.
Using the SweepSubscribers property of the policy controlled sweep, you can retrieve the sweep policies that subscribe to the policy controlled sweep, and then iterate the policies to identify the disposal policies.
Neither CmPolicyControlledSweep nor CmSweepPolicyRelationship can be deleted manually. When you delete a CmDisposalPolicy object, the dependent CmSweepPolicyRelationship object is deleted automatically by the system. If the deleted CmDisposalPolicy object is the last sweep policy subscribed to the policy controlled sweep, then the CmPolicyControlledSweep is deleted as well.
A CmDisposalPolicy object also includes properties to enable generation of failure result records and to retrieve them. Each failure result record identifies a swept object for which the failure occurred, and describes the reason for the failure. See CmSweepResult for more information.
For code examples, see Working with Disposal Policies.