Image affiliation¶
Image affiliation records associate an already-indexed image with a business entity or claim-related context, identified by an AffiliationImageSeqNum. The object supports the full CRUD lifecycle: a new affiliation gets a generated sequence number before insert, existing affiliations can be retrieved individually or as a collection scoped to an image, and updates/deletes operate by the affiliation's own sequence number.
| Field | Value |
|---|---|
| Operation ID | OP-IMG-02 |
| Trigger | Caller calls clsImageAffiliation.NewImageAffiliation/Save() to create, GetImageAffiliation/clsImageAffiliationCollection.GetImageAffiliationCollection to retrieve, or Save()/delete on an existing instance to update or remove |
| Inputs | ImageSeqNum (the image being affiliated), AffiliationImageSeqNum (the affiliated entity's key), and, for retrieval, ImageAffiliationSeqNum or ImageSeqNum |
| Outputs | Persisted IMAGE_AFFILIATION row (insert/update), a populated clsImageAffiliation/clsImageAffiliationCollection (retrieve), or row removal (delete) |
| Primary components | clsImageAffiliation.BeforeCreate, clsImageAffiliation.BeforeInsert, clsImageAffiliation.BeforeRetrieve, clsImageAffiliation.BeforeUpdate, clsImageAffiliation.BeforeDelete, clsImageAffiliationCollection.BeforeRetrieve |
| Entry point | Business\SAIF.Business.Imaging\clsImageAffiliation.vb, Business\SAIF.Business.Imaging\clsImageAffiliationCollection.vb |
Steps¶
- Caller provides
ImageSeqNumand affiliation context (AffiliationImageSeqNum) to a newclsImageAffiliationinstance viaNewImageAffiliation. - Validate required fields. The registered rules require a non-zero
AffiliationImageSeqNum(IMAGEAFF1) and a non-zeroImageSeqNum(IMAGEAFF2), checked on each property set. - On failure: a broken rule is added and blocks save until both keys are populated.
- Generate the sequence number.
BeforeCreateexecutes SQL-001 to obtain the nextIMAGE_AFFILIATION_SEQ_NUMfromIMAGE_AFFILIATION_SEQ.nextval(DUAL);AfterCreatereads the scalar result intoImageAffiliationSeqNumand rebuilds the criteria object with it. - Insert the affiliation row.
BeforeInsertsetsCreateUserfrom the data-portal user ID and executes SQL-004 to insert into IMAGE_AFFILIATION, bindingAffiliationImageSeqNum,ImageAffiliationSeqNum,ImageSeqNum, andCreateUser. - Retrieve a single affiliation.
BeforeRetrieveexecutes SQL-017 byImageAffiliationSeqNum;AfterRetrievefills the object from the reader if a row is returned and marks it old. - Retrieve all affiliations for an image.
clsImageAffiliationCollection.BeforeRetrieveexecutes SQL-018 filtered byImageSeqNum;AfterRetrieveloads each row into a newclsImageAffiliationand adds it to the collection. - Update an existing affiliation.
BeforeUpdatesetsCreateUseragain and executes SQL-033 to updateAffiliationImageSeqNum,CreateDate(tosysdate),CreateUser, andImageSeqNumfor the row keyed byImageAffiliationSeqNum. - Delete an existing affiliation.
BeforeDeleteexecutes SQL-039, removing the IMAGE_AFFILIATION row keyed byImageAffiliationSeqNum. - Note:
AfterInsert,AfterUpdate, andAfterDeleteare present as commented-out templates only; no rows-affected verification is performed after these operations in live code.*
Process flow¶
The following diagram visualizes the image affiliation operation's create/retrieve/update/delete paths.
flowchart TD
Start([Caller provides ImageSeqNum<br>and AffiliationImageSeqNum]) --> Which{Which action?}
Which -->|Create| Validate[Validate: keys non-zero]
Validate --> VOk{Rules pass?}
VOk -->|No| Fail([Broken rules returned])
VOk -->|Yes| GenSeq[BeforeCreate: generate<br>IMAGE_AFFILIATION_SEQ_NUM]
GenSeq --> Insert[BeforeInsert: INSERT row]
Insert --> Done([Affiliation created])
Which -->|Retrieve one| RetrieveOne[BeforeRetrieve by<br>ImageAffiliationSeqNum]
RetrieveOne --> DoneR([Affiliation loaded])
Which -->|Retrieve collection| RetrieveAll[BeforeRetrieve by<br>ImageSeqNum]
RetrieveAll --> DoneRC([Collection loaded])
Which -->|Update| Update[BeforeUpdate: UPDATE row]
Update --> DoneU([Affiliation updated])
Which -->|Delete| Delete[BeforeDelete: DELETE row]
Delete --> DoneD([Affiliation deleted])
Failure and edge-case behavior¶
AfterInsert,AfterUpdate, andAfterDeleteonclsImageAffiliationare present only as commented-out template code, so no rows-affected concurrency check runs after these operations; a failed insert/update/delete may go undetected by this class.*- The required-field rules (
IMAGEAFF1,IMAGEAFF2) run on every property set, not gated by a dirty check, so they apply uniformly to new and loaded instances.
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.Imaging\clsImageAffiliation.vbBusiness\SAIF.Business.Imaging\clsImageAffiliationCollection.vb