Provider retrieval¶
Provider retrieval reads the PROVIDER header row — joined to its primary tax ID row for a formatted tax ID and registered name — either as a single clsProvider object or as a clsProviderCollection. The single-object factory overloads on parameter type to select between a provider-ID lookup and a primary-tax-ID lookup; the collection factory supports either an explicit list of primary tax IDs or an arbitrary caller-supplied WHERE clause. The retrieved provider exposes its locations, tax IDs, and payee-facing address/phone/name through lazily loaded child properties.
| Field | Value |
|---|---|
| Operation ID | OP-VP-01 |
| Trigger | clsProvider.GetProvider(inDataportal, inProviderID); clsProvider.GetProvider(inDataportal, inPrimaryTaxID); clsProviderCollection.GetProviderCollection(inDataportal, inPrimaryTaxIDs()); clsProviderCollection.GetProvidersUsingWhere(inDataportal, inWhereClause) |
| Inputs | Provider ID (Decimal), or primary tax ID (String), or an array of primary tax IDs, or a caller-supplied SQL WHERE clause fragment |
| Outputs | A read-only clsProvider (single retrieval) or a populated clsProviderCollection; lazily resolved ProviderLocations, TaxIDs, and PrimaryLocation/payee properties |
| Primary components | clsProvider.GetProvider, clsProvider.Criteria, clsProviderCollection.GetProviderCollection, clsProviderCollection.GetProvidersUsingWhere, clsProviderCollection.Criteria |
| Entry point | Business\SAIF.Business.View.Provider\clsProvider.vb |
Steps¶
- Select the single-provider lookup key.
GetProvideris overloaded: passing a Decimal constructs a criteria withCriteriaRetrieveTypes.GetByProviderID; passing a String constructs a criteria withCriteriaRetrieveTypes.GetByPrimaryTaxID. The criteria retains whichever key was supplied. - Bind the retrieve parameter.
BeforeRetrieveselects the baseSELECTjoiningPROVIDERtoPROVIDER_TAX_IDon the primary tax ID and binds either:PrimaryTaxIDor:ProviderIDdepending on the criteria's retrieve type (SQL-003, SQL-004, PROVIDER, PROVIDER_TAX_ID). - Read the single row.
AfterRetrievereads at most one row from the result set, fills the object's provider ID, primary tax ID, formatted tax ID, and registered name, and marks the object as previously persisted (MarkOld). - If no row matches: the object remains in its default (empty) state; no exception is raised.
- Mark the object read-only.
GetProvidersetsReadOnly = Trueon the returned object before returning it, so callers cannot save changes back through this path. - Retrieve a provider collection by tax ID list.
GetProviderCollectionbuilds a criteria carrying the supplied array of primary tax IDs. - Retrieve a provider collection by arbitrary WHERE clause.
GetProvidersUsingWherebuilds a criteria carrying the caller-suppliedWHEREclause fragment verbatim. - The caller is responsible for supplying a syntactically valid
WHEREclause; no validation or sanitization is performed on this input.* - Compose the collection SQL. The collection criteria's
RetrieveSQLreusesclsProvider.Criteria.RETRIEVE_SELECT_SQLand appends either the tax-IDIN (...)predicate built from the supplied array, or the caller's rawWHEREclause if one was supplied instead (SQL-007, PROVIDER, PROVIDER_TAX_ID). - Populate the collection.
AfterRetrieveiterates the result set, constructs aclsProviderper row, callsLoadon each (which fills the row and marks it old), and adds each to the collection. - Resolve lazy child data on demand. Reading
ProviderLocationson a populatedclsProvidertriggers a location-collection retrieval by provider ID; readingTaxIDstriggers a tax ID collection retrieval by provider ID; both are cached on first access.
Origin:
ProviderLocationsdelegates to the Provider location retrieval operation, andTaxIDsdelegates to the Provider tax ID retrieval operation, both implemented in this library. 10. Resolve payee-facing properties.PayeeAddressresolves the active tax-ID address whose effective/expiration window covers today and whose tax ID matches the primary location's provider's primary tax ID, falling back to the primary location's active payment address when no matching tax-ID address is found;PayeeIDreturns the provider ID as a string;PayeeTypeCodeis the fixed literal"PROV".
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([GetProvider or GetProviderCollection called]) --> Which{Single or collection?}
Which -->|Single, by ID| SingleID[Bind ProviderID parameter]
Which -->|Single, by tax ID| SingleTax[Bind PrimaryTaxID parameter]
Which -->|Collection, tax ID list| CollTax[Build tax ID IN clause]
Which -->|Collection, WHERE clause| CollWhere[Use caller supplied WHERE clause]
SingleID --> Exec1[Execute retrieve query]
SingleTax --> Exec1
Exec1 --> Row{Row found?}
Row -->|Yes| Fill1[Fill object; MarkOld; set ReadOnly]
Row -->|No| Empty1([Empty object returned; no exception])
CollTax --> Exec2[Execute retrieve query]
CollWhere --> Exec2
Exec2 --> Loop[For each row: create clsProvider,<br>Load, add to collection]
Loop --> Done2([Populated collection returned])
Fill1 --> Done1([Read only provider returned])
Failure and edge-case behavior¶
- A single-provider lookup that matches no row returns an object in its default state rather than throwing; callers must check for a zero/default provider ID to detect a miss.
GetProvidersUsingWhereaccepts a raw SQL fragment from the caller with no validation, so a malformed or maliciousWHEREclause is a caller responsibility, not something this operation guards against.*- The returned single-provider object is marked read-only, so any attempt to persist changes back through the standard save path is blocked by that flag rather than by a business rule.
PayeeAddressresolution depends onPrimaryLocationandTaxIDsboth being resolvable; if a provider has no locations,PrimaryLocationreturnsNothingand the subsequent address lookup dereferences it, a code path not explicitly guarded against.*
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
Business\SAIF.Business.View.Provider\clsProvider.vbBusiness\SAIF.Business.View.Provider\clsProviderCollection.vb