Write the Product Structure Rule Classes

For each product period, you must create a rule class which is responsible for describing the structure of your product, i.e. which types of objectives it supports. Typically the structure of your product will be identical across product periods and you need only create one set of rule classes which will be used on each product period.

For a new benefit product created via the dynamic product wizard, a product structure rule class will be included in the default eligibility and entitlement rule set that is associated with the default product period created for the product at the completion of the dynamic product wizard. This default product structure rule class should be edited to meet your product requirements prior to product use.

You will require the following rule classes:

You will also relate these rule classes to each other by implementing rules that return instances of your rule classes; thus the product rule class has an attribute for identifying its types of objectives, and each objective type has an attribute for identifying its supported tags. The default eligibility and entitlement rule set created for the benefit product by the dynamic product wizard will already contain each of these rule classes, but they should be edited to meet your product requirements prior to product use.

The following sections describe the creation of these rule classes and their interrelations in detail.

Write the Product rule class

Your rule class to describe your product's structure must ultimately extend from the ProductEligibilityEntitlementRuleSet.AbstractProduct interface rule class. For ease of upgrades, it is recommended that your rule class extends the DefaultProductEligibilityEntitlementRuleSet.DefaultProduct rule class which provides default implementations. The default eligibility and entitlement rule set that is automatically created for benefit products by the dynamic product wizard will contain a Product rule class which extends the DefaultProductEligibilityEntitlementRuleSet.DefaultProduct rule class.

Here is a description of the attributes inherited from AbstractProduct:

Table 1. Rule attributes inherited from ProductEligibilityEntitlementRuleSet. AbstractProduct
Rule Attribute name Data type Description
objectiveTypes List of AbstractObjectiveType The types of objective supported by this product.

To write the Product rule class, create a rule class which extends DefaultProductEligibilityEntitlementRuleSet.DefaultProduct. The rule class should be named in line with your product, e.g. ProductName Product (the Engine does not have any technical constraint on the rule class name - rather a good name for your rule class may make it easier to develop and maintain your rule sets). The default name of the Product rule class within the default eligibility and entitlement rule set that is automatically created for a benefit product by the product wizard is ProductNameWithBlankSpacesRemoved Product.

The inherited implementation of objectiveTypes returns an empty list; leave this implementation for now and you will return to it once you have created your objective type and tag rule classes.

Write the Objective Type rule classes

For each type of objective supported by your product (for example, a Personal Benefit Allowance or a Child Benefit Allowance), you must create a rule class which must ultimately extend from the ProductEligibilityEntitlementRuleSet.AbstractObjectiveType interface rule class. For ease of upgrades, it is recommended that your rule class extends the DefaultProductEligibilityEntitlementRuleSet.DefaultObjectiveType rule class which provides default implementations. The default eligibility and entitlement rule set created for benefit products by the dynamic product wizard will contain two Objective Type rule classes each of which extends the DefaultProductEligibilityEntitlementRuleSet.DefaultObjectiveType rule class.

Here is a description of the attributes inherited from AbstractObjectiveType:

Table 2. Rule attributes inherited from ProductEligibilityEntitlementRuleSet.AbstractObjectiveType
Rule Attribute name Data type Description
objectiveTypeID String Identifier of the object type, which must be unique within the product. The length of this identifier must be no more than the number of characters dictated by the RULES_OBJECTIVE_ID domain (which by default is 16 characters).
name Code from the RulesComponentType code table The code for the display name of this objective type.
financialComponentType Code from the RulesComponentFCType code table The financial component type associated with this objective, CT1 if this is a benefit, CT2 if it is a liability.
rateTarget Code from the RulesComponentTarget code table The target for this objective, Client, Product Provide, Service Supplier, Employer, etc..
tagTypes List of AbstractTagType The tag types available for this objective type, indicating the frequencies at which this objective can be delivered
description Localizable message A description of this type of objective
comments Localizable message Comments describing this type of objective
isDeductionAllowable Boolean Whether case workers are allowed to select objective instances of this type when creating case deductions.

