Skip to content

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

  1. Caller provides ImageSeqNum and affiliation context (AffiliationImageSeqNum) to a new clsImageAffiliation instance via NewImageAffiliation.
  2. Validate required fields. The registered rules require a non-zero AffiliationImageSeqNum (IMAGEAFF1) and a non-zero ImageSeqNum (IMAGEAFF2), checked on each property set.
  3. On failure: a broken rule is added and blocks save until both keys are populated.
  4. Generate the sequence number. BeforeCreate executes SQL-001 to obtain the next IMAGE_AFFILIATION_SEQ_NUM from IMAGE_AFFILIATION_SEQ.nextval (DUAL); AfterCreate reads the scalar result into ImageAffiliationSeqNum and rebuilds the criteria object with it.
  5. Insert the affiliation row. BeforeInsert sets CreateUser from the data-portal user ID and executes SQL-004 to insert into IMAGE_AFFILIATION, binding AffiliationImageSeqNum, ImageAffiliationSeqNum, ImageSeqNum, and CreateUser.
  6. Retrieve a single affiliation. BeforeRetrieve executes SQL-017 by ImageAffiliationSeqNum; AfterRetrieve fills the object from the reader if a row is returned and marks it old.
  7. Retrieve all affiliations for an image. clsImageAffiliationCollection.BeforeRetrieve executes SQL-018 filtered by ImageSeqNum; AfterRetrieve loads each row into a new clsImageAffiliation and adds it to the collection.
  8. Update an existing affiliation. BeforeUpdate sets CreateUser again and executes SQL-033 to update AffiliationImageSeqNum, CreateDate (to sysdate), CreateUser, and ImageSeqNum for the row keyed by ImageAffiliationSeqNum.
  9. Delete an existing affiliation. BeforeDelete executes SQL-039, removing the IMAGE_AFFILIATION row keyed by ImageAffiliationSeqNum.
  10. Note: AfterInsert, AfterUpdate, and AfterDelete are 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, and AfterDelete on clsImageAffiliation are 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.

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.vb
  • Business\SAIF.Business.Imaging\clsImageAffiliationCollection.vb