Domain Model
Relevant source files
The following files were used as context for generating this wiki page:
The Domain Model of the SSA Consulta Rapida project establishes the core business entities, value objects, and constants that define the system's logic independently of the user interface or infrastructure. It resides in the src/domain directory and is strictly prohibited from depending on Qt, SQLite, or the filesystem to maintain a clean architecture.
Sources: AGENTS.md:14-14, src/domain/SsaTypes.h:17-17
Core Data Structures
The system represents SSA (Solicitação de Serviço de Apoio) data through several key structures designed for value semantics and explicit ownership.
SSA Entities
- SsaRecord: Represents a single row of data from the database, storing information as a map of string keys to string values.
- SsaId: A final class wrapping a string to provide type-safe identification for individual SSA records.
Sources: src/domain/SsaTypes.h:80-92, src/domain/SsaTypes.h:103-110
Query and Pagination Objects
To facilitate efficient data retrieval, the domain defines specific request and result objects:
- SsaPageRequest: Encapsulates all parameters for a query, including pagination indices, search text, column-specific filters, sorting specifications, and visibility settings.
- SsaPageResult: Holds a collection of
SsaRecordobjects alongside metadata about the total row count and the current page context.
Sources: src/domain/SsaTypes.h:118-133
Class Relationship Diagram
The following diagram illustrates the relationships between the primary domain types used for data representation and querying.
Sources: src/domain/SsaTypes.h:103-133
Filtering and Search Logic
Filtering is handled through a structured expression system that allows for both general search and column-specific criteria.
Filter Specifications
The system supports multiple MatchMode types for filtering data: Contains, StartsWith, EndsWith, Equals, and Regex. Individual search criteria are encapsulated in a FilterTerm, which includes the target text, the match mode, and a negation flag.
Sources: src/domain/SsaTypes.h:94-101
Domain Constants and Constraints
The domain model enforces specific constraints through constants and utility functions:
| Constant | Value | Description |
|---|---|---|
kMinPageSize | 10 | Minimum allowed rows per page. |
kMaxPageSize | 500 | Maximum allowed rows per page. |
kDefaultPageSize | 100 | Default page size. |
kStatusLastSortColumn | "numero_ssa" | Default column for status-aware sorting. |
kScaSesSteExclusionSummary | "sem SCA/SES/STE" | Label for the default filter exclusion. |
Sources: src/domain/SsaTypes.h:18-24
Metadata and Cataloging
The ColumnCatalog serves as the registry for all available data fields within the SSA domain. It provides structural definitions and metadata that drive both the SQL query generation and the UI presentation.
Column Definitions
Each column is defined by a ColumnDef structure containing:
- key: The internal identifier (e.g., database column name).
- label: The human-readable display name.
- type: The data type (
Text,Integer, orDateText). - defaultVisible: Whether the column is shown by default.
- generalSearch: Whether the column is included in global search queries.
Sources: src/domain/ColumnCatalog.h:10-26
Data Flow for Queries
The following diagram shows how domain request objects are processed by the query system to produce domain results.
Conclusion
The Domain Model provides a robust, Qt-independent foundation for the SSA project. By centralizing type definitions, validation logic (via clamping functions), and metadata (via the ColumnCatalog), it ensures that the core business rules remain consistent across the application's query services and presentation layers.