Skip to content

Employee directory retrieval

This operation returns lists of employees for directory-style use cases. clsEmployeeDataCollection reuses the same base employee query used by single-record lookups, then appends a literal predicate that matches the requested directory slice.

Field Value
Operation ID OP-SB-02
Trigger Caller invokes one of the collection factory methods such as GetEmployeeDataByDepartment or GetAllEmployeeData.
Inputs Query type, query value, include-virtual flag
Outputs clsEmployeeDataCollection
Primary components clsEmployeeDataCollection.GetEmployeeDataByDepartment, clsEmployeeDataCollection.Criteria.BeforeRetrieve, clsEmployeeDataCollection.AfterRetrieve
Entry point Business\SAIF.Business\clsEmployeeDataCollection.vb

Steps

  1. The caller selects a query type such as department, title, location, active employees, or all employees and packages the query value inside Criteria (BR-SB-011).
  2. BeforeRetrieve starts from the shared employee SQL template and appends the query-type-specific predicate directly onto the statement, such as DepartmentName = ..., JobTitle = ..., Location = ..., or ActiveInd = 1 (BR-SB-011, SQL-026, ADP_EMPLOYEE).
  3. When the caller requested the all-employees variant with virtual rows enabled, the criteria appends the UNION ALL virtual-employee branch so the directory contains both ADP and VIRTUAL_EMPLOYEE records (SQL-026, VIRTUAL_EMPLOYEE).
  4. The data portal runs the finished SQL and returns the result set as directory rows (SQL-026, ADP_EMPLOYEE, VIRTUAL_EMPLOYEE).
  5. AfterRetrieve creates one clsEmployeeData object per row, loads its fields from the result set, and appends it to the collection.
  6. Collection helpers such as GetByEmployeeID, Contains, and RemoveByEmployeeID operate only against the in-memory list built in the previous step.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Collection request]) --> Type[Choose query type]
    Type --> Build[Append literal filter predicate]
    Build --> Virtual{Include virtual employees?}
    Virtual -->|Yes| Union[Append virtual union]
    Virtual -->|No| Query[Run ADP query]
    Union --> Query
    Query --> Hydrate[Hydrate employee objects]
    Hydrate --> End([Return collection])

Failure and edge-case behavior

  • A query type with no matching rows returns an empty collection rather than raising an application error.
  • Virtual employees appear only on the all-employees path that explicitly enables the union branch.
  • The directory filters are concatenated as literals, so the exact filter shape is determined entirely by the selected query type and supplied value (BR-SB-011).

Sources

  • Business\SAIF.Business\clsEmployeeData.vb
  • Business\SAIF.Business\clsEmployeeDataCollection.vb