Predefined Methods

This section describes the pre-defined methods available per object. These pre-defined methods can be divided into two categories: methods that are available on all or many objects, called generic methods, and methods that are only available on particular objects, called specific methods.

Generic Methods

addDynamicRecord

Adds a new dynamic record to an object. If the record’s usage is configured as time-valid, then the record supports two additional attributes. They are startDate and endDate, of which the former is mandatory.

Availability

This method is available for all objects that support dynamic records. It is available for functions, but not for conditions.

Table 1. addDynamicRecord
In or Out Type Description

In

String

The usage name

In

Map

The attributes of the record, structured as name and value pairs

Example: Add a Non-Time-Valid Record

The following logic adds a non-time-valid record:

person.addDynamicRecord( "occurrence"
                      , [ code        : "06"
                        , description : "Crime victim"
                        ]
                      )
Example: Add A Time-Valid Record

Add a time-valid record in the same manner, except the map contains two extra attributes:

person.addDynamicRecord( "dynRecord1"
                      , [ code        : "06"
                        , description : "dynRecord 1 value 6"
                        , startDate   : person.dateOfBirth
                        , endDate     : person.endDate
                        ]
                      )

getDynamicRecords

Retrieves the dynamic record or records of a particular object. The output parameter type depends on the record’s definition. Check the detailed description in the section below.

Dynamic records are also available as attributes of an entity. Access them directly from the object with a usage name, instead of explicitly invoking this method. See examples.

Availability

This method is available for all objects that support dynamic records.

Single-value and Non-time-valid

This method will return a single record if the record definition has both single-value and non-time-valid configurations.

Table 2. getDynamicRecords
In or Out Type Description

In

String

A usage name.

Out

Map

The attributes of the record can be a name and a value pair.

Example

assert claim.getDynamicRecords("hobby").name == "Cricket"
assert claim.getDynamicRecords("hobby").level.code == "BEGINNER"

assert claim.hobby.name == "Cricket"
assert claim.hobby.level.code == "BEGINNER"

Multi-value or Time-valid

This method will return a list of records if the record definition has either multi-value or time-valid configurations.

Table 3. Multi-value or Time-valid
In or Out Type Description

In

String

A usage name.

Out

List

A list of records. Each record represents a map of attribute names or value pairs.

Example

assert claim.getDynamicRecords("hobbies").size() == 2
assert claim.getDynamicRecords("hobbies")[0].name == "Cricket"
assert claim.getDynamicRecords("hobbies")[1].name == "Soccer"

assert claim.hobbies.size() == 2
assert claim.hobbies[0].name == "Cricket"
assert claim.hobbies[1].name == "Soccer"

getDynamicRecordsByType

Retrieves the dynamic record or records of a particular object based on the usage name. The output parameter type depends on the record’s definition. Check the detailed description in the following section:

We recommend using this method only when there are at least 50 dynamic records for a specific resource. Unlike getDynamicRecords, which loads all dynamic records into memory at once, this method performs a separate database call for each usage name as needed.

This design minimizes memory usage by triggering a DB query if a different dynamic record is queried on the same object.

Dynamic records or fields that are created or updated during a dynamic logic execution cannot be queried within the same execution.

Following example states high level difference between getDynamicRecords and getDynamicRecordsByType:

  • claim.getDynamicRecords("hobby") → This call triggers a DB query to fetch ALL dynamic records (including non-hobby records) in memory and returns hobby records.

  • claim.getDynamicRecords("accidentState") → This call fetches the accidentState from the in-memory cache, which was populated when hobby records were fetched.

  • claim.getDynamicRecordsByType("hobby") → This call triggers a DB query to fetch only "hobby" records.

  • claim.getDynamicRecordsByType("accidentState") → This call triggers a fresh DB query to fetch only accidentState records.

Availability

This method is available for all objects that support dynamic records.

Single-value and Non-time-valid

This method returns a single record if the record definition includes both single-value and non-time-valid configurations.

