-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathi_PackageDataset.pas
More file actions
88 lines (74 loc) · 3.4 KB
/
Copy pathi_PackageDataset.pas
File metadata and controls
88 lines (74 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
unit i_PackageDataset;
(*
Copyright © 2025, 2026
William Meyer All rights reserved.
Narrow interface over the package metadata dataset.
Abstracts FireDAC and VCL dependencies from units that need
to read and write package data without knowing about
TFDMemTable or d_Metadata directly.
IBookmarkedMetadataItem extends IMetadataItem with a TBookmark
for write-back. It is declared here rather than in
i_MetadataViewer because the bookmark concept belongs to the
dataset layer, not to the general metadata viewer contract.
*)
interface
uses
Data.DB,
i_MetadataViewer;
type
/// <summary>
/// Extends IMetadataItem with a dataset bookmark, allowing the
/// write-back path to navigate to the originating record without
/// casting interface references to concrete types.
/// </summary>
IBookmarkedMetadataItem = interface(IMetadataItem)
['{A7B8C9D0-E1F2-3456-0123-567890123456}']
/// <summary>Returns the dataset bookmark for the originating record.</summary>
/// <remark>The caller is responsible to call FreeBookmark after use.</remark>
function GetBookmark: TBookmark;
/// <summary>Dataset bookmark for the originating record.</summary>
property Bookmark: TBookmark read GetBookmark;
end;
/// <summary>
/// Narrow abstraction over the package metadata dataset.
/// Consumers navigate, read, and write through this interface
/// with no knowledge of FireDAC, TFDMemTable, or d_Metadata.
/// </summary>
IPackageDataset = interface
['{B8C9D0E1-F2A3-4567-1234-678901234567}']
/// <summary>Returns a bookmark for the current dataset record.</summary>
function GetCurrentBookmark: TBookmark;
/// <summary>Navigates the dataset to the record identified by the supplied bookmark.</summary>
procedure GotoBookmark(const ABookmark: TBookmark);
/// <summary>Releases a bookmark previously obtained from GetCurrentBookmark.</summary>
procedure FreeBookmark(const ABookmark: TBookmark);
/// <summary>Returns the value of the named field from the current record.</summary>
/// <remarks>Call GotoBookmark before ReadFieldAsString to ensure the correct record is current.</remarks>
function ReadFieldAsString(const AFieldName: string): string;
/// <summary>Writes edited values back to the record identified by the supplied bookmark.</summary>
/// <remarks>
/// Only the four user-editable fields are written: Supplier, SupplierURL,
/// LicenseID, and Description.
/// </remarks>
procedure ApplyItemValues(
const ABookmark: TBookmark;
const AVersion: string;
const ASupplier: string;
const ASupplierURL: string;
const ALicenseID: string;
const ADescription: string);
/// <summary>Disables dataset-linked controls during a batch update.</summary>
procedure DisableControls;
/// <summary>Re-enables dataset-linked controls after a batch update.</summary>
procedure EnableControls;
/// <summary>Applies a filter showing only packages with incomplete metadata.</summary>
procedure ShowIncompleteOnly;
/// <summary>Removes any active filter, showing all packages.</summary>
procedure ShowAllPackages;
/// <summary>Reverts all pending changes, restoring the dataset to its last saved state.</summary>
procedure RevertPackages;
/// <summary>Returns True if the dataset contains no records.</summary>
function IsEmpty: Boolean;
end;
implementation
end.