External view update tracking¶
This operation records and updates the external-view refresh state for a given image file (identified by ImageFileCode and ImageFileKey). It is used to know whether a document's externally-visible rendering reflects the latest data or is pending an update. Updates are protected by an optimistic concurrency check on UPDATE_NUM.
| Field | Value |
|---|---|
| Operation ID | OP-IMG-03 |
| Trigger | Caller creates a new tracking row via clsImageFileExternalViewUpdate, retrieves an existing one by file code/key, or updates it after the external view date changes |
| Inputs | ImageFileCode, ImageFileKey, external view date, and (for update) the current UpdateNum |
| Outputs | Persisted IMAGE_FILE_EXT_VIEW_UPDATE row (insert), a populated instance (retrieve), or an updated row with an incremented UPDATE_NUM (update) |
| Primary components | clsImageFileExternalViewUpdate.BeforeInsert, clsImageFileExternalViewUpdate.BeforeRetrieve, clsImageFileExternalViewUpdate.BeforeUpdate, clsImageFileExternalViewUpdate.AfterUpdate |
| Entry point | Business\SAIF.Business.Imaging\clsImageFileExternalViewUpdate.vb |
Steps¶
- Caller provides
ImageFileCodeandImageFileKeyto a newclsImageFileExternalViewUpdateinstance, along with the external view date to record. - Insert the tracking row.
BeforeInsertexecutes SQL-006 to insert into IMAGE_FILE_EXT_VIEW_UPDATE. - Retrieve an existing tracking row.
BeforeRetrieveexecutes SQL-027 to load the record byImageFileKeyandImageFileCode. - Update the tracking row.
BeforeUpdateexecutes SQL-035; the WHERE clause requires the row's currentUPDATE_NUMvalue in addition to the file key, functioning as an optimistic concurrency check. - Verify the update.
AfterUpdatereads the rows-affected result and raises an error message if it is not exactly one row. - On failure (0 rows affected — the
UPDATE_NUMno longer matches): the update is rejected as a concurrency violation, meaning a concurrent update by another session already advanced the row.
Process flow¶
The following diagram visualizes the external view update tracking operation's control flow.
flowchart TD
Start([Caller provides ImageFileCode<br>and ImageFileKey]) --> Which{Which action?}
Which -->|Create| Insert[BeforeInsert: INSERT row]
Insert --> DoneI([Tracking row created])
Which -->|Retrieve| Retrieve[BeforeRetrieve by<br>ImageFileKey + ImageFileCode]
Retrieve --> DoneR([Tracking row loaded])
Which -->|Update| Update[BeforeUpdate: UPDATE row<br>WHERE current UPDATE_NUM]
Update --> Check{AfterUpdate:<br>exactly 1 row?}
Check -->|No| Conflict([Concurrency violation:<br>error raised])
Check -->|Yes| DoneU([Tracking row updated])
Failure and edge-case behavior¶
clsImageFileExternalViewUpdate.BeforeUpdaterequires the currentUPDATE_NUMvalue in the WHERE clause, so concurrent updates by different sessions to the same file key will cause the second update to affect zero rows.AfterUpdateraises an error message when the rows-affected count is not exactly one, surfacing the concurrency conflict to the caller rather than silently no-op'ing.
Related documentation¶
Sources¶
Business\SAIF.Business.Imaging\clsImageFileExternalViewUpdate.vb