Lazy retrieval of policy detail and indicators¶
Defers a set of expensive per-policy lookups (waiver existence, extended detail record, secondary status, coverage-bound flag, information-page-printed flag, coverage gaps) until the corresponding property is first read, rather than loading them during GetPolicyData.
| Field | Value |
|---|---|
| Operation ID | op-02-lazy-retrieve-policy-detail |
| Trigger | Consumer reads a detail-backed property (e.g. HasWaiver, a detail field, GetCoverageBoundFlag, IsInformationPagePrinted) |
| Inputs | Policy number (from the already-retrieved clsPolicyData) |
| Outputs | Detail fields, flags |
| Primary components | LazyRead, RetrieveHasWaiver, RetrievePolicyDetail/FillDetail, GetSecondaryPolicyStatus, GetCoverageBoundFlag, IsInformationPagePrinted |
| Entry point | SAIF.Business.View.Policy/clsPolicyData.vb |
Steps¶
- A property getter (there are ~10 detail-backed properties in
clsPolicyData) callsLazyRead(LazyReadRequest.PolicyDetail)orLazyRead(LazyReadRequest.HasWaiver)before returning its backing field. LazyReaddispatches on the request type:HasWaiver→RetrieveHasWaiver()(no exception handling — a failure here propagates to the caller).PolicyDetail→RetrievePolicyDetail(), wrapped in aTry/Catchthat silently swallows all exceptions (BR-VP-026).RetrieveHasWaiver: guarded bym_WaiverRead(read-once flag); opens a portal request, setsCommandType = StoredProcedure,RequestType = Scalar,SQLStatement = MyCriteria.HasWaiverSQL(SQL-012, procedurePk82033_ThirdParty.get_policy_waiver_count), bindsPolicyNumand aWaiverCountreturn-value parameter, processes the request, and casts the return value toBooleanviaCBool.RetrievePolicyDetail: guarded bym_PolicyDetailRead; opens a portal request withRequestType = Reader,SQLStatement = MyCriteria.RetrieveDetailSQL(SQL-011, procedurepk72846_view_policy.getviewdetail), bindsapolicynumand a cursor parameter, and setsAfterRequestMethod = AddressOf FillDetailso the framework invokesFillDetailonce the request completes.FillDetailreads the first row (if the reader is not closed) and hydrates ~20 detail fields (m_ChapterCode,m_ComboWrapSubFlag,m_CurrentBalance, date fields converted viaclsSmartDate,m_NaicsCode/m_NaicsDescr,m_SicCode, etc.) directly from named reader columns.GetSecondaryPolicyStatus(invoked by another lazily-backed property, not gated by aLazyReadflag) executesMyCriteria.GetSecondaryPolicyStatusSQL(SQL-015) asCommandType.Text/Scalar, bindingin_policy_num, and trims the scalar result — an empty string if the result is null.GetCoverageBoundFlagonly runs its query ifPolicyPeriods.Count > 0(short-circuits otherwise). It executesMyCriteria.GetCoverageBoundFlagSQL(SQL-016) asText/Scalar, bindingin_policy_numandin_policy_period_eff_datefromGetCurrentPolicyPeriod().PolicyPeriodEffDate(see Retrieve policy periods), and returnsTrueonly if the trimmed result equals"Y".IsInformationPagePrinted(policyNum, effDate)executesMyCriteria.GetIsInformationPagePrintedSQL(SQL-017, procedureSP72347_INFO_PAGE_PRINTED_YN) asCommandType.StoredProcedure/Scalar, bindingin_policy_num,in_policy_period_eff_date, and anout_flagreturn-value parameter; returnsTrueonly if the flag equals"Y".- Coverage gaps (SQL-018, procedure
pk72846_view_policy.getgaps) are exposed through a similarly lazily-triggered accessor that was not directly located in this pass — cross-referenced from the hub catalog only.**
Process flow¶
flowchart TD
Start(["Property getter reads<br>a detail-backed field"]) --> A["LazyRead dispatches<br>on request type"]
A -->|HasWaiver| B["RetrieveHasWaiver:<br>scalar query, get_policy_waiver_count"]
A -->|PolicyDetail| C["RetrievePolicyDetail:<br>reader query, getviewdetail"]
B --> D["m_Waiver flag set,<br>m_WaiverRead = True"]
C --> E{Try succeeds?}
E -->|Yes| F["FillDetail hydrates<br>detail fields"]
E -->|No| G["Exception swallowed,<br>fields remain default"]
F --> H["m_PolicyDetailRead = True"]
G --> H
D --> End(["Return requested field"])
H --> End
Failure and edge-case behavior¶
RetrievePolicyDetailfailures are caught and discarded — the caller sees default field values with no indication a read failed (BR-VP-026).RetrieveHasWaiverhas no exception handling — a data-access failure propagates directly to the caller of theHasWaiver-backed property.*- Both
m_WaiverReadandm_PolicyDetailReadare read-once flags: a caught exception inRetrievePolicyDetailstill setsm_PolicyDetailRead = True, so a transient failure is never retried on a subsequent property read within the same object instance.* GetCoverageBoundFlagreturnsFalse(not unknown) whenPolicyPeriods.Count = 0, which is indistinguishable from a genuine "not bound" result.*
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Related documentation¶
Sources¶
SAIF.Business.View.Policy/clsPolicyData.vb