Skip to content

Commit

Permalink
feat: Bulk-export should support Collections
Browse files Browse the repository at this point in the history
Refs: #285
  • Loading branch information
grigoriev committed Dec 4, 2024
1 parent b3f26db commit bd3e7f5
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.jetbrains.annotations.VisibleForTesting;

import java.util.EnumSet;
import java.util.Objects;


public class DocumentFileNameHelper {
Expand Down Expand Up @@ -46,9 +47,9 @@ public String getDocumentFileName(@NotNull ExportParams exportParams) {
DocumentDataHelper documentDataHelper = new DocumentDataHelper(pdfExporterPolarionService);
final DocumentData<? extends IUniqueObject> documentData =
switch (exportParams.getDocumentType()) {
case LIVE_DOC -> documentDataHelper.getLiveDoc(project, exportParams, false);
case LIVE_DOC -> documentDataHelper.getLiveDoc(Objects.requireNonNull(project), exportParams, false);
case LIVE_REPORT -> documentDataHelper.getLiveReport(project, exportParams, false);
case TEST_RUN -> documentDataHelper.getTestRun(project, exportParams, false);
case TEST_RUN -> documentDataHelper.getTestRun(Objects.requireNonNull(project), exportParams, false);
case WIKI_PAGE -> documentDataHelper.getWikiPage(project, exportParams, false);
case BASELINE_COLLECTION -> throw new IllegalArgumentException("Unsupported document type: %s".formatted(exportParams.getDocumentType()));
};
Expand All @@ -73,15 +74,11 @@ public String getDocumentFileName(@NotNull ExportParams exportParams) {

private @NotNull String getFileNameTemplate(@NotNull DocumentType documentType, @NotNull FileNameTemplateModel fileNameTemplateModel) {
return switch (documentType) {
case LIVE_DOC:
yield fileNameTemplateModel.getDocumentNameTemplate();
case LIVE_REPORT:
yield fileNameTemplateModel.getReportNameTemplate();
case TEST_RUN:
yield fileNameTemplateModel.getTestRunNameTemplate();
case WIKI_PAGE:
yield fileNameTemplateModel.getWikiNameTemplate();
default: throw new IllegalArgumentException("Unknown document type: " + documentType);
case LIVE_DOC -> fileNameTemplateModel.getDocumentNameTemplate();
case LIVE_REPORT -> fileNameTemplateModel.getReportNameTemplate();
case TEST_RUN -> fileNameTemplateModel.getTestRunNameTemplate();
case WIKI_PAGE -> fileNameTemplateModel.getWikiNameTemplate();
case BASELINE_COLLECTION -> throw new IllegalArgumentException("Unsupported document type: %s".formatted(documentType));
};
}

Expand Down

0 comments on commit bd3e7f5

Please sign in to comment.