OP-012: Reserve an image id and write a document with its index sidecar¶
QueueImage is invoked over the Imaging route on SAIF.Services.WCF.Services.ImagingService; this page documents the process end to end, from route dispatch to the message the caller receives.
Optional task metadata passed through to the .idx sidecar; observed C# implementation signature is ImageTaskConfig taskConfig = null (No (C# default null)). SOAP-level optionality and any wire default cannot be confirmed without the external IImagingService contract/WSDL.**
Response
long
long
BCL (System)
The reserved image id assigned to the queued document.
Constructor resolves the Oracle IMG connection, evaluates ImagingHelper.IsClaimDatabase(imagingConnectionString) into the unused useClaimDatabase flag, opens the unit of work, and constructs a FileService (BR-WCF-002).
Enforce.ArgumentNotNull(file), Enforce.ArgumentNotNullOrWhiteSpace(fileExtension), Enforce.ArgumentNotNull(imageConfig); note environment is not guarded (BR-WCF-023).
On failure: ArgumentNullException, logged and surfaced as a generic SOAP fault.
ReserveImageId() delegates to unitOfWork.GetRepository<Image>().GetNextImageId(), outside any transaction, so the id is consumed even if a later step fails (BR-WCF-024).
WriteFileWithIdx generates a GUID file name (BR-WCF-025) and resolves wcf.importqueuelocation, wcf.useobimportpriorityfolders, and one of wcf.lowpriorityfolder / wcf.medpriorityfolder chosen by imageConfig.SystemGeneratedFlag (BR-WCF-026).
EnsureFullPath normalizes the extension to a leading . and the directory to a trailing \ (BR-WCF-027).
Delegate to FileService.WriteFile to write the document bytes (BR-WCF-004).
Origin: This step is implemented in WriteFile and executed within this operation.
Delegate to FileService.WriteFile again to write the sidecar .idx file containing imageConfig.ToIDXFileString(imageId, taskConfig) as ASCII (BR-WCF-028); a failure here leaves the document file present without its index.*
Origin: This step is implemented in WriteFile and executed within this operation.
Return imageId.
On failure: logged by the installed error handler, surfaced as a generic SOAP fault; nothing is rolled back because no transaction and no compensating delete exist.
The following diagram visualizes this process's control flow.
flowchart TD
A["Resolve IMG connection, open unit<br>of work, construct FileService"]
B["Validate file, fileExtension,<br>and imageConfig arguments"]
C["Reserve next image id"]
D["Resolve queue folder and<br>generate GUID file name"]
E["Normalize extension and directory path"]
F["Write document bytes to file"]
G["Write .idx sidecar file"]
H["Return imageId."]
A --> B
B --> C
C --> D
D --> E
E --> F
F --> G
G --> H
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.