@@ -71,10 +71,39 @@ codeunit 40021 "Cloud Mig. Replicate Data Mgt."
71
71
exit ( CanBeIncluded) ;
72
72
end ;
73
73
74
+ procedure IncludeTableToReplication( TableID: Integer ; CompanyName: Text [30 ])
75
+ begin
76
+ IncludeExcludeTableFromReplication( TableID, CompanyName, true) ;
77
+ end ;
78
+
79
+ procedure ExcludeTableFromReplication( TableID: Integer ; CompanyName: Text [30 ])
80
+ begin
81
+ IncludeExcludeTableFromReplication( TableID, CompanyName, false) ;
82
+ end ;
83
+
84
+ local procedure IncludeExcludeTableFromReplication( TableID: Integer ; CompanyName: Text [30 ]; NewReplicateData: Boolean )
85
+ var
86
+ IntelligentCloudStatus: Record "Intelligent Cloud Status";
87
+ TablesModified: Text ;
88
+ SeparatorChar: Char ;
89
+ begin
90
+ IntelligentCloudStatus. SetRange( "Table Id", TableID) ;
91
+ IntelligentCloudStatus. SetRange( "Company Name", CompanyName) ;
92
+ if not IntelligentCloudStatus. FindSet() then
93
+ exit ;
94
+
95
+ CheckCanChangeTheTable( IntelligentCloudStatus) ;
96
+ SeparatorChar := ' ,' ;
97
+ IntelligentCloudStatus. FindSet() ;
98
+ repeat
99
+ UpdateReplicateDataForTable( IntelligentCloudStatus, TablesModified, SeparatorChar, NewReplicateData) ;
100
+ until IntelligentCloudStatus. Next() = 0 ;
101
+
102
+ LogMessageForChangedReplicateData( Format( TableID) , NewReplicateData) ;
103
+ end ;
104
+
74
105
internal procedure IncludeExcludeTablesFromCloudMigration( var IntelligentCloudStatus: Record "Intelligent Cloud Status"; NewReplicateData: Boolean )
75
106
var
76
- HybridCloudManagement: Codeunit "Hybrid Cloud Management";
77
- TelemetryDictionary: Dictionary of [Text , Text ];
78
107
TablesModified: Text ;
79
108
SeparatorChar: Char ;
80
109
begin
@@ -83,49 +112,105 @@ codeunit 40021 "Cloud Mig. Replicate Data Mgt."
83
112
84
113
SeparatorChar := ' ,' ;
85
114
repeat
86
- if IntelligentCloudStatus. "Replicate Data" <> NewReplicateData then begin
87
- InsertInitialLog( IntelligentCloudStatus) ;
88
- IntelligentCloudStatus. "Replicate Data" := NewReplicateData;
89
- IntelligentCloudStatus. Modify () ;
90
- InsertModifyLog( IntelligentCloudStatus) ;
91
- TablesModified += IntelligentCloudStatus. "Table Name" + SeparatorChar;
92
- end ;
115
+ UpdateReplicateDataForTable( IntelligentCloudStatus, TablesModified, SeparatorChar, NewReplicateData) ;
93
116
until IntelligentCloudStatus. Next() = 0 ;
94
117
95
118
TablesModified := TablesModified. TrimEnd( SeparatorChar) ;
119
+ LogMessageForChangedReplicateData( TablesModified, NewReplicateData) ;
120
+ end ;
121
+
122
+ local procedure UpdateReplicateDataForTable( var IntelligentCloudStatus: Record "Intelligent Cloud Status"; var TablesModified: Text ; SeparatorChar: Char ; NewReplicateData: Boolean )
123
+ begin
124
+ if IntelligentCloudStatus. "Replicate Data" <> NewReplicateData then begin
125
+ InsertInitialLog( IntelligentCloudStatus) ;
126
+ IntelligentCloudStatus. "Replicate Data" := NewReplicateData;
127
+ IntelligentCloudStatus. Modify () ;
128
+ InsertModifyLog( IntelligentCloudStatus) ;
129
+ TablesModified += IntelligentCloudStatus. "Table Name" + SeparatorChar;
130
+ end ;
131
+ end ;
132
+
133
+ local procedure LogMessageForChangedReplicateData( TablesModified: Text ; NewReplicateData: Boolean )
134
+ var
135
+ HybridCloudManagement: Codeunit "Hybrid Cloud Management";
136
+ TelemetryDictionary: Dictionary of [Text , Text ];
137
+ begin
96
138
TelemetryDictionary. Add ( ' Category' , HybridCloudManagement. GetTelemetryCategory()) ;
97
139
TelemetryDictionary. Add ( ' TablesModified' , TablesModified) ;
98
140
TelemetryDictionary. Add ( ' ReplicateData' , Format( NewReplicateData, 0 , 9 )) ;
99
141
Session. LogMessage( ' 0000MRJ' , ChangedReplicationPropertyLbl, Verbosity ::Normal, DataClassification ::SystemMetadata, TelemetryScope::ExtensionPublisher, TelemetryDictionary) ;
100
142
end ;
101
143
102
- internal procedure ChangePreserveCloudData( var IntelligentCloudStatus: Record "Intelligent Cloud Status"; NewPreserveCloudData: Boolean )
144
+ procedure SetPreserveDataForTable( TableID: Integer ; CompanyName: Text [30 ])
145
+ begin
146
+ SetResetPreserveDataForTable( TableID, CompanyName, true) ;
147
+ end ;
148
+
149
+ procedure ResetPreserveDataForTable( TableID: Integer ; CompanyName: Text [30 ])
150
+ begin
151
+ SetResetPreserveDataForTable( TableID, CompanyName, false) ;
152
+ end ;
153
+
154
+ local procedure SetResetPreserveDataForTable( TableID: Integer ; CompanyName: Text [30 ]; NewPreserveCloudData: Boolean )
103
155
var
104
- HybridCloudManagement: Codeunit "Hybrid Cloud Management";
105
- TelemetryDictionary: Dictionary of [Text , Text ];
156
+ IntelligentCloudStatus: Record "Intelligent Cloud Status";
106
157
TablesModified: Text ;
107
158
SeparatorChar: Char ;
108
159
begin
160
+ IntelligentCloudStatus. SetRange( "Table Id", TableID) ;
161
+ IntelligentCloudStatus. SetRange( "Company Name", CompanyName) ;
109
162
if not IntelligentCloudStatus. FindSet() then
110
163
exit ;
111
164
165
+ CheckCanChangeTheTable( IntelligentCloudStatus) ;
112
166
SeparatorChar := ' ,' ;
167
+ IntelligentCloudStatus. FindSet() ;
113
168
repeat
114
- if IntelligentCloudStatus. "Preserve Cloud Data" <> NewPreserveCloudData then begin
115
- if ( not NewPreserveCloudData) and ( IntelligentCloudStatus. "Table Id" = Database ::"Tenant Media") then
116
- Error( NotPossibleToReplaceTenantMediaTableErr) ;
169
+ UpdatePreserveDataForTable( IntelligentCloudStatus, TablesModified, SeparatorChar, NewPreserveCloudData) ;
170
+ until IntelligentCloudStatus. Next() = 0 ;
117
171
118
- if ( NewPreserveCloudData ) and ( IntelligentCloudStatus . "Company Name" = ' ' ) then
119
- Error ( NotPossibleToDeltaSyncDataPerCompanyErr ) ;
172
+ LogMessageForChangedPreserveData ( Format ( TableID ) , NewPreserveCloudData ) ;
173
+ end ;
120
174
121
- InsertInitialLog( IntelligentCloudStatus) ;
122
- IntelligentCloudStatus. "Preserve Cloud Data" := NewPreserveCloudData;
123
- IntelligentCloudStatus. Modify () ;
124
- InsertModifyLog( IntelligentCloudStatus) ;
125
- end ;
175
+ internal procedure ChangePreserveCloudData( var IntelligentCloudStatus: Record "Intelligent Cloud Status"; NewPreserveCloudData: Boolean )
176
+ var
177
+ TablesModified: Text ;
178
+ SeparatorChar: Char ;
179
+ begin
180
+ if not IntelligentCloudStatus. FindSet() then
181
+ exit ;
182
+
183
+ SeparatorChar := ' ,' ;
184
+ repeat
185
+ UpdatePreserveDataForTable( IntelligentCloudStatus, TablesModified, SeparatorChar, NewPreserveCloudData) ;
126
186
until IntelligentCloudStatus. Next() = 0 ;
127
187
128
188
TablesModified := TablesModified. TrimEnd( SeparatorChar) ;
189
+ LogMessageForChangedPreserveData( TablesModified, NewPreserveCloudData) ;
190
+ end ;
191
+
192
+ local procedure UpdatePreserveDataForTable( var IntelligentCloudStatus: Record "Intelligent Cloud Status"; var TablesModified: Text ; SeparatorChar: Char ; NewPreserveCloudData: Boolean )
193
+ begin
194
+ if IntelligentCloudStatus. "Preserve Cloud Data" <> NewPreserveCloudData then begin
195
+ if ( not NewPreserveCloudData) and ( IntelligentCloudStatus. "Table Id" = Database ::"Tenant Media") then
196
+ Error( NotPossibleToReplaceTenantMediaTableErr) ;
197
+
198
+ if ( NewPreserveCloudData) and ( IntelligentCloudStatus. "Company Name" = ' ' ) then
199
+ Error( NotPossibleToDeltaSyncDataPerCompanyErr) ;
200
+
201
+ InsertInitialLog( IntelligentCloudStatus) ;
202
+ IntelligentCloudStatus. "Preserve Cloud Data" := NewPreserveCloudData;
203
+ IntelligentCloudStatus. Modify () ;
204
+ InsertModifyLog( IntelligentCloudStatus) ;
205
+ TablesModified += IntelligentCloudStatus. "Table Name" + SeparatorChar;
206
+ end ;
207
+ end ;
208
+
209
+ local procedure LogMessageForChangedPreserveData( TablesModified: Text ; NewPreserveCloudData: Boolean )
210
+ var
211
+ HybridCloudManagement: Codeunit "Hybrid Cloud Management";
212
+ TelemetryDictionary: Dictionary of [Text , Text ];
213
+ begin
129
214
TelemetryDictionary. Add ( ' Category' , HybridCloudManagement. GetTelemetryCategory()) ;
130
215
TelemetryDictionary. Add ( ' TablesModified' , TablesModified) ;
131
216
TelemetryDictionary. Add ( ' PreserveCloudData' , Format( NewPreserveCloudData, 0 , 9 )) ;
0 commit comments