Retrieve affiliated policies (legacy)¶
Loads the legacy affiliate-policy list for a policy — the predecessor to the newer Associations/PolicyAssociationList mechanism (see Retrieve policy associations) — filtering results by agent/agency number and marking the source policy as "current" in the resulting collection.
| Field | Value |
|---|---|
| Operation ID | op-09-retrieve-affiliated-policies |
| Trigger | Consumer reads obsolete affiliate members (clsAffiliatedPolicyCollection.GetAffiliatedPolicyCollection) |
| Inputs | Policy number, clsPolicyData.AffiliateTypes, optional agent number / agency sequence number |
| Outputs | clsAffiliatedPolicyCollection |
| Primary components | clsAffiliatedPolicyCollection.GetAffiliatedPolicyCollection, BeforeRetrieve/AfterRetrieve, SetCurrent |
| Entry point | SAIF.Business.View.Policy/clsAffiliatedPolicyCollection.vb |
Steps¶
- Caller invokes
GetAffiliatedPolicyCollection(inDataportal, inPolicyNum, inAffiliateType), which builds aCriteriaand forwards to theCriteria-accepting overload (BR-VP-011). - The
Criteria-accepting overload branches oninCriteria.AffiliateType: if it isNonAffiliated, the data-access layer'sCreateObjectis called instead ofRetrieveObject, producing a new, empty collection without querying the database at all (BR-VP-013); otherwiseRetrieveObjectproceeds normally. - Framework invokes
BeforeRetrieve: assignsMyCriteria.RetrieveSQL, setsCommandType = StoredProcedure, and bindsin_policy_num,in_affiliate_type(the affiliate type name, upper-cased, SQL-014), andin_include_affil_totals("TRUE"/"FALSE"string literal derived fromMyCriteria.IncludeAffiliateTotals), plus a cursor parameterrecordset(SQL-001, procedurepk72846_view_policy.getpolicyaffiliatelist). - Framework executes the request against Oracle.
- Framework invokes
AfterRetrieve: loopsReader.Read, constructs aNew clsAffiliatedPolicyand callsAffiliatedPolicy.Load(MyCriteria.DataPortalInfo, Reader)per row, then applies an agent/agency filter before adding each row to the collection (BR-VP-012): - If
MyCriteria.AgentNum = 0 And MyCriteria.AgencySeqNum = 0, the row is always added (no filter). - Else if
MyCriteria.AgentNum <> 0and matchesAffiliatedPolicy.AgentNum, the row is added. - Else if
MyCriteria.AgencySeqNum <> 0and matchesAffiliatedPolicy.AgencySeqNum, the row is added. - Rows matching none of these are silently excluded.
- After the loop,
SetCurrent(MyCriteria.PolicyNum.ToString)marks the source policy's row as the collection's current item (commented-out code shows an earlier version that instead defaulted to item0when the source policy was not found in the result set). clsPolicyData.SetCurrentAffiliatedPolicy(inPolicyNum)(inclsPolicyData.vb,#Region "Policy Affiliate") provides an alternate entry point that operates on an already-retrieved collection rather than re-querying.*
Process flow¶
flowchart TD
Start(["Consumer requests<br>affiliated policies"]) --> A{AffiliateType =<br>NonAffiliated?}
A -->|Yes| B["CreateObject: empty<br>collection, no query"]
A -->|No| C["RetrieveObject:<br>BeforeRetrieve assigns<br>getpolicyaffiliatelist"]
C --> D["Framework executes<br>against Oracle"]
D --> E["AfterRetrieve reads rows"]
E --> F{More rows?}
F -->|Yes| G["New clsAffiliatedPolicy / Load"]
G --> H{Agent/agency<br>filter matches?}
H -->|Yes| I["Add to collection"]
H -->|No| F
I --> F
F -->|No| J["SetCurrent to source<br>policy number"]
B --> End(["Return clsAffiliatedPolicyCollection"])
J --> End
Failure and edge-case behavior¶
- When
AffiliateType = NonAffiliated, the collection is created empty with no data-access call at all — a caller cannot distinguish "no query needed" from "query returned zero rows" by inspecting the collection alone.* - The agent/agency filter in
AfterRetrievesilently drops non-matching rows rather than raising or logging — a caller who expected the full unfiltered affiliate list would see a partial result with no indication rows were excluded.* SetCurrentassumes the source policy number is present among the retrieved rows; the currently-active code no longer has the fallback-to-item-0 behavior that the commented-out code shows was once in place, so if the source policy is absent the current-item selection is unclear from this pass alone.**
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/clsAffiliatedPolicyCollection.vbSAIF.Business.View.Policy/clsPolicyData.vb