Retention Rules

The Data Retention Framework allows you to configure retention rules.

To start working with the framework, create a RetentionJobModel model to use with either the AfterRetentionCleanupRuleModel or FlexibleSearchRetentionRuleModel rule configurations. To configure a rule, set your values for appropriate rule configuration parameters.

AfterRetentionCleanupRuleModel Configuration

This example configuration enables you to get orders whose itemtype code starts with an order prefix and whose expirationTime is older than 10 minutes. These orders are then removed since the actionReference parameter is set to basicRemoveCleanupAction.

code="Rule1"
retirementItemType="Order"
retirementDateAttribute="Order:expirationTime"
retentionTimeSeconds="600"
itemFilterExpression="{code} like 'order%'"
actionReference="basicRemoveCleanupAction"

The AfterRetentionCleanupRuleModel parameters include:

Parameter Name

Parameter Type

Required

code

String

Yes

retirementItemType

ComposedType

Yes

retirementDateAttribute

AttributeDescriptorModel

Yes/No*

retentionTimeSeconds

long

Yes/No*

itemFilterExpression

String

No

retirementDateExpression

String

Yes/No*

actionReference

String

Yes

* It is required to set retirementDateAttribute with retentionTimeSeconds or set retirementDateExpresion in AfterRetentionCleanupRuleModel.

FlexibleSearchRetentionRuleModel Configuration

This example configuration enables you to return items defined through the searchQuery parameter. These items are then removed because the actionReference parameter is set to basicRemoveCleanupAction.

code="Rule2"
actionReference="basicRemoveCleanupAction"
searchQuery="select {PK},{itemType} from {Order} where {code} like 'fsorder%' and {expirationTime} < {current_date - 1}"

The FlexibleSearchRetentionRuleModel parameters include:

Parameter Name

Parameter Type

Required

code

String

Yes

actionReference

String

Yes

searchQuery

String

Yes

queryParameters

Map<String,String>

No

retentionTimeSeconds

long

No

Calculated Query Parameters

Due to the fact that date calculations are database dependent, we added some calculated parameters to the queryParameters map. You can use those parameters for searchQuery. This example configuration enables you to get orders whose expirationTime is older than 10 minutes.

code="Rule3"
actionReference="basicRemoveCleanupAction"
retentionTimeSeconds="600"
searchQuery="select {PK},{itemtype} from {Order} where {expirationTime} < ?CALC_RETIREMENT_TIME"

The calculated parameters include:

Key Name

Value Description

Type

JAVA_CURRENT_TIME

current_time from server

java.util.Date

CALC_RETIREMENT_TIME

current_time, minus retentionTimeSeconds

java.util.Date

RETENTION_TIME_SECONDS

retentionTimeSeconds

long