Skip to content

Commit 7a13da8

Browse files
committed
Remove data type config for pdf.
1 parent 0982b6a commit 7a13da8

File tree

7 files changed

+8
-35
lines changed

7 files changed

+8
-35
lines changed

src/Altinn.App.Core/Internal/Pdf/IPdfService.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ public interface IPdfService
2222
/// </summary>
2323
/// <param name="instance">The instance details.</param>
2424
/// <param name="taskId">The task id for which the PDF is generated.</param>
25-
/// <param name="dataTypeId">The data type to use when storing the PDF.</param>
2625
/// <param name="fileNameTextResourceElementId">A text resource element id for the file name of the PDF. If no text resource is found, the literal value will be used. If null, a default file name will be used.</param>
2726
/// <param name="autoGeneratePdfForTaskIds">Enable auto-pdf for a list of tasks. Will not respect pdfLayoutName on those tasks, but use the main layout-set of the given tasks and render the components in summary mode. This setting will be ignored if the PDF task has a pdf layout set defined.</param>
2827
/// <param name="ct">Cancellation token for when a request should be stopped before it's completed.</param>
2928
Task GenerateAndStorePdf(
3029
Instance instance,
3130
string taskId,
32-
string? dataTypeId,
3331
string? fileNameTextResourceElementId,
3432
List<string>? autoGeneratePdfForTaskIds = null,
3533
CancellationToken ct = default

src/Altinn.App.Core/Internal/Pdf/PdfService.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ public async Task GenerateAndStorePdf(Instance instance, string taskId, Cancella
7272
{
7373
using var activity = _telemetry?.StartGenerateAndStorePdfActivity(instance, taskId);
7474

75-
await GenerateAndStorePdfInternal(instance, taskId, null, null, null, ct);
75+
await GenerateAndStorePdfInternal(instance, taskId, null, null, ct);
7676
}
7777

7878
/// <inheritdoc/>
7979
public async Task GenerateAndStorePdf(
8080
Instance instance,
8181
string taskId,
82-
string? dataTypeId,
8382
string? fileNameTextResourceElementId,
8483
List<string>? autoGeneratePdfForTaskIds = null,
8584
CancellationToken ct = default
@@ -90,7 +89,6 @@ public async Task GenerateAndStorePdf(
9089
await GenerateAndStorePdfInternal(
9190
instance,
9291
taskId,
93-
dataTypeId,
9492
fileNameTextResourceElementId,
9593
autoGeneratePdfForTaskIds,
9694
ct
@@ -122,7 +120,6 @@ public async Task<Stream> GeneratePdf(Instance instance, string taskId, Cancella
122120
private async Task GenerateAndStorePdfInternal(
123121
Instance instance,
124122
string taskId,
125-
string? dataTypeId,
126123
string? fileNameTextResourceElementId,
127124
List<string>? autoGeneratePdfForTaskIds = null,
128125
CancellationToken ct = default
@@ -148,7 +145,7 @@ private async Task GenerateAndStorePdfInternal(
148145
string fileName = GetFileName(instance, textResource, fileNameTextResourceElementId);
149146
await _dataClient.InsertBinaryData(
150147
instance.Id,
151-
dataTypeId ?? PdfElementType,
148+
PdfElementType,
152149
PdfContentType,
153150
fileName,
154151
pdfContent,

src/Altinn.App.Core/Internal/Process/Elements/AltinnExtensionProperties/AltinnPdfConfiguration.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ namespace Altinn.App.Core.Internal.Process.Elements.AltinnExtensionProperties;
77
/// </summary>
88
public sealed class AltinnPdfConfiguration
99
{
10-
/// <summary>
11-
/// Set the data type to use when storing the PDF. If not set, ref-data-as-pdf will be used.
12-
/// </summary>
13-
[XmlElement("dataTypeId", Namespace = "http://altinn.no/process")]
14-
public string? DataTypeId { get; set; }
15-
1610
/// <summary>
1711
/// Set the filename of the PDF. Supports text resource keys for language support.
1812
/// </summary>
@@ -28,15 +22,10 @@ public sealed class AltinnPdfConfiguration
2822

2923
internal ValidAltinnPdfConfiguration Validate()
3024
{
31-
string? normalizedDataTypeId = string.IsNullOrWhiteSpace(DataTypeId) ? null : DataTypeId.Trim();
3225
string? normalizedFilename = string.IsNullOrWhiteSpace(Filename) ? null : Filename.Trim();
3326

34-
return new ValidAltinnPdfConfiguration(normalizedDataTypeId, normalizedFilename, AutoPdfTaskIds);
27+
return new ValidAltinnPdfConfiguration(normalizedFilename, AutoPdfTaskIds);
3528
}
3629
}
3730

38-
internal readonly record struct ValidAltinnPdfConfiguration(
39-
string? DataTypeId,
40-
string? Filename,
41-
List<string>? AutoPdfTaskIds
42-
);
31+
internal readonly record struct ValidAltinnPdfConfiguration(string? Filename, List<string>? AutoPdfTaskIds);

src/Altinn.App.Core/Internal/Process/ProcessTasks/ServiceTasks/PdfServiceTask.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public async Task<ServiceTaskResult> Execute(ServiceTaskContext context)
4141
await _pdfService.GenerateAndStorePdf(
4242
instance,
4343
taskId,
44-
config.DataTypeId,
4544
config.Filename,
4645
config.AutoPdfTaskIds,
4746
context.CancellationToken

test/Altinn.App.Core.Tests/Internal/Pdf/PdfServiceTests.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,7 @@ public async Task GenerateAndStorePdf_WithAutoGeneratePdfForTaskIds_ShouldInclud
323323
};
324324

325325
// Act
326-
await target.GenerateAndStorePdf(
327-
instance,
328-
"Task_PDF",
329-
null,
330-
null,
331-
autoGeneratePdfForTaskIds,
332-
CancellationToken.None
333-
);
326+
await target.GenerateAndStorePdf(instance, "Task_PDF", null, autoGeneratePdfForTaskIds, CancellationToken.None);
334327

335328
// Assert
336329
_pdfGeneratorClient.Verify(

test/Altinn.App.Core.Tests/Internal/Process/ServiceTasks/PdfServiceTaskTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public async Task Execute_Should_Call_GenerateAndStorePdf()
5656
x.GenerateAndStorePdf(
5757
instance,
5858
instance.Process.CurrentTask.ElementId,
59-
null,
6059
FileName,
6160
It.IsAny<List<string>?>(),
6261
It.IsAny<CancellationToken>()
@@ -98,7 +97,7 @@ public async Task Execute_Should_Pass_AutoPdfTaskIds_To_PdfService()
9897

9998
// Assert
10099
_pdfServiceMock.Verify(
101-
x => x.GenerateAndStorePdf(instance, "pdfTask", null, "test.pdf", taskIds, It.IsAny<CancellationToken>()),
100+
x => x.GenerateAndStorePdf(instance, "pdfTask", "test.pdf", taskIds, It.IsAny<CancellationToken>()),
102101
Times.Once
103102
);
104103
}

test/Altinn.App.Core.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3170,7 +3170,7 @@ namespace Altinn.App.Core.Internal.Pdf
31703170
public interface IPdfService
31713171
{
31723172
System.Threading.Tasks.Task GenerateAndStorePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, System.Threading.CancellationToken ct);
3173-
System.Threading.Tasks.Task GenerateAndStorePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, string? dataTypeId, string? fileNameTextResourceElementId, System.Collections.Generic.List<string>? autoGeneratePdfForTaskIds = null, System.Threading.CancellationToken ct = default);
3173+
System.Threading.Tasks.Task GenerateAndStorePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, string? fileNameTextResourceElementId, System.Collections.Generic.List<string>? autoGeneratePdfForTaskIds = null, System.Threading.CancellationToken ct = default);
31743174
System.Threading.Tasks.Task<System.IO.Stream> GeneratePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, System.Threading.CancellationToken ct);
31753175
System.Threading.Tasks.Task<System.IO.Stream> GeneratePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, bool isPreview, System.Threading.CancellationToken ct);
31763176
}
@@ -3192,7 +3192,7 @@ namespace Altinn.App.Core.Internal.Pdf
31923192
{
31933193
public PdfService(Altinn.App.Core.Internal.App.IAppResources appResources, Altinn.App.Core.Internal.Data.IDataClient dataClient, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor, Altinn.App.Core.Internal.Pdf.IPdfGeneratorClient pdfGeneratorClient, Microsoft.Extensions.Options.IOptions<Altinn.App.Core.Internal.Pdf.PdfGeneratorSettings> pdfGeneratorSettings, Microsoft.Extensions.Options.IOptions<Altinn.App.Core.Configuration.GeneralSettings> generalSettings, Microsoft.Extensions.Logging.ILogger<Altinn.App.Core.Internal.Pdf.PdfService> logger, Altinn.App.Core.Features.Auth.IAuthenticationContext authenticationContext, Altinn.App.Core.Features.Telemetry? telemetry = null) { }
31943194
public System.Threading.Tasks.Task GenerateAndStorePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, System.Threading.CancellationToken ct) { }
3195-
public System.Threading.Tasks.Task GenerateAndStorePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, string? dataTypeId, string? fileNameTextResourceElementId, System.Collections.Generic.List<string>? autoGeneratePdfForTaskIds = null, System.Threading.CancellationToken ct = default) { }
3195+
public System.Threading.Tasks.Task GenerateAndStorePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, string? fileNameTextResourceElementId, System.Collections.Generic.List<string>? autoGeneratePdfForTaskIds = null, System.Threading.CancellationToken ct = default) { }
31963196
public System.Threading.Tasks.Task<System.IO.Stream> GeneratePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, System.Threading.CancellationToken ct) { }
31973197
public System.Threading.Tasks.Task<System.IO.Stream> GeneratePdf(Altinn.Platform.Storage.Interface.Models.Instance instance, string taskId, bool isPreview, System.Threading.CancellationToken ct) { }
31983198
}
@@ -3309,8 +3309,6 @@ namespace Altinn.App.Core.Internal.Process.Elements.AltinnExtensionProperties
33093309
[System.Xml.Serialization.XmlArray(ElementName="autoPdfTaskIds", IsNullable=true, Namespace="http://altinn.no/process")]
33103310
[System.Xml.Serialization.XmlArrayItem(ElementName="taskId", Namespace="http://altinn.no/process")]
33113311
public System.Collections.Generic.List<string>? AutoPdfTaskIds { get; set; }
3312-
[System.Xml.Serialization.XmlElement("dataTypeId", Namespace="http://altinn.no/process")]
3313-
public string? DataTypeId { get; set; }
33143312
[System.Xml.Serialization.XmlElement("filename", Namespace="http://altinn.no/process")]
33153313
public string? Filename { get; set; }
33163314
}

0 commit comments

Comments
 (0)