For each objective type supported by your product, create a rule class which extends DefaultProductEligibilityEntitlementRuleSet.DefaultObjectiveType. The default eligibility and entitlement rule set that is automatically created for benefit products by the dynamic product wizard will already contain two rule classes which extend the DefaultProductEligibilityEntitlementRuleSet.DefaultObjectiveType rule class. These two default rule classes are named PersonalBenefitAllowanceObjectiveType and ChildBenefitAllowanceObjectiveType. If you are writing a new rule class, the name of your rule class should be in line with the name of your objective type (ObjectiveTypeName ObjectiveType), to ease development and maintenance, e.g. PersonalBenefitAllowanceObjectiveType or ChildBenefitAllowanceObjectiveType.

The inherited implementation of tagTypes returns an empty list; leave this implementation for now and you will return to it once you have created your objective tag rule classes.

For all other inherited rule attributes, use your analysis of your business requirements to implement rules to return values appropriate to your objective type. The default eligibility and entitlement rule set should be edited to reference values suitable to your product. If you are writing a new eligibility and entitlement rule set rather than using the default rule set created by the product wizard, typically you will add a new value to the RulesComponentType code table to implement the name for your objective type, but you will use one of the values provided from the RulesComponentFCType and RulesComponentTarget code tables when implementing the rules for financialComponentType and rateTarget respectively.

Write the Objective Tag Type rule classes

For each of your product's supported objectives (e.g. a Personal Benefit Allowance), your analysis determined frequencies at which that objective may be delivered (e.g. a Personal Benefit Allowance might be payable either daily or weekly, at the choice of the claimant or to handle ramp-up/ramp-down periods).

For each frequency for an objective type, you must create a rule class which must ultimately extend from the ProductEligibilityEntitlementRuleSet.AbstractTagType interface rule class. For ease of upgrades, it is recommended that your rule class extends the DefaultProductEligibilityEntitlementRuleSet.DefaultTagType rule class which provides default implementations. The default eligibility and entitlement rule set created for benefit products by the dynamic product wizard will already contain three objective tag type rule classes each of which extends the DefaultProductEligibilityEntitlementRuleSet.DefaultTagType rule class.

Here is a description of the attributes inherited from AbstractTagType:

Table 3. Rule attributes inherited from ProductEligibilityEntitlementRuleSet.AbstractTagType
Rule Attribute name Data type Description
tagTypeID Long Identifier of the tag type, which must be unique within the product.
name Localizable message The display name of this tag type.
pattern Frequency Pattern The frequency at which this tag type is delivered. For more information, see the JavaDoc for curam.util.type.FrequencyPattern.
valueType Code from the RulesTagType code table The type of value held in instances of this tag type.
description Localizable message A description of this type of objective tag.

The three objective tags defined in the default eligibility and entitlement rule set created for benefit products by the dynamic product wizard are daily, weekly and monthly tags. If you are extending this default rule set to include additional objective tags, or if you are creating a new eligibility and entitlement rule set, for each objective tag supported by your product create a rule class which extends DefaultProductEligibilityEntitlementRuleSet.DefaultTagType. Again the name of your rule class should be in line with the name of your objective tag type (TagTypeName TagType), to ease development and maintenance, e.g. PersonalBenefitAllowanceWeeklyDeliveryTagType or PersonalBenefitAllowanceDailyDeliveryTagType.

For all the inherited rule attributes, use your analysis of your business requirements to implement rules to return values appropriate to your objective tag type. Typically you will use one of the values provided from the RulesTagType code table when implementing the rules for valueType.

Relate each Objective Type to its supported Objective Tag Types

Now that you have created rule classes for your objective types and objective tag types, you must relate each objective type to its list of supported objective tag types.

For each objective type rule class that you created, you must now implement its tagTypes attribute to create a list of instances of the rule classes which represent its tag types. Typically this list is a <fixedlist> where each member in the list is a simple <create> expression.

For example, for the PersonalBenefitAllowanceObjectiveType, its implementation of tagTypes, in pseudo-code, would be:

Relate the Product to its supported Objective Types

Now that you have created rule classes for your product and objective types, you must relate the product to its list of supported objective tag types. This association will already be in place if you are using the default eligibility and entitlement rule set that is automatically created for benefit products by the dynamic product wizard.

For your product rule class, you must now implement its objectiveTypes attribute to create a list of instances of the rule classes which represent its objective types. Typically this list is a <fixedlist> where each member in the list is a simple <create> expression.

For example, for a product which supports Personal Benefit Allowance and Child Benefit Allowance objective types, its implementation of objectiveTypes, in pseudo-code, would be: