Files

276 lines
12 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateListView.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateExportView.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateImportView.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/ITemplateChannelListView.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateInfoControlView.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateViewModel.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateInfoControlViewModel.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplate.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateListViewModel.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/ITemplateChannelListViewModel.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateChannel.cs
- Common/DTS.CommonCore/Interface/GroupTemplate/ITestObjectTemplate.cs
generated_at: "2026-04-16T12:16:13.665831+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7ad50e5b491c81bf"
---
# GroupTemplate Interface Module Documentation
## 1. Purpose
This module defines the contract layer for the Group Template subsystem within the DTS application. It provides interfaces for Views, ViewModels, and data models that manage group templates—entities that associate channels with groups and support import/export functionality. The module follows a Model-View-ViewModel (MVVM) architecture, separating presentation concerns from business logic. These interfaces enable testability and decoupling between concrete implementations and their consumers.
---
## 2. Public Interface
### View Interfaces (Marker Interfaces)
| Interface | Namespace | Base | Description |
|-----------|-----------|------|-------------|
| `IGroupTemplateListView` | `DTS.Common.Interface.GroupTemplate` | `IBaseView` | Marker interface for list view |
| `IGroupTemplateExportView` | `DTS.Common.Interface.GroupTemplate` | `IBaseView` | Marker interface for export view |
| `IGroupTemplateImportView` | `DTS.Common.Interface.GroupTemplate` | `IBaseView` | Marker interface for import view |
| `ITemplateChannelListView` | `DTS.Common.Interface.GroupTemplate` | `IBaseView` | Marker interface for channel list view |
| `IGroupTemplateInfoControlView` | `DataPro.Common.Interface` | `IBaseView` | Marker interface for info control view |
---
### `IGroupTemplateViewModel`
**Namespace:** `DTS.Common.Interface.GroupTemplate`
**Base:** `IBaseViewModel`
```csharp
IGroupTemplateImportView ImportView { get; set; }
IGroupTemplateExportView ExportView { get; set; }
void Unset();
```
- **ImportView/ExportView**: Properties for accessing import/export view implementations.
- **Unset()**: Clears or resets the view model state. Behavior implementation-specific.
---
### `IGroupTemplateInfoControlViewModel`
**Namespace:** `DataPro.Common.Interface`
**Base:** `IBaseViewModel`
```csharp
IGroupTemplateInfoView View { get; }
IGroupTemplateModel SelectedGroupTemplate { get; set; }
```
- **View**: Read-only property returning the associated Shell View.
- **SelectedGroupTemplate**: Gets or sets the currently selected group template model.
---
### `IGroupTemplate`
**Namespace:** `DTS.Common.Interface.GroupTemplate`
```csharp
bool Disabled { get; set; }
string Name { get; set; }
string Description { get; set; }
string Channels { get; set; }
string AssociatedGroups { get; set; }
string LastModifiedBy { get; set; }
DateTime LastModified { get; set; }
string SerialNumber { get; set; }
bool Filter(string term);
```
- **Disabled**: Flag indicating whether the template is disabled.
- **Name/Description**: Template identification and documentation.
- **Channels/AssociatedGroups**: String representations of related entities (format unclear from interface).
- **LastModifiedBy/LastModified**: Audit tracking fields.
- **SerialNumber**: Unique identifier for the template.
- **Filter(string term)**: Returns `true` if the template matches the search term; matching criteria implementation-specific.
---
### `IGroupTemplateListViewModel`
**Namespace:** `DTS.Common.Interface.GroupTemplate`
**Base:** `IBaseViewModel`, `IFilterableListView`
```csharp
IGroupTemplateListView View { get; set; }
void GetAllTemplates(bool bIncludeEmbedded, bool bISOMode);
void Unset();
void Sort(object o, bool columnClick);
IGroupTemplate[] Templates { get; set; }
void Filter(string term);
void MouseDoubleClick(int index);
```
- **View**: Associated list view instance.
- **GetAllTemplates(bool bIncludeEmbedded, bool bISOMode)**: Loads templates; `bIncludeEmbedded` controls whether embedded templates are included, `bISOMode` behavior unclear from interface.
- **Unset()**: Clears view model state.
- **Sort(object o, bool columnClick)**: Sorts the template list; `o` represents the sort criteria, `columnClick` indicates sort direction toggle behavior.
- **Templates**: Array of loaded templates.
- **Filter(string term)**: Filters the template list by search term.
- **MouseDoubleClick(int index)**: Handles double-click interaction on the template at the specified index.
---
### `ITemplateChannelListViewModel`
**Namespace:** `DTS.Common.Interface.GroupTemplate`
**Base:** `IBaseViewModel`
```csharp
ITemplateChannelListView View { get; set; }
void Unset();
void Sort(object o, bool columnClick);
void Filter(string term);
void SetAllChannels(IGroupTemplateChannel[] channels);
IGroupTemplateChannel[] GetAllChannels();
void MoveDown(IGroupTemplateChannel channel);
void MoveUp(IGroupTemplateChannel channel);
void SetParent(object o);
```
- **View**: Associated channel list view instance.
- **Unset()**: Clears view model state.
- **Sort(object o, bool columnClick)**: Sorts channels; parameters same as list view model.
- **Filter(string term)**: Filters channels by search term.
- **SetAllChannels(IGroupTemplateChannel[] channels)**: Replaces the channel collection.
- **GetAllChannels()**: Returns the current channel array.
- **MoveDown/MoveUp(IGroupTemplateChannel channel)**: Adjusts `DisplayOrder` of the specified channel relative to siblings.
- **SetParent(object o)**: Associates the channel list with a parent object; type of `o` unclear from interface.
---
### `IGroupTemplateChannel`
**Namespace:** `DTS.Common.Interface.GroupTemplate`
```csharp
bool Custom { get; }
int DisplayOrder { get; set; }
string NameOfTheChannel { get; set; }
string Name { get; }
bool Required { get; set; }
string ISOCode { get; }
bool Filter(string term);
```
- **Custom**: Read-only flag indicating whether the channel is user-defined.
- **DisplayOrder**: Sortable position index.
- **NameOfTheChannel**: Mutable channel name.
- **Name**: Read-only name property (relationship to `NameOfTheChannel` unclear).
- **Required**: Flag indicating whether the channel is mandatory.
- **ISOCode**: Read-only ISO code identifier.
- **Filter(string term)**: Returns `true` if the channel matches the search term.
---
### `GroupTemplateChannelComparer`
**Namespace:** `DTS.Common.Interface.GroupTemplate`
**Base:** `IComparer<IGroupTemplateChannel>`
```csharp
GroupTemplateChannelFields SortField { get; set; }
bool Ascending { get; set; }
int Compare(IGroupTemplateChannel x, IGroupTemplateChannel y);
```
- **SortField**: Enum value from `GroupTemplateChannelFields` determining sort criteria.
- **Ascending**: Direction flag; `true` for ascending, `false` for descending.
- **Compare(IGroupTemplateChannel x, IGroupTemplateChannel y)**: Compares two channels based on `SortField`. Handles nulls (null < non-null). Throws `ArgumentOutOfRangeException` for unrecognized `SortField` values.
---
### `ITestObjectTemplate`
**Namespace:** `DTS.Common.Interface.GroupTemplate`
```csharp
string TemplateName { get; set; }
string TemplateNameOrOriginalTemplateName { get; }
string Icon { get; set; }
string Description { get; set; }
bool LocalOnly { get; set; }
int Version { get; set; }
string LastModifiedBy { get; set; }
DateTime LastModified { get; set; }
int CRC32 { get; set; }
string TestObject { get; set; }
string TestObjectType { get; set; }
string TemplateParent { get; set; }
bool SysBuilt { get; set; }
string OriginalTemplateName { get; set; }
bool Embedded { get; set; }
bool IsISOMode();
```
- **TemplateName**: Identifier; may be a GUID for embedded templates.
- **TemplateNameOrOriginalTemplateName**: Read-only human-readable name.
- **Icon/Description**: UI display properties.
- **LocalOnly**: Restricts template to local use.
- **Version**: Version number (comment notes "not currently used").
- **CRC32**: Checksum value (comment notes "not currently used").
- **TestObject/TestObjectType**: ISO meta fields.
- **TemplateParent**: Parent template reference (usage unclear per comments).
- **SysBuilt**: System-generated flag.
- **OriginalTemplateName**: Preserved name when embedded (GUID assigned as new `TemplateName`).
- **Embedded**: Indicates whether template is embedded in a test setup.
- **IsISOMode()**: Returns ISO mode status; implementation-specific.
---
## 3. Invariants
1. **Null Handling in Comparer**: `GroupTemplateChannelComparer.Compare` treats `null` as less than any non-null value. Two nulls are equal (returns 0).
2. **DisplayOrder Consistency**: `MoveUp` and `MoveDown` operations on `ITemplateChannelListViewModel` must maintain consistent `DisplayOrder` values across the channel collection.
3. **Embedded Template Naming**: When `ITestObjectTemplate.Embedded` is `true`, `TemplateName` is expected to be a GUID, while `OriginalTemplateName` preserves the human-readable name.
4. **SortField Enum Coverage**: `GroupTemplateChannelComparer.Compare` supports `Required`, `Name`, `ISOCode`, `Custom`, and `DisplayOrder` fields only. Any other value throws `ArgumentOutOfRangeException`.
---
## 4. Dependencies
### This Module Depends On:
| Dependency | Usage |
|------------|-------|
| `DTS.Common.Base` | `IBaseView`, `IBaseViewModel` base interfaces |
| `DataPro.Common.Base` | Alternative namespace for `IBaseView`, `IBaseViewModel` |
| `DTS.Common.Interface.Pagination` | `IFilterableListView` for list filtering |
| `DTS.Common.Enums.GroupTemplates` | `GroupTemplateChannelFields` enum for sorting |
| `System` | `DateTime`, `IComparer<T>`, `StringComparison` |
### Consumers (Inferred):
Concrete implementations of Views, ViewModels, and Models in higher-level modules will implement these interfaces. Specific consumers cannot be determined from the provided source files.
---
## 5. Gotchas
1. **Mixed Namespaces**: The codebase uses both `DTS.Common.*` and `DataPro.Common.*` namespaces inconsistently. `IGroupTemplateInfoControlView` and `IGroupTemplateInfoControlViewModel` use `DataPro.Common` while all other interfaces use `DTS.Common`. This may indicate a refactoring in progress or historical naming inconsistency.
2. **Unused Properties**: `ITestObjectTemplate.Version` and `ITestObjectTemplate.CRC32` are explicitly documented as "not currently used" in the source comments. Implementers should be aware these may have no functional effect.
3. **Ambiguous Name Properties**: `IGroupTemplateChannel` has both `NameOfTheChannel` (read/write) and `Name` (read-only). The relationship between these is not documented in the interface.
4. **Parameter Naming Convention**: Methods like `GetAllTemplates(bool bIncludeEmbedded, bool bISOMode)` use Hungarian notation (`b` prefix for booleans), which is inconsistent with modern C# conventions.
5. **Unknown Types**: Several interfaces reference types not defined in the provided sources:
- `IGroupTemplateModel` (referenced in `IGroupTemplateInfoControlViewModel`)
- `IGroupTemplateInfoView` (referenced in `IGroupTemplateInfoControlViewModel`)
- `GroupTemplateChannelFields` enum (referenced in `GroupTemplateChannelComparer`)
6. **Channels/AssociatedGroups Format**: `IGroupTemplate.Channels` and `IGroupTemplate.AssociatedGroups` are typed as `string`, but the expected format (CSV, JSON, delimited) is unclear from the interface alone.