Table 4. getDynamicRecordsByType
In or Out Type Description

In

String

A usage name.

Out

DynamicRecord

DynamicRecord with its attributes.

Example

assert claim.getDynamicRecordsByType("hobby").name == "Cricket"
assert claim.getDynamicRecordsByType("hobby").level.code == "BEGINNER"

Multi-value or Time-valid

This method will return a list of records if the record definition has either multi-value or time-valid configurations.

Table 5. Multi-value or Time-valid
In or Out Type Description

In

String

A usage name.

Out

List

An unordered list of records. Each record represents dynamicRecord with its attributes.

Example

assert claim.getDynamicRecordsByType("hobbies").size() == 2

def hobby1 = claim.getDynamicRecordsByType("hobbies")[0]
def hobby2 = claim.getDynamicRecordsByType("hobbies")[1]

deleteDynamicRecord

Deletes an existing dynamic record. If a key attribute is configured on the record’s definition, then the second input argument can delete a dynamic record with a specific key value. If no record with a matching key value is found, nothing is deleted. If multiple records match with the input key value, only one record is deleted. If the input key is NULL, or if no key attribute is configured at all, then all associated dynamic records are deleted.

Availability

This method is available for all objects that support dynamic records. It is available for functions, but not for conditions.

Table 6. deleteDynamicRecord
In or Out Type Description

In

String

The usage name

In

String

The record’s key attribute value, or null.

Examples

Assume an existing person has the following three values for the dynRecord1 record. This dynamic record has two attributes: code and description, where code is configured as the key.

Table 7. Examples
Code Description

01

dynRecord1 value 1

02

dynRecord1 value 2

03

dynRecord1 value 3

The following logic deletes the record with code 02 while leaving the other two records intact.

person.deleteDynamicRecord("dynRecord1", "02")

The following logic deletes all three occurrences in records.

person.deleteDynamicRecord("dynRecord1", null)

lookUpFlexCode

Returns the flex code object that matches the input character string.

Availability

This method can be called without a base object.

Table 8. lookUpFlexCode
In / Out Type Description

In

String

Key value of the flexCode

In

String

Definition code of the flexCode

Out

flexCode

The flex code

Example
person.dynamicFieldYesNoIndicator = lookUpFlexCode("YES", "YES_NO")

test

A method that tests a dynamic logic:

  1. Follows the security restrictions of the unit under test (UUT).

  2. The application sets the transaction to rollback only. Any data changes to the database are temporary.

    Availability

    This method is available for a Dynamic Logic (Groovy script).

Table 9. test
In or Out Type Description

In

String

Dynamic logic Code of the UUT

In

Map<String,Object>

Map with the input parameters of the UUT

Out

DynamicLogicResult

Contains the result of the test and the exception class if the test encounters any errors.

Attributes of this object are:

  • result

  • exception

Example
def result = test("SPECIAL_BENEFIT_SELECT", [
    "claim" : claim
])

updateDynamicRecord

Updates the attributes of an existing dynamic record. To find the correct record to update, match on the record’s key attribute value. If none of the existing records have a matching key value, nothing is updated. If multiple records match with the key value, only one of them is updated. If no key is configured at all, executing this method results in adding a record. This applies to both non-time-valid and time-valid dynamic records, so time-validity does not play a role in finding the record to update.

Only the attributes that are present in the input map are updated. Attributes that are not mentioned are left untouched.

Availability

This method is available for all objects that support dynamic records. It is available for functions, but not for conditions.

Table 10. updateDynamicRecord
In / Out Type Description

In

String

A usage name.

In

Map

The attributes of the record, that can have a structure of name or value pairs.

Example, Update a Multi-Value Record

Assume an existing person has the following three values for the dynRecord1 record. This dynamic record has three attributes: code, description, and level, where code is configured as the key.

Table 11. Update a Multi-Value Record
Code Description Level

01

dynRecord1 value 1

3

02

dynRecord1 value 2

7

03

dynRecord1 value 3

12

