Task collection retrieval¶
clsTaskCollection searches the TASK table with a caller-assembled Criteria object that supports source system, category, priority, date range, assignee, claim, policy, action code, and task-context filters. Because every filter is optional and additive, the same retrieval path serves everything from "all open tasks for a worker" to "every urgent third-party task assigned to a mail ID." The retrieved rows are handed to a source-code-specific factory so each row becomes an instance of the correct concrete task subclass.
| Field | Value |
|---|---|
| Operation ID | OP-TASK-02 |
| Trigger | Caller builds a clsTaskCollection.Criteria, sets zero or more filters, and calls clsTaskCollection.GetTasks(dataPortalInfo, criteria) |
| Inputs | Optional filters: task source code(s)/system(s), category code(s), priority code or TaskPriority level, begin/end date range, mail ID, claim ID(s), policy number(s), action code(s), task-context values (code, key, category, text, date, numeric), ShowCompleted flag, TaskText substring, row-count limit, inner/outer sort |
| Outputs | clsTaskCollection populated with one typed task instance per matching, non-deleted (by default) TASK row |
| Primary components | clsTaskCollection.BeforeRetrieve, clsTaskCollection.AfterRetrieve, clsTaskCollection.Criteria.FormatRequest, clsTaskCollection.NewTask, clsTaskSourceCodeCollection.TaskSource |
| Entry point | Business\SAIF.Business.Tasks\clsTaskCollection.vb |
Steps¶
- Caller configures the criteria. The caller adds zero or more filters to a
Criteriainstance:AddTaskSourceSystem/TaskSource(by enum or code string),AddTaskCategory,TaskPriorityCodeorPriorityLevel, a begin/end date window,MailID,AddClaimID,AddPolicyNumber,AddTaskActionCode,TaskText,ShowCompleted, aRowNumLimit, and inner/outer sort expressions. List-based filters (claim, policy, action, category, source) silently ignore non-positive or blank values. - Assemble the base SELECT.
BeforeRetrievesets the request's SQL statement to the criteria's fixedRetrieveSQLprojection of allTASKcolumns (SQL-008, TASK), then callsCriteria.FormatRequestto append the dynamicWHEREclause and an optional row-limiting wrapper. - Apply the base filter.
FormatOtherParametersalways restricts to non-deleted rows (DELETE_FLAG = 'N') unlessShowCompletedis set, in which case both deleted and active rows are returned (BR-023). - If
TaskTextis non-blank, an unparameterizedTASK_TEXT LIKE '%<value>%'fragment is appended directly to the SQL text rather than bound as a parameter.* - Apply the source, category, and priority filters.
FormatSourceCodeParametersandFormatCategoryParametersbind a single=predicate for one value or anIN (...)list with indexed bind parameters (:SOURCE1..N,:CAT1..N) for multiple values.FormatPriorityParameterbinds a single:PriorityCodewhen an explicit code is set; otherwise, ifPriorityLevelis notInformational, it expands to an inlineIN (...)list of literal priority codes cascading upward from the requested level —Lowincludes Low/Medium/High/Urgent,Mediumincludes Medium/High/Urgent,Highincludes High/Urgent, andUrgentmatches only Urgent (BR-024). - Apply the date, assignee, claim, policy, and action filters.
FormatDateParametersbinds:BeginDate/:EndDateagainstTRUNC(TASK_DATE)only when the caller narrowed the corresponding sentinel (Date.MinValue/Date.MaxValue).FormatMailIDParameterbinds:MailID(uppercased) when set.FormatClaimParameter,FormatPolicyParameter, andFormatActionCodeParametereach follow the same single-value/IN-list pattern as source and category. - Apply the task-context filters.
FormatContextParametersappendsCONTEXT_CODE,CONTEXT_KEY,CONTEXT_CATEGORY,CONTEXT_TEXT,CONTEXT_DATE, andCONTEXT_NUMpredicates directly as literal values in the SQL text (not bound parameters) whenever the corresponding criteria property is non-default.* - Apply row limiting and sorting. If
RowNumLimit > 0, the statement is wrapped asSELECT * FROM ( <query> ORDER BY <InnerSort> ) WHERE ROWNUM <= <limit>followed by an optionalORDER BY <OuterSort>; if no limit is set, only the outer sort is appended. - Execute and materialize rows.
AfterRetrievereads each row from the cursor, extracts the trimmedTaskSourceCode, and calls the collection's abstractNewTask()factory (implemented per concrete collection subclass) to obtain an empty task of the correct concrete type. - If the factory returns
Nothing: throw anApplicationExceptionnaming the unsupported source system, resolved throughclsTaskSourceCodeCollection.TaskSourcefor display. - Otherwise: call
Task.Load(dataPortalInfo, reader)to fill the concrete instance and add it to the collection.
Process flow¶
The following diagram visualizes how criteria filters combine into the final query and how each row is materialized.
flowchart TD
Start([Caller configures Criteria]) --> Base[Base SELECT from<br>TASK, all columns]
Base --> Filter1[Apply DELETE_FLAG filter<br>unless ShowCompleted]
Filter1 --> Filter2[Apply source, category,<br>priority filters]
Filter2 --> Filter3[Apply date, mail ID,<br>claim, policy, action filters]
Filter3 --> Filter4[Apply task-context filters]
Filter4 --> Limit{RowNumLimit set?}
Limit -->|Yes| Wrap[Wrap in ROWNUM<br>subquery with inner sort]
Limit -->|No| Sort[Append outer sort only]
Wrap --> Sort
Sort --> Exec[Execute query]
Exec --> Loop{More rows?}
Loop -->|Yes| Factory{NewTask factory<br>returns instance?}
Factory -->|No| Throw([ApplicationException:<br>unsupported source system])
Factory -->|Yes| LoadRow[Load row into<br>concrete task, add to collection]
LoadRow --> Loop
Loop -->|No| Done([Collection returned])
Failure and edge-case behavior¶
TASK_TEXT,CONTEXT_CODE,CONTEXT_CATEGORY,CONTEXT_TEXT,CONTEXT_DATE, andCONTEXT_NUMfilters are concatenated directly into the SQL text instead of using bind parameters, unlike every other filter in the criteria; this is a latent SQL-construction risk if caller-supplied values are not otherwise sanitized upstream.*- An unsupported
TaskSourceCodeon a retrieved row is a hard failure: the collection throws rather than skipping the row or returning a partial result. PriorityLevelandTaskPriorityCodeare independent properties; setting an explicitTaskPriorityCodetakes precedence and the cascadingPriorityLevelexpansion is only evaluated when no explicit code is set.- List-based filters (claim, policy, action, category, source) silently drop non-positive numeric values or blank strings rather than raising an error, so a caller that passes only invalid values effectively applies no filter for that dimension.*
ClearCriteria()resets filter lists and dates but does not resetRowNumLimit,InnerSort, orOuterSort, so a criteria object reused afterClearCriteria()keeps any previously configured limit and sort behavior.*
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.
Sources¶
Business\SAIF.Business.Tasks\clsTaskCollection.vb