Accessing risk assessment non-interactively

You can access risk assessment non-interactively by clicking Update Risk Evaluations on the Risk Analysis screen. PolicyCenter runs risk assessment for all locations on the policy period.

When accessing risk assessment non-interactively, PolicyCenter calls the Spotlight risk assessment service, saves the results, and creates an activity indicating whether the risk assessment succeeded or failed. This occurs without providing the user access to Spotlight interactive services.

The following illustration shows the flow when accessing Spotlight non-interactively from PolicyCenter.



For non-interactive risk assessment flow, the following steps correspond to the numbers in the previous illustration.

  1. The user selects Update Risk Evaluations and PolicyCenter calls the PolicyLocationRiskAssessmentRequestor class.

    This class requests risk assessments for all the locations on a policy period, by calling the enqueueForLocationsRiskAssessment method. This method creates a RiskEvaluationWorkItem which refers to the PolicyPeriod. It also sets the RequestingUser field to the current user. The workItem is created and committed in the PolicyPeriod bundle.

    The class also provides the static query isLocationsRiskAssessmentInProgress method to determine whether there is already an active RiskEvaluationWorkItem for this policy period.

  2. Policy Locations Risk Assessment batch processing writes items to the Policy Locations Risk Assessment work queue. This work queue starts risk assessment for all locations on the policy.

    This work queue does not have a finder. Therefore, batch requests are created explicitly by the PolicyLocationsRiskAssessmentRequestor class.

  3. The work queue calls PolicyLocationRiskAssessmentGateway class. The gateway ensures that the plugin methods are called correctly, checks permissions, and handles errors.
  4. The gateway class calls the PolicyLocationRiskAssessmentPlugin plugin.
  5. The plugin calls the Spotlight risk assessment service. The data is sent by OutboundPolicyData.
  6. The risk assessment data is returned with InboundRiskAssessmentData.
  7. The data is persisted in InboundLocationRiskAssessmentTempStore objects.
  8. For each location, the SpotlightNotificationActivityCreator class creates an activity indicating whether risk assessment succeeded or failed.
  9. Users can view the activities in PolicyCenter.