The following logic updates the level of the record with code 02 from 7 to 6. Its description is retained.

person.updateDynamicRecord( "dynRecord1"
                         , [ code  : "02"
                           , level : 6
                           ]
                         )
Example: Update a Time-Valid Record

Update a record’s start and end date attribute in the same way as other attributes. Assume an existing person has the following two values for the dynRecord1 record. Besides, startDate and endDate, this time-valid dynamic record has two attributes: code, description, where code is configured as the key.

Table 12. Update a Time-Valid Record
Code Description StartDate EndDate

01

dynRecord1 value 1

2015-01-01

2015-12-31

02

dynRecord1 value 2

2016-01-01

The following logic sets the endDate of the second record to the person’s end date. Its other attributes are retained.

person.updateDynamicRecord("dynRecord1"
                         , [ code    : "02"
                           , endDate : person.endDate
                           ]
                         )

Please refer to the Claims Developer Guide for the complete list of available generic methods.

Specific Methods

In this section, the methods are described that are only available on specific objects. For each method, the following information is given:

  • The purpose of the method.

  • On which object(s) the method can be called.

  • Description of the parameters.

  • An example of the usage.

getParameterValue

Gets the parameter value of a product that is defined for a parameter alias at a given point in time. If a value is defined at the parameter alias value level, then it will also return that value.

Availability

This method is available on product objects.

Parameters

Table 13. getParameterValue
In or Out Type Description

In

String

The code of the parameter alias. Mandatory.

In

Date

As of date for time validity. Optional.

Out

List

The parameter value list defined for the parameter alias in context of the product. Null if no parameter value is defined.

Example
parameterValue = product.getParameterValue("PCP_COPAY","2014-01-21")

getProductLimitRenewalPeriod

Gets the product limit renewal period of a product that is defined for a limit at a given point in time.

Availability

This method is available on product objects.

Parameters

Table 14. getProductLimitRenewalPeriod
In or Out Type Description

In

String

The code of the limit. Mandatory.

Out

Product Limit Renewal Period

The product limit renewal period defined for the limit in context of the product. Null if no product limit renewal period is defined.

Example
productLimitRenewalPeriod = product.getproductLimitRenewalPeriod("DEDUCTIBLE")

getProductProviderGroup

Gets the product provider group of a product that is defined for a provider group at a given point in time.

Availability

This method is available on product objects.

Parameters

Table 15. getProductProviderGroup
In or Out Type Description

In

String

The code of the provider group. Mandatory.

In

Date

As of date for time validity. Optional.

Out

Product Provider Group

The product provider group defined for the provider group in context of the product. Null if no product provider group is defined.

Example
productProviderGroup = product.getProductProviderGroup("NY NETWORK","2014-01-21")

getProductServiceDefinition

Gets the product service definition of a product that is defined for a service definition at a given point in time.

Availability

This method is available on product objects.

Parameters

Table 16. getProductServiceDefinition
In or Out Type Description

In

String

The code of the service option. Mandatory.

In

String

The code of the service. Mandatory.

In

String

The code of the service definition. Mandatory.

In

String

The type of the service definition ("A","C","R","W"). Mandatory

In

Date

As of date for time validity. Mandatory.

Out

Product Service Definition

The product service definition defined for the service definition in context of the product. Null if no product service definition is defined.

Example
productServiceDefinition = product.getproductServiceDefinition("PHYSICAL THERAPY","SERVICES","PROFESSIONAL","C","2014-01-21")

setDynamicField

The method sets the dynamic field to an object.

Availability

This method is available for all objects that support dynamic fields.

Parameters

Table 17. getProductServiceDefinition
In or Out Type Description

In

String

A usage name

In

Object

Structure of the dynamic field

Example

The following logic sets a time-valid field usage:

policy.setDynamicField("policyCoverage", new DynamicFieldPeriod(polCovRef.policyCoverage,polCovRef.startDate,polCovRef.endDate))
The recommended way to use the dynamic field is mentioned in the Writing section.