Incidents and risk units: Incident endpoints
After you have configured your incident and risk unit data model, you must generate endpoints for both the incident and the risk unit. The following section describes differences in the REST endpoint generator behavior when the target entity is an incident.
For an overview of the process of implementing custom incidents and risk units, see Incidents and risk units: Implementation overview.
For information on how to run the REST endpoint generator, see REST endpoint generator overview.
Differences in the generator prompts
The REST endpoint generator checks to see if the target entity is a subtype of
Incident
. If it is, the REST endpoint generator considers the
entity to be an incident entity.
For incident endpoints:
- The endpoints are always added to the Claim API.
- The endpoints are always child endpoints (with
Claim
as the parent). - The collection is always backed by a Gosu query.
- The resource is always added to the claim integration graph.
Therefore:
- There is no prompt asking which API to add the endpoints to.
- There is no prompt asking if the endpoints are root resource endpoints.
- There is no prompt asking for the name of the parent.
- There is no prompt asking whether you want the endpoint to be stream-back or query-backed.
- There is no prompt asking if you want the entity to be added to an integration graph.
There is one additional prompt asking whether to create child endpoints for assessment content items.
Differences in the generated files
Resources
The REST endpoint generator always creates a new resource for the custom incident.
If you chose to also create children /assessment-content-item
endpoints, the REST endpoint generator does not create a new resource for the
assessment content items. Rather, it uses the base configuration
AssessmentContentItem
resource. For a description of the
business functionality of these endpoints, see the Cloud API Consumer Guide.
Schemas
The custom incident's schema
For standard entities, the REST endpoint generator makes only the following changes to the schema configuration files:
- It adds an
id
property to the API's schema extension file - It adds a mapper for the
id
property to the API's mapping extension file.
For incidents, the generator makes the following additional changes.
- In the schema extension file, it adds the following properties, as these are
standard entity model properties found on the
Incident
supertype:description
(sortable and filterable)lossParty
(sortable and filterable)severity
(sortable and filterable)
- In the mapper extension file, it adds mappers for the
description
,lossParty
, andseverity
properties. - In the updater extension file, it adds updaters for the
description
,lossParty
, andseverity
properties.
The Exposure
schema
Every exposure must be
associated with an incident. The Exposure
resource has a foreign
key property for each type of incident the exposure could be associated with. For
example, there is a baggageIncident
property, a
dwellingIncident
property, a
fixedPropertyIncident
property, and so on.
To ensure that
exposures can be associated with the custom incident type, the generator modifies
the Exposure
schema configuration files in the following
ways:
- In the schema extension file, it adds a
<customIncident>
property. - In the mapping extension file, it adds a
<customIncident>
property. - It creates a
<CustomIncident>
JsonValueResolver
in a new child package in thegw.rest.ext.cc.claim.v1.claims
package. - In the updater extension file, it adds a
<customIncident>
property that references the<CustomIncident>
JsonValueResolver
.
The Claim graph schema
The generator also creates a Gosu
enhancement named
Claim<CustomIncident>RestV1Enhancement_Ext
. This
enhancement has a single getter named <CustomIncident>Sorted_Ext
that returns a list of CustomIncident
instances sorted by
description
and then by id
.
The
generator adds a <customIncident>
array property to the
Claim graph schema extension file. The array is sorted using the
<CustomIncident>Sorted_Ext
getter.
Schema changes for assessment content items
When you choose to create child endpoints for assessment content items, the generator does the following:
- In the Claim graph, it adds an
assessmentContentItems
property to theIncident
schema.
OrderedContentItemLine
, which orders by
IncidentOrder
. The customer can optionally change the mapper to use
a different order. The endpoint is also added to the
claim_ext-1.0.swagger.yaml file.