NotePreferenceConversionService¶
Implements INotePreferenceConversionService, a one-time migration utility that reads legacy per-user .config XML profile files from a directory and converts any ClaimTasksNotes note-default preferences (category, type, external-view) found in them into Preference records persisted via NHibernate. It depends on NHibernateUnitOfWork for persistence and IUserProfileService to confirm the target user is authorized (CTNoteUpdate, CTNoteSupervisor, or CTNCENotes) before writing a converted preference.
Purpose¶
- Scans a directory for
*.configfiles, treating each file name (minus extension) as a user ID. - Parses each file's XML
Profileelements into key/value pairs, skipping theOnlineLogin~lastuserprofileverifydatekey. - Extracts the
ClaimTasksNotes~category,ClaimTasksNotes~type, andClaimTasksNotes~externalviewvalues and, once all three are found together, saves them as a single JSON-serializedPreferencerow for that user. - Only writes a preference for users who currently hold note-update, note-supervisor, or NCE-notes authorization.
- Reports the number of files read and preference records added via the supplied log writers.
Context¶
- Namespace:
SAIF.Services.Claims.Notes - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| NotePreferenceConversionService(...) | public NotePreferenceConversionService(NHibernateUnitOfWork unitOfWork, IUserProfileService userProfileService) |
Stores the unit of work and user profile service used by ConvertNotePreferences. |
| ConvertNotePreferences | public bool ConvertNotePreferences(string pathName, ILogWriter controlLog, ILogWriter controlReport) |
Reads every *.config file directly under pathName, converts each file's ClaimTasksNotes preference triples into Preference rows (for authorized users only), logs read/added counts to controlLog, and always returns true. |
Behavioral notes¶
- Each qualifying preference (category, type, and external-view all present) is persisted in its own
unitOfWork.Begin()/Commit()transaction insideSavePreferences, so partial failures on one user do not roll back preferences already saved for other users. - The
controlReportparameter is accepted but not used in the current implementation*. - Preference values are JSON-serialized into a single
PreferenceTextfield with keysCategoryCode,TypeCode, andExternalView, tagged withUpdateUser = "CTNCONV". - Users lacking
CTNoteUpdate,CTNoteSupervisor, orCTNCENotesauthorization are silently skipped — their config file is read but no preference is written for them. - The private
GetPrefKeyshelper (which returns aPrefKeyValues) is present but not called fromConvertNotePreferences's current logic path*, suggesting it may be leftover/unused code.
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¶
- Services/SAIF.Services/Claims/Notes/NotePreferenceConversionService.cs