TaskService¶
Implements ITaskService (extending ValidatingServiceBase*) as the central service for claim activities ("tasks"): querying, creating, updating, completing, deleting, reassigning in bulk, and printing tasks tied to injury claims. It coordinates a large set of collaborators — IUnitOfWork for the Task/TaskGroup/TaskCategory/TaskPriority repositories, IUserProfileService for the current/target user and claim-note preferences, IDocumentService for PDF generation, IValidationService for ClaimTask validation, IClaimInformationService and IRTWService for claim security/RTW masking rules, IPolicyInformationService for policy name lookups, IImagingClient for OnBase document integration, ILogService for exception logging, IWorkCalendarService for due-date adjustment, and claim/worker query providers plus a Guidewire claim API client for building Claim domain objects.
Purpose¶
- Retrieves individual tasks, task groups, and filtered task lists, masking worker names on confidential/secured/conflict claims according to the current user's security access and RTW load code.
- Creates new tasks (stateful
CreateTaskand statelessCreateTaskStatelessoverloads), assigning default category/priority/source, work-day-adjusted due dates, and validating the result before persisting. - Updates existing tasks, detecting stale concurrent edits via
UpdateNumber, flags whether a UI refresh is required, and optionally completes the task as part of the update. - Completes or deletes tasks individually or in bulk (comma-delimited ID lists), writing a claim note when a completed/deleted task is flagged for the notepad.
- Reassigns tasks in bulk to a new user, date, priority, group, and/or text, subject to per-field "only if provided" semantics.
- Produces PDF reports of filtered task lists and note printable output, and exposes claim/user/date validity checks used by
ClaimTaskValidator.
Context¶
- Namespace:
SAIF.Services.Claims.Tasks - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| ValidGroups | public IEnumerable<string> ValidGroups { get; } |
The set of task-group identifiers (parsed from the ClaimActivities.ValidGroups environment setting) that are treated as valid assignees alongside individual mail IDs. |
| ClaimTaskCategoryCode | public const string ClaimTaskCategoryCode = "CLMM" |
The default task-category code applied to claim tasks created without an explicit category. |
| TaskService(...) | public TaskService(IUnitOfWork unitOfWork, IUserProfileService userProfileService, IDocumentService documentService, IValidationService validationService, IClaimInformationService claimInformationService, IRTWService rtwService, IEnvironmentService environmentService, IPolicyInformationService policyInformationService, IImagingClient imagingClient, ILogService logService, IWorkCalendarService workCalendarService, IClaimQueryProvider claimQueryProvider, IWorkerQueryProvider workerQueryProvider, ICCClaimApiService claimApiService) |
Validates required collaborators are non-null, stores them, loads the current user's ClaimTasksNotes/ClaimNoteDefaults note preferences, builds a ClaimUserSecurityAccess for the current user, and parses ValidGroups from environment configuration. |
| GetTaskById | public ClaimTask GetTaskById(long id) |
Returns the task with the given ID mapped to a ClaimTask contract, or a mapped null result if no task with that ID exists. |
| GetTaskGroups | public IEnumerable<TaskGroup> GetTaskGroups() |
Returns all configured task groups mapped to TaskGroup contracts. |
| GetTasks | public IEnumerable<ClaimTask> GetTasks(TaskFilter filter) |
Returns claim/imaging-sourced, non-"INFO" tasks matching the filter (deleted-state, claim number, assigned user/group, and any additional filters), with worker name, policy, conflict/secure flags, and RTW masking applied; returns an empty list when no valid group configuration, claim, or user filter is present. |
| GetAdditionalInfoTask | public ClaimTask GetAdditionalInfoTask(string claimNumber) |
Returns the most recent non-deleted "INFO"-priority/"INFO"-user task for the claim, or synthesizes an unsaved placeholder task (with TaskDate set to DateTime.MaxValue.Date) if none exists. |
| GetOnBaseEncodedString | public string GetOnBaseEncodedString(string claimNumber) |
Calls the imaging API client to obtain an OnBase encoded query string for the claim's custom query, logging and returning null if the call throws. |
| CanUserEdit | public bool CanUserEdit(string userId) |
Returns true when userId is non-blank and the resolved system user is authorized for CTTaskUpdate or RTWExternalUpdate. |
| IsValidClaim | public bool IsValidClaim(string claimNum) |
Returns true if an injury claim with the given claim number exists. |
| IsValidWorkDate | public bool IsValidWorkDate(DateTime workDate) |
Returns true when the date is between today and two years from today, inclusive. |
| GetClaimWorkerName | public string GetClaimWorkerName(string claimNum) |
Deprecated: always throws NotImplementedException ("This method is not implemented and is deprecated as part of the CSI project"); the working implementation has been commented out. |
| CreateTaskStateless(TaskEditContext, ...) | public long CreateTaskStateless(TaskEditContext taskEdit, IMessageContainer messages, bool isBatchCommit = false) |
Builds a new Task entity from the edit context (resolving claim, policy, category defaults, priority, group, and due-date adjustment), validates it, and — unless isBatchCommit is true (in which case the caller controls the transaction) — begins and commits its own transaction; returns the new task's ID, or 0 if validation fails. |
| CreateTaskStateless(TaskEdit, ...) | public long CreateTaskStateless(TaskEdit task, IMessageContainer messages, bool isBatchCommit = false) |
Maps a TaskEdit to a TaskEditContext and delegates to the TaskEditContext overload. |
| CreateTask | public ClaimTask CreateTask(TaskEdit task, IMessageContainer messages) |
Begins a transaction, builds and validates a new ClaimTask/Task pair (resolving claim, policy, category, priority, group, and adjusted due date), commits and returns the persisted, editable ClaimTask on success, or an empty ClaimTask if validation fails. |
| UpdateTask | public bool UpdateTask(long id, ref TaskEdit task, IMessageContainer messages) |
Begins a transaction and applies the edit to the existing task, failing with an error if the task ID is invalid or if UpdateNumber indicates a concurrent edit; sets task.IsRefreshRequired when the date, user, or completion status changed; completes/deletes the task when IsComplete is set; validates and commits, returning whether the update succeeded. |
| DeleteTask | public bool DeleteTask(long id, IMessageContainer messages) |
Begins a transaction, marks the task deleted (or reports an "Invalid Task ID" error if not found), writes a claim note if the task was flagged for the notepad, commits, and always returns true. |
| CompleteTasks | public void CompleteTasks(string ids) |
In one transaction, marks each comma-delimited task ID as deleted/completed (recording a claim note for each). |
| DeleteTasks | public void DeleteTasks(string ids) |
In one transaction, marks each comma-delimited task ID as deleted (not completed), recording a claim note only for notepad-flagged tasks. |
| ReassignTasks | public void ReassignTasks(string ids, string newTaskUser, DateTime newTaskDate, Boolean? newPriority, string newGroup, string newText) |
In one transaction, updates each comma-delimited task ID's user, work-day-adjusted date, priority, group, and/or text — applying each field only when a corresponding non-empty/non-null value is supplied, and only rewriting text when the task is image-backed and not worker-name-masked. |
| PrintTasks | public byte[] PrintTasks(TaskFilter filter) |
Builds an XML report payload for the filtered task list and returns the rendered PDF bytes from IDocumentService.GeneratePdf using the "Clm_TaskAndNotes_Tasks" template. |
| HasMedia | public bool HasMedia(long claimId) |
Returns whether the claim has associated imaging media, per the imaging client's HasMedia check for DocTypeGroup.CLAIM. |
Behavioral notes¶
- Extends
ValidatingServiceBase*, whose members are not documented here because it could not be confirmed as a type from a documented dependency library. - All create/update/delete/reassign/complete operations that own their own transaction call
_unitOfWork.Begin()thenCommit();CreateTaskStatelessskips the transaction boundary entirely whenisBatchCommitis true, deferring to the caller. - Worker names are masked to
"Confidential"for conflict/secure claims unless the current user has the matchingHasConflict/HasSecureclaim security access or a claim-level security override; RTW-loaded external users are also checked viaIRTWService.CanAccessRTWClaim. CreateTaskNote/AddLimitToHistory-style note creation throws anApplicationExceptionif the current user's claim-note category/type preferences are not set, requiring preferences be configured before tasks can be completed.UpdateTasktreats a mismatchedUpdateNumberas an optimistic-concurrency conflict and rolls back with a "someone else has updated this data" error.GetClaimWorkerName(string)is dead/deprecated code — it always throwsNotImplementedException; callers relying on the private overloads (by claim or by flattened task data) are unaffected.
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/Tasks/TaskService.cs