Skip to content

Commit

Permalink
Add ADLSEExternalEvents.OnExportFinishedv2 (Bertverbeek4PS#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bertverbeek4PS authored Apr 22, 2024
2 parents b267c40 + 6e1dfca commit fe2da78
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion businessCentral/app/src/Execute.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ codeunit 82561 "ADLSE Execute"
ADLSESessionManager.StartExportFromPendingTables();

ADLSESetupRec.GetSingleton();
ADLSEExternalEvents.OnExportFinished(ADLSESetupRec);
ADLSEExternalEvents.OnExportFinished(ADLSESetupRec, ADLSETable);

if not ADLSECurrentSession.AreAnySessionsActive() then
if EmitTelemetry then
Expand Down
2 changes: 2 additions & 0 deletions businessCentral/app/src/Execution.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ codeunit 82569 "ADLSE Execution"
Message(ExportStartedTxt, Started, Counter);
if EmitTelemetry then
Log('ADLSE-001', StrSubstNo(ExportStartedTxt, Started, Counter), Verbosity::Normal);

ADLSEExternalEvents.OnAllExportIsFinished(ADLSESetupRec);
end;

internal procedure StopExport()
Expand Down
36 changes: 35 additions & 1 deletion businessCentral/app/src/ExternalEvents.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ codeunit 82574 "ADLSE External Events"
MyBusinessOnExport(ADLSESetup.SystemId, ADLSESetup."Storage Type", Url, WebClientUrl);
end;

[Obsolete('Replaced with the OnExportFinishedv2 External Business Event', '24.0')]
internal procedure OnExportFinished(ADLSESetup: Record "ADLSE Setup")
var
Url: Text[250];
Expand All @@ -116,6 +117,28 @@ codeunit 82574 "ADLSE External Events"
MyBusinessOnExportFinished(ADLSESetup.SystemId, ADLSESetup."Storage Type", Url, WebClientUrl);

Check warning on line 117 in businessCentral/app/src/ExternalEvents.Codeunit.al

View workflow job for this annotation

GitHub Actions / Build . (Default) / . (Default)

AL0432 Method 'MyBusinessOnExportFinished' is marked for removal. Reason: Replaced with the OnExportFinishedv2 External Business Event. Tag: 24.0.
end;

internal procedure OnExportFinished(ADLSESetup: Record "ADLSE Setup"; ADLSETable: Record "ADLSE Table")
var
Url: Text[250];
WebClientUrl: Text[250];
ADLSEFieldApiUrlTok: Label 'bc2adlsTeamMicrosoft/bc2adls/v1.0/companies(%1)/adlseTables(%2)', Locked = true;
begin
Url := ADLSEExternalEventsHelper.CreateLink(ADLSEFieldApiUrlTok, ADLSETable.SystemId);
WebClientUrl := CopyStr(GetUrl(ClientType::Web, CompanyName(), ObjectType::Page, Page::"ADLSE Setup", ADLSESetup), 1, MaxStrLen(WebClientUrl));
MyBusinessOnExportFinishedv2(ADLSETable.SystemId, ADLSESetup."Storage Type", ADLSETable."Table ID", Url, WebClientUrl);
end;

internal procedure OnAllExportIsFinished(ADLSESetup: Record "ADLSE Setup")
var
Url: Text[250];
WebClientUrl: Text[250];
ADLSEFieldApiUrlTok: Label 'bc2adlsTeamMicrosoft/bc2adls/v1.0/companies(%1)/adlseSetup(%2)', Locked = true;
begin
Url := ADLSEExternalEventsHelper.CreateLink(ADLSEFieldApiUrlTok, ADLSESetup.SystemId);
WebClientUrl := CopyStr(GetUrl(ClientType::Web, CompanyName(), ObjectType::Page, Page::"ADLSE Setup", ADLSESetup), 1, MaxStrLen(WebClientUrl));
MyBusinessOnAllExportIsFinished(ADLSESetup.SystemId, ADLSESetup."Storage Type", Url, WebClientUrl);
end;

internal procedure OnRefreshOptions(ADLSESetup: Record "ADLSE Setup")
var
Url: Text[250];
Expand Down Expand Up @@ -192,11 +215,22 @@ codeunit 82574 "ADLSE External Events"
begin
end;

[ExternalBusinessEvent('OnExportFinished', 'Export is finished', 'When the export is finished', EventCategory::ADLSE)]
[Obsolete('Replaced with the OnExportFinishedv2 External Business Event', '24.0')]
[ExternalBusinessEvent('OnExportFinished', 'Export is finished for one table', 'When the export is finished for one table', EventCategory::ADLSE)]
local procedure MyBusinessOnExportFinished(SystemId: Guid; "Storage Type": Enum "ADLSE Storage Type"; Url: Text[250]; WebClientUrl: Text[250])
begin
end;

[ExternalBusinessEvent('OnExportFinishedv2', 'Export is finished for one table v2', 'When the export is finished for one table', EventCategory::ADLSE)]
local procedure MyBusinessOnExportFinishedv2(SystemId: Guid; "Storage Type": Enum "ADLSE Storage Type"; TableId: Integer; Url: Text[250]; WebClientUrl: Text[250])
begin
end;

[ExternalBusinessEvent('OnAllExportIsFinished', 'Export is finished of all tables', 'When the export is finished of all tables', EventCategory::ADLSE)]
local procedure MyBusinessOnAllExportIsFinished(SystemId: Guid; "Storage Type": Enum "ADLSE Storage Type"; Url: Text[250]; WebClientUrl: Text[250])
begin
end;

[ExternalBusinessEvent('OnRefreshOptions', 'Refresh Options', 'When the options are refreshed', EventCategory::ADLSE)]
local procedure MyBusinessOnRefreshOptions(SystemId: Guid; "Storage Type": Enum "ADLSE Storage Type"; Url: Text[250]; WebClientUrl: Text[250])
begin
Expand Down

0 comments on commit fe2da78

Please sign in to comment.