Configure the updater extension file

The REST endpoint generator automatically adds the following updaters to claim_ext-1.0.updater.json file:

  • Incident
    • description
    • lossParty
    • severity
    • valueResolver
  • Risk unit
    • RUnumber
    • description
  • Damageable
    • (none)

Configuring the incident

This is the syntax for a foreign key from a custom incident to a custom damageable.

"<CustomIncident>": {
  ...
   "<customDamageable>": {
     "path": "<CustomIncident>.<CustomDamageable>",
     "create": "{ var d = new <CustomDamageable>(<CustomIncident>); 
                  d.Policy<CustomDamageable> = false;
                  return d}",
     "handler": "PolicyObjectSemiSharedPropertyUpdateHandler",
     "valueResolver": {
       "typeName": "<fullyQualifiedNameForCustomDamageableValueResolver>",
       "resolvedValueToAncestorPath": 
                   "resolvedValue.<CustomRiskUnit>.Policy",
       "rootToAncestorPath": "<CustomIncident>.Claim.Policy"
      },
     "shouldCreate": "currentValue == null ||  
                      currentValue.Policy<CustomDamageable>",
     "touchParent": "currentValue.Changed",
     "updaterRef": "#/updaters/<CustomDamageable>"
   },
   ...
  },

This updater is more complex than normal because it must provide information for two cases:

  • The foreign key from incident to damageable (where it is possible to create a new damageable)
    • This case makes use of the create and updaterRef attributes.
  • The foreign key from risk unit to damageable (where you must resolve to damageable on the policy)
    • This case makes use of the valueResolver attribute.

For example, suppose you have a custom incident named TowableIncident_Ext that has a foreign key field to Towable_Ext. The updater property for the foreign key would be:

"TowableIncident_Ext": {
  ...
   "towable_Ext": {
     "path": "TowableIncident_Ext.Towable_Ext",
     "create": "{ var d = new Towable_Ext(TowableIncident_Ext); 
                  d.PolicyTowable = false;
                  return d}",
     "handler": "PolicyObjectSemiSharedPropertyUpdateHandler",
     "valueResolver": {
       "typeName": "gw.rest.ext.cc.claim.v1.claims.policy.towableext.
                    TowableExtJsonValueResolver ",
       "resolvedValueToAncestorPath": 
                   "resolvedValue.TowableRU_Ext.Policy",
       "rootToAncestorPath": "TowableIncident_Ext.Claim.Policy"
      },
     "shouldCreate": "currentValue == null ||  
                      currentValue.PolicyTowable",
     "touchParent": "currentValue.Changed",
     "updaterRef": "#/updaters/Towable_Ext"
   },
   ...
  },

If the incident has additional business fields you wish to make writeable, you must add them to the file manually. For most fields, you can find information on how to add them to a schema in Endpoint architecture.

Configuring the risk unit

This is the syntax for a foreign key from a custom risk unit to a custom damageable.

"<CustomRiskUnit>": {
  ...
   "<customDamageable>": {
     "path": "<CustomRiskUnit>.<CustomDamageable>",
     "create": "{var <CustomDamageble> = 
                           new <CustomDamageble>(<CustomRiskUnit>);
                 <CustomDamageable>.Policy<CustomDamageable> = true;
                 return <CustomDamageable>}",
          "updaterRef": "#/updaters/<CustomDamageable>"
        }
      }
    },

For example, suppose you have a custom risk unit named TowableRU_Ext that has a foreign key field to Towable_Ext. The updater property for the foreign key would be:

"TowableRU_Ext": {
  ...
   "towable_Ext": {
     "path": "TowableRU_Ext.Towable_Ext",
     "create": "{var Towable_Ext = 
                           new Towable_Ext(TowableRU_Ext);
                 Towable_Ext.PolicyTowable = true;
                 return Towable_Ext}",
          "updaterRef": "#/updaters/Towable_Ext"
        }
      }
    },

If the risk unit has additional business fields you wish to make writeable, you must add them to the file manually. For most fields, you can find information on how to add them to a schema in Endpoint architecture.

Configuring the damageable

All fields in the damageable updater must be added manually.

An entity's DisplayName field is not writeable. Therefore, there is no need to provide an updater for the damageable's displayName field.

As an example of a damageable updater, suppose you have a custom damageable named Towable_Ext that has the following writeable fields:

  • PolicyTowable
  • LicensePlate (a business field)

The updater for the damageable would be:

"Towable_Ext":
  ...
  "properties":
    "policyTowable": {
      "path": "Towable_Ext.PolicyTowable"
    },
    "licensePlate": {
      "path": "Towable_Ext.LicensePlate"
    }