Skip to content

OP-001: Run the OnBase keyword sync

This is the entire business operation of the application. It logs the run mode, clears invalid person keyword syncs, retrieves and orders the unprocessed batch, delegates the sync to OnBase, and rethrows any exception so the framework can map it to an exit code.

Field Value
Operation ID OP-001
Trigger ConsoleBase.Run() after Initialize() returns and Environment.ExitCode is set to 0†
Lifecycle stage Execute
Owning component OnBaseKeywordSyncRunner.Execute
Inputs None from the command line; all inputs are environment settings and Imaging API data
Outputs OnBase keyword updates applied; Imaging API records marked processed; narrated console/log output
Failure exit code 5 — any unhandled exception rethrown from Execute()

Steps

  1. Log "OnBase Keyword Sync execution started."
  2. Read OnBaseKeywordSync.onbaseasync as bool and log the resulting mode (BR-OBKS-001)
  3. On failure: a bool conversion failure throws an exception → exit code 5
  4. Construct ImagingApiClient: read imagingapiurl, append v1/Integration, read onbasekeywordsync.imagingClientTimeoutSeconds, and build a JsonHttpClient with ClientInfo { ApplicationId = "OnBaseKeywordSync", MachineName = <machine, upper>, UserId = <Windows user, upper> } and a timeout in milliseconds
  5. On failure: a missing/invalid setting throws an exception → exit code 5
  6. Delegate to OP-002 (clear invalid person keyword syncs) (BR-OBKS-002)
  7. On failure: propagates → exit code 5
  8. GET ImageKeywordSyncs?getDocumentCount={OnBaseKeywordSync.getdocumentcount}, order the result by Id ascending (BR-OBKS-003)
  9. On failure: propagates → exit code 5
  10. Log the record count and the sum of TotalDocumentUpdates
  11. On failure: KeywordUpdates null on any record throws NullReferenceException → exit code 5*
  12. Delegate to OP-003 (sync the batch with OnBase) (BR-OBKS-004, BR-OBKS-005, BR-OBKS-006, BR-OBKS-007, BR-OBKS-008, BR-OBKS-009)
  13. On failure: propagates → exit code 5
  14. On any exception: LogError the message, LogException the exception, rethrow
  15. The framework maps the rethrown exception to exit code 5†

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    A["Log execution started"] --> B["Read onbaseasync<br>and log the mode"]
    B --> C["Construct ImagingApiClient"]
    C --> D["OP-002: Clear invalid<br>person keyword syncs"]
    D --> E["Retrieve unprocessed<br>keyword syncs, order by Id"]
    E --> F["Log record count<br>and total document updates"]
    F --> G["OP-003: Sync a keyword<br>batch with OnBase"]
    G --> H["Complete"]
    B -.->|Conversion failure| ERR["Exit code 5"]
    C -.->|Missing setting| ERR
    D -.->|Exception| ERR
    E -.->|Exception| ERR
    F -.->|NullReferenceException| ERR
    G -.->|Exception| ERR

Logging

Log id Written content
Not application-assigned (fans out to all registered file0–file4 writers) "OnBase Keyword Sync execution started.", "Updates will be sent to OnBase {asynchronously\|synchronously}", "Found {n} unprocessed image_keyword_sync records with a total of {m} total docs to update."

Error handling

  • Any exception raised during this operation is logged (WriteError + LogException) and rethrown; ProgramRunnerBase maps the rethrown exception to exit code 5, since no SaifConsoleException subclass is ever thrown by this application.
  • There is no per-record error isolation: one failed record aborts the remaining batch, and already-processed records are not rolled back*.

Note: Statements marked with † are derived from dependency library documentation via the Legends CLI. Statements marked with * were inferred from code structure or contextual evidence.

Sources

  • OnBaseKeywordSync/OnBaseKeywordSyncRunner.cs
  • OnBaseKeywordSync/Services/ImagingApiClient.cs