Code table management¶
The imaging library defines four parallel code-table families — category, document name, document type, and file type — each with a single-object business class and a matching collection class. These tables constrain the valid values used during image indexing, and this operation covers their shared CRUD pattern.
| Field | Value |
|---|---|
| Operation ID | OP-IMG-06 |
| Trigger | Caller creates, retrieves (single or collection), updates, or deletes a code-table object: clsImageCategoryCode, clsImageDocumentNameCode, clsImageDocumentTypeCode, or clsImageFileCode (and their *Collection counterparts) |
| Inputs | Code, description, and file/category/type context fields specific to each code table |
| Outputs | Persisted or retrieved code-table rows |
| Primary components | clsImageCategoryCode, clsImageCategoryCodeCollection, clsImageDocumentNameCode, clsImageDocumentTypeCode, clsImageDocumentTypeCodeCollection, clsImageFileCode, clsImageFileCodeCollection |
| Entry point | Business\SAIF.Business.Imaging\clsImageCategoryCode.vb, Business\SAIF.Business.Imaging\clsImageDocumentNameCode.vb, Business\SAIF.Business.Imaging\clsImageDocumentTypeCode.vb, Business\SAIF.Business.Imaging\clsImageFileCode.vb |
Steps¶
- Caller provides a code, description, and context fields (e.g.,
ImageFileCode,ImageCategoryCode) to a code-table business object, such asclsImageDocumentNameCode. - Insert the code row.
BeforeInsertexecutes the relevant insert statement for the object — SQL-005 for document-name codes. - Verify the insert.
AfterInsertconfirms exactly one row was affected. - On failure: an error message is raised.
- Retrieve a single code row. Single-object classes filter by their specific key fields — SQL-019 (category code by code and file code), SQL-023 (document type code by key), SQL-025 (file code by code).
- Retrieve all rows of a code table. Collection classes'
BeforeRetrievereturns the full table — SQL-020 (all category codes), SQL-024 (all document type codes), SQL-026 (all file codes). - Update or delete a code row. Update and delete paths exist for each object but may be incomplete in live code:
clsImageDocumentNameCode.UpdateSQL(SQL-034) andDeleteSQL(SQL-040) each concatenate a base statement with a separately-assignableWhereSqlStatementthat defaults to the bare literal" Where "with no predicate appended.** - If
WhereSqlStatementis never set to a real predicate before use: the resulting SQL ends in a danglingWHEREclause, which would fail at execution or (depending on the database driver) match unintended rows.**
Process flow¶
The following diagram visualizes the shared code-table CRUD pattern.
flowchart TD
Start([Caller provides code,<br>description, context fields]) --> Which{Which action?}
Which -->|Create| Insert[BeforeInsert: INSERT row]
Insert --> Check{AfterInsert:<br>exactly 1 row?}
Check -->|No| Error([Error raised])
Check -->|Yes| DoneI([Code row created])
Which -->|Retrieve one| RetrieveOne[BeforeRetrieve by key]
RetrieveOne --> DoneR([Code row loaded])
Which -->|Retrieve all| RetrieveAll[BeforeRetrieve: all rows]
RetrieveAll --> DoneRC([Collection loaded])
Which -->|Update/Delete| UpdDel[BeforeUpdate/BeforeDelete:<br>base SQL + WhereSqlStatement]
UpdDel --> WhereCheck{WhereSqlStatement<br>set to real predicate?}
WhereCheck -->|No| Dangling([Dangling WHERE clause:<br>likely execution failure])
WhereCheck -->|Yes| DoneUD([Code row updated/deleted])
Failure and edge-case behavior¶
clsImageDocumentNameCode.UpdateSQLandDeleteSQLend with a bareWHEREclause unlessWhereSqlStatementis separately assigned by the caller, suggesting those paths are incomplete or dead code in current usage.**AfterInsertrow-count verification exists across the code-table classes but not uniformly for update/delete lifecycle methods; behavior on a failed update/delete varies by class.*
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. Statements marked with**could not be confirmed; treat as unknown until verified.
Sources¶
Business\SAIF.Business.Imaging\clsImageCategoryCode.vbBusiness\SAIF.Business.Imaging\clsImageCategoryCodeCollection.vbBusiness\SAIF.Business.Imaging\clsImageDocumentNameCode.vbBusiness\SAIF.Business.Imaging\clsImageDocumentTypeCode.vbBusiness\SAIF.Business.Imaging\clsImageDocumentTypeCodeCollection.vbBusiness\SAIF.Business.Imaging\clsImageFileCode.vbBusiness\SAIF.Business.Imaging\clsImageFileCodeCollection.vb