com.ail.insurance.quotation.assessrisk
Class AssessRiskService

java.lang.Object
  extended by com.ail.core.Type
      extended by com.ail.core.Service
          extended by com.ail.insurance.quotation.assessrisk.AssessRiskService
All Implemented Interfaces:
ConfigurationOwner, CoreUser, java.io.Serializable, java.lang.Cloneable

public class AssessRiskService
extends Service

Version:
$Revision: 1.7 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ail.core.Type
jXPathContext, NOT_PERSISTED
 
Constructor Summary
AssessRiskService()
          Default constructor
 
Method Summary
 CommandArg getArgs()
          Getter returning the arguments used by this entry point.
 java.lang.String getConfigurationNamespace()
          Return the product type id of the policy we're assessing the risk for as the configuration namespace.
 Core getCore()
          Getter to fetch the entry point's code.
 Version getVersion()
          Fetch the version of this entry point.
 VersionEffectiveDate getVersionEffectiveDate()
          Return the date for which rules etc should be used.
 void invoke()
          Assess risks logic is pretty simple, all of the actual risk assessment logic is handled by business rules.
 void setArgs(CommandArg args)
          Setter used to the set the entry points arguments.
 
Methods inherited from class com.ail.core.Service
getConfiguration, getSecurityPrincipal, resetConfiguration, setConfiguration
 
Methods inherited from class com.ail.core.Type
addAttribute, clone, deleteLock, deleteSerialVersion, fetchJXPathContext, getAttribute, getAttribute, getAttributeCount, getForeignSystemId, getLock, getSerialVersion, getSystemId, hasLock, hasSerialVersion, hasSystemId, isPersisted, markAsNotPersisted, mergeWithDataFrom, removeAttribute, removeAttribute, setAttribute, setForeignSystemId, setLock, setSerialVersion, setSystemId, xpathGet, xpathGet, xpathIterate, xpathSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssessRiskService

public AssessRiskService()
Default constructor

Method Detail

getCore

public Core getCore()
Getter to fetch the entry point's code. This method is demanded by the EntryPoint class.

Specified by:
getCore in class Service
Returns:
This entry point's instance of Core.

getVersion

public Version getVersion()
Fetch the version of this entry point.

Specified by:
getVersion in class Service
Returns:
A version object describing the version of this entry point.

getVersionEffectiveDate

public VersionEffectiveDate getVersionEffectiveDate()
Return the date for which rules etc should be used. todo This should come from someplace in the policy.

Specified by:
getVersionEffectiveDate in interface CoreUser
Overrides:
getVersionEffectiveDate in class Service
Returns:
Date to define rules to be used etc.

getConfigurationNamespace

public java.lang.String getConfigurationNamespace()
Return the product type id of the policy we're assessing the risk for as the configuration namespace. The has the effect of selecting the product's configuration.

Specified by:
getConfigurationNamespace in interface CoreUser
Overrides:
getConfigurationNamespace in class Service
Returns:
product type id

setArgs

public void setArgs(CommandArg args)
Setter used to the set the entry points arguments.

Specified by:
setArgs in class Service
Parameters:
args - for invoke

getArgs

public CommandArg getArgs()
Getter returning the arguments used by this entry point.

Specified by:
getArgs in class Service
Returns:
An instance of $Name: $Args.

invoke

public void invoke()
            throws BaseException
Assess risks logic is pretty simple, all of the actual risk assessment logic is handled by business rules. The steps are as follows:
  1. Check the precondition:
    1. We must have been given a policy (policy!=null)
    2. The policy must have a status of Application (policy.status=Application)
    3. The policy must have a productTypeId (policy.productTypeId!=null && policy.productTypeId.length>0)
  2. Loop through each of the sections in the policy, and:
    1. Check that the section has a SectionTypeId, throw a PreconditionException if it doesn't.
    2. Load the service called <ProductTypeID>/<SectionTypeID>
    3. Create a AssessmentSheet object.
    4. Pass the policy, section, and assessmentSheet into the rule.
    5. Invoke the rule.
    6. Pull the assessmentSheet out of the rule and add it to the section.
  3. Load the service called <ProductTypeID>
  4. Create a AssessmentSheet object.
  5. Pass the policy, and assessmentSheet into the rule.
  6. Invoke the rule.
  7. Pull the assessmentSheet out of the rule and add it to the policy.

Specified by:
invoke in class Service
Throws:
BaseException